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;
     }
 }
 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);
     }
 }
 /**
  * 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;
     }
 }
Example #4
0
 /**
  * getter na form
  * @return LBoxForm
  */
 public function getForm()
 {
     try {
         if (count($this->processors) < 1) {
             $this->processors[] = new ProcessorLogin();
         }
         if (count($this->validators) < 1) {
             $this->validators[] = new LBoxFormValidatorLogin();
         }
         $controlEmail = new LBoxFormControlFill("email", "e-mail", "", LBoxConfigManagerProperties::getPropertyContentByName("form_max_length_email"));
         $controlEmail->setTemplateFileName("lbox_form_control_email.html");
         $controlEmail->setRequired();
         $controlPassword = new LBoxFormControlPassword("password", "heslo", "", LBoxConfigManagerProperties::getPropertyContentByName("form_max_length_password"));
         $controlPassword->setRequired();
         $controlsLogin = new LBoxFormControlMultiple("form", "controls");
         $controlsLogin->setTemplateFileName("lbox_form_control_multi_login.html");
         $controlsLogin->addControl($controlEmail);
         $controlsLogin->addControl($controlPassword);
         foreach ($this->validators as $validator) {
             $controlsLogin->addValidator($validator);
         }
         $form = new LBoxForm("login", "post", "Přihlášení uživatele", "přihlásit");
         $form->setTemplateFileName("lbox_form_login.html");
         $form->addControl($controlsLogin);
         $form->setAntiSpam(true);
         foreach ($this->processors as $processor) {
             $form->addProcessor($processor);
         }
         return $this->form = $form;
     } catch (Exception $e) {
         throw $e;
     }
 }
 public function process()
 {
     try {
         if (array_key_exists("id", $this->form->getControls())) {
             $record = new InquiriesRecord($this->form->getControlByName("id")->getValue());
         } else {
             $record = new InquiriesRecord();
             $record->question = $this->form->getControlByName("question")->getValue();
         }
         $record->is_active = (int) $this->form->getControlByName("is_active")->isSelected();
         $record->store();
         if (!array_key_exists("id", $this->form->getControls())) {
             for ($i = 1; $i <= LBoxConfigManagerProperties::getPropertyContentByName("inquiries_answers_count"); $i++) {
                 if (strlen($this->form->getControlByName("answer-{$i}")->getValue()) < 1) {
                     continue;
                 }
                 $optionsRecords[$i] = new InquiriesOptionsRecord();
                 $optionsRecords[$i]->ref_inquiry = $record->id;
                 $optionsRecords[$i]->answer = $this->form->getControlByName("answer-{$i}")->getValue();
                 $optionsRecords[$i]->store();
             }
         }
         LBoxFront::reload(LBoxFront::getPage()->url . ":" . $record->id);
     } 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)
 {
     try {
         switch ($name) {
             case "url":
                 $pageItem = LBoxConfigManagerStructure::getInstance()->getPageById(LBoxConfigManagerProperties::gpcn($this->configVarNameArticleRefPage));
                 return LBoxUtil::getURLWithParams(array($this->instance->getParamDirect("url")), $pageItem->url);
                 break;
             case "url_param":
                 return $this->instance->getParamDirect("url");
                 break;
             case "urlAbsolute":
                 return LBOX_REQUEST_URL_SCHEME . "://" . LBOX_REQUEST_URL_HOST . $this->prepare("url");
                 break;
             case "headingEntities":
                 return htmlentities($this->prepare("heading"));
                 break;
             case "publishedDate":
                 return date("j.n. Y", $this->instance->time_published);
                 break;
             case "published2":
                 return date("j.n.Y | H:i:s", $this->instance->time_published);
                 break;
             case "perex_raw":
                 return strip_tags($this->instance->perex);
                 break;
             default:
                 return parent::prepare($name, $value);
         }
     } catch (Exception $e) {
         throw $e;
     }
 }
 /**
  * vraci form pro forward na editaci clanku
  * @return LBoxForm
  * @throws LBoxException
  */
 protected function getFormXTToEdit()
 {
     try {
         if (!constant('CLI')) {
             if (!LBoxXTProject::isLoggedAdmin()) {
                 return "";
             }
         }
         if ($this->formToEdit instanceof LBoxForm) {
             return $this->formToEdit;
         }
         if (strlen($this->propertyNameRefPageEdit) < 1) {
             throw new LBoxExceptionOutputFilter(get_class($this) . "::\$propertyNameRefPageEdit: " . LBoxExceptionOutputFilter::MSG_INSTANCE_VAR_STRING_NOTNULL, LBoxExceptionOutputFilter::CODE_BAD_INSTANCE_VAR);
         }
         $instanceType = get_class($this->instance);
         $idColName = eval("return {$instanceType}::\$idColName;");
         $id = $this->instance->getParamDirect(strlen($this->editURLFilterColname) > 0 ? $this->editURLFilterColname : $idColName);
         $controlID = new LBoxFormControlFillHidden("id", "", $id);
         $controlRefPageEdit = new LBoxFormControlFillHidden("rpe", "", LBoxConfigManagerStructure::getInstance()->getPageById(LBoxConfigManagerProperties::getPropertyContentByName($this->propertyNameRefPageEdit))->id);
         $controlPropertyNamePatternURLParam = new LBoxFormControlFillHidden("pnpup", "", $this->propertyNamePatternURLParam);
         $form = new LBoxForm("record_xt_to_edit_{$id}", "post", "", "editovat");
         $form->setTemplateFileName("lbox_form_xt_btn_edit.html");
         $form->addControl($controlID);
         $form->addControl($controlRefPageEdit);
         $form->addControl($controlPropertyNamePatternURLParam);
         $form->addProcessor(new ProcessorRecordToEdit());
         return $this->formToEdit = $form;
     } catch (Exception $e) {
         throw $e;
     }
 }
 /**
  * destroys singleton instance from cache
  */
 public static function resetInstance()
 {
     try {
         self::$instance = NULL;
     } catch (Exception $e) {
         throw $e;
     }
 }
 /**
  * private recaptcha key getter
  * @return string
  */
 protected function getKeyPrivate()
 {
     try {
         return strlen($this->keyPrivate) > 0 ? $this->keyPrivate : LBoxConfigManagerProperties::getPropertyContentByName("recaptcha_key_private");
     } catch (Exception $e) {
         throw $e;
     }
 }
 public function validate(LBoxFormControl $control = NULL)
 {
     try {
         if (strlen($control->getValue()) > LBoxConfigManagerProperties::gpcn("form_max_length_discussion_text")) {
             throw new LBoxExceptionFormValidator(LBoxExceptionFormValidator::MSG_FORM_VALIDATION_CONTROL_TOO_LONG, LBoxExceptionFormValidator::CODE_FORM_VALIDATION_CONTROL_TOO_LONG);
         }
     } catch (Exception $e) {
         throw $e;
     }
 }
