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


PHP Model_Config类代码示例

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


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

示例1: getSemester

 public static function getSemester($nim)
 {
     $config = new Model_Config();
     $mahasiswa = new Model_Mahasiswa($nim);
     $tahun = $config->where('name', '=', 'tahun')->find()->value;
     $semester = $config->where('name', '=', 'semester')->find()->value;
     return ($tahun - $mahasiswa->tahun_masuk) * 2 + $semester;
 }
开发者ID:trie0856,项目名称:sidemik,代码行数:8,代码来源:sidemik.php

示例2: action_index

 public function action_index()
 {
     // validation active
     Breadcrumbs::add(Breadcrumb::factory()->set_title(__('List')));
     $this->template->title = __('Translations');
     //scan project files and generate .po
     $parse = $this->request->query('parse');
     if ($parse) {
         //scan script
         require_once Kohana::find_file('vendor', 'POTCreator/POTCreator', 'php');
         $obj = new POTCreator();
         $obj->set_root(DOCROOT);
         $obj->set_exts('php');
         $obj->set_regular('/_[_|e]\\([\\"|\']([^\\"|\']+)[\\"|\']\\)/i');
         $obj->set_base_path('..');
         $obj->set_read_subdir(true);
         $obj->write_pot(i18n::get_language_path());
         Alert::set(Alert::SUCCESS, 'File regenerated');
     }
     //change default site language
     if ($this->request->param('id')) {
         //save language
         $locale = new Model_Config();
         $locale->where('group_name', '=', 'i18n')->where('config_key', '=', 'locale')->limit(1)->find();
         if (!$locale->loaded()) {
             $locale->group_name = 'i18n';
             $locale->config_key = 'locale';
         }
         $locale->config_value = $this->request->param('id');
         try {
             $locale->save();
             Alert::set(Alert::SUCCESS, __('Translations regenarated'));
         } catch (Exception $e) {
             throw HTTP_Exception::factory(500, $e->getMessage());
         }
         HTTP::redirect(Route::url('oc-panel', array('controller' => 'translations')));
     }
     //create language
     if (Core::post('locale')) {
         $language = $this->request->post('locale');
         $folder = DOCROOT . 'languages/' . $language . '/LC_MESSAGES/';
         // if folder does not exist, try to make it
         if (!file_exists($folder) and !@mkdir($folder, 0775, true)) {
             // mkdir not successful ?
             Alert::set(Alert::ERROR, __('Language folder cannot be created with mkdir. Please correct to be able to create new translation.'));
             HTTP::redirect(Route::url('oc-panel', array('controller' => 'translations')));
         }
         // write an empty .po file for $language
         $out = 'msgid ""' . PHP_EOL;
         $out .= 'msgstr ""' . PHP_EOL;
         File::write($folder . 'messages.po', $out);
         Alert::set(Alert::SUCCESS, $this->request->param('id') . ' ' . __('Language saved'));
     }
     $this->template->content = View::factory('oc-panel/pages/translations/index', array('languages' => i18n::get_languages(), 'current_language' => core::config('i18n.locale')));
 }
开发者ID:demoic,项目名称:common,代码行数:55,代码来源:translations.php

示例3: salaryAction

 public function salaryAction()
 {
     $salaryConfig = new Model_Config();
     $salaryData = $salaryConfig->findConfig();
     $this->view->salaryData = $salaryData;
     if ($this->_request->isPost()) {
         $data = $this->_getParam('searchParam');
         $salaryConfig->updateSalary($data);
         echo "<script>alert('Cập nhật dữ liệu thành công');</script>";
         header('Refresh:0');
     }
 }
开发者ID:phamviet1510,项目名称:giaovu,代码行数:12,代码来源:ConfigController.php

示例4: updateAction

 public function updateAction()
 {
     $degree = new Model_Config();
     $listDegree = $degree->listDegree();
     $this->view->listDegree = $listDegree;
     if ($this->_request->isPost()) {
         $data = $this->_getParam('Params');
         foreach ($data as $degree_id => $coefficient) {
             $degree->updateDegree($degree_id, $coefficient);
         }
         $this->redirect('giaovu/degree/update');
     }
 }
开发者ID:phamviet1510,项目名称:giaovu,代码行数:13,代码来源:DegreeController.php

