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


PHP Viewer::instance方法代碼示例

本文整理匯總了PHP中Viewer::instance方法的典型用法代碼示例。如果您正苦於以下問題:PHP Viewer::instance方法的具體用法?PHP Viewer::instance怎麽用?PHP Viewer::instance使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在Viewer的用法示例。


在下文中一共展示了Viewer::instance方法的3個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。

示例1: 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

示例2: 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

示例3: action_update

 /**
  * update
  */
 public function action_update()
 {
     // get id
     $id = $this->param('id');
     // create new model
     $model = ORM::factory($this->_settings->get('model'), $id);
     // add item to navigation
     Viewer::instance('Navigation')->item($model);
     // create form
     $form = Form::factory($this->_settings->get('form'));
     // add request to form
     $form->request($this->request);
     // add text to form
     $form->text(Text::instance());
     // add alias settings to form
     $form->alias($this->_settings->get('alias.global') ? 'multiple' : ($this->_settings->get('alias.module') ? 'single' : FALSE));
     // add model to form
     $form->model($model);
     // get viewport
     $viewport = $this->request->param('viewport');
     // add urls
     if ($viewport === 'item') {
         // urls when directly updating in a dialog
         $form->urls(array('submit' => URL::to($this->request->controller() . '@update:' . $id, array('query' => 'after=update')), 'submit_back' => URL::to($this->request->controller() . '@update:' . $id, array('query' => 'after=close')), 'back' => URL::to($this->request->controller() . '@close'), 'preview' => URL::to($this->request->controller() . '@preview:' . $id)));
     } else {
         // default urls
         $url_back = State::instance()->get('url.back', FALSE);
         State::instance()->set('url.back', FALSE);
         $form->urls(array('submit' => URL::to($this->request->controller() . '@update:' . $id, array('query' => 'after=update')), 'submit_back' => URL::to($this->request->controller() . '@update:' . $id), 'back' => $url_back ? $url_back : URL::to($this->request->controller()), 'preview' => URL::to($this->request->controller() . '@preview:' . $id)));
     }
     // raise event
     Event::raise($this, Event::AFTER_UPDATE_FORM, array('form' => $form, 'model' => $model));
     // do the action
     if ($this->update($model, $form)) {
         // get after
         if ($this->request->query('after') === 'update') {
             $params = array('controller' => $this->request->controller(), 'action' => 'update', 'id' => $id);
         } elseif ($this->request->query('after') === 'close') {
             $params = array('controller' => $this->request->controller(), 'action' => 'close', 'id' => $id);
         } else {
             $params = array();
         }
         //redirect
         $this->redirect_done('updated', $params);
     }
 }
開發者ID:yubinchen18,項目名稱:A-basic-website-project-for-a-company-using-the-MVC-pattern-in-Kohana-framework,代碼行數:49,代碼來源:Item.php


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