Example #12
0
 /**
  * reloadne hlavni stranku adminu
  */
 protected function reloadAdminHome()
 {
     try {
         if (strlen($adminHomePageID = LBoxConfigManagerProperties::getPropertyContentByName("ref_page_xt_admin")) < 1) {
             throw new LBoxExceptionPage("Property ref_page_xt_admin not set!");
         }
         LBoxFront::reload(LBoxConfigManagerStructure::getPageById($adminHomePageID)->url);
     } catch (Exception $e) {
         throw $e;
     }
 }
Example #13
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;
     }
 }
 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);
     }
 }
 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);
     }
 }
 public function process()
 {
     try {
         $url = LBoxConfigManagerStructure::getInstance()->getPageById($this->form->getControlByName("rpe")->getValue())->url;
         if (strlen($this->form->getControlByName("pnpup")->getValue()) > 0) {
             $url .= ":" . str_replace("<url_param>", $this->form->getControlByName("id")->getValue(), LBoxConfigManagerProperties::gpcn($this->form->getControlByName("pnpup")->getValue()));
         } else {
             $url .= ":" . $this->form->getControlByName("id")->getValue();
         }
         LBoxFront::reload($url);
     } catch (Exception $e) {
         throw $e;
     }
 }
Example #17
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;
     }
 }
 protected function getPath()
 {
     try {
         $pathGallery = LBoxConfigManagerProperties::gpcn("path_photos_photogalleries");
         $pathGallery = str_replace("<project>", LBOX_PATH_PROJECT, $pathGallery);
         $pathGallery = str_replace("<photogallery_name>", $this->getPhotogallery()->name, $pathGallery);
         $pathGallery = str_replace("<photogallery_url>", $this->getPhotogallery()->getParamDirect("url"), $pathGallery);
         $fileName = $this->instance->getParamDirect("filename");
         $ext = $this->instance->getParamDirect("ext");
         return LBoxUtil::fixPathSlashes("{$pathGallery}/{$fileName}.{$ext}");
     } catch (Exception $e) {
         throw $e;
     }
 }
 public function process()
 {
     try {
         $data = array();
         $data["from"] = LBoxConfigManagerProperties::getPropertyContentByName("registration_confirm_mail_from");
         $data["to"] = $this->form->getControlByName("email")->getValue();
         $data["subject"] = "Potvrzeni registrace";
         $data["page_confirm"] = LBoxConfigManagerStructure::getInstance()->getPageById(LBoxConfigManagerProperties::getPropertyContentByName("ref_page_registration_confirm"));
         $data["processor_save"] = $this->processorSaveProfile;
         $mail = new MailProductsRegistrationConfirm($data);
         $mail->init();
     } 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;
     }
 }
