Ejemplo n.º 1
0
 public function prepare($name = "", $value = NULL)
 {
     try {
         switch ($name) {
             case "id":
                 return $this->instance->getParamDirect("url");
                 break;
             case "heading":
                 return $this->instance->getParamDirect("name");
                 break;
             case "createdRSS":
                 return gmdate("D, d M Y H:i:s", strtotime($this->instance->created)) . " GMT";
                 break;
             case "url":
                 $refPageAttName = $this->configVarNamePhotogalleryRefPage;
                 // najdeme stranku zobrazovani fotogalerie podle reference
                 $idPageItem = LBoxConfigManagerProperties::getInstance()->getPropertyByName($refPageAttName)->getContent();
                 $pageItem = LBoxConfigManagerStructure::getInstance()->getPageById($idPageItem);
                 $urlBase = $this->instance->getParamDirect("url");
                 return $pageItem->url . ":{$urlBase}";
                 break;
             case "published_human_cs":
                 return date("j.n.Y", $this->instance->__get("time_published"));
                 break;
             default:
                 return parent::prepare($name, $value);
         }
     } catch (Exception $e) {
         throw $e;
     }
 }
Ejemplo n.º 2
0
 public function prepare($name = "", $value = NULL)
 {
     switch ($name) {
         case "title":
             if (!$this->party instanceof PartiesRecord) {
                 $class = get_class($this);
                 throw new LBoxExceptionPage("You have to set party database record via setPartyRecord() setter before get values via '{$class}' instance!");
             }
             $webTitle = LBoxConfigManagerProperties::getInstance()->getPropertyByName("web_title")->getContent();
             $pageTitlePattern = LBoxConfigManagerProperties::getInstance()->getPropertyByName("page_title_pattern_party")->getContent();
             $pageTitle = $pageTitlePattern;
             $pageTitle = str_replace("\$properties_web_title", $webTitle, $pageTitle);
             $pageTitle = str_replace("\$page_title", $value, $pageTitle);
             $pageTitle = str_replace("\$party_name", $this->party->name, $pageTitle);
             $pageTitle = trim($pageTitle);
             // v pripade ze mame nakonci samotny oddelovac, odrizneme ho ze stringu
             if (substr($pageTitle, -1) == "|") {
                 $pageTitle = trim(substr($pageTitle, 0, strlen($pageTitle) - 1));
             }
             return $pageTitle;
             break;
         default:
             return parent::prepare($name, $value);
     }
 }
Ejemplo n.º 3
0
 /**
  * pretizeno o nastaveni povinnych hodnot
  * @param string $name
  * @param string $value
  */
 public function getCreateItem($name = "", $value = "")
 {
     try {
         if (strlen($name) < 1) {
             throw new LBoxExceptionConfig(LBoxExceptionConfig::MSG_PARAM_STRING_NOTNULL, LBoxExceptionConfig::CODE_BAD_PARAM);
         }
         try {
             if (LBoxConfigManagerProperties::getInstance()->getPropertyByName($name)) {
                 throw new LBoxExceptionConfig("'{$name}': This property already exists!");
             }
         } catch (Exception $e) {
             switch ($e->getCode()) {
                 case LBoxExceptionProperty::CODE_PROPERTY_NOT_FOUND:
                     break;
                 default:
                     throw $e;
             }
         }
         $instance = parent::getCreateItem();
         $instance->name = $name;
         $instance->setContent($value);
         return $instance;
     } catch (Exception $e) {
         throw $e;
     }
 }
 public function prepare($name = "", $value = NULL)
 {
     switch ($name) {
         case "title":
             $webTitle = LBoxConfigManagerProperties::getInstance()->getPropertyByName("web_title")->getContent();
             $pageTitlePattern = LBoxConfigManagerProperties::getInstance()->getPropertyByName("page_title_pattern_photogallery")->getContent();
             $pageTitle = $pageTitlePattern;
             $pageTitle = str_replace("\$properties_web_title", $webTitle, $pageTitle);
             $pageTitle = str_replace("\$page_title", $value, $pageTitle);
             $pageTitle = str_replace("\$photogallery_name", $this->getPhotogallery()->name, $pageTitle);
             $pageTitle = trim($pageTitle);
             // v pripade ze mame nakonci samotny oddelovac, odrizneme ho ze stringu
             if (substr($pageTitle, -1) == "|") {
                 $pageTitle = trim(substr($pageTitle, 0, strlen($pageTitle) - 1));
             }
             return $pageTitle;
             break;
         case "heading":
             if ($this->getPhotogallery() instanceof AbstractRecordLBox) {
                 return $this->getPhotogallery()->heading;
             } else {
                 return $value;
             }
             break;
         default:
             return parent::prepare($name, $value);
     }
 }
 public function prepare($name = "", $value = NULL)
 {
     switch ($name) {
         case "rssURL":
             $rssPageId = LBoxConfigManagerProperties::getInstance()->getPropertyByName($this->propertyNameRefRSSPage)->getContent();
             $rssPageUrl = LBoxConfigManagerStructure::getInstance()->getPageById($rssPageId)->url;
             return $rssPageUrl;
             break;
         default:
             return parent::prepare($name, $value);
     }
 }
