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


PHP Settings::factory方法代码示例

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


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

示例1: action_index

 public function action_index()
 {
     // get acl
     $acl = Acl::instance();
     // get modules
     $modules = Settings::factory('modules')->as_array();
     // get navigation
     $settings = Settings::factory('navigation', array('settings' . DIRECTORY_SEPARATOR . Website::instance()->id() . DIRECTORY_SEPARATOR, 'settings'));
     $navigation = $settings->get('menu');
     // filter out allowed modules
     $allowedModules = array();
     foreach ($modules as $module => $data) {
         if ($acl->allowed($module, 'access')) {
             $allowedModules[$module] = $data;
         }
     }
     // fill up sections
     $sections = array();
     foreach ($navigation as $section => $modules) {
         foreach ($modules as $module) {
             if (isset($allowedModules[$module])) {
                 // section has a allowed module, so include it
                 if (!isset($sections[$section])) {
                     $sections[$section] = array();
                 }
                 // add module to section
                 $sections[$section][$module] = $allowedModules[$module];
             }
         }
     }
     $view = View::factory('start', array('sections' => $sections));
     $this->response->body($view->render());
 }
开发者ID:yubinchen18,项目名称:A-basic-website-project-for-a-company-using-the-MVC-pattern-in-Kohana-framework,代码行数:33,代码来源:Start.php

示例2: action_index

 /**
  * Default action in default controller
  */
 public function action_index()
 {
     // get acl
     $acl = Acl::instance();
     // get first allowed module
     // get modules
     $modules = Settings::factory('modules')->as_array();
     $modules = array_keys($modules);
     $module = State::instance()->get('active.module');
     if ($module !== FALSE && $module !== 'Default') {
         if ($acl->allowed($module, 'access', FALSE, $this->_website) === TRUE) {
             $url = URL::to($module, array('website' => $this->_website));
             $this->redirect($url);
             exit;
         }
     }
     // find the first allowed module & redirect
     foreach ($modules as $module) {
         if ($acl->allowed($module, 'access', FALSE, $this->_website) === TRUE) {
             $url = URL::to($module, array('website' => $this->_website));
             $this->redirect($url);
             exit;
         }
     }
 }
开发者ID:yubinchen18,项目名称:A-basic-website-project-for-a-company-using-the-MVC-pattern-in-Kohana-framework,代码行数:28,代码来源:Default.php

示例3: __construct

 function __construct($table, $property = null, $value = null)
 {
     $this->settings = Settings::factory();
     $this->table = $this->settings->tbl_prefix . $table;
     $this->dbh = @mysql_connect($this->settings->db_host, $this->settings->db_user, $this->settings->db_pass);
     if ($this->dbh === FALSE) {
         throw new exception("construct:データベースに接続できない");
     }
     $sqlstr = "use " . $this->settings->db_name;
     $res = $this->__query($sqlstr);
     if ($res === false) {
         throw new exception("construct: " . $sqlstr);
     }
     $sqlstr = "set NAMES utf8";
     $res = $this->__query($sqlstr);
     if ($property == null || $value == null) {
         // レコードを特定する要素が指定されない場合はid=0として空のオブジェクトを作成する
         $this->id = 0;
     } else {
         $sqlstr = "SELECT * FROM " . $this->table . " WHERE " . mysql_real_escape_string($property) . "='" . mysql_real_escape_string($value) . "'";
         $res = $this->__query($sqlstr);
         $arr = mysql_fetch_array($res, MYSQL_ASSOC);
         if ($arr === FALSE) {
             throw new exception("construct:無効な行");
         }
         // 最初にヒットした行のidを使用する
         $this->id = $arr['id'];
     }
     return;
 }
开发者ID:sushi-k,项目名称:epgrec,代码行数:30,代码来源:DBRecord.class.php

示例4: saveSettings

 public function saveSettings()
 {
     require_once INSTALL_PATH . "/Settings.class.php";
     $settings = Settings::factory();
     $settings->post();
     $settings->save();
     $smarty = new Smarty();
     $smarty->template_dir = dirname(dirname(__FILE__)) . '/templates/';
     $smarty->compile_dir = dirname(dirname(__FILE__)) . '/templates_c/';
     $smarty->assign('message', '設定が保存されました');
     $smarty->assign('url', 'index.php');
     $smarty->display("dialog.html");
 }
开发者ID:ha1t,项目名称:epgrec,代码行数:13,代码来源:api.php

示例5: action_module

 /**
  * Get module navigation
  */
 public function action_module()
 {
     // get request
     $request = Request::initial();
     // get settings
     $settings = Settings::factory($request->controller());
     // navigation viewer
     $navigation = Viewer::instance('Navigation')->settings($settings->get('navigation'))->request(Request::initial())->acl(Acl::instance());
     // create view
     $view = View::factory($settings->get('view.navigation'), array('navigation' => $navigation));
     // raise event
     Event::raise($this, Event::BEFORE_NAVIGATION_RENDER, array('navigation' => $navigation));
     // render view
     $this->response->body($view->render());
 }
