本文整理汇总了PHP中plgFabrik_Element::filterValueList方法的典型用法代码示例。如果您正苦于以下问题:PHP plgFabrik_Element::filterValueList方法的具体用法?PHP plgFabrik_Element::filterValueList怎么用?PHP plgFabrik_Element::filterValueList使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类plgFabrik_Element
的用法示例。
在下文中一共展示了plgFabrik_Element::filterValueList方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: cacheAutoCompleteOptions
/**
* Cache method to populate autocomplete options
*
* @param plgFabrik_Element $elementModel element model
* @param string $search search string
* @param array $opts options, 'label' => field to use for label (db join)
*
* @since 3.0.7
*
* @return string json encoded search results
*/
public static function cacheAutoCompleteOptions($elementModel, $search, $opts = array())
{
$listModel = $elementModel->getListModel();
$label = JArrayHelper::getValue($opts, 'label', '');
$rows = $elementModel->filterValueList(true, '', $label);
$v = addslashes(JRequest::getVar('value'));
$start = count($rows) - 1;
for ($i = $start; $i >= 0; $i--) {
if (!preg_match("/{$v}(.*)/i", $rows[$i]->text)) {
unset($rows[$i]);
}
}
$rows = array_values($rows);
echo json_encode($rows);
}
示例2: cacheAutoCompleteOptions
/**
* Cache method to populate autocomplete options
*
* @param plgFabrik_Element $elementModel Element model
* @param string $search Search string
* @param array $opts Options, 'label' => field to use for label (db join)
*
* @since 3.0.7
*
* @return string Json encoded search results
*/
public static function cacheAutoCompleteOptions($elementModel, $search, $opts = array())
{
$app = JFactory::getApplication();
$listModel = $elementModel->getListModel();
$label = FArrayHelper::getValue($opts, 'label', '');
$rows = $elementModel->filterValueList(true, '', $label);
$v = $app->input->get('value', '', 'string');
// Search for every word separately in the result rather than the single string (of multiple words)
$regex = "/(?=.*" . implode(")(?=.*", array_filter(explode(" ", addslashes($v)))) . ").*/i";
$start = count($rows) - 1;
for ($i = $start; $i >= 0; $i--) {
$rows[$i]->text = strip_tags($rows[$i]->text);
// Check that search strings are not in the HTML we just stripped
if (!preg_match($regex, $rows[$i]->text)) {
unset($rows[$i]);
}
}
$rows = array_values($rows);
echo json_encode($rows);
}
示例3: filterValueList
public function filterValueList($normal, $tableName = '', $label = '', $id = '', $incjoin = true)
{
$rows = parent::filterValueList($normal, $tableName, $label, $id, $incjoin);
$this->unmergeFilterSplits($rows);
$this->reapplyFilterLabels($rows);
return $rows;
}