Пример #1
0
 protected function createTemplate($class = NULL)
 {
     $template = parent::createTemplate($class);
     $template->addFilter('texy', callback($this->texy, 'process'));
     $template->addFilter('timeAgo', 'Helpers::timeAgoInWords');
     return $template;
 }
Пример #2
0
 public function startup()
 {
     parent::startup();
     if (!$this->getRequest()->isMethod(Nette\Application\Request::FORWARD)) {
         $this->error();
     }
 }
Пример #3
0
 protected function startup()
 {
     parent::startup();
     if (session_status() == PHP_SESSION_NONE) {
         session_start();
     }
 }
Пример #4
0
 public function __construct(ArticleRepository $articles, CommentRepository $comments, UserRepository $users, CategoryRepository $categories)
 {
     parent::__construct();
     $this->articles = $articles;
     $this->comments = $comments;
     $this->users = $users;
     $this->categories = $categories;
 }
Пример #5
0
 /** Vychodzie nastavenia */
 protected function startup()
 {
     parent::startup();
     // Kontrola ACL
     if (!$this->user->isAllowed($this->name, $this->action)) {
         $this->flashRedirect('Homepage:notAllowed', sprintf($this->trLang('base_nie_je_opravnenie'), $this->action), 'danger');
     }
 }
Пример #6
0
 protected function startup()
 {
     parent::startup();
     if (!$this->user->isLoggedIn()) {
         if ($this->user->logoutReason === \Nette\Security\IUserStorage::INACTIVITY) {
             $this->flashMessage('Byli jste odhlášeni');
         }
         $this->redirect('Sign:in', array('backlink' => $this->storeRequest()));
     }
 }
Пример #7
0
 protected function startup()
 {
     parent::startup();
     // Kontrola prihlasenia - ak >0 ok a ACL
     if (!$this->user->isLoggedIn()) {
         $this->flashRedirect(array('User:'******'backlink' => $this->storeRequest())), $this->trLang('base_nie_je_opravnenie1') . '<br/>' . $this->trLang('base_prihlaste_sa'), 'danger,n');
     }
     // Kontrola ACL
     if (!$this->user->isAllowed($this->name, $this->action)) {
         $this->flashRedirect('Homepage:', sprintf($this->trLang('base_nie_je_opravnenie'), $this->action), 'danger');
     }
 }
Пример #8
0
 protected function startup()
 {
     parent::startup();
     $this->setDB();
     if ($this->getParameter('moduleid')) {
         $this->iModuleId = $this->getParameter('moduleid');
         $this->loadModuleFromDB();
         $this->template->module = $this->module;
     } else {
         if ($this->getParameter('id')) {
             $this->load($this->getParameter('id'));
         }
     }
 }
Пример #9
0
 protected function startup()
 {
     parent::startup();
     // Kontrola prihlasenia - ak >0 ok
     if (!$this->user->isLoggedIn()) {
         $this->flashRedirect(array('User:'******'backlink' => $this->storeRequest())), $this->trLang('base_nie_je_opravnenie1') . '<br/>' . $this->trLang('base_prihlaste_sa'), 'danger,n');
     }
     // Kontrola ACL
     if (!$this->user->isAllowed($this->name, $this->action)) {
         $this->flashRedirect($this->action == 'edit' && $this->user->isAllowed($this->name, 'default') ? 'Debata:' : 'Homepage:', sprintf($this->trLang('base_nie_je_opravnenie'), $this->action), 'danger');
     }
     $this->template->h2 = $this->trLang('h2');
     $this->template->txt_na_zmaz = $this->trLang('txt_na_zmaz');
     $vp = new VisualPaginator($this, 'vp');
     $paginator = $vp->getPaginator();
     $paginator->itemsPerPage = $this->udaje->getUdajInt('d_riadkov');
     $paginator->itemCount = $this->debata->findAll()->count();
     $this->template->komentare = $this->debata->findAll()->order('timestamp DESC')->limit($paginator->getLength(), $paginator->getOffset());
 }
Пример #10
0
 protected function startup()
 {
     parent::startup();
     // Kontrola ACL
     if (!$this->user->isAllowed($this->name, $this->action)) {
         $this->flashRedirect('Homepage:', sprintf($this->trLang('base_nie_je_opravnenie'), $this->action), 'danger');
     }
     if ($this->user->isLoggedIn()) {
         $this->flashRedirect('Homepage:', $this->trLang('base_loged_in_bad'), 'danger');
     }
     $this->hasser = $this->user->getAuthenticator();
     //Ziskanie objektu pre vytvaranie hash hesla a iných
     $this->hasser->PasswordHash(8, FALSE);
     //Nastavenie
     $this->template->form_required = $this->trLang('base_form_required');
     $this->template->h2 = $this->trLang('h2_' . $this->action);
     //Nacitanie hlavneho nadpisu
     $this->clen = $this->user_profiles->find(1);
     //Odosielatel e-mailu
     $this->user_view_fields = $this->nastavenie['user_view_fields'];
 }