Ejemplo n.º 6
0
 /**
  * Vraci hodnotu paging (po kolika se ma strankovat)
  * @return int
  * @throws LBoxException
  */
 protected function getListPaging()
 {
     try {
         $out = LBoxConfigManagerProperties::getInstance()->getPropertyByName("news_list_limit")->getContent();
         if (strlen($out) < 1) {
             $out = LBoxConfigSystem::getInstance()->getParamByPath("output/paging/paging_by_default");
         }
         return (int) $out;
     } catch (Exception $e) {
         throw $e;
     }
 }
Ejemplo n.º 7
0
 public function prepare($name = "", $value = NULL)
 {
     switch ($name) {
         case "contact_form_addresses":
             $addresses = LBoxConfigManagerProperties::getInstance()->getPropertyByName("contact_form_addresses")->getContent();
             $addresses = str_ireplace("\$domain_email", LBOX_REQUEST_URL_HOST, $addresses);
             $addresses = str_ireplace("www.", "", $addresses);
             return $addresses;
             break;
         default:
             return parent::prepare($name, $value);
     }
 }
Ejemplo n.º 8
0
 protected function executePrepend(PHPTAL $TAL)
 {
     //DbControl::$debug = true;
     try {
         $itemsLimit = LBoxConfigManagerProperties::getInstance()->getPropertyByName($this->itemsLimitConfigParamName)->getContent();
         $className = $this->articlesRecordsClassName;
         $articles = new $className(false, array("time_published" => 0), array(0, $itemsLimit));
         $articles->setOutputFilterItemsClass($this->articlesRecordsOutputFilterClassName);
         $TAL->items = $articles;
         $TAL->host = LBOX_REQUEST_URL_SCHEME . "://" . LBOX_REQUEST_URL_HOST;
     } catch (Exception $e) {
         throw $e;
     }
 }
 public function prepare($name = "", $value = NULL)
 {
     try {
         switch ($name) {
             case "title_image_url":
                 $pathTitleImages = LBoxConfigManagerProperties::getInstance()->getPropertyByName("articles_static_title_images_path")->getContent();
                 return "{$pathTitleImages}/{$value}";
                 break;
             default:
                 return parent::prepare($name, $value);
         }
     } catch (Exception $e) {
         throw $e;
     }
 }
Ejemplo n.º 10
0
 protected function executePrepend(PHPTAL $TAL)
 {
     try {
         // DbControl::$debug	= true;
         $itemsLimit = LBoxConfigManagerProperties::getInstance()->getPropertyByName("box_last_news_limit")->getContent();
         $order["time_published"] = 0;
         $limit = array(0, $itemsLimit);
         $news = new ArticlesNewsRecords(false, $order, $limit);
         $news4Count = new ArticlesNewsRecords();
         $news->setOutputFilterItemsClass("OutputFilterArticleNews");
         $TAL->iteratorNews = $news;
         $TAL->pageMoreCfg = LBoxConfigManagerStructure::getInstance()->getPageById(LBoxConfigManagerProperties::getInstance()->getPropertyByName("ref_page_articles_news")->getContent());
         $TAL->atLeastOne = $news->count() > 0;
         $TAL->hasMore = $news4Count->count() > $news->count();
     } catch (Exception $e) {
         throw $e;
     }
 }
