本文整理汇总了PHP中JModelList::getFilterForm方法的典型用法代码示例。如果您正苦于以下问题:PHP JModelList::getFilterForm方法的具体用法?PHP JModelList::getFilterForm怎么用?PHP JModelList::getFilterForm使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类JModelList
的用法示例。
在下文中一共展示了JModelList::getFilterForm方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: getFilterForm
/**
* Method to get the record form.
*
* @param array $data Data for the form.
* @param boolean $loadData True if the form is to load its own data (default case), false if not.
*
* @return mixed A JForm object on success, false on failure
* @since 1.6
*/
public function getFilterForm($data = array(), $loadData = true)
{
$form = parent::getFilterForm($data, $loadData);
if (empty($form)) {
return false;
}
//configure sort list - create two options for each visforms form field (asc and desc) and replace definition of fullordering field in filter_visdatas.xml
$xml = '<field
name="fullordering"
type="list"
label="COM_VISFORMS_LIST_FULL_ORDERING"
description="COM_VISFORMS_LIST_FULL_ORDERING_DESC"
onchange="this.form.submit();"
default="a.id ASC"
>
<option value="">JGLOBAL_SORT_BY</option>
<option value="a.id ASC">JGRID_HEADING_ID_ASC</option>
<option value="a.id DESC">JGRID_HEADING_ID_DESC</option>
<option value="a.published ASC">JSTATUS_ASC</option>
<option value="a.published DESC">JSTATUS_DESC</option>
<option value="a.created ASC">JDATE_ASC</option>
<option value="a.created DESC">JDATE_DESC</option>
<option value="a.ipaddress ASC">COM_VISFORMS_SORT_IP_ASC</option>
<option value="a.ipaddress DESC">COM_VISFORMS_SORT_IP_DESC</option>
<option value="a.ismfd ASC">COM_VISFORMS_SORT_ISMFD_ASC</option>
<option value="a.ismfd DESC">COM_VISFORMS_SORT_ISMFD_DESC</option>';
$datafields = $this->getDatafields();
foreach ($datafields as $datafield) {
if (isset($datafield->showFieldInDataView) && $datafield->showFieldInDataView == true) {
$xml .= '<option value="a.F' . $datafield->id . ' ASC">' . $datafield->name . ' ' . JText::_("COM_VISFORMS_ASC") . '</option>';
$xml .= '<option value="a.F' . $datafield->id . ' DESC">' . $datafield->name . ' ' . JText::_("COM_VISFORMS_DESC") . '</option>';
}
}
$xml .= '</field>';
$xmlfield = new SimpleXMLElement($xml);
$form->setField($xmlfield, 'list', 'true');
return $form;
}
示例2: getFilterForm
public function getFilterForm($data = array(), $loadData = true)
{
$form = parent::getFilterForm($data, $loadData);
if ($form) {
$path = JPATH_ADMINISTRATOR . '/components/' . $this->getState('filter.component') . '/models/forms/filter_fields.xml';
if (file_exists($path)) {
// Load all children that's why we need to define the xpath
if (!$form->loadFile($path, true, '/form/*')) {
throw new Exception(JText::_('JERROR_LOADFILE_FAILED'));
}
}
// If the context has multiple sections, this is the input field
// to display them
$form->setValue('section', 'custom', JFactory::getApplication()->input->getCmd('context'));
}
return $form;
}