Example #21
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;
     }
 }
Example #22
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;
     }
 }
Example #23
0
 /**
  * getter na form
  * @return LBoxForm
  */
 public function getForm()
 {
     try {
         if ($this->form instanceof LBoxForm) {
             return $this->form;
         }
         $ctrls["name"] = new LBoxFormControlFill("name", "jméno", "", LBoxConfigManagerProperties::getPropertyContentByName("form_max_length_name"));
         $ctrls["name"]->setTemplateFileName("lbox_form_control_first_name.html");
         $ctrls["name"]->setRequired();
         $ctrls["surname"] = new LBoxFormControlFill("surname", "příjmení", "", LBoxConfigManagerProperties::getPropertyContentByName("form_max_length_surname"));
         $ctrls["surname"]->setTemplateFileName("lbox_form_control_surname.html");
         $ctrls["surname"]->setRequired();
         $ctrls["company"] = new LBoxFormControlFill("company", "firma", "", LBoxConfigManagerProperties::getPropertyContentByName("form_max_length_company"));
         $ctrls["phone"] = new LBoxFormControlFill("phone", "telefon");
         $ctrls["phone"]->setTemplateFileName("lbox_form_control_phone.html");
         $ctrls["phone"]->addFilter(new LBoxFormFilterEraseSpaces());
         $ctrls["phone"]->addFilter(new LBoxFormFilterPhoneNumberCS());
         $ctrls["phone"]->addValidator(new LBoxFormValidatorPhone());
         $ctrls["email"] = new LBoxFormControlFill("email", "email", "", LBoxConfigManagerProperties::getPropertyContentByName("form_max_length_email"));
         $ctrls["email"]->setTemplateFileName("lbox_form_control_email.html");
         $ctrls["email"]->setRequired();
         $ctrls["email"]->addValidator(new LBoxFormValidatorEmail());
         $ctrls["message"] = new LBoxFormControlFill("message", "zpráva");
         $ctrls["message"]->setTemplateFileName("lbox_form_control_message.html");
         $ctrls["message"]->setRequired();
         $ctrlGroup = new LBoxFormControlMultiple("contact-info");
         foreach ($ctrls as $name => $ctrl) {
             if ($name == "message") {
                 continue;
             }
             $ctrlGroup->addControl($ctrl);
         }
         $form = new LBoxForm("contact");
         $form->setTemplateFileName("lbox_form_contact.html");
         $form->addProcessor(new LBoxFormProcessorContact());
         $form->addProcessor(new LBoxFormProcessorContactStoreToDB());
         $form->addControl($ctrlGroup);
         $form->addControl($ctrls["message"]);
         return $this->form = $form;
     } catch (Exception $e) {
         throw $e;
     }
 }
 public function prepare($name = "", $value = NULL)
 {
     try {
         $classNameInstance = get_class($this->instance);
         $editURLFilterColname = strlen($this->editURLFilterColname) > 0 ? $this->editURLFilterColname : eval("return {$classNameInstance}::\$idColName;");
         switch ($name) {
             case "url_detail":
                 if (strlen($this->propertyNameRefPageDetail) < 1) {
                     return $this->instance->getParamDirect($this->editURLFilterColname);
                 }
                 return LBoxConfigManagerStructure::getInstance()->getPageById(LBoxConfigManagerProperties::getPropertyContentByName($this->propertyNameRefPageDetail))->url . ":" . $this->instance->getParamDirect($this->editURLFilterColname);
                 break;
             default:
                 return $value;
         }
     } catch (Exception $e) {
         throw $e;
     }
 }