Ejemplo n.º 11
0
 public function prepare($name = "", $value = NULL)
 {
     try {
         switch ($name) {
             case "url":
                 $pageDetailID = LBoxConfigManagerProperties::getInstance()->getPropertyByName("ref_page_party")->getContent();
                 $pageDetail = LBoxConfigManagerStructure::getInstance()->getPageById($pageDetailID);
                 return $pageDetail->url . ":" . $this->instance->getParamDirect("url");
                 break;
             case "datetimeRSS":
                 return gmdate("D, d M Y H:i:s", strtotime($this->instance->datetime)) . " GMT";
                 break;
             default:
                 return $value;
         }
     } catch (Exception $e) {
         throw $e;
     }
 }
Ejemplo n.º 12
0
 public function prepare($name = "", $value = NULL)
 {
     $discussionURLParams = $this->instance->getDiscussionURLParamsArray();
     // zvolime spravny nazev konfiguracniho parametru pro titulek - podle toho co zobrazujeme za RSS
     switch ($discussionURLParams[0]) {
         // clanek
         case LBoxConfigManagerProperties::getInstance()->getPropertyByName("ref_page_article")->getContent():
             $articles = new ArticlesRecords(array("url" => $discussionURLParams[1]));
             if ($articles->count() < 1) {
                 LBoxFront::reloadHomePage();
             } else {
                 $this->articleHeading = $articles->current()->heading;
             }
             $this->configParamNamePageTitle = "page_rss_discussion_article_title_pattern";
             break;
             // party
             /*
             case LBoxConfigManagerProperties::getInstance()->getPropertyByName("ref_page_party")->getContent():
             		$parties	= new PartiesRecords(array("url" => $discussionURLParams[1]));
             		if ($parties->count() < 1) LBoxFront::reloadHomePage();
             		else $this->articleHeading	= $parties->current()->name ." ". $parties->current()->datetime;
             		$this->configParamNamePageTitle = "page_rss_discussion_party_title_pattern";
             	break;
             */
             // guestbook
         // party
         /*
         case LBoxConfigManagerProperties::getInstance()->getPropertyByName("ref_page_party")->getContent():
         		$parties	= new PartiesRecords(array("url" => $discussionURLParams[1]));
         		if ($parties->count() < 1) LBoxFront::reloadHomePage();
         		else $this->articleHeading	= $parties->current()->name ." ". $parties->current()->datetime;
         		$this->configParamNamePageTitle = "page_rss_discussion_party_title_pattern";
         	break;
         */
         // guestbook
         case LBoxConfigManagerProperties::getInstance()->getPropertyByName("ref_page_guestbook")->getContent():
             $this->configParamNamePageTitle = "page_rss_discussion_guestbook_title_pattern";
             break;
     }
     return parent::prepare($name, $value);
 }
Ejemplo n.º 13
0
 public function prepare($name = "", $value = NULL)
 {
     switch ($name) {
         case "title":
             if (!LBoxFront::getPage()->getRecord() instanceof ArticlesRecord) {
                 $class = get_class($this);
                 throw new LBoxExceptionPage("Wrong data returns by LBoxFront::getPage()->getRecord(): " . get_class(LBoxFront::getPage()->getRecord()) . "!");
             }
             $webTitle = LBoxConfigManagerProperties::getInstance()->getPropertyByName("web_title")->getContent();
             $pageTitlePattern = LBoxConfigManagerProperties::getInstance()->getPropertyByName("page_title_pattern_article")->getContent();
             $pageTitle = $pageTitlePattern;
             $pageTitle = str_replace("\$properties_web_title", $webTitle, $pageTitle);
             $pageTitle = str_replace("\$page_title", $value, $pageTitle);
             $pageTitle = str_replace("\$record_name", LBoxFront::getPage()->getRecord()->heading, $pageTitle);
             $pageTitle = str_replace("\$article_name", LBoxFront::getPage()->getRecord()->heading, $pageTitle);
             $pageTitle = trim($pageTitle);
             // v pripade ze mame nakonci samotny oddelovac, odrizneme ho ze stringu
             if (substr($pageTitle, -1) == "|") {
                 $pageTitle = trim(substr($pageTitle, 0, strlen($pageTitle) - 1));
             }
             return $pageTitle;
             break;
         case "description":
             return (string) LBoxFront::getPage()->getRecord()->getParamDirect($name);
             break;
         case "heading":
             return LBoxFront::getPage()->getRecord()->getParamDirect($name);
             break;
         case "nameBreadcrumb":
         case "headingBreadcrumb":
             return $this->instance->heading;
             break;
         default:
             return parent::prepare($name, $value);
     }
 }
