コード例 #1
0
ファイル: page.php プロジェクト: g-a-g/its2015
 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
0
 public static function getInstance($url = array())
 {
     if (!self::$instance) {
         self::$instance = new Navigation($url);
     }
     return self::$instance;
 }
コード例 #3
0
ファイル: samples.php プロジェクト: HIVE-Creative/spicers
 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
0
ファイル: account.php プロジェクト: HIVE-Creative/spicers
 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
0
ファイル: base.php プロジェクト: HIVE-Creative/spicers
 /**
  * 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
0
ファイル: Crud.php プロジェクト: ariol/adminshop
 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
0
ファイル: index.php プロジェクト: ariol/adminshop
<?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
0
ファイル: Menu.php プロジェクト: ariol/adminshop
 private function is_route_active($route_str)
 {
     return Navigation::instance()->crumbs()->has_route($route_str);
 }
コード例 #9
0
ファイル: global.php プロジェクト: ariol/adminshop
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
0
ファイル: Navigation.php プロジェクト: arhe/pwak
 /**
  * Constructor
  *
  * @access public
  * @return void
  */
 public static function singleton()
 {
     if (!self::$instance) {
         self::$instance = new Navigation();
     }
     return self::$instance;
 }