示例5: action_index

 public function action_index()
 {
     if (!\DBUtil::table_exists('blog') && !\DBUtil::table_exists('blog_comment')) {
         \Response::redirect('blog/installrequired');
     }
     // list posts -----------------------------------------------------------------------------------------------------
     $option['limit'] = \Model_Config::getval('content_items_perpage');
     $option['offset'] = trim(\Input::get('page')) != null ? ((int) \Input::get('page') - 1) * $option['limit'] : 0;
     $list_items = \Blog\Model_Blog::listItems($option);
     // pagination config
     $config['pagination_url'] = \Uri::main() . \Uri::getCurrentQuerystrings(true, true, false);
     $config['total_items'] = $list_items['total'];
     $config['per_page'] = $option['limit'];
     $config['uri_segment'] = 'page';
     $config['num_links'] = 3;
     $config['show_first'] = true;
     $config['show_last'] = true;
     $config['first-inactive'] = "\n\t\t<li class=\"disabled\">{link}</li>";
     $config['first-inactive-link'] = '<a href="#">{page}</a>';
     $config['first-marker'] = '&laquo;';
     $config['last-inactive'] = "\n\t\t<li class=\"disabled\">{link}</li>";
     $config['last-inactive-link'] = '<a href="#">{page}</a>';
     $config['last-marker'] = '&raquo;';
     $config['previous-marker'] = '&lsaquo;';
     $config['next-marker'] = '&rsaquo;';
     $pagination = \Pagination::forge('viewlogins_pagination', $config);
     $output['list_items'] = $list_items;
     $output['pagination'] = $pagination;
     unset($config, $list_accounts, $option, $pagination);
     // <head> output ----------------------------------------------------------------------------------------------
     $output['page_title'] = $this->generateTitle(\Lang::get('blog'));
     // <head> output ----------------------------------------------------------------------------------------------
     return $this->generatePage('blog_v', $output, false);
 }
开发者ID:rundiz,项目名称:fuel-start,代码行数:34,代码来源:blog.php

示例6: listAction

 public function listAction()
 {
     $hocky = new Model_Config();
     $listHocky = $hocky->listHocky();
     $this->view->listHocky = $listHocky;
     if ($this->_request->isPost()) {
         $findHocky = $hocky->findOneHocky();
         $name = $findHocky->schoolyears_name;
         $array1 = explode(' - ', $name);
         $array2 = array($array1[0] + 1, $array1[1] + 1);
         $schoolyears_name = implode(' - ', $array2);
         $hocky->addHocky($schoolyears_name);
         $this->redirect('giaovu/namhoc/list');
         var_dump($schoolyears_name);
     }
 }
开发者ID:phamviet1510,项目名称:giaovu,代码行数:16,代码来源:NamhocController.php

示例7: action_status

 public function action_status()
 {
     $status = (bool) $this->request->param('id');
     Model_Config::set_value('general', 'cron', $status);
     Alert::set(Alert::SUCCESS, __('General Configuration updated'));
     $this->redirect(Route::url('oc-panel', array('controller' => 'crontab')));
 }
开发者ID:JeffPedro,项目名称:project-garage-sale,代码行数:7,代码来源:crontab.php

示例8: action_index

 public function action_index()
 {
     Breadcrumbs::add(Breadcrumb::factory()->set_title(__('Social Authentication for login')));
     $this->template->title = __('Social Auth');
     $this->template->styles = array('css/sortable.css' => 'screen');
     $this->template->scripts['footer'][] = 'js/jquery-sortable-min.js';
     //retrieve social_auth values
     $config = Social::get();
     if ($p = $this->request->post()) {
         $confit_old = $config;
         $config_new = array();
         foreach ($p as $key => $value) {
             if ($key != 'submit') {
                 // check if its id, secret .. and build multy d. array, same as they have
                 if (strpos($key, '_id')) {
                     $config_new['providers'][str_replace('_id', '', $key)]['keys']['id'] = $value;
                 } elseif (strpos($key, '_secret')) {
                     $config_new['providers'][str_replace('_secret', '', $key)]['keys']['secret'] = $value;
                 } elseif (strpos($key, '_key')) {
                     $config_new['providers'][str_replace('_key', '', $key)]['keys']['key'] = $value;
                 } elseif ($key == 'debug_mode') {
                     $config_new[$key] = $value;
                 } else {
                     $config_new['providers'][$key]['enabled'] = $value;
                 }
             }
         }
         // two fields not included
         $config_new['base_url'] = Route::url('default', array('controller' => 'social', 'action' => 'login', 'id' => 1));
         $config_new['debug_file'] = DOCROOT . 'oc/vendor/hybridauth/logs.txt';
         $obj_social_config = new Model_Config();
         $conf = $obj_social_config->where('group_name', '=', 'social')->where('config_key', '=', 'config')->limit(1)->find();
         if ($conf->loaded()) {
             $conf->config_value = json_encode($config_new);
             try {
                 $conf->save();
                 $config = $config_new;
                 //we update the form values if we changed them
                 Alert::set(Alert::SUCCESS, __('Social Auth updated'));
             } catch (Exception $e) {
                 throw HTTP_Exception::factory(500, $e->getMessage());
             }
         }
     }
     $this->template->content = View::factory('oc-panel/pages/social_auth/index', array('config' => $config));
 }
开发者ID:JeffPedro,项目名称:project-garage-sale,代码行数:46,代码来源:social.php

示例9: save

 public static function save($items)
 {
     // save widget to DB
     $conf = new Model_Config();
     $conf->where('group_name', '=', 'general')->where('config_key', '=', 'menu')->limit(1)->find();
     if (!$conf->loaded()) {
         $conf->group_name = 'general';
         $conf->config_key = 'menu';
     }
     $conf->config_value = json_encode($items);
     try {
         $conf->save();
         return TRUE;
     } catch (Exception $e) {
         throw HTTP_Exception::factory(500, $e->getMessage());
     }
     return FALSE;
 }