Example #25
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);
 }
 public function process()
 {
     try {
         if (count($this->patternPropertyNames) < 1) {
             throw new LBoxExceptionFormProcessor(LBoxExceptionFormProcessor::MSG_INSTANCE_VAR_ARRAY_NOTNULL, LBoxExceptionFormProcessor::CODE_BAD_INSTANCE_VAR);
         }
         if (count($this->patternPropertyNames) < 2) {
             $patternDefault = LBoxConfigManagerProperties::gpcn(current($this->patternPropertyNames));
         }
         $patternPCRES = array();
         foreach ($this->patternPropertyNames as $patternPropertyName) {
             $patternPCRES[] = "/" . str_ireplace("<url_param>", "([\\w-_\\.\\/\\\\ěščřžýáíéůúřťňĚďŠČŘŽÝÁÍÉŮÚŘŤĎŇ]+)", LBoxConfigManagerProperties::gpcn($patternPropertyName)) . "/";
         }
         $reloadParams = array();
         foreach ($this->form->getControls() as $control) {
             if (count($this->patternPropertyNames) > 1 && !array_key_exists($control->getName(), $this->patternPropertyNames)) {
                 continue;
             }
             $pattern = "";
             $pattern = $patternDefault ? $patternDefault : LBoxConfigManagerProperties::gpcn($this->patternPropertyNames[$control->getName()]);
             switch (true) {
                 case $control instanceof LBoxFormControlMultiple:
                 case $control instanceof LBoxFormControlSpamDefense:
                     continue;
                     break;
                 default:
                     if ($control->getValue() && strlen(trim($control->getValue())) > 0) {
                         $reloadParams[] = str_replace("<url_param>", $control->getValue(), $pattern);
                     }
             }
         }
         if (count($reloadParams) > 0) {
             LBoxFront::reload(LBoxUtil::getURLWithParams($reloadParams, LBoxUtil::getURLWithoutParamsByPattern($patternPCRES)));
         } else {
             LBoxFront::reload(LBoxUtil::getURLWithoutParamsByPattern($patternPCRES));
         }
     } catch (Exception $e) {
         throw $e;
     }
 }
Example #27
0
 /**
  * getter na form editace ankety
  * @return LBoxForm
  */
 public function getForm()
 {
     try {
         if ($this->form instanceof LBoxForm) {
             return $this->form;
         }
         $controls["is_active"] = new LBoxFormControlBool("is_active", "Aktivní", $this->getInquiry() ? $this->getInquiry()->is_active : 0);
         $controls["question"] = new LBoxFormControlFill("question", "Otázka", $this->getInquiry() ? $this->getInquiry()->question : "");
         $controls["question"]->setTemplateFileName("lbox_form_control_admin_inquiry_question.html");
         $controls["question"]->addFilter(new LBoxFormFilterTrim());
         $controls["question"]->setRequired();
         $controls["question"]->setDisabled((bool) $this->getInquiry());
         $inquiryOptions = $this->getInquiryOptions();
         for ($i = 1; $i <= LBoxConfigManagerProperties::getPropertyContentByName("inquiries_answers_count"); $i++) {
             $controlsAnswers["answer-{$i}"] = new LBoxFormControlFill("answer-{$i}", "Odpověď {$i}", $inquiryOptions[$i]);
             $controlsAnswers["answer-{$i}"]->addFilter(new LBoxFormFilterTrim());
             $controlsAnswers["answer-{$i}"]->setDisabled((bool) $this->getInquiry());
         }
         $controls["answers"] = new LBoxFormControlMultiple("answers", NULL);
         foreach ($controlsAnswers as $controlAnswer) {
             $controls["answers"]->addControl($controlAnswer);
         }
         $controls["answers"]->setTemplateFileName("lbox_form_control_admin_inquiries_answers.html");
         $controls["answers"]->addValidator(new LBoxFormValidatorInquiriesAnswers());
         if ($this->getInquiry()) {
             $controls["id"] = new LBoxFormControlFillHidden("id", "", $this->getInquiry()->id);
         }
         $form = new LBoxForm("edit-inquiry", "post", "editace ankety", "ulož");
         foreach ($controls as $control) {
             $form->addControl($control);
         }
         $form->addProcessor(new LBoxFormProcessorAdminInquiryEdit());
         return $this->form = $form;
     } catch (Exception $e) {
         throw $e;
     }
 }
Example #28
0
 /**
  * pretizeno o dalsi kontroly vztahujici se pouze na metanodes
  * @return bool
  */
 public function isToShow()
 {
     try {
         if (!parent::isToShow()) {
             return false;
         }
         $forbiddenXTRoles = explode(",", LBoxConfigManagerProperties::getPropertyContentByName("metanodes_forbidden_xtroles"));
         array_walk($forbiddenXTRoles, "trim");
         foreach ($forbiddenXTRoles as $forbiddenXTRole) {
             if (LBoxXTDBFree::isLogged()) {
                 if (trim($forbiddenXTRole) == LBoxXTDBFree::getUserXTRecord()->ref_xtrole) {
                     return false;
                 }
             } else {
                 if (trim($forbiddenXTRole) == LBoxXTProject::getUserXTRoleRecord()->id) {
                     return false;
                 }
             }
         }
         return true;
     } catch (Exception $e) {
         throw $e;
     }
 }
 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);
     }
 }
Example #30
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;
     }
 }