예제 #1
0
 public function adminEdit(Nette\Application\UI\Presenter $presenter)
 {
     if (!$presenter->user->isAllowed('Admin:Admin', Model\Authorizator::UPDATE)) {
         $presenter->flashMessage('Myslím to vážně, editovat opravdu **ne**můžete!', 'danger');
         $presenter->redirect('this');
         return;
     }
 }
예제 #2
0
 /**
  * Registruje helper pro zobrazování obrázků
  * 
  * @param string|NULL $class
  * 
  * @return Nette\Templating\FileTemplate 
  */
 public function createTemplate($class = NULL)
 {
     $tpl = parent::createTemplate($class);
     $tpl->registerHelper('checkImage', callback($this, 'checkImage'));
     return $tpl;
 }
예제 #3
0
 /**
  * Overwrite default $message by translating it
  * @param  string
  * @param  string
  * @return \stdClass
  */
 public function flashMessage($message, $type = "info")
 {
     $message = $this->translator->translate($message);
     return parent::flashMessage($message, $type);
 }
예제 #4
0
 /**
  * Before render - set up template variables, add helpers...
  * @return type
  */
 public function beforeRender()
 {
     parent::beforeRender();
     /** set visibility of newItem form */
     $this->canAdd = false;
     $permissions = $this->getUser()->isLoggedIn() ? $this->getUser()->getIdentity()->getRoles() : NULL;
     if (isset($permissions[$this->pageUrl]) && $this->pageConfig['settings']['lvlForAdding'] <= $permissions[$this->pageUrl] || $permissions['admin'] || $this->pageConfig['settings']['lvlForAdding'] == 0) {
         $this->canAdd = true;
     }
     $this->template->canAdd = $this->canAdd;
     $this->template->page = $this->pageConfig;
     $this->template->pages = $this->pages;
     $this->template->pageUrl = !empty($this->pageUrl) ? $this->pageUrl : 'default';
     $this->template->isAdmin = $this->isAdmin();
     $helpers = new \Agility\Helpers();
     $this->template->registerHelperLoader(array($helpers, 'loader'));
     \Stopwatch::stop('BasePresenter');
 }
예제 #5
0
 public function __construct(TemplateFactory $templateFactory)
 {
     parent::__construct();
     $this->templateFactory = $templateFactory;
 }
 public function beforeRender()
 {
     parent::beforeRender();
     $this->template->menuItems = array('Číselníky' => 'Ciselniky:', 'Minerál' => 'Mineral:');
 }
 public function startup()
 {
     parent::startup();
     $this->context->documentManager;
 }
예제 #8
0
 protected function startup()
 {
     parent::startup();
     $this->taskLists = $this->context->taskLists;
 }