Stud.IP  jlu_3.3 Revision
PageLayout Class Reference
Collaboration diagram for PageLayout:
Collaboration graph

Static Public Member Functions

static initialize ()
 
static setTitle ($title)
 
static hasTitle ()
 
static getTitle ()
 
static setHelpKeyword ($help_keyword)
 
static getHelpKeyword ()
 
static setTabNavigation ($path)
 
static getTabNavigation ()
 
static getTabNavigationPath ()
 
static addStyle ($content, $media='')
 
static addStylesheet ($source, $attributes=array())
 
static removeStylesheet ($source, $attributes=array())
 
static addScript ($source, $attributes=array())
 
static removeScript ($source, $attributes=array())
 
static addHeadElement ($name, $attributes=array(), $content=NULL)
 
static removeHeadElement ($name, $attributes=array())
 
static addComment ($content)
 
static removeComment ($content)
 
static getHeadElements ()
 
static addBodyElements ($html)
 
static getBodyElements ()
 
static disableHeader ()
 
static isHeaderEnabled ()
 
static setBodyElementId ($id)
 
static getBodyElementId ()
 
static postMessage (MessageBox $message, $id=null)
 
static clearMessages ()
 
static getMessages ()
 
static getSqueezePackages ()
 
static setSqueezePackages ($package)
 
static addSqueezePackage ($package)
 

Detailed Description

The PageLayout class provides utility functions to control the global page layout of Stud.IP. This includes the page title, the included CSS style sheets and JavaScript files. It replaces the "traditional" way of manipulating the page header via special global variables (like $CURRENT_PAGE and $_include_stylesheet).

Each Stud.IP page should at least set the page title and help keyword (if a help page exists).

Member Function Documentation

◆ addBodyElements()

static addBodyElements (   $html)
static

Add an extra HTML fragment at the start of the HTML BODY section.

Parameters
string$htmlHTML fragment to include in BODY
Here is the caller graph for this function:

◆ addComment()

static addComment (   $content)
static

Insert a (conditional) comment in the header. To preserve execution order, this method utilizes addHeadElement() in a more or less hackish way.

Parameters
string$contentcomment content
Here is the call graph for this function:
Here is the caller graph for this function:

◆ addHeadElement()

static addHeadElement (   $name,
  $attributes = array(),
  $content = NULL 
)
static

Add an extra HTML element to the HTML HEAD section. This can be used to include RSS/ATOM feed links, META tags or other stuff. If $content is NULL, no closing tag is generated. If the element needs a closing tag (like SCRIPT) but should not have contents, pass the empty string as the third parameter.

Parameters
string$nameelement name (e.g. 'meta')
array$attributesadditional attributes for the element
string$contentelement contents, if any
Here is the caller graph for this function:

◆ addScript()

static addScript (   $source,
  $attributes = array() 
)
static

Add a JavaScript SCRIPT element to the HTML HEAD section.

Parameters
string$sourceURL of JS file or file in assets folder
array$attributesAdditional parameters for the script tag
Here is the call graph for this function:
Here is the caller graph for this function:

◆ addSqueezePackage()

static addSqueezePackage (   $package)
static

Add a squeeze package to the list of squeeze packages to use

static addSqueezePackage($package)
Definition: PageLayout.php:544
Parameters
string$packagethe name of the package
Here is the caller graph for this function:

◆ addStyle()

static addStyle (   $content,
  $media = '' 
)
static

Add a STYLE element to the HTML HEAD section.

Parameters
string$contentelement contents
string$mediamedia types
Here is the call graph for this function:
Here is the caller graph for this function:

◆ addStylesheet()

static addStylesheet (   $source,
  $attributes = array() 
)
static

Add a style sheet LINK element to the HTML HEAD section.

Parameters
string$sourcestyle sheet URL or file in assets folder
array$attributesadditional attributes for LINK element
Here is the call graph for this function:
Here is the caller graph for this function:

◆ clearMessages()

static clearMessages ( )
static

Clears all messages pending for display.

Here is the caller graph for this function:

◆ disableHeader()

static disableHeader ( )
static

Disable output of the navigation header for this page.

Here is the caller graph for this function:

◆ getBodyElementId()

static getBodyElementId ( )
static

Gets the id of the body element. If non was set, it is dynamically generated base on the name of the current PHP script, with the suffix removed and all non-alphanumeric characters replaced with '_'.

Returns
String containing the body element id

◆ getBodyElements()

static getBodyElements ( )
static

Return all HTML BODY fragments as a string.

Returns
string HTML fragment

