• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

PHP Model_Config类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



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


示例16: action_index

 /**
  * default method for this controller.
  * you may replace code in this method with yours to start build your project.
  */
 public function action_index()
 {
     // load language
     \Lang::load('fslang');
     // <head> output ----------------------------------------------------------------------------------------------
     $output['page_title'] = \Model_Config::getval('site_name');
     // example for asset and theme asset
     //\Asset::css('bootstrap.min.css', array(), 'fuelstart');
     //\Theme::instance()->asset->css('main.css', array(), 'fuelstart');
     //$output['page_meta'][] = \Html::meta('description', 'test-fuel-start-description');
     //$output['page_link'][] = html_tag('link', array('rel' => 'stylesheet', 'href' => Uri::createNL(\Theme::instance()->asset_path('css/main.css'))));
     // end example
     // <head> output ----------------------------------------------------------------------------------------------
     $theme = \Theme::instance();
     return $theme->view('front/templates/index_v', $output, false);
 }
开发者ID:rundiz,项目名称:fuel-start,代码行数:20,代码来源:index.php


示例17: 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
     if (core::get('parse') !== NULL) {
         //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 (($locale = $this->request->param('id')) != NULL and array_key_exists($locale, i18n::get_languages())) {
         //save language
         Model_Config::set_value('i18n', 'locale', $locale);
         //change the cookie if not he will not see the changes
         if (Core::config('i18n.allow_query_language') == 1) {
             Cookie::set('user_language', $locale, Core::config('auth.lifetime'));
         }
         Alert::set(Alert::SUCCESS, __('Language') . ' ' . $locale);
         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:ThomWensink,项目名称:common,代码行数:47,代码来源:translations.php


示例18: gmtDate

 /**
  * gmt date. the timezone up to current user data.
  *
  * @param string $date_format date format can use both date() function or strftime() function
  * @param integer $timestamp localtime timestamp.
  * @param type $timezone php timezone (http://www.php.net/manual/en/timezones.php)
  * @return null
  */
 public static function gmtDate($date_format = '%Y-%m-%d %H:%M:%S', $timestamp = '', $timezone = '')
 {
     // check empty date format
     if (empty($date_format)) {
         $date_format = '%Y-%m-%d %H:%M:%S';
     }
     // check timestamp
     if (empty($timestamp)) {
         $timestamp = time();
     } else {
         if (!self::isValidTimeStamp($timestamp)) {
             $timestamp = strtotime($timestamp);
         }
     }
     // make very sure that selected timezone is in the timezone list or converted to real timezone.
     if ($timezone != null) {
         $timezone = static::isValidTimezone($timezone);
     }
     // check timezone
     if ($timezone == null) {
         $account_model = new \Model_Accounts();
         $cookie = $account_model->getAccountCookie();
         $site_timezone = static::getRealTimezoneValue(\Model_Config::getval('site_timezone'));
         if (!isset($cookie['account_id'])) {
             // not member or not log in. use default config timezone.
             $timezone = $site_timezone;
         } else {
             // find timezone for current user.
             $row = \Model_Accounts::find($cookie['account_id']);
             if (!empty($row)) {
                 $timezone = static::getRealTimezoneValue($row->account_timezone);
             } else {
                 $timezone = $site_timezone;
             }
         }
         unset($account_model, $cookie, $row, $site_timezone);
     }
     // what format of the date_format (use date() value or strftime() value)
     if (strpos($date_format, '%') !== false) {
         // use strftime() format
         return \Date::forge($timestamp)->set_timezone($timezone)->format($date_format);
     } else {
         // use date() format
         return date($date_format, strtotime(\Date::forge($timestamp)->set_timezone($timezone)->format('%Y-%m-%d %H:%M:%S')));
     }
 }
开发者ID:rundiz,项目名称:fuel-start,代码行数:54,代码来源:date.php


示例19: listItems

 /**
  * list items
  * 
  * @param array $option
  * @return mixed
  */
 public static function listItems($option = array())
 {
     $query = self::query();
     $output['total'] = $query->count();
     // offset and limit
     if (!isset($option['offset'])) {
         $option['offset'] = 0;
     }
     if (!isset($option['limit'])) {
         if (isset($option['list_for']) && $option['list_for'] == 'admin') {
             $option['limit'] = \Model_Config::getval('content_admin_items_perpage');
         } else {
             $option['limit'] = \Model_Config::getval('content_items_perpage');
         }
     }
     // get the results from sort, order, offset, limit.
     $output['items'] = $query->order_by('post_id', 'DESC')->offset($option['offset'])->limit($option['limit'])->get();
     unset($orders, $query, $sort);
     return $output;
 }
开发者ID:rundiz,项目名称:fuel-start,代码行数:26,代码来源:blog.php


示例20: readTemplate

 /**
  * read template
  *
  * @author Vee Winch.
  * @param string $email_file email file.
  * @param string $template_path path to folder that store email file.
  * @return mixed
  */
 public static function readTemplate($email_file = '', $template_path = null)
 {
     if ($email_file == null) {
         return null;
     }
     if ($template_path == null) {
         $template_path = APPPATH . 'lang' . DS . \Lang::get_lang() . DS . 'email' . DS;
     }
     if (file_exists($template_path . $email_file)) {
         $site_name = \Model_Config::getval('site_name');
         $output = file_get_contents($template_path . $email_file);
         $output = str_replace("%site_name%", $site_name, $output);
         $output = str_replace("%site_url%", \Uri::base(), $output);
         $output = str_replace("%site_admin%", \Uri::create('admin'), $output);
         unset($site_name, $template_path);
         return $output;
     } else {
         return false;
     }
 }
开发者ID:rundiz,项目名称:fuel-start,代码行数:28,代码来源:emailtemplate.php



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
PHP Model_Content类代码示例发布时间:2022-05-23
下一篇:
PHP Model_Category类代码示例发布时间:2022-05-23
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap