當前位置: 首頁>>代碼示例>>PHP>>正文


PHP cmsController::saveOptions方法代碼示例

本文整理匯總了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));
 }
開發者ID:roman-burachenko,項目名稱:icms2,代碼行數:25,代碼來源:backend.php

示例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));
 }
開發者ID:pin-git,項目名稱:icms2,代碼行數:30,代碼來源:options.php

示例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);
     }
 }
開發者ID:Val-Git,項目名稱:icms2,代碼行數:33,代碼來源:backend.php

示例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();
 }
開發者ID:Val-Git,項目名稱:icms2,代碼行數:15,代碼來源:index_save_order.php

示例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));
 }
開發者ID:asphix,項目名稱:icms2,代碼行數:23,代碼來源:options.php


注:本文中的cmsController::saveOptions方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。