开发者ID:yubinchen18,项目名称:A-basic-website-project-for-a-company-using-the-MVC-pattern-in-Kohana-framework,代码行数:18,代码来源:Navigation.php

示例6: init

 /**
  * INIT
  */
 public function init()
 {
     // call parent before
     parent::init();
     //create settings
     //read from website specific settings before general settings
     $this->_settings = Settings::factory($this->_controller, array('settings' . DIRECTORY_SEPARATOR . $this->_website . DIRECTORY_SEPARATOR, 'settings'));
     // set up listeners
     $this->listeners();
     // set up navigation
     if (Request::current()->is_initial() === TRUE) {
         $navigation = Viewer::instance('Navigation');
         $navigation->breadcrumb(Text::instance()->get('section.start'), URL::to('Start'));
         $navigation->breadcrumb(Text::instance()->get('module.name'), URL::to($this->_controller));
         $navigation->title(Text::instance()->get('title.' . $this->_action));
     }
 }
开发者ID:yubinchen18,项目名称:A-basic-website-project-for-a-company-using-the-MVC-pattern-in-Kohana-framework,代码行数:20,代码来源:Module.php

示例7: init

 /**
  * init
  */
 public function init()
 {
     // raise event
     Event::raise($this, Event::BEFORE_INIT);
     // get website and feed it the current uri so we can figure out the ->id()
     $website = Website::instance()->uri(Request::initial()->uri());
     // set controller vars
     $this->_website = $website->id();
     $this->_directory = Request::current()->directory();
     $this->_controller = Request::current()->controller();
     $this->_action = Request::current()->action();
     $this->_language = isset(Identity::instance()->user) ? Identity::instance()->user->language : 'nl';
     // manually set website in Website
     // this will be used by alias
     Website::instance()->id($this->_website);
     // set state session
     // get state instance for this website / controller
     State::session(Session::instance('database'));
     $this->_state = State::instance($this->_website . '.' . $this->_controller);
     // set route in URL helper
     URL::route('backend');
     // Let Filereader cache results
     Reader::cache(Cache::instance('reader_backend'), 'backend');
     // set default language
     Text::language($this->_language);
     // get that language's text instance and configure it
     Text::instance($this->_language)->load(array_keys(Settings::factory('modules')->as_array()))->group($this->_controller)->substitutes('module');
     // set URL presets
     $base = URL::base();
     URL::set('base', $base);
     URL::set('library', $base . 'library/');
     URL::set('vendor', $base . 'vendor/');
     URL::set('files', $base . 'files/');
     // set website in view
     View::set_global('_website', $this->_website);
     // set language in view
     View::set_global('_language', $this->_language);
 }
开发者ID:yubinchen18,项目名称:A-basic-website-project-for-a-company-using-the-MVC-pattern-in-Kohana-framework,代码行数:41,代码来源:Base.php

示例8: DBRecord

#!/usr/bin/php
<?php 
// 録画が完了したことを知らせるフラグ
// @TODO gen-thumbnailを実行する
require_once "config.php";
require_once INSTALL_PATH . "/DBRecord.class.php";
$settings = Settings::factory();
$reserve_id = $argv[1];
try {
    $rrec = new DBRecord(RESERVE_TBL, "id", $reserve_id);
    if (file_exists(INSTALL_PATH . $settings->spool . "/" . $rrec->path)) {
        // 予約完了
        $rrec->complete = '1';
    } else {
        // 予約失敗
        $rrec->delete();
    }
} catch (Exception $e) {
    exit($e->getMessage());
}
开发者ID:ha1t,项目名称:epgrec,代码行数:20,代码来源:recomplete.php

示例9: cancel

 public static function cancel($reserve_id = 0, $program_id = 0)
 {
     $settings = Settings::factory();
     $rec = null;
     try {
         if ($reserve_id) {
             $rec = new DBRecord(RESERVE_TBL, "id", $reserve_id);
         } else {
             if ($program_id) {
                 $rec = new DBRecord(RESERVE_TBL, "program_id", $program_id);
             }
         }
         if ($rec == null) {
             throw new Exception("IDの指定が無効です");
         }
         if (!$rec->complete) {
             // 未実行の予約である
             if (strtotime($rec->starttime) < time() + PADDING_TIME + $settings->former_time) {
                 throw new Exception("過去の録画予約です");
             }
             exec($settings->atrm . " " . $rec->job);
         }
         $rec->delete();
     } catch (Exception $e) {
         throw $e;
     }
 }
开发者ID:ha1t,项目名称:epgrec,代码行数:27,代码来源:Reservation.class.php


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