开发者ID:JeffPedro,项目名称:project-garage-sale,代码行数:18,代码来源:menu.php

示例10: Set

 /**
  * A shortcut for creating or updating a config value.
  * @param string $name The config name.
  * @param string $value The config value.
  * @return Dbi_Record The resulting record.
  */
 public static function Set($name, $value)
 {
     $config = Model_Config::Get($name);
     if (!$config->exists()) {
         $config = Model_Config::Create();
         $config['configname'] = $name;
     }
     $config['configvalue'] = $value;
     $config->save();
     return $config;
 }
开发者ID:ssrsfs,项目名称:blg,代码行数:17,代码来源:Config.php

示例11: check_maintenance

 public function check_maintenance()
 {
     $config = Model_Config::find('first');
     View::set_global('config', $config);
     if ($this->action === 'maintenance' && (int) $config->maintenance !== 1) {
         Response::redirect('/');
     }
     if (!in_array($this->action, ['maintenance']) && (int) $config->maintenance === 1) {
         Response::redirect('/maintenance');
     }
 }
开发者ID:khoapld,项目名称:wjshop,代码行数:11,代码来源:core.php

示例12: before

 /**
  * Automatically executed before the widget action. Can be used to set
  * class properties, do authorization checks, and execute other custom code.
  *
  * @return  void
  */
 public function before()
 {
     //we need this option enabled for this plugin to work
     if (Core::config('i18n.allow_query_language') == 0) {
         Model_Config::set_value('i18n', 'allow_query_language', 1);
     }
     if ($this->languages == '') {
         $this->languages = i18n::get_languages();
     } else {
         $this->languages = array_map('trim', explode(',', $this->languages));
     }
 }
开发者ID:kotsios5,项目名称:openclassifieds2,代码行数:18,代码来源:languages.php

示例13: action_index

 public function action_index()
 {
     // validation active
     Breadcrumbs::add(Breadcrumb::factory()->set_title(__('List')));
     $this->template->title = __('Translations');
     //scan project files and generate .po
     $parse = $this->request->query('parse');
     if ($parse) {
         //scan script
         require_once Kohana::find_file('vendor', 'POTCreator/POTCreator', 'php');
         $obj = new POTCreator();
         $obj->set_root(DOCROOT);
         $obj->set_exts('php');
         $obj->set_regular('/_[_|e]\\([\\"|\']([^\\"|\']+)[\\"|\']\\)/i');
         $obj->set_base_path('..');
         $obj->set_read_subdir(true);
         $obj->write_pot(i18n::get_language_path());
         Alert::set(Alert::SUCCESS, 'File regenerated');
     }
     //change default site language
     if ($this->request->param('id')) {
         //save language
         $locale = new Model_Config();
         $locale->where('group_name', '=', 'i18n')->where('config_key', '=', 'locale')->limit(1)->find();
         if (!$locale->loaded()) {
             $locale->group_name = 'i18n';
             $locale->config_key = 'locale';
         }
         $locale->config_value = $this->request->param('id');
         try {
             $locale->save();
             Alert::set(Alert::SUCCESS, '');
             Request::current()->redirect(Route::url('oc-panel', array('controller' => 'translations')));
         } catch (Exception $e) {
             echo $e;
         }
     }
     $this->template->content = View::factory('oc-panel/pages/translations/index', array('languages' => i18n::get_languages(), 'current_language' => core::config('i18n.locale')));
 }
开发者ID:Wildboard,项目名称:WbWebApp,代码行数:39,代码来源:translations.php

示例14: update

 public static function update($data)
 {
     try {
         $data['updated_at'] = date('Y-m-d H:i:s', Date::forge()->get_timestamp());
         $query = Model_Config::find(1);
         $query->set($data);
         $query->save();
     } catch (Exception $e) {
         Log::write('ERROR', $e->getMessage());
         return false;
     }
     return true;
 }
开发者ID:khoapld,项目名称:wjshop,代码行数:13,代码来源:config.php

示例15: getConfig

 /**
  * get config
  * get email config values from db and set it to ready for FuelPHP email configuration array.
  *
  * @author Vee Winch.
  * @return array all email configuration in db.
  */
 public static function getConfig()
 {
     $cfg_email = \Model_Config::getvalues(array('mail_protocol', 'mail_mailpath', 'mail_smtp_host', 'mail_smtp_user', 'mail_smtp_pass', 'mail_smtp_port'));
     $config['driver'] = $cfg_email['mail_protocol']['value'];
     $config['sendmail_path'] = $cfg_email['mail_mailpath']['value'];
     $config['smtp']['host'] = $cfg_email['mail_smtp_host']['value'];
     $config['smtp']['port'] = (int) $cfg_email['mail_smtp_port']['value'];
     $config['smtp']['username'] = $cfg_email['mail_smtp_user']['value'];
     $config['smtp']['password'] = $cfg_email['mail_smtp_pass']['value'];
     $config['smtp']['timeout'] = 20;
     $config['newline'] = "\r\n";
     unset($cfg_email);
     return $config;
 }
开发者ID:rundiz,项目名称:fuel-start,代码行数:21,代码来源:email.php


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