Ejemplo n.º 14
0
 /**
  * reloaduje na homepage
  * @throws Exception
  */
 public static function reloadXTLogin()
 {
     try {
         // 1) pokus ziskat not-logged referenci primo u stranky ve structure
         if (strlen($pageAdminXTID = self::getPageCfg()->xt_reload_notlogged) < 1) {
             // 2) pokus ziskat not-logged referenci v properties
             if (strlen($pageAdminXTID = LBoxConfigManagerProperties::getInstance()->getPropertyByName("ref_page_xt_login")->getContent()) < 1) {
                 self::reloadHomePage();
             }
         }
         // pokusime se ziskat stranku ze struktury
         try {
             $pageAdminXT = LBoxConfigManagerStructure::getInstance()->getPageById($pageAdminXTID);
         } catch (LBoxExceptionConfigComponent $e) {
             throw $e;
         }
         $_SESSION["LBox"]["LBoxFront"]["persistentLocationXT"] = LBOX_REQUEST_URL;
         self::reload($pageAdminXT->url);
     } catch (Exception $e) {
         throw $e;
     }
 }
Ejemplo n.º 15
0
 /**
  * vraci subject emailu
  * @return string
  */
 protected function getSubject()
 {
     try {
         $out = LBoxConfigManagerProperties::getInstance()->getPropertyContentByName("contact_form_subject");
         $out = str_ireplace("<host>", LBOX_REQUEST_URL_HOST, $out);
         return $out;
     } catch (Exception $e) {
         throw $e;
     }
 }
Ejemplo n.º 16
0
 /**
  * Vraci zobrazovaci URL downloadu
  * @return string
  * @throws Exception
  */
 protected function getURLDisplay()
 {
     try {
         $pageDownloadsID = LBoxConfigManagerProperties::getInstance()->getPropertyByName("ref_page_downloads")->getContent();
         $pageDownloads = LBoxConfigManagerStructure::getInstance()->getPageById($pageDownloadsID);
         $downloadType = $this->instance->getDownloadType();
         $downloadsPaging = LBoxConfigManagerProperties::getInstance()->getPropertyByName("downloads_paging")->getContent();
         // zjistime si na kolikate strance strankovani tento download je
         $myCreated = $this->instance->created;
         $whereAdd = "created > '{$myCreated}'";
         $recordsNew = new DownloadsRecords(false, false, false, $whereAdd);
         $out = $pageDownloads->url;
         $page = ceil($recordsNew->count() / $downloadsPaging);
         if ($page > 1) {
             $out .= ":" . LBoxUtil::getPagingURLString($page);
         }
         return "{$out}#download-" . $this->instance->id;
     } catch (Exception $e) {
         throw $e;
     }
 }
