Methods to access properties of a theme
Located in /program/lib/theme.class.php (line 34)
Class | Description |
---|---|
![]() |
this class implements the axis theme |
![]() |
/program/themes/ruta/ruta.class.php - the class that implements the theme |
![]() |
this class implements the schoolyard theme (based on a design by David Prousch) |
![]() |
/program/themes/frugal/frugal.class.php - the class that comprises the most minimal theme |
![]() |
/program/themes/cornelia/cornelia.class.php - the class that implements the theme |
![]() |
this class implements the rosalina theme (based on HV Menu |
![]() |
/program/themes/sophia/sophia.class.php - the class that implements the theme |
construct a Theme object
this stores the information about this theme from the database. Also, we construct/read the tree of nodes for this area $area_id. This information will be used lateron when constructing the navigation. The node to display is $node_id.
Also, we prepare a list of areas where the current user is allowed to go. This is handy when constructing a jumpmenu and doing it here saves a trip to the database lateron in get_jumpmenu().
add a line or array of lines to the content part of the document
add a header to the HTML head part of the document
add an HTTP-header
add a message to the list of inline messages, part of the BODY of the document
add a line with meta-information to the HTML head part of the document
Note: this code is hardly used since most meta headers are not allowed in HTML5 anyway. Maybe we can remove this routine in a later version.
add a line with http-equiv meta-information to the HTML head part of the document
Note: this code is hardly used since most meta headers are not allowed in HTML5 anyway. Maybe we can remove this routine in a later version.
add a message to the list of popup-messages at the BOTTOM of the document
add a message to the list of popup-messages at the TOP of the document
add a link to a stylesheet to the HTML head part of the document
this adds a link to a stylesheet file to the HTML head part of the document. Note that we qualify the path to prevent problems with incorrect assumptions about relative URLs, see was_url().
set breadcrumbs in tree AND construct list of clickable anchors
Note: the anchors are created with the current setting of the preview mode, so if that changes after we construct a list of anchors we're in trouble. I prefer late binding, so the real list to use should be created in the phase where the HTML-code is constructed. Mmmmm...
read all nodes from table for this area and construct a tree
this constructs the tree for this area, and makes sure that only non-hidden pages and non-empty sections are visible
a helper-routine during development/debugging (currently unused)
return the reconstructed URL in a single (indented) line
actual code moved to waslib; keep this wrapper for compatibility
collect bazaar style style from area and nodes
this collects the additional style per node and per area This implements the Bazaaar Style Style Sheets: every node can add additional style information ad hoc.
The additional information is constructed backwards so the style cascades in the correct direction, ie. from area to top-level section, subsections and finally the page.
Note that the style information is trim()'ed and that individual lines in the style information area indented by two additional spaces for increased readability. All Bazaar Style Style is concatenated within a single style-tag.
show 'powered by' and (maybe) report basic performance indicators
This calculates the execution time of the script and the number of queries. Note a special trick: we retrieve the translated string in a dummy variable before calculating the number of queries because otherwise we might miss one or more query from the language/translation subsystem.
Note: for the time being the performance report commented out (2010-12-08). Update: as from 2011-05-20 the performance report only displayed while debug is on,
get all lines in the content DIV in a single properly indented string
construct breadcrumb trail
this constructs a breadcrumb trail with clickable links. The crumbs are separated by this->breadcrumb_separator (default '-'). Note that if there is actually a non-empty separator, we append a space for readability.
get a perhaps bulleted list of messages in a DIV
This constructs an unordered list with messages, if there are any If there is no message at all, an empty string is returned (without DIV). If there is a single message, no bullet is added to the message. If there are two or more messages, bullets are added.
Note that this routine is an exception with respect to the DIV-tags: this helper routine DOES generate its own DIVs whenever there is at least 1 message. This means that there is no DIV at all when there are no messages.
construct an output page in HTML
This constructs a full HTML-page, starting at the DTD and ending with the html closing tag.
The page is constructed using nested DIVs, the layout is taken care of in a separate style sheet. All knowledge about the structure of the page is contained in this routine.
The performance of the script (# of queries, execution time) is calculated as late as possible, to catch as much as we can. Therefore the construction is done in two parts and performance is calculated last.
The contents of the various DIVs is constructed in various helper routines in order to make this routine easy to read (by humans that is). The various helper routines all are called with a string of space characters; this should improve the the readability of the page that is generated eventually.
Note that the routine $this->get_div_messages() does in fact generate its own DIV tags. This is done in order to completely get rid of the message DIV, we do not even want to see an empty DIV if there are no messages.
The same logic applies to the breadcrumb trail.
get all lines in the HTML head section in a single, properly indented string
construct a simple jumplist to navigate to other areas
this constructs a listbox with areas to which the current user has access. The user can pick an area from the list and press the [Go] button to navigate to that area. Only the active areas are displayed. Private areas are only displayed when the user actually has access to those areas.
This routine always shows the Submit-button even when JavaScript is turned 'off'. If it is 'on', a tiny snippet auto-submits the form whenever the user selects another area; no need press any button anymore. However, pressing the Go button is necessary when Javascript is 'off'. Rationale: the user will find out soon enough that pressing the button is superfluous, and as a benefit we keep the same look and feel no matter the state of Javascript.
We rely on the constructor to provide us with an array of area_id=>area_title pairs in the $this->jumps array.
The special preview-mode is implemented by adding the necessary hash in the preview parameter via a hidden field. This will ultimately lead to ourselves, with the preview code so we can never leave for another area in preview mode.
get lines from an array in a single properly indented string
This is a workhorse to convert an array of lines to a properly indented block of text.
construct an image tag with the area logo
This constructs HTML-code that displays the logo.
construct the submenu starting at $menu_id OR the first breadcrumb in the top level menu
this constructs an 'infinitely' nested set of submenus, starting at $menu_id or at the first breadcrumb in the top level menu (if any). If there are no suitable nodes, an empty string is returned.
construct a top level menu (navigation bar) as an unnumbered list (UL) of list items (LI)
this simply walks through the top level of the menu tree and creates a link for each node.
construct javascript alerts for messages
This constructs a piece of HTML that yields 0 or more calls to the javascript alert() function, once per message. If no messages need to be displayed an empty string is returned.
retrieve configuration parameters for this combination of theme and area
construct a list of quicklinks for bottom of page (if any)
(see also get_quicktop()).
workhorse for constructing list of quicklinks
This creates HTML-code for links that can be displayed at the top/bottom of the page. These links are the pages (but not subsections) defined in the quicktop_section_id or quickbottom_section_id in $this->config.
Note that this array may or may not exist and also that the section may or may not exist and that the section may or may not contain any visible pages. Mmm, that's a lot of may/maybenot's...
Also note that these links are always displayed as text, even if a graphics image is defined in the corresponding node. The contents of the section can be found in $this->tree. If there are two or more links, they are separated with $separator (default '');
construct a list of quicklinks for top of page (if any)
(see also get_quickbottom()).
construct an anchor from a node record
This constructs an array with key-value-pairs that can be used to construct an HTML anchor tag. At least the following keys are created in the resulting array: 'href', 'title' and 'anchor'. The latter is either the text or a referenct to an image that is supposed to go between the opening A-tag and closing A-tag. Furtermore an optional key is created: target. The contents of the input array $attributes is merged into the result.
If the parameter $textonly is TRUE the key 'anchor' is always text. If $textonly is NOT TRUE, the 'anchor' may refer to an image.
Note that the link text is always non-empty. If the node record has an empty link_text, the word 'node' followed by the node_id is returned. (Otherwise it will be hard to make an actual clickable link).
Note that we attempt to create 'friendly' URLs, ie. URLs that look very much like a plain path, e.g. http://www.exemplum.eu/index.php/3/Information_about_the_school.html rather than http://www.exemplum.eu/index.php?node=3 When bookmarking a page, the part 'Information_about_the_school.html' makes it easier to recognise the bookmark than when it is just some number. Choice for friendly URLs is made in the global (site) configuration.
add $message to alerts watching this page
service routine for modules that are 'interactive', used in case data is added somehow, e.g. a visitor adds a post to an althing. In that case the module can decide to add an alert like
send collected HTTP-headers to user's browser
This sends the headers that still need to be sent. These are collected in the array $this->http_headers. If headers are already sent, this fact is logged (and the collected headers are not sent).
send collected output to user's browser
This first sends any pending HTTP-headers and subsequently outputs the page that is constructed by $this->get_html() However, if $silent_mode is TRUE, we don't send anything. This allows for modules to 'get rid' of the navigation etc. and handle the I/O in the module (example: confab-module).
set the preview mode
this sets the preview mode of the page currently being built. If it is set to TRUE, all internal URLs (such as those pointing to a node in the breadcrumb trail or in menu items) will be equal to '#' which makes it more or less impossible to leave the current page because a bare '#' is considered an unnamed fragment and so no new page is loaded when the link is clicked; just the thing we need.
workhorse for constructing recursive menu (walk the tree) along the breadcrumb trail
this constructs nested (sub)menus along the breadcrumb trail. The effect is that the (sub)menus that lead to the current page ($this->node_id) are 'opened' whereas the other submenus are 'closed'. The (sub)menus are constructed in the form of nested UL's with LI's.
The level of recursion of the list items (LI) is indicated via class='levelNNN'. The type of item is indicated via class='page' or class='section'. Also, the item has an addional class='current' when it is part of the breadcrumb trail. Finally a current item also has the additional class 'activepage' or 'activesection' which makes the CSS easier.
The actual A-tag of the link only indicates being part of the breadcrumb trail via class='current'.
It is up to the style sheet to visualise these items taking all variants into account. Note that we only process visible pages and sections.
Documentation generated on Tue, 28 Jun 2016 19:12:10 +0200 by phpDocumentor 1.4.0