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

Static Public Member Functions

static 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=[])
 
static removeStylesheet ($source, $attributes=[])
 
static addScript ($source, $attributes=[])
 
static removeScript ($source, $attributes=[])
 
static addHeadElement ($name, $attributes=[], $content=NULL)
 
static removeHeadElement ($name, $attributes=[])
 
static addComment ($content)
 
static removeComment ($content)
 
static getHeadElements ()
 
static addBodyElements ($html)
 
static getBodyElements ()
 
static disableHeader ()
 
static isHeaderEnabled ()
 
static setBodyElementId ($id)
 
static getBodyElementId ()
 
static postMessage (LayoutMessage $message, $id=null)
 
static postSuccess ($message, $details=[], $close_details=false)
 
static postError ($message, $details=[], $close_details=false)
 
static postInfo ($message, $details=[], $close_details=false)
 
static postWarning ($message, $details=[], $close_details=false)
 
static postException ($message, $details=[], $close_details=false)
 
static postQuestion ($question, $accept_url='', $decline_url='')
 
static clearMessages ()
 
static getMessages ()
 
static getSqueezePackages ()
 
static setSqueezePackages ($package)
 
static addSqueezePackage ($package)
 
static addCustomQuicksearch ($html)
 
static hasCustomQuicksearch ()
 
static getCustomQuicksearch ()
 

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

◆ addCustomQuicksearch()

static addCustomQuicksearch (   $html)
static

Modifies the Quicksearch of Stud.IP

Parameters
$htmlHTML code for the custom quicksearch

◆ addHeadElement()

static addHeadElement (   $name,
  $attributes = [],
  $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 = [] 
)
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

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 caller graph for this function:

◆ addStylesheet()

static addStylesheet (   $source,
  $attributes = [] 
)
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

◆ getCustomQuicksearch()

static getCustomQuicksearch ( )
static

Retrieves the code of the custom quicksearch

Returns
mixed Quicksearch code

◆ getHeadElements()

static getHeadElements ( )
static

Return all HTML HEAD elements as a string.

Returns
string HTML fragment
Here is the call graph for this function:
Here is the caller 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 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 call graph for this function:
Here is the caller graph for this function:

◆ hasCustomQuicksearch()

static hasCustomQuicksearch ( )
static

Check if a custom quicksearch was added to the layout

Returns
bool TRUE if there is a custom quicksearch

◆ hasTitle()

static hasTitle ( )
static

Returns whether a title has been set

Returns
bool
Here is the caller graph for this function:

◆ initialize()

static 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:
Here is the caller graph for this function:

◆ isHeaderEnabled()

static isHeaderEnabled ( )
static

Return whether output of the navigation header is enabled.

◆ postError()

static postError (   $message,
  $details = [],
  $close_details = false 
)
static

Convenience method: Post an error message box.

Parameters
String$messageError message to diplay
Array$detailsAdditional details (optional)
bool$close_detailsShow the details closed (optional, defaults to false)
Here is the call graph for this function:

◆ postException()

static postException (   $message,
  $details = [],
  $close_details = false 
)
static

Convenience method: Post an exception message box.

Parameters
String$messageException message to diplay
Array$detailsAdditional details (optional)
bool$close_detailsShow the details closed (optional, defaults to false)
Here is the call graph for this function:

◆ postInfo()

static postInfo (   $message,
  $details = [],
  $close_details = false 
)
static

Convenience method: Post an info message box.

Parameters
String$messageInfo message to diplay
Array$detailsAdditional details (optional)
bool$close_detailsShow the details closed (optional, defaults to false)
Here is the call graph for this function:
Here is the caller graph for this function:

◆ postMessage()

static postMessage ( LayoutMessage  $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

◆ postQuestion()

static postQuestion (   $question,
  $accept_url = '',
  $decline_url = '' 
)
static

Convenience method: Post a question to confirm an action.

Be aware, that this will output the question as html. So you should either know what you are doing, use htmlReady() or post the QuestionBox for yourself using self::postMessage().

Parameters
String$questionQuestion to confirm
Array$approve_paramsParameters to send when approving
Array$disapprove_paramsParameters to send when disapproving
Returns
QuestionBox to allow further settings like urls and such
See also
QuestionBox
Since
Stud.IP 4.2
Here is the caller graph for this function:

◆ postSuccess()

static postSuccess (   $message,
  $details = [],
  $close_details = false 
)
static

Convenience method: Post a success message box.

Parameters
String$messageSuccess message to diplay
Array$detailsAdditional details (optional)
bool$close_detailsShow the details closed (optional, defaults to false)
Here is the call graph for this function:

◆ postWarning()

static postWarning (   $message,
  $details = [],
  $close_details = false 
)
static

Convenience method: Post a warning message box.

Parameters
String$messageWarning message to diplay
Array$detailsAdditional details (optional)
bool$close_detailsShow the details closed (optional, defaults to false)
Here is the call graph for this function:
Here is the caller graph for this function:

◆ removeComment()

static removeComment (   $content)
static

Remove a (conditional) comment from the header.

Parameters
string$contentcomment content

◆ removeHeadElement()

static removeHeadElement (   $name,
  $attributes = [] 
)
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' => '...'));

◆ removeScript()

static removeScript (   $source,
  $attributes = [] 
)
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 = [] 
)
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(...);
Parameters
...a variable-length argument list containing the names of the packages

◆ 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: