public function process() { try { $parent = new DiscussionsRecord($this->form->getControlByName("pid")->getValue()); $record = new DiscussionsRecord(); $classNameRecord = get_class($record); foreach ($this->form->getControls() as $control) { if ($control instanceof LBoxFormControlMultiple) { continue; } if ($control instanceof LBoxFormControlSpamDefense) { continue; } if ($control->getName() == "pid") { continue; } if ($control->getName() == eval("return {$classNameRecord}::\$idColName;")) { continue; } $colName = $control->getName(); $record->{$colName} = strlen($control->getValue()) > 0 ? $control->getValue() : "<<NULL>>"; } $record->pageId = LBoxFront::getPage()->id; $record->store(); $parent->addChild($record); // u odpovedi reloadovat na hlavni vlakno if ($parent->hasParent()) { LBoxFront::reload(LBoxUtil::getURLWithoutParamsByPattern(array("/" . $this->patternURLParamReplyTo . "/"))); } } 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) { if (!$this->record instanceof AbstractRecord) { throw new LBoxExceptionOutputFilter(LBoxExceptionOutputFilter::MSG_INSTANCE_VAR_INSTANCE_CONCRETE_NOTNULL, LBoxExceptionOutputFilter::CODE_BAD_INSTANCE_VAR); } switch ($name) { case "rssURL": if ($this->instance->rss) { $rssPageUrl = LBoxConfigManagerStructure::getInstance()->getPageById($this->instance->rss)->url; $pageId = $this->instance->page->id; return "{$rssPageUrl}:{$pageId}/" . LBoxFront::getLocationUrlParam(); } break; case "getForm": $parentId = NULL; foreach (LBoxFront::getUrlParamsArray() as $param) { if (preg_match("/" . $this->patternURLParamReplyTo . "/", $param, $matches)) { $parentId = $matches[1]; } } if ($parentId) { $record = new DiscussionsRecord($parentId); if (!$record->isInDatabase()) { LBoxFront::reload(LBoxUtil::getURLWithoutParamsByPattern(array("/" . $this->patternURLParamReplyTo . "/"))); } $record->setOutputFilter(new OutputFilterDiscussionRecord($record)); return $record->getForm(); } else { return $this->record->getForm(); } break; default: return $value; } }
/** * vraci current language colname podle konvenci * @param string $name puvodni nazev parametru * @return mixed */ protected function getColNameLNGCurrent($name) { try { return $name . "_" . LBoxFront::getDisplayLanguage(); } catch (Exception $e) { throw $e; } }
public function process() { try { LBoxFront::reload(LBoxUtil::getURLWithParams(array("edit-" . $this->form->getName()))); } catch (Exception $e) { throw $e; } }
/** * Vrati kompletni logout URL * @return string * @throws Exception */ public function getURLLogout() { try { return LBoxUtil::getURLWithParams(array(LBoxFront::getURLParamNameLogout()), LBoxUtil::getURLWithoutParams(array(LBoxFront::getURLParamNameLogout()))); } catch (Exception $e) { throw $e; } }
public function process() { try { $pid = $this->form->getControlByName("pid")->getValue(); LBoxFront::reload(LBoxUtil::getURLWithParams(array("replyto-{$pid}"), LBoxUtil::getURLWithoutParamsByPattern(array("/" . $this->patternURLParamReplyTo . "/"))) . "#frm-discussion-{$pid}-post"); } catch (Exception $e) { throw $e; } }
/** * * @return string */ protected function getURLHash() { try { foreach (LBoxFront::getUrlParamsArray() as $param) { return $param; } } catch (Exception $e) { throw $e; } }
/** * kontrola validity * @param LBoxFormControl $control * @return bool */ protected function isValid(LBoxFormControl $control) { try { new recaptcha(); $dataPost = LBoxFront::getDataPost(); $this->resp = recaptcha_check_answer($this->getKeyPrivate(), LBOX_REQUEST_IP, $dataPost["recaptcha_challenge_field"], $dataPost["recaptcha_response_field"]); return $this->resp->is_valid; } catch (Exception $e) { throw $e; } }
public function executeInit() { try { parent::executeInit(); if ($this->config->getChildNodesIterator()) { LBoxFront::reload($this->config->getChildNodesIterator()->current()->url); } } catch (Exception $e) { throw $e; } }
/** * 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; } }
public function commitProcessSuccess() { try { $cookieName = self::$cookieName; $cookieName = str_replace("<formName>", $this->control->getForm()->getName(), $cookieName); // ulozit zaznam do session a cookie @LBoxFront::setCookie($cookieName, (string) time(), time() + self::$cookiePersistenceDays * 24 * 60 * 60, "/"); $_SESSION[$cookieName] = (string) time(); } catch (Exception $e) { throw $e; } }
/** * returns URL param location * @return string */ protected function getLocationUrlParam() { try { foreach ($this->getUrlParamsArray() as $param) { if (LBoxFront::isUrlParamPaging($param)) { continue; } return $param; } return ""; } catch (Exception $e) { throw $e; } }
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; } }
/** * getter na fotogalerii * @return PhotogalleriesRecord */ protected function getPhotogallery() { try { if (!$this->photoGallery instanceof PhotogalleriesRecord) { $this->photoGallery = LBoxFront::getPage()->getRecord(); } if (!$this->photoGallery instanceof PhotogalleriesRecord) { $class = get_class($this); throw new LBoxExceptionPage("You have to set photogallery database record via setPhotoGalleryRecord() setter before get values via '{$class}' instance!"); } return $this->photoGallery; } catch (Exception $e) { throw $e; } }
/** * pretizeno o kontrolu vzhledem k multilang */ public function getDOM() { try { if ($this->dom instanceof DOMDocument) { return $this->dom; } $configNameBase = $this->configName; try { $this->configName .= "." . LBoxFront::getDisplayLanguage(); return parent::getDOM(); } catch (Exception $e) { $this->configName = $configNameBase; return parent::getDOM(); } } catch (Exception $e) { throw $e; } }
/** * zjistuje, jestli je na aktualne zobrazene strance povolen resize * @return bool */ public function isAllowedResize() { try { $pagesAllowedResize = LBoxConfigManagerProperties::getPropertyContentByName("metanodes_allow_resize_pages"); $pagesAllowedResizeArr = explode(" ", $pagesAllowedResize); foreach ($pagesAllowedResizeArr as $pageAllowedResize) { $pageAllowedResize = trim($pageAllowedResize); switch (true) { case strtolower($pageAllowedResize) == "all": case $pageAllowedResize == LBoxFront::getPage()->id: return true; break; } } return false; } catch (Exception $e) { throw $e; } }
public function prepare($name = "", $value = NULL) { try { switch ($name) { case "rssURL": $rssPageId = $this->instance->rss; $rssPageUrl = LBoxConfigManagerStructure::getInstance()->getPageById($rssPageId)->url; $pageId = $this->instance->page->id; return "{$rssPageUrl}:{$pageId}/" . LBoxFront::getLocationUrlParam(); break; default: return $value; } } catch (Exception $e) { if ($e->getCode() == LBoxExceptionConfig::CODE_NODE_BYID_NOT_FOUND) { throw new LBoxExceptionConfig("Discussion component 'rss' " . LBoxExceptionConfig::MSG_ATTRIBUTE_WRONG, LBoxExceptionConfig::CODE_ATTRIBUTE_WRONG); } throw $e; } }
/** * * @param string $type node type * @param int $seq node order on page * @param LBoxComponent $caller * @param string $lng * @return LBoxMetanode */ public static function getNode($type = "", $seq = 1, LBoxComponent $caller, $lng = "") { try { if (!is_int($seq) || $seq < 1) { throw new LBoxExceptionMetanodes("\$seq: " . LBoxExceptionMetanodes::MSG_PARAM_INT_NOTNULL, LBoxExceptionMetanodes::CODE_BAD_PARAM); } if (strlen($type) < 1) { throw new LBoxExceptionMetanodes(LBoxExceptionMetanodes::MSG_PARAM_STRING_NOTNULL, LBoxExceptionMetanodes::CODE_BAD_PARAM); } if (strlen($lng) < 1) { $lng = LBoxFront::getDisplayLanguage(); } // get node className switch (strtolower($type)) { case self::NODES_TYPE_INT: $nodeClassName = "LBoxMetanodeInt"; break; case self::NODES_TYPE_STRING: $nodeClassName = "LBoxMetanodeString"; break; case self::NODES_TYPE_RICHTEXT: $nodeClassName = "LBoxMetanodeRichText"; break; default: throw new LBoxExceptionMetanodes("{$type}: " . LBoxExceptionMetanodes::MSG_NODETYPE_UNRECOGNIZED, LBoxExceptionMetanodes::CODE_NODETYPE_UNRECOGNIZED); } // try cache var $callerType = $caller instanceof LBoxPage ? "pages" : "components"; if (array_key_exists($callerType, self::$cache) && array_key_exists($caller->config->id, self::$cache[$callerType]) && array_key_exists($seq, self::$cache[$callerType][$caller->config->id])) { if (self::$cache[$callerType][$caller->config->id][$seq] instanceof LBoxMetanode) { // check propability of second call for same metanode of another node type if (self::$cache[$callerType][$caller->config->id][$seq] instanceof $nodeClassName) { return self::$cache[$callerType][$caller->config->id][$seq]; } } } return self::$cache[$callerType][$caller->config->id][$seq] = new $nodeClassName($seq, $caller, $lng); } catch (Exception $e) { throw $e; } }
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; } }
/** * vraci jestli uz uzivatel hlasoval pro tuto anketu * - podle cookie * @return bool */ public function didUserVotedForByCookie() { try { $cookieName = "lbox-inquiry-voted-in-" . $this->instance->id; // session if (array_key_exists($cookieName, $_SESSION)) { if (strlen((string) $_SESSION[$cookieName]) > 0) { @LBoxFront::setCookie($cookieName, (string) time(), time() + LBoxFormValidatorSubmitedYetCookie::$cookiePersistenceDays * 24 * 60 * 60, "/"); return true; } } // cookie if (array_key_exists($cookieName, $_COOKIE)) { if (strlen((string) $_COOKIE[$cookieName]) > 0) { $_SESSION[$cookieName] = (string) time(); return true; } } return false; } catch (Exception $e) { throw $e; } }
/** * pretizeno o kontrolu vzhledem k multilang */ public function getDOM() { try { if ($this->dom instanceof DOMDocument) { return $this->dom; } $configNameBase = $this->configName; try { $this->configName .= "." . LBoxFront::getDisplayLanguage(); return parent::getDOM(); } catch (Exception $e) { try { $this->configName = $configNameBase; return parent::getDOM(); } catch (Exception $e) { if ($e->getCode() == LBoxExceptionConfig::CODE_TYPE_NOT_FOUND) { die($this->configName . ".xml not found due to langdomain did not recognized!"); } } } } 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); } }
<?php DEFINE("XT_GROUP", 1); require "../../../../lBox/lib/loader.php"; session_start(); LBoxCacheManagerFront::getInstance()->switchListeningOff(); // check xt session if (!LBoxXTDBFree::isLogged(XT_GROUP) && !LBoxXTProject::isLoggedAdmin(XT_GROUP)) { header("HTTP/1.1 404 Not Found"); die; } $post = LBoxFront::getDataPost(); $postFormData = current($post); // firePHP debug //LBoxFirePHP::table($post, 'POST data debug'); try { ////////////////////////////////////////////////////////////////////// // saving data ////////////////////////////////////////////////////////////////////// foreach ($post as $formID => $data) { $typeRecord = $data["type"]; $idColname = eval("return {$typeRecord}::\$idColName;"); $flagEdit = strlen($postFormData[$idColname]) > 0; $record = strlen($postFormData[$idColname]) < 1 ? new $typeRecord() : new $typeRecord($postFormData[$idColname]); $form = LBoxMetaRecordsManager::getMetaRecord($record)->getForm(); $form->setDoNotReload(true); $form->toString($forceThrow = true); $ret = new stdclass(); // PHP base class // check controls validations errors $exceptions = array();
/** * preneseni commit success z formu na validatory */ public function commitProcessSuccess() { try { foreach ($this->validators as $validator) { $validator->commitProcessSuccess(); } // uchovat hodnotu pro pripadnou persistenci $_SESSION["LBox"]["Forms"][$this->form->getName()]["Controls"][$this->getName()]["value"][LBoxFront::getPage()->url] = $this->getValue(); } catch (Exception $e) { throw $e; } }
/** * @throws LBoxExceptionForm */ public function process() { try { if (!$this->wasSent()) { return; } // zkontrolovat, jestli mame nastaven procesor if (!$this->isSubForm() && count($this->processors) < 1) { throw new LBoxExceptionForm(LBoxExceptionForm::MSG_FORM_PROCESSOR_DOESNOT_EXISTS, LBoxExceptionForm::CODE_FORM_PROCESSOR_DOESNOT_EXISTS); } if ($this->isAntiSpamSet()) { if (!$this->getSpamDefenseControl()->process()) { return; } } // spustit checking controls $controlInvalid = false; foreach ($this->controls as $control) { if ($control->getName() == $this->getSpamDefenseControl()->getName()) { continue; } if (!$control->process()) { $controlInvalid = true; } } if ($controlInvalid) { return; } // spustit processory foreach ($this->processors as $processor) { $processor->process(); } // oznamit controls uspesne dokonceny processing foreach ($this->controls as $control) { $control->commitProcessSuccess(); } // nastavit do session uspesne odeslani a reloadovat stranku if (!$this->doNotReload) { if (strtolower($this->method) == "post") { $this->sentSucces = true; $_SESSION["LBox"]["Forms"][$this->getName()]["succes"] = true; if (!$this->isSubForm()) { LBoxFront::reload(); } } } else { //vynulovat pole a nastavit, ze byl uspesne proveden foreach ($this->controls as $control) { $control->setValue(""); } $this->sentSucces = true; } } catch (Exception $e) { throw $e; } }
/** * Vraci config home page * @return LBoxConfigItemStructure * @throws LBoxException */ public function getHomePageCfg() { try { $page = LBoxConfigManagerStructure::getInstance()->getHomePage(); if (LBoxFront::getPage()->config->getOutputFilter() instanceof LBoxOutputFilter) { $outputFilterClassName = get_class(LBoxFront::getPage()->config->getOutputFilter()); $page->setOutputFilter(new $outputFilterClassName($page)); } return $page; } catch (Exception $e) { throw $e; } }
/** * vraci, jestli je cache na aktualni strance zapnuta * @return bool */ public function isCacheON() { try { switch (true) { case !LBoxConfigManagerProperties::gpcn("cache_front"): case LBoxFront::getPage()->cache_off: case LBoxFront::getPage()->cache_only_notlogged && LBoxXTProject::isLogged(): return false; break; default: return true; } } catch (Exception $e) { throw $e; } }
public function process() { try { $parent = NULL; if (strlen($this->fileNamesTemplatePagesTypesPattern) < 1) { throw new LBoxExceptionFormProcessor(LBoxExceptionFormProcessor::MSG_INSTANCE_VAR_STRING_NOTNULL, LBoxExceptionFormProcessor::CODE_BAD_INSTANCE_VAR); } if (strlen($this->form->getControlByName("id")->getValue()) > 0) { $configItem = LBoxConfigManagerStructure::getInstance()->getPageById($this->form->getControlByName("id")->getValue()); // smazat cache pro existujici stranku na jeji puvodni URL jeste pred moznou zmenou! LBoxCacheManagerFront::getInstance()->cleanAllURLs(true); if ($parentID = $this->form->getControlByName("parent_id")->getValue()) { $parent = LBoxConfigManagerStructure::getInstance()->getPageById($parentID); } } else { try { if (LBoxConfigManagerStructure::getInstance()->getPageByUrl($this->form->getControlByName("url")->getValue())) { throw new LBoxExceptionConfigStructure("URL: " . LBoxExceptionConfigStructure::MSG_ATTRIBUTE_UNIQUE_NOT_UNIQUE, LBoxExceptionConfigStructure::CODE_ATTRIBUTE_UNIQUE_NOT_UNIQUE); } } catch (Exception $e) { switch ($e->getCode()) { case LBoxExceptionConfigStructure::CODE_NODE_BYURL_NOT_FOUND: NULL; break; default: throw $e; } } if ($parentID = $this->form->getControlByName("parent_id")->getValue()) { $parent = LBoxConfigManagerStructure::getInstance()->getPageById($parentID); // zaridi parental vztah jen pri vytvareni (nutno kvuli odvozeni ID) - pro editaci je dodatecne prirazeni nize $configItem = LBoxConfigStructure::getInstance()->getCreateChild($parent, $this->form->getControlByName("url")->getValue()); } else { $configItem = LBoxConfigStructure::getInstance()->getCreateItem($this->form->getControlByName("url")->getValue()); } } foreach ($this->form->getControls() as $control) { if ($control instanceof LBoxFormControlMultiple) { continue; } $name = $control->getName(); switch ($name) { case "id": case "parent_id": case "move_before": NULL; break; case "type": $configItem->template = str_replace("(.+)", $control->getValue(), $this->fileNamesTemplatePagesTypesPattern); $configItem->template = preg_replace("/[^\\w_\\-\\.]/", "", $configItem->template); break; case "url": if ($parent) { $configItem->{$name} = "/" . $parent->url . "/" . $control->getValue() . "/"; $configItem->{$name} = preg_replace("/(\\/+)/", "/", $configItem->{$name}); } else { $configItem->{$name} = "/" . $control->getValue() . "/"; $configItem->{$name} = preg_replace("/(\\/+)/", "/", $configItem->{$name}); } break; default: $configItem->{$name} = $control->getValue(); } } // move before a parent_id // - je treba dodatecne zajistit parental vztah, pri editaci horni logika to zajistuje pouze pri vytvareni, ale ne pri editaci switch (true) { // editace + parent puvodne nemel tohoto potomka case $this->form->getControlByName("id")->getValue() && $this->form->getControlByName("parent_id")->getValue() > 0 && !LBoxConfigManagerStructure::getInstance()->getPageById($this->form->getControlByName("parent_id")->getValue())->isParentOf($configItem): LBoxConfigManagerStructure::getInstance()->getPageById($this->form->getControlByName("parent_id")->getValue())->appendChild($configItem); break; // parent neni nastaven, jde o editaci a predtim nastaven byl // parent neni nastaven, jde o editaci a predtim nastaven byl case !$this->form->getControlByName("parent_id")->getValue() && $configItem->hasParent(): // uprednostnit removeFromTree() $configItem->removeFromTree(); break; // editace + move before je nastaveno na jiny node nez bylo // editace + move before je nastaveno na jiny node nez bylo case $this->form->getControlByName("move_before")->getValue() && $this->form->getControlByName("id")->getValue() && (!$configItem->hasSiblingBefore() || $configItem->getSiblingBefore()->id != $this->form->getControlByName("move_before")->getValue()): // vlozeni + moveBefore je nastaveno // vlozeni + moveBefore je nastaveno case $this->form->getControlByName("move_before")->getValue() && $this->form->getControlByName("id")->getValue(): // uprednostnit insertBefore() LBoxConfigManagerStructure::getInstance()->getPageById($this->form->getControlByName("move_before")->getValue())->insertBefore($configItem); break; // parent je nastaven // parent je nastaven case $this->form->getControlByName("parent_id")->getValue(): // uprednostnit appendChild() LBoxConfigManagerStructure::getInstance()->getPageById($this->form->getControlByName("parent_id")->getValue())->appendChild($configItem); break; default: $configItem->removeFromTree(); } LBoxConfigStructure::getInstance()->store(); // pro jistotu smazani front cache stranky na jeji potencialne zmenene URL (mohly by tam byt data z minulosti) LBoxCacheManagerFront::getInstance()->cleanAllURLs(true); //reload na nove ulozenou stranky LBoxFront::reload(LBoxConfigManagerStructure::getInstance()->getPageById($configItem->id)->url); } catch (Exception $e) { throw $e; } }