Stud.IP  4.0
 All Data Structures Namespaces Files Functions Variables Groups
Widget Class Reference
Inheritance diagram for Widget:
HelpbarWidget SidebarWidget VueWidget HelpbarTourWidget BlubberThreadsWidget ClipboardWidget ListWidget ResourceTreeWidget RoomSearchWidget SearchWidget SelectWidget TemplateWidget

Public Member Functions

 addElement (WidgetElement $element, $index=null)
 
 insertElement (WidgetElement $element, $before_index, $index=null)
 
 getElement ($index)
 
 getElements ()
 
 removeElement ($index)
 
 hasElements ()
 
 hasElement ($index)
 
 forceRendering ($state=true)
 
 addLayoutCSSClass ($css_class)
 
 removeLayoutCSSClass ($css_class)
 
 render ($variables=[])
 
 __isset ($offset)
 
 __get ($offset)
 
 __set ($offset, $value)
 
 __unset ($offset)
 

Protected Member Functions

 guessIndex (WidgetElement $element)
 

Protected Attributes

 $elements = []
 
 $template = 'widgets/widget'
 
 $template_variables = []
 
 $layout = 'widgets/widget-layout'
 
 $forced_rendering = false
 
 $layout_css_classes = []
 

Detailed Description

Generic Widget

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

Member Function Documentation

__get (   $offset)
__isset (   $offset)
__set (   $offset,
  $value 
)
__unset (   $offset)
addElement ( WidgetElement  $element,
  $index = null 
)

Add an element to the widget.

Parameters
WidgetElement$elementThe actual element
String$indexIndex/name of the element
addLayoutCSSClass (   $css_class)

Adds a css class to the layout

around the widget.
forceRendering (   $state = true)

Force rendering

Parameters
bool$stateWhether to force rendering or not
getElement (   $index)

Retrieve the element at the specified position.

Parameters
String$indexIndex/name of the element to retrieve.
Returns
WidgetElement The element at the specified position.
Exceptions
Exceptionif the specified position is invalid
getElements ( )

Returns all elements of the widget.

Returns
array of WidgetElement
guessIndex ( WidgetElement  $element)
protected

Tries to guess an appropriate index name for the element.

Parameters
WidgetElement$elementThe element in question
Returns
String Appropriate index name
hasElement (   $index)

Returns whether an element exists at the given index.

Parameters
String$indexIndex/name of the element to check for.
Returns
bool Does a widget exist at the given index?
hasElements ( )

Returns whether this widget has any elements.

Returns
bool True if the widget has at least one element, false otherwise.
insertElement ( WidgetElement  $element,
  $before_index,
  $index = null 
)

Insert an element before a specific other element or at the end of the list if the specified position is invalid.

Parameters
WidgetElement$elementThe actual element
String$before_indexInsert element before this element.
String$indexIndex/name of the element
removeElement (   $index)

Removes the element at the specified position.

Parameters
String$indexIndex/name of the element to remove.
Exceptions
Exceptionif the specified position is invalid
removeLayoutCSSClass (   $css_class)

Removes a css class from the layout

around the widget.
render (   $variables = [])

Renders the widget. The widget will only be rendered if it contains at least one element.

Returns
String The THML code of the rendered sidebar widget

Field Documentation

$elements = []
protected

Contains the elements of the widget.

$forced_rendering = false
protected

Forced rendering?

$layout = 'widgets/widget-layout'
protected

Layout for this widget

$layout_css_classes = []
protected
$template = 'widgets/widget'
protected

Contains the template used to render the widget.

$template_variables = []
protected

Contains additional template variables


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