Stud.IP  5.4
 All Data Structures Namespaces Files Functions Variables Groups
SearchWidget Class Reference
Inheritance diagram for SearchWidget:
SidebarWidget Widget

Public Member Functions

 __construct ($url= '')
 
 setMethod ($method)
 
 getMethod ()
 
 addNeedle ($label, $name, $placeholder=false, SearchType $quick_search=null, $js_func=null, $value=null, array $attributes=[])
 
 addFilter ($label, $key)
 
 hasElements ()
 
 render ($variables=[])
 
- Public Member Functions inherited from SidebarWidget
 __construct ()
 
 setId (string $id)
 
 getId ()
 
 setTitle ($title)
 
 getTitle ()
 
 removeTitle ()
 
 setExtra ($extra)
 
 getExtra ()
 
 removeExtra ()
 
 setAdditionalAttribute (string $key, $value)
 
 setAdditionalAttributes (array $attributes)
 
 removeAdditionalAttribute (string $key)
 
 render ($variables=[])
 
- Public Member Functions inherited from Widget
 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)
 

Data Fields

const INDEX = 'search'
 

Protected Member Functions

 hasData ()
 
- Protected Member Functions inherited from Widget
 guessIndex (WidgetElement $element)
 

Protected Attributes

 $url
 
 $needles = []
 
 $filters = []
 
 $method = 'get'
 
 $id = null
 
- Protected Attributes inherited from SidebarWidget
 $additional_attributes = []
 
- Protected Attributes inherited from Widget
 $elements = []
 
 $template = 'widgets/widget'
 
 $template_variables = []
 
 $layout = 'widgets/widget-layout'
 
 $forced_rendering = false
 
 $layout_css_classes = []
 

Detailed Description

This class provides a generic search widget for the sidebar.

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

Constructor & Destructor Documentation

__construct (   $url = '')

Constructor for the widget.

Parameters
String$urlURL to send the search to

Member Function Documentation

addFilter (   $label,
  $key 
)

Add a filter option. This will create a checkbox with the given key as the name attribute.

Parameters
String$labelLabel of the filter
String$keyKey/name of the filter (this will be the name attribute)
addNeedle (   $label,
  $name,
  $placeholder = false,
SearchType  $quick_search = null,
  $js_func = null,
  $value = null,
array  $attributes = [] 
)

Add a needle to search (optionally as quick search)

Parameters
String$labelLabel for the input element
String$nameName of the input (which will be the transmitted name attribute)
bool$placeholderUse label as placeholder (this will hide the associated label)
mixed$quick_searchAn optional SearchType object if quick search should be used
mixed$js_funcOptional name of a js function or a js function itself that's executed when an entry of the found elements is selected
array$attributesAn array with optional HTML attributes that shall be attached to the input element that is constructed when rendering this "needle". The array keys specify the attribute names while the array values specify the attribute values. Note that this parameter is ignored when a quick search object is provided!
getMethod ( )

Returns the request method used for the form.

Returns
string containing the chosen request method.
hasData ( )
protected

Returns whether the widget has any data. The widget has data if it was submitted and any of the needles or needles has been filled out.

Returns
bool indicating whether the request method matches and any element has data.
hasElements ( )

Returns whether the widgets has any elements. Since this widget uses a special template, not all elements are "real" SidebarElements.

Returns
bool If widget has any element.
render (   $variables = [])

Renders the widget.

Parameters
Array$variablesUnused variables parameter
Returns
String containing the html output of the widget
setMethod (   $method)

Sets the request method used for the form.

Field Documentation

$filters = []
protected
$id = null
protected
$method = 'get'
protected
$needles = []
protected
$url
protected
const INDEX = 'search'

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