本文整理匯總了PHP中cmsController::saveOptions方法的典型用法代碼示例。如果您正苦於以下問題:PHP cmsController::saveOptions方法的具體用法?PHP cmsController::saveOptions怎麽用?PHP cmsController::saveOptions使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類cmsController
的用法示例。
在下文中一共展示了cmsController::saveOptions方法的5個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。
示例1: actionOptions
public function actionOptions()
{
if (empty($this->useDefaultOptionsAction)) {
cmsCore::error404();
}
$form = $this->getForm('options');
if (!$form) {
cmsCore::error404();
}
$is_submitted = $this->request->has('submit');
$options = cmsController::loadOptions($this->name);
if ($is_submitted) {
$options = $form->parse($this->request, $is_submitted);
$errors = $form->validate($this, $options);
if (!$errors) {
cmsUser::addSessionMessage(LANG_CP_SAVE_SUCCESS, 'success');
cmsController::saveOptions($this->name, $options);
$this->redirectToAction('options');
}
if ($errors) {
cmsUser::addSessionMessage(LANG_FORM_ERRORS, 'error');
}
}
return cmsTemplate::getInstance()->render('backend/options', array('options' => $options, 'form' => $form, 'errors' => isset($errors) ? $errors : false));
}
示例2: run
public function run()
{
$form = $this->getForm('options');
if (!$form) {
cmsCore::error404();
}
$is_submitted = $this->request->has('submit');
$options = cmsController::loadOptions($this->name);
$source_controllers = cmsEventsManager::hookAll('sitemap_sources');
if (is_array($source_controllers)) {
foreach ($source_controllers as $controller) {
foreach ($controller['sources'] as $id => $title) {
$form->addField('sources', new fieldCheckbox("sources:{$controller['name']}|{$id}", array('title' => $title)));
}
}
}
if ($is_submitted) {
$options = $form->parse($this->request, $is_submitted);
$errors = $form->validate($this, $options);
if (!$errors) {
cmsUser::addSessionMessage(LANG_CP_SAVE_SUCCESS, 'success');
cmsController::saveOptions($this->name, $options);
$this->redirectToAction('options');
}
if ($errors) {
cmsUser::addSessionMessage(LANG_FORM_ERRORS, 'error');
}
}
return cmsTemplate::getInstance()->render('backend/options', array('options' => $options, 'form' => $form, 'errors' => isset($errors) ? $errors : false));
}
示例3: actionOptions
public function actionOptions()
{
if (empty($this->useDefaultOptionsAction)) {
cmsCore::error404();
}
$form = $this->getForm('options');
if (!$form) {
cmsCore::error404();
}
$form = $this->addControllerSeoOptions($form);
$options = cmsController::loadOptions($this->name);
if ($this->request->has('submit')) {
$options = array_merge($options, $form->parse($this->request, true));
$errors = $form->validate($this, $options);
if (!$errors) {
cmsUser::addSessionMessage(LANG_CP_SAVE_SUCCESS, 'success');
cmsController::saveOptions($this->name, $options);
$this->processCallback(__FUNCTION__, array($options));
$this->redirectToAction('options');
}
if ($errors) {
cmsUser::addSessionMessage(LANG_FORM_ERRORS, 'error');
}
}
$template_params = array('toolbar' => $this->getOptionsToolbar(), 'options' => $options, 'form' => $form, 'errors' => isset($errors) ? $errors : false);
// если задан шаблон опций в контроллере
if ($this->cms_template->getTemplateFileName('controllers/' . $this->name . '/backend/options', true)) {
return $this->cms_template->render('backend/options', $template_params);
} else {
$default_admin_tpl = $this->cms_template->getTemplateFileName('controllers/admin/controllers_options');
return $this->cms_template->processRender($default_admin_tpl, $template_params);
}
}
示例4: run
public function run()
{
if (!$this->request->isAjax()) {
cmsCore::error404();
}
$items = $this->request->get('items', array());
if (!$items || !is_array($items)) {
cmsCore::error404();
}
foreach ($items as $order_id => $block_id) {
$options['dashboard_order'][(int) $block_id] = (int) $order_id;
}
cmsController::saveOptions('admin', array_merge($this->options, $options));
$this->halt();
}
示例5: run
public function run()
{
$form = $this->getForm('options');
if (!$form) {
cmsCore::error404();
}
$activity_model = cmsCore::getModel('activity');
$is_submitted = $this->request->has('submit');
$options = cmsController::loadOptions($this->name);
if ($is_submitted) {
$options = $form->parse($this->request, $is_submitted);
$errors = $form->validate($this, $options);
if (!$errors) {
cmsController::saveOptions($this->name, $options);
$activity_model->enableTypes($options['types']);
$this->redirectToAction('options');
}
if ($errors) {
cmsUser::addSessionMessage(LANG_FORM_ERRORS, 'error');
}
}
return cmsTemplate::getInstance()->render('backend/options', array('options' => $options, 'form' => $form, 'errors' => isset($errors) ? $errors : false));
}