本文整理汇总了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