当前位置: 首页>>代码示例>>PHP>>正文


PHP Alert::del方法代码示例

本文整理汇总了PHP中Alert::del方法的典型用法代码示例。如果您正苦于以下问题:PHP Alert::del方法的具体用法?PHP Alert::del怎么用?PHP Alert::del使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Alert的用法示例。


在下文中一共展示了Alert::del方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: action_general

 /**
  * All general configuration related with configuring site.
  * @return [view] Renders view with form inputs
  */
 public function action_general()
 {
     $this->template->styles = array('//cdn.jsdelivr.net/bootstrap.tagsinput/0.3.9/bootstrap-tagsinput.css' => 'screen', 'css/pnotify.custom.min.css' => 'screen');
     $this->template->scripts['footer'][] = '//cdn.jsdelivr.net/bootstrap.tagsinput/0.3.9/bootstrap-tagsinput.min.js';
     Breadcrumbs::add(Breadcrumb::factory()->set_title(__('General')));
     $this->template->title = __('General');
     // all form config values
     $generalconfig = new Model_Config();
     $config = $generalconfig->where('group_name', '=', 'general')->or_where('group_name', '=', 'i18n')->find_all();
     // config general array
     foreach ($config as $c) {
         $forms[$c->config_key] = $forms[$c->config_key] = array('key' => $c->group_name . '[' . $c->config_key . '][]', 'id' => $c->config_key, 'value' => $c->config_value);
     }
     //not updatable fields
     $do_nothing = array('base_url', 'menu', 'locale', 'allow_query_language', 'charset', 'translate', 'ocacu', 'minify', 'subscribe', 'blog', 'faq', 'forums', 'messaging', 'black_list', 'auto_locate', 'social_auth', 'adblock', 'subscriptions', 'cron', 'hide_homepage_categories');
     // save only changed values
     if ($this->request->post()) {
         foreach ($this->request->post('general') as $k => $v) {
             $this->request->post('general_' . $k, $v[0]);
         }
         $validation = Validation::factory($this->request->post())->rule('general_maintenance', 'range', array(':value', 0, 1))->rule('general_private_site', 'range', array(':value', 0, 1))->rule('general_disallowbots', 'range', array(':value', 0, 1))->rule('general_cookie_consent', 'range', array(':value', 0, 1))->rule('general_site_name', 'not_empty')->rule('general_moderation', 'not_empty')->rule('general_moderation', 'range', array(':value', 0, 5))->rule('general_blog', 'range', array(':value', 0, 1))->rule('general_forums', 'range', array(':value', 0, 1))->rule('general_faq', 'range', array(':value', 0, 1))->rule('general_black_list', 'range', array(':value', 0, 1))->rule('general_search_by_description', 'range', array(':value', 0, 1))->rule('general_recaptcha_active', 'range', array(':value', 0, 1));
         if ($validation->check()) {
             //save general
             foreach ($config as $c) {
                 $config_res = $this->request->post();
                 if (!in_array($c->config_key, $do_nothing) and ($config_res[$c->group_name][$c->config_key][0] != $c->config_value or Kohana::$_POST_ORIG['general']['html_head'][0] != $c->config_value or Kohana::$_POST_ORIG['general']['html_footer'][0] != $c->config_value)) {
                     if ($c->config_key == 'html_head' or $c->config_key == 'html_footer') {
                         $c->config_value = Kohana::$_POST_ORIG[$c->group_name][$c->config_key][0];
                     } else {
                         $c->config_value = $config_res[$c->group_name][$c->config_key][0];
                     }
                     if ($c->config_key == 'maintenance' and $c->config_value == 0) {
                         Alert::del('maintenance');
                     }
                     if ($c->config_key == 'private_site' and $c->config_value == 0) {
                         Alert::del('private_site');
                     }
                     Model_Config::set_value($c->group_name, $c->config_key, $c->config_value);
                 }
             }
         } else {
             $errors = $validation->errors('config');
             foreach ($errors as $error) {
                 Alert::set(Alert::ALERT, $error);
             }
             $this->redirect(Route::url('oc-panel', array('controller' => 'settings', 'action' => 'general')));
         }
         Alert::set(Alert::SUCCESS, __('General Configuration updated'));
         $this->redirect(Route::url('oc-panel', array('controller' => 'settings', 'action' => 'general')));
     }
     $this->template->content = View::factory('oc-panel/pages/settings/general', array('forms' => $forms));
 }
开发者ID:johnulist,项目名称:openclassifieds2,代码行数:56,代码来源:settings.php

