Previous | Up | Next |
Authentication | Introduction | Boxes |
"Themes" are SWS's answer to the problem of separating content from layout. Themes are (a collection of) PHP source files that expose a well-defined API, which is described below. The SWS framework will call this API at various points in generating the page.
setThemeOptions()
preContent()
postContent()
boxStart()
boxEnd()
loginForm()
See also the $PAGE['theme'] variable description.
function setThemeOptions($options)()
This function is called before any output is to be done.
$options is a hash containing all the
options that the current page has specified to the SWS
pre function. You can see the keys that SWS uses at the
description of pre
; all other options are
available for use by themes.
function preContent()
This function should output all the HTML to the browser that is needed before the actual page content starts. A theme can make use of the values in the $PAGE global variable to generate this content, as well as the boxStart() and boxEnd() functions.
function postContent()
This function should output all the HTML to the browser that is needed after the actual page content ends.
function boxStart($title = "", $class = "")
This function should output the HTML needed to start a section on the page known as a "box". See boxes for more information about boxes.
function boxEnd()
This function should output the HTML needed to end a box section on the page. See boxes for more information about boxes.
function loginForm($reason, $db)
This function should present the user with a HTTP login
form that POSTs its data to itself (it is appropriate to
use the me function for this). The form should have
(at least) two fields, named user
for the
username, and password
for the password.
The $reason parameter contains a code that signifies the reason that this theme function was called. It can be one of the following:
LOGIN_REQUIRED
The user had not logged in yet, and is trying to view a restricted page.
LOGIN_FAILED
A previous logon attempt failed due to an incorrect password or non-existing username. On purpose, there is no distinction between the two cases.
LOGIN_PRIVS
The user is logged on, but does not have the needed privilege to view this page. A login form should be presented to allow the user to logon as someone else if need be.
If the $db
parameter is present, it
is the name of a database for which login credentials are
required. The function should use this to distinguish the
form from a regular user login form.
This function can of course call preContent() and postContent() as necessary, and is in fact encouraged to do so, so as to provide a consistent theme to the user.
function passwordChangeForm($reason)
This function should present the user with a HTTP login
form that POSTs its data to itself (it is appropriate to
use the me function for this). The form should have
(at least) three fields, named old
for the
old password, new
for the new password and
verify
for the new password verification
field.
The $reason parameter contains a code that signifies the reason that this theme function was called. It can be one of the following:
PASSWORD_CHANGE
The user has just started the password change process.
PASSWORD_WRONG
The old password provided was wrong.
PASSWORD_MISMATCH
The new passwords did not match.
This function can of course call preContent() and postContent() as necessary, and is in fact encouraged to do so, so as to provide a consistent theme to the user.
Previous | Up | Next |
Authentication | Introduction | Boxes |
Documentation generated on Fri, 30 Jun 2006 10:31:37 +0200 by phpDocumentor 1.3.0RC3