Display a search form that selects on typed text only

package Gems
subpackage Snippets_Generic
copyright Copyright (c) 2011 Erasmus MC
license New BSD License
since Class available since version 1.5.6

 Methods

Called after the check that all required registry values have been set correctly has run.

afterRegistry() : void

Create the snippets content

getHtmlOutput(\Zend_View_Abstract $view) : \MUtil_Html_HtmlInterface

This is a stub function either override getHtmlOutput() or override render()

Parameters

$view

\Zend_View_Abstract

Just in case it is needed here

Returns

\MUtil_Html_HtmlInterfaceSomething that can be rendered

Helper function to generate a period query string

getPeriodFilter(array $filter, \Zend_Db_Adapter_Abstract $db, $inFormat = null, $outFormat = null) : string
Static

Parameters

$filter

array

A filter array or $request->getParams()

$db

\Zend_Db_Adapter_Abstract

$inFormat

Optional format to use for date when reading

$outFormat

Optional format to use for date in query

Returns

string

Generate two date selectors and - depending on the number of $dates passed - either a hidden element containing the field name or an radio button or dropdown selector for the type of date to use.

_addPeriodSelectors(array $elements, mixed $dates, string $defaultDate = null, integer $switchToSelect = 4

Parameters

$elements

array

Search element array to which the element are added.

$dates

mixed

A string fieldName to use or an array of fieldName => Label

$defaultDate

string

Optional element, otherwise first is used.

$switchToSelect

integer

The number of dates where this function should switch to select display

Creates a \Zend_Form_Element_Select

_createCheckboxElement(string $name, string $label) : \Zend_Form_Element_Checkbox

If $options is a string it is assumed to contain an SQL statement.

Parameters

$name

string

Name of the element

$label

string

Label for element

Returns

\Zend_Form_Element_Checkbox

Creates a \Zend_Form_Element_Select

_createRadioElement(string $name, string|array $options, string $empty = null) : \Zend_Form_Element_Radio

If $options is a string it is assumed to contain an SQL statement.

Parameters

$name

string

Name of the select element

$options

stringarray

Can be a SQL select string or key/value array of options

$empty

string

Text to display for the empty selector

Returns

\Zend_Form_Element_Radio

Creates a \Zend_Form_Element_Select

_createSelectElement(string $name, string|array $options, string $empty = null) : \Zend_Form_Element_Select

If $options is a string it is assumed to contain an SQL statement.

Parameters

$name

string

Name of the select element

$options

stringarray

Can be a SQL select string or key/value array of options

$empty

string

Text to display for the empty selector

Returns

\Zend_Form_Element_Select

Creates the form itself

createForm(array $options = null) : \Gems_Form

Parameters

$options

array

Returns

\Gems_Form

Returns a text element for autosearch. Can be overruled.

getAutoSearchElements(array $data) : array

The form / html elements to search on. Elements can be grouped by inserting null's between them. That creates a distinct group of elements

Parameters

$data

array

The $form field values (can be usefull, but no need to set them)

Returns

arrayOf \Zend_Form_Element's or static tekst to add to the html or null for group breaks.

Creates an autosearch form for indexAction.

getAutoSearchForm() : \Gems_Form | null

Returns

\Gems_Formnull

getAutoSearchHref()

getAutoSearchHref() : string

Returns

stringHref attribute for type as you go autofilter

Creates a reset button for the search form

getAutoSearchReset() : \Zend_Form_Element_Html

Returns

\Zend_Form_Element_Htmlor null

Creates a submit button

getAutoSearchSubmit() : \Zend_Form_Element_Submit

Returns

\Zend_Form_Element_Submit

getSearchData()

getSearchData() : array

Returns

arrayThe data to fill the form with

Creates a \Zend_Form_Element_Select

_createMultiElement(string $class, string $name, string|array $options, string $empty) : \Zend_Form_Element_Multi

If $options is a string it is assumed to contain an SQL statement.

Parameters

$class

string

Name of the class to use

$name

string

Name of the select element

$options

stringarray

Can be a SQL select string or key/value array of options

$empty

string

Text to display for the empty selector

Returns

\Zend_Form_Element_Multi

 Properties

 

Optional, otherwise created from $util

$requestCache : \Gems_Util_RequestCache

Default

 

The id of a div that contains target that should be replaced.

$containingId : string

Default

 

Optional string format for date

$dateFormat : string

Default

 

$db

$db : \Zend_Db_Adapter_Abstract

Default

 

The default search data to use.

$defaultSearchData : \array()

Default

array()
 

$menu

$menu : \Gems_Menu

Default

 

$model

$model : \MUtil_Model_ModelAbstract

Default

 

$request

$request : \Zend_Controller_Request_Abstract

Default

 

Id for auto search button

$searchButtonId : string

Default

'AUTO_SEARCH_TEXT_BUTTON'
 

The input data for the model

$searchData : array

Default

false
 

$util

$util : \Gems_Util

Default

 Constants

 

Field name for perioe filters

PERIOD_DATE_USED = 'dateused'