◆ getHeadElements()

static getHeadElements ( )
static

Return all HTML HEAD elements as a string.

Returns
string HTML fragment
Here is the call graph for this function:

◆ getHelpKeyword()

static getHelpKeyword ( )
static

Get the current help keyword (defaults to 'Basis.Allgemeines').

Here is the caller graph for this function:

◆ getMessages()

static getMessages ( )
static

Returns the list of pending messages and clears the list.

Returns
array list of MessageBox objects
Here is the call graph for this function:
Here is the caller graph for this function:

◆ getSqueezePackages()

static getSqueezePackages ( )
static

Return the names of the squeeze packages to use.

Per default the squeeze package "base" is included.

Returns
array an array containing the names of the packages

◆ getTabNavigation()

static getTabNavigation ( )
static

Returns the base navigation object (not its path) for the tabs. May return NULL if tab display is disabled.

Here is the call graph for this function:

◆ getTabNavigationPath()

static getTabNavigationPath ( )
static

Returns the base navigation path for the tabs. May return NULL if tab display is disabled.

◆ getTitle()

static getTitle ( )
static

Get the current page title (defaults to $UNI_NAME_CLEAN).

Returns
string
Here is the caller graph for this function:

◆ hasTitle()

static hasTitle ( )
static

Returns whether a title has been set

Returns
bool
Here is the caller graph for this function:

◆ initialize()

static initialize ( )
static

Initialize default page layout. This should only be called once from phplib_local.inc.php. Don't use this otherwise.

Here is the call graph for this function:

◆ isHeaderEnabled()

static isHeaderEnabled ( )
static

Return whether output of the navigation header is enabled.

◆ postMessage()

static postMessage ( MessageBox  $message,
  $id = null 
)
static

Registers a MessageBox object for display the next time a layout is rendered. Note: This will only work for pages that use layout templates.

Parameters
MessageBoxmessage object to display

◆ removeComment()

static removeComment (   $content)
static

Remove a (conditional) comment from the header.

Parameters
string$contentcomment content
Here is the call graph for this function:

◆ removeHeadElement()

static removeHeadElement (   $name,
  $attributes = array() 
)
static

Remove HTML elements from the HTML HEAD section. This method will remove all elements matching the given name and all the attributes.

For example, to remove all META elements: PageLayout::removeHeadElement('meta');

Remove all style sheet LINK elements: PageLayout::removeHeadElement('link', array('rel' => 'stylesheet'));

Remove a particular style sheet LINK by href: PageLayout::removeHeadElement('link', array('href' => '...'));

Here is the caller graph for this function:

◆ removeScript()

static removeScript (   $source,
  $attributes = array() 
)
static

Remove a JavaScript SCRIPT element from the HTML HEAD section.

Parameters
string$sourceURL of JS file or file in assets folder
array$attributesAdditional parameters for the script tag
Here is the call graph for this function:

◆ removeStylesheet()

static removeStylesheet (   $source,
  $attributes = array() 
)
static

Remove a style sheet LINK element from the HTML HEAD section.

Parameters
string$sourcestyle sheet URL or file in assets folder
array$attributesadditional attributes for LINK element
Here is the call graph for this function:
Here is the caller graph for this function:

◆ setBodyElementId()

static setBodyElementId (   $id)
static

Sets the id of the html body element. The given id is stripped of all non alpha-numeric characters (except for -).

Parameters
String$idId of the body element
Here is the caller graph for this function:

◆ setHelpKeyword()

static setHelpKeyword (   $help_keyword)
static

Set the help keyword to the given string.

Here is the caller graph for this function:

◆ setSqueezePackages()

static setSqueezePackages (   $package)
static

Set the names of the squeeze packages to use

# use as many arguments as you want
PageLayout::setSqueezePackages("base", "admin", "upload");
# PageLayout::setSqueezePackages(...);
static setSqueezePackages($package)
Definition: PageLayout.php:530
Parameters
...a variable-length argument list containing the names of the packages
Here is the caller graph for this function:

◆ setTabNavigation()

static setTabNavigation (   $path)
static

Select which tabs (if any) should be displayed on the page. The argument specifies a navigation item in the tree whose children will form the first level of tabs. If $path is NULL, no tabs are displayed. The default setting is to use the active element in the top navigation.

Parameters
string$pathpath of navigation item for tabs or NULL
Here is the call graph for this function:
Here is the caller graph for this function:

◆ setTitle()

static setTitle (   $title)
static

Set the page title to the given text.

Parameters
string$titlePage title

The documentation for this class was generated from the following file: