本文整理汇总了PHP中plgFabrik_Element::getParams方法的典型用法代码示例。如果您正苦于以下问题:PHP plgFabrik_Element::getParams方法的具体用法?PHP plgFabrik_Element::getParams怎么用?PHP plgFabrik_Element::getParams使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类plgFabrik_Element
的用法示例。
在下文中一共展示了plgFabrik_Element::getParams方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: cacheAutoCompleteOptions
/**
* Cache method to populate auto-complete 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();
$table = $listModel->getTable();
$db = $listModel->getDb();
$name = $elementModel->getFullName(false, false);
$query = $db->getQuery(true);
$params = $elementModel->getParams();
$format = $params->get('date_table_format');
$elementModel->strftimeTFormatToMySQL($format);
$search = $db->quote('%' . addslashes($search) . '%');
$query->select('DISTINCT(' . $name . ') AS value, ' . $name . ' AS text')->from($table->db_table_name)->where($name . ' LIKE ' . $search . ' OR DATE_FORMAT(' . $name . ', "' . $format . '" ) LIKE ' . $search);
$db->setQuery($query);
$tmp = $db->loadObjectList();
$ddData = array();
foreach ($tmp as &$t) {
$elementModel->toLabel($t->text);
if (!array_key_exists($t->text, $ddData)) {
$ddData[$t->text] = $t;
}
}
$ddData = array_values($ddData);
echo json_encode($ddData);
}
示例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())
{
$params = $elementModel->getParams();
$c = $elementModel->getLabelOrConcatVal();
if (!strstr($c, 'CONCAT')) {
$c = FabrikString::safeColName($c);
}
$filterMethod = $elementModel->getFilterBuildMethod();
if ($filterMethod == 1) {
$join = $elementModel->getJoin()->table_join;
$opts = array();
if (!strstr($c, 'CONCAT')) {
$opts['label'] = strstr($c, '.') ? $c : $join . '.' . $c;
} else {
$opts['label'] = $c;
}
return parent::cacheAutoCompleteOptions($elementModel, $search, $opts);
}
// $$$ hugh - added 'autocomplete_how', currently just "starts_with" or "contains"
// default to "contains" for backward compat.
$elementModel->autocomplete_where = $elementModel->_autocompleteWhere($params->get('dbjoin_autocomplete_how', 'contains'), $c, $search);
$opts = array('mode' => 'filter');
$tmp = $elementModel->_getOptions(array(), 0, true, $opts);
return json_encode($tmp);
}