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; } }
/** * * @return string */ protected function getURLHash() { try { foreach (LBoxFront::getUrlParamsArray() as $param) { return $param; } } catch (Exception $e) { throw $e; } }
/** * Vraci v poli vsechny URL params, za separator povazuje / * @return string */ protected function getUrlParamsArray() { return LBoxFront::getUrlParamsArray(); }
/** * getter na potomky, ktere budou v prvni urovni prispevku serazeny sestupne * @return DiscussionsRecords */ public function getChildren() { try { if ($this->children instanceof AbstractRecords || $this->records instanceof LBoxPagingIterator) { return $this->children; } $treeColNames = $this->getClassVar("treeColNames"); $parentId = NULL; foreach (LBoxFront::getUrlParamsArray() as $param) { if (preg_match("/" . $this->patternURLParamReplyTo . "/", $param, $matches)) { $parentId = $matches[1]; } } if (!$this->hasParent() && $parentId) { // replyto $this->children = new DiscussionsRecordsNotTree(array($this->getClassVar("idColName") => $parentId)); $this->children->setOutputFilterItemsClass("OutputFilterDiscussionRecord"); } else { // strankovany vypis z rootu if (!$this->hasParent() && is_numeric($pageItems = LBoxConfigManagerProperties::gpcn("discussion_paging_pageitems")) && $pageItems > 0) { $this->children = new LBoxPagingIteratorRecords("DiscussionsRecordsNotTree", $pageItems, get_class($this->outputFilter), array($treeColNames[2] => $this->getParamDirect($this->getClassVar("idColName"))), array($treeColNames[0] => 0)); } else { $this->children = parent::getChildren(false, $this->hasParent() ? array($treeColNames[0] => 1) : array($treeColNames[0] => 0)); } } return $this->children; } catch (Exception $e) { throw $e; } }
/** * vraci URL param relevantni k teto instanci * @return string */ protected function getURLParam() { try { foreach (LBoxFront::getUrlParamsArray() as $param) { if (preg_match($this->getPatternURLParam(), $param)) { return $param; } } } catch (Exception $e) { throw $e; } }
/** * getter na prvni URL param * @return string */ public static function getURLParamByPatternProperty($propertyName = "") { try { if (strlen($propertyName) < 1) { throw new LBoxExceptionPage(LBoxExceptionPage::MSG_PARAM_STRING_NOTNULL, LBoxExceptionPage::CODE_BAD_PARAM); } $pattern = LBoxConfigManagerProperties::getPropertyContentByName($propertyName); $pattern = str_ireplace("<url_param>", "([\\w-_\\.\\/\\\\ěščřžýáíéůúřťňĚďŠČŘŽÝÁÍÉŮÚŘŤĎŇ]+)", $pattern); foreach (LBoxFront::getUrlParamsArray() as $param) { if (preg_match("/{$pattern}/", $param, $matches)) { return $matches[1]; } } } catch (Exception $e) { throw $e; } }
/** * getter na URL param * @return string */ protected function getRecordURLParam() { try { if (strlen($this->propertyNamePatternURLParam) > 0) { return LBoxUtil::getURLParamByPatternProperty($this->propertyNamePatternURLParam); } else { foreach (LBoxFront::getUrlParamsArray() as $param) { return $param; } } } catch (Exception $e) { throw $e; } }
/** * getter na URL param zaznamu * @return string */ protected function getURLParamRecord() { try { foreach (LBoxFront::getUrlParamsArray() as $param) { if (LBoxFront::isUrlParamPaging($param)) { continue; } return $param; } } catch (Exception $e) { throw $e; } }