Stud.IP  4.0
 All Data Structures Namespaces Files Functions Variables Groups
Helpbar Class Reference
Inheritance diagram for Helpbar:
WidgetContainer

Public Member Functions

 loadContent ()
 
 setVariables ($variables)
 
 addPlainText ($label, $text, $icon=null, $edit_link=null, $delete_link=null, $add_link=null)
 
 addText ($label, $id)
 
 addLink ($label, $url, $icon=false, $target=false, $attributes=[])
 
 insertLink ($label, $url, $icon=false, $target=false, $attributes=[])
 
 open ($state=true)
 
 shouldRender ($state=true)
 
 ignoreDatabaseContents ($state=true)
 
 render ()
 
- Public Member Functions inherited from WidgetContainer
 addWidget (Widget $widget, $index=null)
 
 insertWidget (Widget $widget, $before_index, $index=null)
 
 getWidget ($index)
 
 getWidgets ()
 
 removeWidget ($index)
 
 hasWidgets ()
 
 hasWidget ($index)
 
 render ()
 

Protected Member Functions

 __construct ()
 
 interpolate ($string, $variables=[])
 
- Protected Member Functions inherited from WidgetContainer
 __construct ()
 

Protected Attributes

 $open = false
 
 $should_render = true
 
 $variables = []
 
 $ignore_db = false
 
 $help_admin
 
- Protected Attributes inherited from WidgetContainer
 $widgets = []
 

Additional Inherited Members

- Static Public Member Functions inherited from WidgetContainer
static Get ()
 
- Static Protected Attributes inherited from WidgetContainer
static $instances = null
 

Detailed Description

Help section

Author
Jan-Hendrik Willms tleil.nosp@m.ax+s.nosp@m.tudip.nosp@m.@gma.nosp@m.il.co.nosp@m.m GPL 2 or later
Since
3.1

Constructor & Destructor Documentation

__construct ( )
protected

Constructs the helpbar

Member Function Documentation

addLink (   $label,
  $url,
  $icon = false,
  $target = false,
  $attributes = [] 
)

Adds a link to the helpbar

Parameters
String$labelLabel of the link
String$urlThe link itself
mixed$iconAn optional, additional icon
mixed$targetThe target attribute of the link element
array$attributesAdditional attribute for the link element
addPlainText (   $label,
  $text,
  $icon = null,
  $edit_link = null,
  $delete_link = null,
  $add_link = null 
)

Adds text entries to the helpbar.

Parameters
String$labelLabel/category
String$textThe text item itself
mixed$iconAn optional, additional icon
mixed$edit_linkOptional edit link if the user may do so
mixed$delete_linkOptional delete link if the user may do so
mixed$add_linkOptional add link if the user may do so
addText (   $label,
  $id 
)

Adds an entry from the database to the helpbar.

Parameters
String$labelLabel for the entry
String$idId of the entry
ignoreDatabaseContents (   $state = true)

Tells the helpbar to ignore any potentially stored contents from the database. This is neccessary for pages like the wiki where a helpbar entry is present in the database but since url parameters are currently ignored, the entry would apply for all pages of the wiki - which it shouldn't. This is just a makeshift solution until arbitrary routes can be handled.

Parameters
bool$stateIndicating whether the contents should be ignored
insertLink (   $label,
  $url,
  $icon = false,
  $target = false,
  $attributes = [] 
)

Inserts a link to the helpbar before all other elements

Parameters
String$labelLabel of the link
String$urlThe link itself
mixed$iconAn optional, additional icon
mixed$targetThe target attribute of the link element
array$attributesAdditional attribute for the link element
interpolate (   $string,
  $variables = [] 
)
protected

Interpolates a string with variables.

Essentially, the string "i am #{name}" with the variables ['name' => 'groot'] will be converted to "i am groot". I guess you get the principle.

Parameters
mixed$stringString to interpolate (an array of string may be passed as well)
array$variablesVariables to interpolate into the string(s)
Returns
mixed Either an interpolated string or an array of such
loadContent ( )

load help content from db

open (   $state = true)

Tells the helpbar whether it should be open by default.

Parameters
bool$stateIndicating whether the helpbar should be open
render ( )

Renders the help bar. The helpbar will only be rendered if it actually contains any widgets. It will use the template "helpbar.php" located at "templates/helpbar". A notification is dispatched before and after the actual rendering process.

Returns
String The HTML code of the rendered helpbar.
setVariables (   $variables)

set variables for help content

Parameters
Array$variablesThe variables to set
shouldRender (   $state = true)

Tells the helpbar whether it should render.

Parameters
bool$stateIndicating whether the helpbar should render

Field Documentation

$help_admin
protected
$ignore_db = false
protected
$open = false
protected
$should_render = true
protected
$variables = []
protected

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