Stud.IP  5.4
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)
 
 countWidgets (string $widget_class=null)
 
 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()

__construct ( )
protected

Constructs the helpbar

Member Function Documentation

◆ addLink()

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

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

addText (   $label,
  $id 
)

Adds an entry from the database to the helpbar.

Parameters
String$labelLabel for the entry
String$idId of the entry

◆ ignoreDatabaseContents()

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

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

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

loadContent ( )

load help content from db

◆ open()

open (   $state = true)

Tells the helpbar whether it should be open by default.

Parameters
bool$stateIndicating whether the helpbar should be open

◆ render()

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

setVariables (   $variables)

set variables for help content

Parameters
Array$variablesThe variables to set

◆ shouldRender()

shouldRender (   $state = true)

Tells the helpbar whether it should render.

Parameters
bool$stateIndicating whether the helpbar should render

Field Documentation

◆ $help_admin

$help_admin
protected

◆ $ignore_db

$ignore_db = false
protected

◆ $open

$open = false
protected

◆ $should_render

$should_render = true
protected

◆ $variables

$variables = []
protected

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