예제 #1
0
 protected function createComponentGrid()
 {
     $grid = new \App\Grid\Grid();
     $grid->setModel($this->model->getAll());
     $grid->addColumn(new \App\Grid\Column\Column('name', $this->translator->translate('admin.form.name')));
     $grid->addColumn(new \App\Grid\Column\Column('shortcut', $this->translator->translate('language.shortcut')));
     $grid->addColumn(new \App\Grid\Column\Column('id', $this->translator->translate('admin.grid.id')));
     $grid->addMenu(new \App\Grid\Menu\Update('edit', $this->translator->translate('admin.form.edit')));
     $grid->addMenu(new \App\Grid\Menu\Delete('delete', $this->translator->translate('admin.grid.delete')));
     return $grid;
 }
예제 #2
0
파일: BasePresenter.php 프로젝트: vsek/base
 public function beforeRender()
 {
     parent::beforeRender();
     $this->template->setTranslator($this->translator);
     $this->template->menuPresenters = $this->menuModules;
     $this->template->languages = $this->languages->getAll();
     $this->template->webLanguage = $this->webLanguage;
 }
예제 #3
0
파일: RouterFactory.php 프로젝트: vsek/cms
 /**
  * @return Nette\Application\IRouter
  */
 public function createRouter()
 {
     $langRoute = array('language');
     foreach ($this->languages->getAll() as $language) {
         $langRoute[] = $language['link'];
     }
     $uri = explode('/', $_SERVER['REQUEST_URI']);
     if (isset($uri[1])) {
         $language = $this->languages->where('link', $uri[1])->fetch();
     } else {
         $language = $this->languages->get(1);
     }
     $router = new RouteList();
     $router[] = $adminRouter = new RouteList('Admin');
     $adminRouter[] = new Route('[<locale=cs ' . implode('|', $langRoute) . '>/]admin/<presenter>/<action>', 'Homepage:default');
     $router[] = $frontRouter = new RouteList('Front');
     $pages = $this->pages->where('NOT module', null)->fetchAll();
     foreach ($pages as $page) {
         $link = $page['link'];
         //jen staticka
         if (in_array($page['module'], array())) {
             //vypis => detail s ID
         } elseif (in_array($page['module'], array())) {
             //katalog
             $frontRouter[] = new Route('[<locale=cs cs|en>/]' . $link . '/<link>/<id [0-9]+>/', array('action' => 'default', 'presenter' => array(Route::FILTER_TABLE => array($link => $this->createPresenterName($page['module'])), Route::FILTER_STRICT => true)));
             $frontRouter[] = new Route('[<locale=cs cs|en>/]' . $link . '/<url>/', array('action' => 'default', 'presenter' => array(Route::FILTER_TABLE => array($link => $this->createPresenterName($page['module'])), Route::FILTER_STRICT => true)));
             //jen specialni stranka modulu
         } else {
             $frontRouter[] = new Route('[<locale=cs cs|en>/]<presenter>/', array('action' => 'default', 'presenter' => array(Route::FILTER_TABLE => array($link => $this->createPresenterName($page['module'])), Route::FILTER_STRICT => true)));
             $frontRouter[] = new Route('[<locale=cs cs|en>/]<presenter>/[<id>/]', array('action' => 'detail', 'presenter' => array(Route::FILTER_TABLE => array($link => $this->createPresenterName($page['module'])), Route::FILTER_STRICT => true)));
         }
     }
     //obrazky
     $frontRouter[] = new Route('[<locale=cs ' . implode('|', $langRoute) . '>/]<presenter image>/<action preview>/', array('presenter' => 'Homepage', 'action' => 'default'));
     //stranky
     $frontRouter[] = new Route('[<locale=cs ' . implode('|', $langRoute) . '>/]<url .*>/', array('presenter' => 'Page', 'action' => 'default'));
     //vychozi router
     $frontRouter[] = new Route('[<locale=cs ' . implode('|', $langRoute) . '>/]<presenter>/<action>/[<id>/]', array('presenter' => 'Homepage', 'action' => 'default'));
     return $router;
 }