Пример #11
0
 protected function startup()
 {
     parent::startup();
     if ($this->action != 'activateNewEmail') {
         if (!$this->user->isLoggedIn()) {
             //Neprihlaseneho presmeruj
             $this->flashRedirect(['User:'******'backlink' => $this->storeRequest()]], $this->trLang('base_nie_je_opravnenie1') . '<br/>' . $this->trLang('base_prihlaste_sa'), 'danger,n');
         }
     }
     // Kontrola ACL
     if (!$this->user->isAllowed($this->name, $this->action)) {
         $this->flashRedirect('Homepage:', sprintf($this->trLang('base_nie_je_opravnenie'), $this->action), 'danger');
     }
     //Najdem aktualne prihlaseneho clena
     $this->clen = $this->user_profiles->findOneBy(['id_users' => $this->user->getIdentity()->getId()]);
     $this->hasser = $this->user->getAuthenticator();
     //Ziskanie objektu pre vytvaranie hash hesla a iných
     $this->hasser->PasswordHash(8, FALSE);
     //Nastavenie
     $this->user_view_fields = $this->nastavenie['user_view_fields'];
 }
Пример #12
0
 /**
  * Vytvorenie spolocnych helperov pre sablony
  * @param type $class
  * @return type */
 protected function createTemplate($class = NULL)
 {
     $servise = $this;
     $template = parent::createTemplate($class);
     $template->addFilter('vlastnik', function ($id_user_profiles = 0, $action = 'edit') use($servise) {
         $user = $servise->user;
         // Vrati true ak: si prihlaseny && si admin || (mas opravnenie a si valstnik)
         $out = $user->isLoggedIn() ? $user->isInRole('admin') ? TRUE : ($user->isAllowed($servise->name, $action) ? $id_user_profiles ? $user->getIdentity()->id == $id_user_profiles : FALSE : FALSE) : FALSE;
         return $out;
     });
     return $template;
 }
Пример #13
0
 public function beforeRender()
 {
     parent::beforeRender();
     $this->template->defaultTags = $this->articleManager->getTagsAsString();
 }
Пример #14
0
 public function __construct(ArticleRepository $articles)
 {
     parent::__construct();
     $this->articles = $articles;
 }
Пример #15
0
 protected function startup()
 {
     parent::startup();
     $this->template->page = $this->database->table("pages")->get($this->getParameter("page_id"));
 }
Пример #16
0
 protected function createTemplate($class = NULL)
 {
     $servise = $this;
     $template = parent::createTemplate($class);
     $template->addFilter('obr_v_txt', function ($text) use($servise) {
         $rozloz = explode("#", $text);
         $serv = $servise->presenter;
         $vysledok = '';
         $cesta = 'http://' . $serv->nazov_stranky . "/";
         foreach ($rozloz as $k => $cast) {
             if (substr($cast, 0, 2) == "I-") {
                 $obr = $serv->dokumenty->find((int) substr($cast, 2));
                 if ($obr !== FALSE) {
                     $cast = \Nette\Utils\Html::el('a class="fotky" rel="fotky"')->href($cesta . $obr->subor)->title($obr->nazov)->setHtml(\Nette\Utils\Html::el('img')->src($cesta . $obr->thumb)->alt($obr->nazov));
                 }
             }
             $vysledok .= $cast;
         }
         return $vysledok;
     });
     $template->addFilter('koncova_znacka', function ($text) use($servise) {
         $rozloz = explode("{end}", $text);
         $vysledok = $text;
         if (count($rozloz) > 1) {
             //Ak som nasiel znacku
             $vysledok = $rozloz[0] . \Nette\Utils\Html::el('a class="cely_clanok"')->href($servise->link("this"))->title($servise->trLang("base_title"))->setHtml('&gt;&gt;&gt; ' . $servise->trLang("base_viac")) . '<div class="ostatok">' . $rozloz[1] . '</div>';
         }
         return $vysledok;
     });
     return $template;
 }
Пример #17
0
 /** Vychodzie nestavenia */
 protected function startup()
 {
     parent::startup();
     //Len na to aby som vedel zobraziť odkaz na aktuality
     $this->template->aktuality = $this->hlavne_menu->findBy(["datum_platnosti >= '" . StrFTime("%Y-%m-%d", strtotime("0 day")) . "'", "id_registracia <= " . ($this->user->isLoggedIn() ? $this->user->getIdentity()->id_registracia : 0), "id_nadradenej = " . ($this->template->id_nadradeny_aktuality = 1)]);
 }
Пример #18
0
 public function startup()
 {
     parent::startup();
 }