本文整理匯總了PHP中SearchForm::getSearchFields方法的典型用法代碼示例。如果您正苦於以下問題:PHP SearchForm::getSearchFields方法的具體用法?PHP SearchForm::getSearchFields怎麽用?PHP SearchForm::getSearchFields使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類SearchForm
的用法示例。
在下文中一共展示了SearchForm::getSearchFields方法的2個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。
示例1: actionSaveSort
public function actionSaveSort()
{
$objTypeId = Yii::app()->request->getParam('id', NULL);
$sort = Yii::app()->request->getParam('sort');
if (count($sort) >= param('searchMaxField', 15)) {
HAjax::jsonError(tt('Search max field ') . param('searchMaxField', 3));
}
if ($objTypeId !== NULL && $sort && is_array($sort)) {
$elements = SearchForm::getSearchFields();
$sql = "DELETE FROM {{search_form}} WHERE obj_type_id=:id AND status!=:status";
Yii::app()->db->createCommand($sql)->execute(array(':id' => $objTypeId, ':status' => SearchFormModel::STATUS_NOT_REMOVE));
$i = 3;
foreach ($sort as $field) {
if (!isset($elements[$field])) {
continue;
}
$search = new SearchFormModel();
$search->attributes = array('obj_type_id' => $objTypeId, 'field' => $field, 'status' => $elements[$field]['status'], 'sorter' => $i, 'formdesigner_id' => isset($elements[$field]['formdesigner_id']) ? $elements[$field]['formdesigner_id'] : 0);
$search->save();
$i++;
}
// delete assets js cache
ConfigurationModel::clearGenerateJSAssets();
HAjax::jsonOk();
}
HAjax::jsonError();
}
示例2: getLabelByField
public static function getLabelByField($field)
{
if ($field == SearchForm::SEARCH_LOCATION) {
if (issetModule('location') && param('useLocation', 1)) {
return tc('Country') . ' / ' . tc('Region') . ' / ' . tc('City');
} else {
return tc('City');
}
}
$elements = SearchForm::getSearchFields();
if (isset($elements[$field])) {
return tc($elements[$field]['translate']);
} else {
return tc('Search by ' . $field);
}
}