示例2: action_general

 /**
  * All general configuration related with configuring site.
  * @return [view] Renders view with form inputs
  */
 public function action_general()
 {
     // validation active
     $this->template->scripts['footer'][] = 'js/jquery.validate.min.js';
     $this->template->scripts['footer'][] = 'js/oc-panel/settings.js';
     Breadcrumbs::add(Breadcrumb::factory()->set_title(__('General')));
     $this->template->title = __('General');
     // all form config values
     $generalconfig = new Model_Config();
     $config = $generalconfig->where('group_name', '=', 'general')->find_all();
     $config_img = $generalconfig->where('group_name', '=', 'image')->find_all();
     $config_i18n = $generalconfig->where('group_name', '=', 'i18n')->find_all();
     foreach ($config as $c) {
         $forms[$c->config_key] = array('key' => $c->config_key, 'value' => $c->config_value);
     }
     foreach ($config_img as $c) {
         $forms_img[$c->config_key] = array('key' => $c->config_key, 'value' => $c->config_value);
     }
     // config i18n configs
     foreach ($config_i18n as $c) {
         $i18n[$c->config_key] = array('key' => $c->config_key, 'value' => $c->config_value);
     }
     //not updatable fields
     $do_nothing = array('menu', 'locale', 'allow_query_language', 'charset', 'minify', 'api_key', 'cron');
     // save only changed values
     if ($this->request->post()) {
         $validation = Validation::factory($this->request->post())->rule('maintenance', 'range', array(':value', 0, 1))->rule('disallowbots', 'range', array(':value', 0, 1))->rule('cookie_consent', 'range', array(':value', 0, 1))->rule('site_name', 'not_empty')->rule('eu_vat', 'range', array(':value', 0, 1))->rule('products_per_page', 'not_empty')->rule('products_per_page', 'digit')->rule('feed_elements', 'not_empty')->rule('feed_elements', 'digit')->rule('max_image_size', 'not_empty')->rule('max_image_size', 'digit')->rule('height', 'digit')->rule('width', 'digit')->rule('height_thumb', 'digit')->rule('width_thumb', 'digit')->rule('quality', 'not_empty')->rule('quality', 'digit')->rule('quality', 'range', array(':value', 1, 100))->rule('watermark', 'range', array(':value', 0, 1))->rule('watermark_position', 'not_empty')->rule('watermark_position', 'digit')->rule('watermark_position', 'range', array(':value', 0, 2))->rule('blog', 'range', array(':value', 0, 1))->rule('faq', 'range', array(':value', 0, 1))->rule('forums', 'range', array(':value', 0, 1))->rule('sort_by', 'not_empty')->rule('aws_s3_active', 'range', array(':value', 0, 1));
         if ($validation->check()) {
             //save general
             foreach ($config as $c) {
                 $config_res = $this->request->post($c->config_key);
                 if ($config_res != $c->config_value and !in_array($c->config_key, $do_nothing)) {
                     if ($c->config_key == 'html_head' or $c->config_key == 'html_footer') {
                         $c->config_value = Kohana::$_POST_ORIG[$c->config_key];
                     } else {
                         $c->config_value = $config_res;
                     }
                     if ($c->config_key == 'maintenance' and $c->config_value == 0) {
                         Alert::del('maintenance');
                     }
                     try {
                         $c->save();
                     } catch (Exception $e) {
                         echo $e;
                     }
                 }
             }
             //save image config
             foreach ($config_img as $ci) {
                 $allowed_formats = '';
                 $config_res = $this->request->post($ci->config_key);
                 if ($config_res != $ci->config_value) {
                     if ($ci->config_key == 'allowed_formats') {
                         foreach ($config_res as $key => $value) {
                             $allowed_formats .= $value . ",";
                         }
                         $config_res = $allowed_formats;
                     }
                     if ($ci->config_key == 'aws_s3_domain') {
                         switch ($config_res) {
                             case 'bn-s3':
                                 $s3_domain = $this->request->post('aws_s3_bucket') . '.s3.amazonaws.com';
                                 break;
                             case 'bn':
                                 $s3_domain = $this->request->post('aws_s3_bucket');
                                 break;
                             default:
                                 $s3_domain = 's3.amazonaws.com/' . $this->request->post('aws_s3_bucket');
                                 break;
                         }
                         $config_res = $s3_domain . '/';
                     }
                     $ci->config_value = $config_res;
                     try {
                         $ci->save();
                     } catch (Exception $e) {
                         echo $e;
                     }
                 }
             }
             //save i18n
             foreach ($config_i18n as $cn) {
                 $config_res = $this->request->post($cn->config_key);
                 if ($config_res != $cn->config_value and !in_array($cn->config_key, $do_nothing)) {
                     $cn->config_value = $config_res;
                     try {
                         $cn->save();
                     } catch (Exception $e) {
                         echo $e;
                     }
                 }
             }
         } else {
             $errors = $validation->errors('config');
             foreach ($errors as $error) {
                 Alert::set(Alert::ALERT, $error);
//.........这里部分代码省略.........
开发者ID:Ryanker,项目名称:open-eshop,代码行数:101,代码来源:settings.php


注:本文中的Alert::del方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。