conveniently collect output
This class allows for a convenient way to temporarily store output, in random order and still being able to output to the browser in the correct order (eg. headers() first, etc.).
This class 'knows' everything about the structure of a generated page. Most of this knowledge is contained in $this-get_html(); The actual layout is defined in the corresponding stylesheets, e.g. admin_base.css.
Typical use of this object is to add HTML-code to various parts of the page via the add_*() methods and finally sending the collected output to the user's browser with $this->send_output(). That's it.
Located in /program/main_admin.php (line 618)
constructor
This sets up the object and adds the title and subtitle.
add a breadcrumb to the breadcrumb trail
this stores information about a crumb in the breadcrumb trail into the breadcrumbs array. We store this information in pieces that are readily usable with html_a(). However, by constructing the links at the latest possible time, we are able to suppress the real links, by replacing the href + parameters with a bare "#". This trick can be used to keep the user focussed on the task at hand (in 'funnel-mode').
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 line to the menu part of the document
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
add a line with http-equiv meta-information to the HTML head part of the document
add a pagination navigation bar to the output
this adds a pagination navbar to the output making it easier to step through a long listing of items a screen at a time
Features:
add a link to screen of a paginated list to the existing list
this stores information about a screen in the paginated display of a list. We store this information in pieces that are readily usable with html_a(). However, by constructing the links at the latest possible time, we are able to suppress the real links, by replacing the href + parameters with a bare "#". This trick can be used to keep the user focussed on the task at hand (in 'funnel-mode').
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
return the reconstructed URL in a single (indented) line
actual code moved to waslib; keep this wrapper for compatibility
report basic performance indicators in a single line
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 that the message containing the performance indicators is only generated when debug is TRUE; the information is not that interesting for ordinary users.
retrieve/construct a list of 0 or more clickable breadcrumbs
this reads the breadcrumbs-array and constructs the breadcrumb trail If $this->funnel_mode is TRUE, the links are still clickable but the href-part is replaced with a "#" instead of the 'real' href + parameters.
get all lines in the content DIV in a single properly indented string
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). Previously, if there was a single message, no bullet was added to the message. If there were two or more messages, bullets were added. We now (april 2012) have a boolean parameter $bullets which modifies this behaviour as follows. If $bullets is TRUE, bullets are added to every message, even when there is only one. This makes this list more predictable for vision impaired users. Note that we also added an H2 with the phrase 'Messages' to make it even easier to identify this div. This phrase can be visually suppressed via a style sheet.
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 message.
get all lines in the HTML head section in a single properly indented string
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.
proof of concept for braille-skin
construct an image tag with the W
get all lines in the menu DIV in a single properly indented string
construct a navigation bar for various jobs the user is allowed to do
This constructs an unordered list (UL) with items, where each item is a clickable link to one of the various 'managers' (e.g. page manger, file manager, etc.).
There are several different 'modes' for this function. The type of output not only depends on the $textonly flag, but also on the user's permissions for the various 'managers'. This information is retrieved from the global $USER object.
The list of available options is stored in an array of arrays. This should make it easier to add a new 'manager' in the future: simply add another element to the $items array below (and of course the necessary changes in the dispatcher in main_admin() above).
A a rule the links are presented to the user in the form of clickable images (icons) as provided by the currently selected skin. If the optional flag $textonly is set, all links are displayed as a text-link (using the alt text from the image).
Depending on the user's privileges, access to some 'managers' is denied. This is visualised by displaying either a black/white image (instead of the coloured one) or by adding the class 'dimmed' to the text-based anchor tags. This makes it possible to show 'dimmed' or 'greyed out' text if the user has no access. Note, however, that these 'forbidden' links are not suppressed: the W@S philosophy says that everything should be transparent as possible and that rules out the option to suppress the things the user is not supposed to do. If the user does follow the 'dimmed' links, an error message is displayed (see the code in the dispatcher in main_admin() above). One last note on this issue of denying access in a transparent way: the mousover already indicate that access will be denied. That should provide an extra clue to the user.
The list of items contains a link to the start centre (the first link) and also a link to the documentation (the last link). Both items are goverend by the same privilege mask: JOB_PERMISSION_STARTCENTER. Basically it means that everyone with minimal administrator privileges has access to both the start centre and the help function. Effectively this is everyone that has access to admin.php so the images startcenter-bw.gif and help-bw.gif do not really make sense, but for completeness sake...
Note that we rely on the fact the the names of the black/white navigation images are systematically derived from the base name by appending '-bw' to the image name.
retrieve/construct a list of 0 or more clickable links to paginated screens
this reads the pagination-array and constructs a list of links to individual screens of a paginated display of a list.
Even when $this->funnel_mode is TRUE, the links are still operational.
construct javascript alerts for messages
This constructs a piece of HTML that yields 0 or more calles to the javascript alert() function, once per message. If no messages need to be displayed an empty string is returned.
construct a list of quicklinks for botton of page
This creates HTML-code for a few links that can be displayed at the bottom of the page. Currently this list is has 1 link. Possible links are
construct a list of quicklinks for top of page, including logout link
This creates HTML-code for a few links that can be displayed at the top of the page. These links are:
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 the flag suppress_output is set then nothing is sent, not even a header. This allows for routines that interact directly with the user, e.g. a function to download a file.
manipulate the funnel mode
set the additional help topic to show when user clicks help button
manipulate output suppression
Documentation generated on Tue, 28 Jun 2016 19:10:20 +0200 by phpDocumentor 1.4.0