Пример #1
0
 /**
  * (non-PHPdoc)
  * @see Application/Presenter#startup()
  */
 protected function startup()
 {
     parent::startup();
     $this->user = $this->context->user;
     if ($this->lang == NULL) {
         $this->lang = $this->translator->getLang();
     }
     $this->isMobile = $this->context->parameters["isMobile"];
     $this->translator->setLang($this->lang);
     // nastavi PHP na cesky jazyk kdyz je zvolena cestina
     if ($this->lang == "cs") {
         setlocale(LC_ALL, 'cs_CZ.UTF-8');
     }
     $session = $this->session;
     $this->mainSession = $session->getSection("main");
     //$this->mainSession->start = TRUE;
     // inicializace Texy!
     $texy = new Texy();
     $texy->alignClasses['left'] = 'fl';
     $texy->alignClasses['right'] = 'fr';
     $texy->imageModule->root = $this->getHttpRequest()->url->baseUrl;
     $texy->imageModule->fileRoot = $this->getHttpRequest()->url->baseUrl;
     $texy->imageModule->linkedRoot = $this->getHttpRequest()->url->baseUrl;
     $texy->linkModule->root = $this->getHttpRequest()->url->baseUrl;
     $texy->headingModule->top = 2;
     $texy_small = new Texy();
     $texy_small->alignClasses['left'] = 'fl';
     $texy_small->alignClasses['right'] = 'fr';
     $texy_small->imageModule->root = $this->getHttpRequest()->url->baseUrl;
     $texy_small->imageModule->fileRoot = $this->getHttpRequest()->url->baseUrl;
     $texy_small->linkModule->root = $this->getHttpRequest()->url->baseUrl;
     $texy_small->headingModule->top = 4;
     // registrace pomocnych filtru
     $this->template->registerHelper('texy', array($texy, 'process'));
     $this->template->registerHelper('texy_small', array($texy_small, 'process'));
     $this->template->registerHelper('date', 'soundake\\utils\\Date::getDate');
     $this->template->registerHelper('datetime', 'soundake\\utils\\Date::getDateTime');
     $this->template->registerHelper('time', 'soundake\\utils\\Date::getTime');
     $this->template->registerHelper('ago', 'soundake\\utils\\Date::timeAgoInWords');
     $this->template->registerHelper('url', 'soundake\\utils\\String::url');
     $this->template->registerHelper('dayname', 'soundake\\utils\\Date::getDayname');
     $this->template->registerHelper('monthname', 'soundake\\utils\\Date::getMonthname');
     $this->template->registerHelper('fill', 'soundake\\utils\\String::fill');
     $this->template->context = $this->context;
     $this->template->presenterName = substr($this->presenter->name, strpos($this->presenter->name, ":") + 1);
     // pridani mailovaciho klienta
     $this->mailer = $this->context->getService('nette.mailer');
     // pridani komponenty RequestButton http://addons.nettephp.com/cs/requestbutton
     Container::extensionMethod('Nette\\Forms\\Container::addRequestButton', array('\\RequestButton\\RequestButtonHelper', 'addRequestButton'));
     Container::extensionMethod('Nette\\Forms\\Container::addRequestButtonBack', array('\\RequestButton\\RequestButtonHelper', 'addRequestButtonBack'));
 }