Ejemplo n.º 1
0
 /**
  * Vrati instanci tridy Template.
  *
  * @return Bobr_Page_Template
  */
 public static function getInstance()
 {
     if (NULL === self::$instace) {
         self::$instace = new self();
     }
     return self::$instace;
 }
Ejemplo n.º 2
0
 private function init()
 {
     $request = Bobr_Request_HttpRequest::getInstance();
     // Zjistime co mame za jazyk.
     $this->setLang();
     // Pokud je to ajaxovej request...
     if (TRUE === $request->isAjax()) {
         Bobr_Page_Template::getInstance()->setDocumentType('fragment');
     }
     // Je get prazdnej?
     $uri = Bobr_Request_HttpRequest::uri();
     if ($uri === '' || empty($uri)) {
         // Nastavime defaultni stranku.
         $this->setDefaultPage();
     } else {
         $this->setPage();
     }
 }
Ejemplo n.º 3
0
 /**
  * Spusti bobra.
  *
  */
 private function getBobr()
 {
     // veskery odeslany obsah zacnem bufferovat
     ob_start();
     echo '<p>Tyto blahy se daji vypnout v configu. Jedna se o debugMode</p>';
     $this->setUser();
     try {
         // Vytvorime si zaklad z url.
         $process = new Bobr_Process();
         print_Re($process);
         if (0 < $process->getPageId()) {
             $page = new Bobr_Page_Page($process->pageId);
             // Nastavime jazyk pro popiskovac a dame mu i informaci o pageId kvuli cachovani
             $description = Bobr_DescriptionList::getInstance($process->getLang(), $process->getPageId());
             // Nastavime jazyk generatoru linku
             Lib_LinkCreator::setLang($process->getLang());
             // To co se do ted vypsalo vypisem pod html kodem.
             $errorOutput = ob_get_contents();
             ob_end_clean();
             $config = new Config();
             $template = Bobr_Page_Template::getInstance();
             $template->setContainerColection($page->getContainerColection())->setCommand($process->getCommand());
             Bobr_Page_Template::add('title', 'Vitej');
             $template->addCssLink($page->getCss());
             $template->load(__WEB_ROOT__ . $config->share . $page->getTemplate(), FALSE);
             echo $template;
         } else {
             throw new Bobr_BobrException('Z nejakeho duvodu se nepovedlo nacist stranku.');
         }
     } catch (Bobr_Page_PageException $e) {
         // Nemuze se vytvorit stranka, vyhodime nejvissi vyjimku.
         throw new Bobr_BobrException($e->getMessage());
     } catch (Bobr_Page_TemplateException $e) {
         throw new Bobr_BobrException($e->getMessage());
     }
     echo $this->getErrorOutput($errorOutput);
 }
Ejemplo n.º 4
0
 /**
  * Nacte sablonu.
  *
  * @param string $fileName Cesta se udava od korenoveho adresare modulu.
  * @return string
  */
 protected function loadTemplate($fileName)
 {
     $template = Bobr_Page_Template::getInstance();
     return $template->load($this->getFileName($fileName));
 }