Example #1
0
 public function beforeRender()
 {
     parent::beforeRender();
     $this->setActiveMenuItem('Eshop');
     $this->setLayout('layoutEshop');
     $this->template->eshopCategories = $this->categoryModel->findEshopCategories();
 }
 protected function beforeRender()
 {
     $file = '/static/bundle.js';
     parent::beforeRender();
     $bundleJs = $this->context->getParameters()['wwwDir'] . $file;
     $this->template->bundleJsVersion = file_exists($bundleJs) ? md5(file_get_contents($this->context->getParameters()['wwwDir'] . $file)) : "404";
 }
 public function beforeRender()
 {
     parent::beforeRender();
     $form = $this['loginForm'];
     if ($form->isSubmitted()) {
         $this->login($form, $form->getValues());
     }
 }
Example #4
0
 public function beforeRender()
 {
     parent::beforeRender();
     $this->template->imagePath = $this->template->basePath . '/images/';
     $this->template->languages = $this->getLanguagesTplData();
     $this->template->actualLangaugeCode = $this->getActualLanguage()->getCode();
     $this->template->page = (object) array('description' => $this->getPageDescription(), 'keywords' => $this->getPageKeywords(), 'title' => $this->getPageTitle());
     $this->template->menuItems = array('intro', 'about', 'gallery', 'contact');
 }
Example #5
0
 protected function beforeRender()
 {
     parent::beforeRender();
     $this->template->articleRepository = $this->articleRepository;
     $this->template->imageRepository = $this->imageRepository;
     $this->template->videoRepository = $this->videoRepository;
     $this->template->wikiRepository = $this->wikiRepository;
     $this->template->tagRepository = $this->tagRepository;
     $this->template->uploadDir = $this->context->parameters['uploadDir'];
 }
Example #6
0
 public function beforeRender()
 {
     parent::beforeRender();
     if (!$this->getUser()->isLoggedIn()) {
         $this->redirect('Homepage:default');
     } else {
         if (!$this->isAllowedInAdmin($this->getUser()->getId())) {
             $this->redirect('Homepage:default');
         }
     }
     $this->template->adminMenu = array('Upravit novinky' => 'Admin:default', 'Změnit banner' => 'Admin:banner');
 }
Example #7
0
 public function beforeRender()
 {
     parent::beforeRender();
     $this->template->setTranslator($this->translator);
     $this->template->isHp = $this->isHp;
     $this->template->isMobile = $this->isMobile();
     $this->template->getLatte()->addFilter('externalUrl', function ($s) {
         if (!Nette\Utils\Strings::startsWith($s, 'http://') && !Nette\Utils\Strings::startsWith($s, 'https://')) {
             $s = 'http://' . $s;
         }
         return $s;
     });
 }
Example #8
0
 /**
  *
  */
 public function beforeRender()
 {
     parent::beforeRender();
     $presenter = ucfirst($this->tableName);
     $templatesDir = __DIR__ . '/../templates/';
     $paths = array($templatesDir . $presenter . '/' . $this->view . '.latte', $templatesDir . $presenter . '.' . $this->view . '.latte');
     $useDefault = TRUE;
     foreach ($paths as $file) {
         if (is_file($file)) {
             $useDefault = FALSE;
             break;
         }
     }
     if ($useDefault) {
         $this->template->setFile($templatesDir . '_' . $this->view . '.latte');
     }
     $this->template->presenterTitle = $this->presenterTitle;
 }
