本文整理汇总了PHP中Navigation::instance方法的典型用法代码示例。如果您正苦于以下问题:PHP Navigation::instance方法的具体用法?PHP Navigation::instance怎么用?PHP Navigation::instance使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Navigation
的用法示例。
在下文中一共展示了Navigation::instance方法的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: before
public function before()
{
$this->navigation = Navigation::instance('sitemap');
// Ищем текущую страницу в карте сайта по текущему URL
$this->page = $this->navigation->pages()->findOneByUri(Request::current()->uri());
// Если найдена, то рендерим шаблон для нее
if ($this->page) {
$this->auto_render = TRUE;
// Указываем, нужна ли авторизация и для каких ролей доступен
// контроллер
$this->auth_required = $this->page->getRoles();
}
parent::before();
if (!$this->page and $this->request->is_ajax() === TRUE) {
return;
}
if ($this->page) {
if (!isset($this->page->title)) {
$this->page->title = $this->page->label;
}
if (!isset($this->page->meta_keywords)) {
$this->page->meta_keywords = $this->config['view']['keywords'];
}
if (!isset($this->page->meta_description)) {
$this->page->meta_description = $this->config['view']['description'];
}
}
if ($this->auto_render === TRUE) {
$this->template->content = View::factory($this->_get_uri());
}
}
示例2: getInstance
public static function getInstance($url = array())
{
if (!self::$instance) {
self::$instance = new Navigation($url);
}
return self::$instance;
}
示例3: __construct
public function __construct()
{
parent::__construct();
$this->breadcrumbs->add()->url('account')->title('Account');
$this->breadcrumbs->add()->url(url::area())->title('Samples & Dummies');
// add the account right menu
$this->template->right_navigation = Navigation::instance('account', NULL, Kohana::config('hf.database'))->get();
$this->template->right_navigation['title'] = 'Your Spicers';
$this->template->right_navigation['footer'] = 'Hi!';
}
示例4: __construct
public function __construct()
{
parent::__construct();
$this->breadcrumbs->add()->url(url::area())->title('Account');
// add the account right menu
$this->template->right_navigation = Navigation::instance('account', NULL, Kohana::config('hf.database'))->get();
$this->template->right_navigation['title'] = 'Your Spicers';
$this->template->right_navigation['footer'] = 'Hi!';
// check to see if we can find the config file.
if (!($this->config = Kohana::config('users'))) {
throw new Kohana_User_Exception('Account Error', 'Unable to find the configuration for the accounts.');
}
}
示例5: init
/**
* This function will set all the defaults for the base controllers
* default template, page title, etc and set up each of the classes that
* we might use later on, notification, breadcrumbs, navigation, security.
*
* @author Jamie Peake
*/
protected function init()
{
// initialise the default template data
$this->template->title = '';
$this->template->content = '';
$this->notification = Notification::instance();
$this->breadcrumbs = new Breadcrumbs();
$this->breadcrumbs->add()->url('home')->title('Home');
// add the home location.
$this->navigation = Navigation::instance('main');
$this->access = Access::instance();
$this->current = $this->access->get_user();
$this->i18n = Kohana::lang(url::area() . Router::$method);
$this->post = Session::instance()->get('post');
// this is a simple way to build the css classes we will be using, it will check to see
// if the method is index, and if the url requested didnt include an index then it will add it
// this is a feeble way to do this, and needs to be looked into as there are cases where it will break
// @todo test with edge cases, fix for edge cases.
$this->css_classes = Router::$rsegments;
if (Router::$method == 'index' && !in_array('index', Router::$rsegments)) {
$this->css_classes[] = 'index';
}
}
示例6: action_index
public function action_index()
{
foreach ($this->_group_actions as $action => $cfg) {
if (!ACL::is_action_allowed($this->request->directory(), $this->request->controller(), $action)) {
unset($this->_group_actions[$action]);
}
}
if (isset($_POST['group_actions'])) {
$action = NULL;
foreach (arr::get($_POST, 'action', array()) as $name => $value) {
$action = $name;
}
$handler = arr::path($this->_group_actions, $action . '.handler');
if ($action && $handler && method_exists($this, $handler)) {
if (arr::path($this->_group_actions, $action . '.one_item')) {
foreach ($_POST['ids'] as $id) {
$item = ORM::factory($this->_model, $id);
if ($item->loaded()) {
$this->{$handler}($item);
}
}
} else {
$ids = array();
foreach ($_POST['ids'] as $id) {
if ($id) {
$ids[] = $id;
}
}
if (count($ids)) {
$this->{$handler}($ids);
}
}
}
$this->back($this->get_index_route());
}
$this->set_view('crud/index');
Navigation::instance()->actions()->add($this->get_create_route(), 'Добавить');
$model = ORM::factory($this->_model);
$this->template->filter_form = $this->get_filter_form($model);
if ($this->template->filter_form) {
$this->template->filter_form->set_method('GET');
if (isset($_GET['filter_cancel'])) {
$this->redirect('/' . Extasy_Url::url_to_route($this->get_index_route()));
}
if (isset($_GET['filter'])) {
$this->template->filter_form->submit();
}
}
$this->template->unSortableFields = $model->getUnSortableSortableFields();
$grid = $this->before_fetch($model)->grid()->set_group_actions($this->_group_actions);
$this->template->grid = $this->prepare_grid($grid);
}
示例7: defined
<?php
defined('SYSPATH') or die('No direct script access.');
/**
* @version SVN: $Id:$
*/
echo Navigation::instance()->actions();
echo Ext::form_begin(NULL, array('method' => 'GET'));
echo $filter_form->render();
echo Ext::buttons_begin();
?>
<p>
<?php
echo Ext::submit('filter', 'Фильтр');
?>
<?php
echo Ext::submit('cancel_filter', 'Очистить', NULL, array('ResetButton' => true));
?>
</p>
<?php
echo Ext::buttons_end();
echo Ext::form_end();
echo $grid;
示例8: is_route_active
private function is_route_active($route_str)
{
return Navigation::instance()->crumbs()->has_route($route_str);
}
示例9:
style="width:100%"<?php
}
?>
class="col-lg-<?php
echo $gridCols;
?>
col-sm-11 ">
<?php
if (!preg_match('%print_page%', $_SERVER['REQUEST_URI'])) {
echo Navigation::instance()->crumbs();
}
?>
<div class="box">
<div class="box-header" data-original-title="">
<h2><i class="fa fa-table"></i><?php
echo Navigation::instance()->title();
?>
</h2>
</div>
<div class="box-content">
<?php
echo $content;
?>
</div>
</div>
</div>
</div>
</div>
<div class="clearfix"></div>
<footer>
<p>
示例10: singleton
/**
* Constructor
*
* @access public
* @return void
*/
public static function singleton()
{
if (!self::$instance) {
self::$instance = new Navigation();
}
return self::$instance;
}