Ejemplo n.º 17
0
 public function prepare($name = "", $value = NULL)
 {
     switch ($name) {
         case "title":
             $value = strlen($value) > 0 ? $value : $this->prepare("heading", $this->instance->getParamDirect("heading"));
             $webTitle = LBoxConfigManagerProperties::getInstance()->getPropertyByName($this->configParamNameWebTitle)->getContent();
             $homePageTitlePattern = LBoxConfigManagerProperties::getInstance()->getPropertyByName($this->configParamNameHomepageTitle)->getContent();
             $pageTitlePattern = LBoxConfigManagerProperties::getInstance()->getPropertyByName($this->configParamNamePageTitle)->getContent();
             $pageTitle = $this->instance->isHomePage() ? $homePageTitlePattern : $pageTitlePattern;
             $pageTitle = str_replace("\$properties_web_title", $webTitle, $pageTitle);
             $pageTitle = str_replace("\$page_title", $value, $pageTitle);
             $pageTitle = str_replace("\$article_heading", $this->articleHeading, $pageTitle);
             $pageTitle = trim($pageTitle);
             // v pripade ze mame nakonci samotny oddelovac, odrizneme ho ze stringu
             if (substr($pageTitle, -1) == "|") {
                 $pageTitle = trim(substr($pageTitle, 0, strlen($pageTitle) - 1));
             }
             return $pageTitle;
             break;
         case "titleMenu":
         case "title_menu":
             return strlen($this->instance->getParamDirect("title")) > 0 ? $this->instance->getParamDirect("title") : (strlen($this->instance->name_menu) > 0 ? $this->instance->name_menu : $this->prepare("heading", $this->instance->getParamDirect("heading")));
             break;
         case "nameMenu":
         case "name_menu":
         case "headingMenu":
             return strlen($value) > 0 ? $value : $this->instance->heading;
             break;
         case "nameBreadcrumb":
         case "headingBreadcrumb":
             return strlen($value) > 0 ? $value : $this->instance->name_menu;
             break;
         case "titleWeb":
             return LBoxConfigManagerProperties::getInstance()->getPropertyByName($this->configParamNameWebTitle)->getContent();
             break;
         case "description":
         case "keywords":
             return (string) $value;
             break;
         case "isCurrent":
             return $this->instance->url == LBoxFront::getPage()->url;
             break;
         case "isCurrentBranch":
             if ($this->instance->url == LBoxFront::getPage()->url) {
                 return true;
             }
             $parent = LBoxFront::getPage()->config;
             while ($parent = $parent->getParent()) {
                 if ($parent->url == $this->instance->url) {
                     return true;
                 }
             }
             return false;
             break;
         case "heading":
             return (string) $value;
             break;
         case "name":
             return $this->instance->heading;
             break;
         case "name_menu":
             if (strlen($value) < 1) {
                 $value = $this->instance->name;
             }
             return $value;
             break;
         case "getChildren":
             return $this->instance->getChildNodesIterator();
             break;
         case "rssPage":
             if (strlen($this->instance->rss) < 1) {
                 return NULL;
             } else {
                 return LBoxConfigManagerStructure::getPageById($this->instance->rss);
             }
             break;
         case "in_menu":
             return $this->instance->is_accesible ? $value : false;
             break;
         case "bodyclass":
             return LBoxFront::getDisplayLanguage();
             break;
         case "is_accesible":
             if ($this->instance->superxt == 1) {
                 if (!LBoxXTProject::isLoggedSuperAdmin()) {
                     return false;
                 }
             }
             if ($this->instance->xt == 1) {
                 if (!LBoxXTProject::isLoggedAdmin()) {
                     return false;
                 }
             }
             return true;
             break;
         case "getClass":
             return $this->getClassMenu();
             break;
         case "getClassBreadcrumb":
             return $this->getClassBreadcrumb();
             break;
         default:
             return $value;
     }
 }
Ejemplo n.º 18
0
 public function testGetPropertyContent()
 {
     $content = "testovaci obsah";
     $this->assertType("LBoxConfigItemProperty", $property = LBoxConfigProperties::getInstance()->getCreateItem("phpunit_test", $content));
     LBoxConfigProperties::getInstance()->store();
     $this->assertSame($content, LBoxConfigManagerProperties::gpcn("phpunit_test"));
     $this->assertType("LBoxConfigItemProperty", $property = LBoxConfigManagerProperties::getInstance()->getPropertyByName("phpunit_test"));
     $property->delete();
     LBoxConfigProperties::getInstance()->store();
 }
Ejemplo n.º 19
0
 /**
  * Vraci aktualni hodnotu limitu parties na stranku pro admin
  * @return int
  */
 protected function getPagingBy()
 {
     try {
         if (strlen($this->recordsPagingByConfigVarname) < 1) {
             throw new LBoxExceptionPage("\$recordsPagingByConfigVarname: " . LBoxExceptionPage::MSG_INSTANCE_VAR_STRING_NOTNULL, LBoxExceptionPage::CODE_BAD_INSTANCE_VAR);
         }
         $value = LBoxConfigManagerProperties::getInstance()->getPropertyByName($this->recordsPagingByConfigVarname)->getContent();
         return is_numeric($value) ? (int) $value : parent::getPagingBy();
     } catch (Exception $e) {
         throw $e;
     }
 }