Good morning,
I have done a little extensions that allows you to access some Pagekit as well as PHP variables. What does it do?
Code
- Variable: Pagekit's Internal Page ID
- Call: (variables){"id":"pageid"}
- Usage: Create a link that takes the user straight to editor withthis page loaded
- Example: <a href="admin/site/page/edit?id=(variables){"id":"pageid"}" target="pkedit"> Edit page</a>
- Variable: Server-related date and time information
- Call: (variables){"id":"datetime", "format": "<format from PHP date() function"}
- Usage: Provide date/time-related information by calling PHP's date() function with format as paramater
- Example: (variables){"id":"datetime", "format": "H:i:s"} returns the server's current time (hour/min/sec)
- Variable: Server-related information
- Call: (variables){"id":"server", "element": "<element of PHP's $_SERVER variable"}
- Usage: Provide information held in the PHP's $_SERVER global variable
- Example: (variables){"id":"server", "element": "SERVER_NAME"} returns the name of the server Pagekit runs on
- Variable: Specific role
- Call: (variables){"id":"user-hasRole", "role": "<Role>"}
- Usage: Check if the current user has a specific role
- Example: (variables){"id":"role", "role": "Administrator"} returns "true" if the user is an Admin, "false" otherwise
- Variable: Authenticated user
- Call: (variables){"id":"user-isAuthenticated"}
- Usage: Check if the current user is authenticated
- Example: (variables){"id":"user-isAutheticated"} returns "true" if the user is autheticated, "false" otherwise
- Variable: Active / Blocked user
- Call: (variables){"id":"user-isActive"}
- Usage: Check if the current user is active (as opposed to blocked)
- Example: (variables){"id":"user-isActive"} returns "true" if the user is active, "false" if teh user is blocked.
- Variable: Login name
- Call: (variables){"id":"user-loginname", "pre":"<string>", "post":"<string>"}
- Usage: Returns the login name for the current user, prepending "pre" and appending "post" if the user is authenticated
- Example: (variables){"id":"user-username", "pre":"Hello ", "post":"!"} returns "Hello XYZ!" for the user XYZ, "" if the user is not logged in, "" otherwise.
- Variable: User name
- Call: (variables){"id":"user-fullname", "pre":"<string>", "post":"<string>"}
- Usage: Returns the full name for the current user, prepending "pre" and appending "post" if the user is authenticated
- Example: (variables){"id":"user-fullname", "pre":"Hello ", "post":"!"} returns "Hello Helmut Kaufmann!" for the user Helmut Kaufmann, "" if the user is not logged in, "" otherwise.
- Variable: Email
- Call: (variables){"id":"user-email", "pre":"<string>", "post":"<string>"}
- Usage: Returns the email address for the current user, prepending "pre" and appending "post" if the user is authenticated
- Example: (variables){"id":"user-username", "pre":"Hello ", "post":"!"} returns "Hello foo@bla.com!" for the user XYZ, "" if the user has registered foo@bla.com as his/her email address, "" otherwise.
The original idea was to have a widget on the bottom where the user can click on a link and is taken directly to a page where he/she can edit the content of that page. This can be achieved using this module by creating a widget with the following code:
To use the extension, just unzip the file into you packages directory. I might be extending this further.