本文整理汇总了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));
}