Stud.IP  5.4
PageLayout Class Reference

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 disableSidebar (bool $state=true)
 
static isSidebarEnabled ()
 
static disableFooter (bool $state=true)
 
static isFooterEnabled ()
 
static setBodyElementId ($id)
 
static hasBodyElementId ()
 
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 ()
 
static allowFullscreenMode ($state=true)
 
static isFullscreenModeAllowed ()
 

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

◆ 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

◆ 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

◆ addSqueezePackage()

static addSqueezePackage (   $package)
static

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

Parameters
string$packagethe name of the package

◆ addStyle()

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

Add a STYLE element to the HTML HEAD section.

Parameters
string$contentelement contents
string$mediamedia types

◆ 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

◆ allowFullscreenMode()

static allowFullscreenMode (   $state = true)
static

Defines whether full screen mode toggle is allowed or not.

Parameters
boolean$state

◆ clearMessages()

static clearMessages ( )
static

Clears all messages pending for display.

◆ disableFooter()

static disableFooter ( bool  $state = true)
static

Disable output of the page footer for this page.

Parameters
bool$state
Since
Stud.IP 5.4

◆ disableHeader()

static disableHeader ( )
static

Disable output of the navigation header for this page.

◆ disableSidebar()

static disableSidebar ( bool  $state = true)
static

Disable output of the sidebar for this page.

Since
Stud.IP 5.4

◆ 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

◆ getHelpKeyword()

static getHelpKeyword ( )
static

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

◆ getMessages()

static getMessages ( )
static

Returns the list of pending messages and clears the list.

Returns
array list of MessageBox objects

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

◆ 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

◆ hasBodyElementId()

static hasBodyElementId ( )
static

Returns whether an id for the body element has been set.

Returns
bool

◆ 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

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

◆ isFooterEnabled()

static isFooterEnabled ( )
static

Return whether output of the page footer is enabled.

Since
Stud.IP 5.4

◆ isFullscreenModeAllowed()

static isFullscreenModeAllowed ( )
static

Returns whether full screen mode toggle is allowed.

Returns
boolean

◆ isHeaderEnabled()

static isHeaderEnabled ( )
static

Return whether output of the navigation header is enabled.

◆ isSidebarEnabled()

static isSidebarEnabled ( )
static

Return whether output of the sidebar is enabled.

Since
Stud.IP 5.4

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

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

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

◆ 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

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

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

◆ 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

◆ 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

◆ 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

◆ setHelpKeyword()

static setHelpKeyword (   $help_keyword)
static

Set the help keyword to the given string.

◆ 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

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