Example #9
0
 public function beforeRender()
 {
     parent::beforeRender();
     $nastaveni = $this->database->table('nastaveni');
     $this->template->nastaveni = $nastaveni;
     $this->template->basicMenu = $this->getBasicMenu();
     $zmeneneStranky = $this->database->table('stranka')->where('editor_zmeneno != ?', 'ne')->where('redirect IS NULL');
     //\Tracy\Debugger::barDump($zmeneneStranky->count());
     if ($zmeneneStranky->count() > 0) {
         $texy = new \Texy();
         $texy->headingModule->top = (int) $nastaveni->get('texy_heading_top')->hodnota;
         $texy->imageModule->root = '/images/main-content/';
         $texy->imageModule->leftClass = 'tifl';
         $texy->imageModule->rightClass = 'tifr';
         $now = new Nette\DateTime();
         $menuTable = $this->getBasicMenu(TRUE);
         foreach ($zmeneneStranky as $stranka) {
             $obsahujeGalerii = 'ne';
             $tempTemplate = NULL;
             $fragmentHtml = array();
             $castiStranky = $stranka->related('editor_obsahu_stranky')->order('poradi, id');
             if ($castiStranky->count() > 0) {
                 foreach ($castiStranky as $fragment) {
                     $zaloha = array();
                     $posledniZalohaTexy = NULL;
                     if ($fragment->galerie_skupina_fotek_id == NULL) {
                         $posledniZaloha = $this->database->table('zaloha_obsah')->where('editor_obsahu_stranky_id = ?', $fragment->id)->order('id DESC')->limit(1)->fetch();
                         if ($posledniZaloha) {
                             $posledniZalohaTexy = $posledniZaloha->texy;
                         } else {
                             $posledniZalohaTexy = NULL;
                         }
                         $posledniZaloha = NULL;
                         if ($posledniZalohaTexy != $fragment->obsah_texy) {
                             $zaloha = array('editor_obsahu_stranky_id' => $fragment->id, 'stranka_id' => $fragment->stranka_id, 'poradi' => $fragment->poradi, 'pocet_sloupcu' => $fragment->pocet_sloupcu, 'texy' => $fragment->obsah_texy, 'datum' => $now);
                             $this->database->table('zaloha_obsah')->insert($zaloha);
                         }
                         $posledniZalohaTexy = NULL;
                         $zaloha = array();
                         $fragmentHtml[$fragment->id] = $texy->process($fragment->obsah_texy);
                     } else {
                         $obsahujeGalerii = 'ano';
                     }
                 }
                 $tempTemplate = NULL;
                 $tempTemplate = $this->createTemplate()->setFile(__DIR__ . '/templates/components/renderMainContent.latte')->setParameters(array('casti' => $castiStranky, 'htmlFragmenty' => $fragmentHtml));
                 $tempTemplate = (string) $tempTemplate;
             }
             $bigTemplate = NULL;
             $bigTemplate = $this->createTemplate()->setFile(__DIR__ . '/templates/components/renderStandardPage.latte')->setParameters(array('stranka' => $stranka, 'sGalerii' => $obsahujeGalerii, 'upperContent' => $tempTemplate, 'basicMenu' => $menuTable, 'noflashes' => 'noflashes', 'nastaveni' => $nastaveni));
             $bigTemplate = (string) $bigTemplate;
             $tempTemplate = NULL;
             $proVlozeni = array();
             $proVlozeni = array('html' => $bigTemplate, 'stranka_id' => $stranka->id);
             $bigTemplate = NULL;
             if ($stranka->related('stranka_html_celek')->count() > 0) {
                 $stranka->related('stranka_html_celek')->order('id')->limit(1)->fetch()->update($proVlozeni);
             } else {
                 $this->database->table('stranka_html_celek')->insert($proVlozeni);
             }
             $proVlozeni = NULL;
             $stranka->update(array('obsahuje_galerii' => $obsahujeGalerii, 'editor_zmeneno' => 'ne'));
             $this->flashMessage('Upravena stránka id ' . $stranka->id);
         }
     }
 }
Example #10
0
 public function beforeRender()
 {
     parent::beforeRender();
     $this->template->nastaveni = $this->database->table('nastaveni');
     $this->template->basicMenu = $this->getBasicMenu();
 }
Example #11
0
 protected function beforeRender()
 {
     parent::beforeRender();
     $this->template->last = $this->blog->findAll()->limit(5)->order("datum DESC");
 }
Example #12
0
 protected function beforeRender()
 {
     parent::beforeRender();
     $this->setLayout('layoutAdmin');
 }