/** * Adds the code to load the portaleditor * * @param string $strReturn * * @return string */ private function addPortaleditorCode($strReturn) { $objNavigation = new class_module_navigation_tree($this->arrElementData["navigation_id"]); //Add pe code $arrPeConfig = array("pe_module" => "navigation", "pe_action_edit" => "list", "pe_action_edit_params" => "&systemid=" . $this->arrElementData["navigation_id"], "pe_action_new" => "", "pe_action_new_params" => "", "pe_action_delete" => "", "pe_action_delete_params" => ""); $arrPeConfigAutoNavigation = array("pe_module" => "pages", "pe_action_edit" => "list", "pe_action_edit_params" => "&systemid=" . $objNavigation->getStrFolderId(), "pe_action_new" => "", "pe_action_new_params" => "", "pe_action_delete" => "", "pe_action_delete_params" => ""); //only add the code, if not auto-generated if (!validateSystemid($objNavigation->getStrFolderId())) { $strReturn = class_element_portal::addPortalEditorCode($strReturn, $this->arrElementData["navigation_id"], $arrPeConfig); } else { $strReturn = class_element_portal::addPortalEditorCode($strReturn, $this->arrElementData["navigation_id"], $arrPeConfigAutoNavigation); } return $strReturn; }
/** * Returns a list of comments. * * @return string * @permissions view */ protected function actionList() { $strReturn = ""; $strPosts = ""; $strForm = ""; $strNewButton = ""; //pageid or systemid to filter? $strSystemidfilter = ""; $strPagefilter = $this->strPagefilter; if ($this->getSystemid() != "") { $strSystemidfilter = $this->getSystemid(); } if ($strPagefilter === null && class_module_pages_page::getPageByName($this->getPagename()) !== null) { $strPagefilter = class_module_pages_page::getPageByName($this->getPagename())->getSystemid(); } $intNrOfPosts = isset($this->arrElementData["int1"]) ? $this->arrElementData["int1"] : 0; //Load all posts $objArraySectionIterator = new class_array_section_iterator(class_module_postacomment_post::getNumberOfPostsAvailable(true, $strPagefilter, $strSystemidfilter, $this->getStrPortalLanguage())); $objArraySectionIterator->setIntElementsPerPage($intNrOfPosts); $objArraySectionIterator->setPageNumber((int) ($this->getParam("pvPAC") != "" ? $this->getParam("pvPAC") : 1)); $objArraySectionIterator->setArraySection(class_module_postacomment_post::loadPostList(true, $strPagefilter, $strSystemidfilter, $this->getStrPortalLanguage(), $objArraySectionIterator->calculateStartPos(), $objArraySectionIterator->calculateEndPos())); //params to add? $strAdd = ""; if ($this->getParam("action") != "") { $strAdd .= "&action=" . $this->getParam("action"); } if ($this->getParam("systemid") != "") { $strAdd .= "&systemid=" . $this->getParam("systemid"); } if ($this->getParam("pv") != "") { $strAdd .= "&pv=" . $this->getParam("pv"); } $arrComments = $this->objToolkit->simplePager($objArraySectionIterator, $this->getLang("commons_next"), $this->getLang("commons_back"), "", $this->getPagename(), $strAdd, "pvPAC"); $strTemplateID = $this->objTemplate->readTemplate("/module_postacomment/" . $this->arrElementData["char1"], "postacomment_post"); if (!$objArraySectionIterator->valid()) { $strPosts .= $this->getLang("postacomment_empty"); } //Check rights /** @var class_module_postacomment_post $objOnePost */ foreach ($objArraySectionIterator as $objOnePost) { if ($objOnePost->rightView()) { $strOnePost = ""; $arrOnePost = array(); $arrOnePost["postacomment_post_name"] = $objOnePost->getStrUsername(); $arrOnePost["postacomment_post_subject"] = $objOnePost->getStrTitle(); $arrOnePost["postacomment_post_message"] = $objOnePost->getStrComment(); $arrOnePost["postacomment_post_systemid"] = $objOnePost->getSystemid(); $arrOnePost["postacomment_post_date"] = timeToString($objOnePost->getIntDate(), true); //ratings available? if ($objOnePost->getFloatRating() !== null) { /** @var $objRating class_module_rating_portal */ $objRating = class_module_system_module::getModuleByName("rating")->getPortalInstanceOfConcreteModule(); $arrOnePost["postacomment_post_rating"] = $objRating->buildRatingBar($objOnePost->getFloatRating(), $objOnePost->getIntRatingHits(), $objOnePost->getSystemid(), $objOnePost->isRateableByUser(), $objOnePost->rightRight2()); } $strOnePost .= $this->objTemplate->fillTemplate($arrOnePost, $strTemplateID, false); //Add pe code $arrPeConfig = array("pe_module" => "postacomment", "pe_action_edit" => "edit", "pe_action_edit_params" => "&systemid=" . $objOnePost->getSystemid(), "pe_action_new" => "", "pe_action_new_params" => "", "pe_action_delete" => "delete", "pe_action_delete_params" => "&systemid=" . $objOnePost->getSystemid()); $strPosts .= class_element_portal::addPortalEditorCode($strOnePost, $objOnePost->getSystemid(), $arrPeConfig); } } //Create form if ($this->getObjModule()->rightRight1()) { $strTemplateID = $this->objTemplate->readTemplate("/module_postacomment/" . $this->arrElementData["char1"], "postacomment_form"); $arrForm = array(); if ($this->getParam("comment_name") == "" && $this->objSession->isLoggedin()) { $this->setParam("comment_name", $this->objSession->getUsername()); } $arrForm["formaction"] = class_link::getLinkPortalHref($this->getPagename(), "", "postComment", "", $this->getSystemid()); $arrForm["comment_name"] = $this->getParam("comment_name"); $arrForm["comment_subject"] = $this->getParam("comment_subject"); $arrForm["comment_message"] = $this->getParam("comment_message"); $arrForm["comment_template"] = $this->arrElementData["char1"]; $arrForm["comment_systemid"] = $this->getSystemid(); $arrForm["comment_page"] = $this->getPagename(); $arrForm["validation_errors"] = $this->strErrors; foreach ($arrForm as $strKey => $strValue) { if (uniStrpos($strKey, "comment_") !== false) { $arrForm[$strKey] = htmlspecialchars($strValue, ENT_QUOTES, "UTF-8", false); } } $strForm .= $this->objTemplate->fillTemplate($arrForm, $strTemplateID, false); //button to show the form $strTemplateNewButtonID = $this->objTemplate->readTemplate("/module_postacomment/" . $this->arrElementData["char1"], "postacomment_new_button"); $strNewButton = $this->objTemplate->fillTemplate(array("comment_systemid" => $this->getSystemid()), $strTemplateNewButtonID, false); } //add sourrounding list template $strTemplateID = $this->objTemplate->readTemplate("/module_postacomment/" . $this->arrElementData["char1"], "postacomment_list"); //link to the post-form & pageview links $arrTemplate = array(); $arrTemplate["postacomment_forward"] = $arrComments["strForward"]; $arrTemplate["postacomment_pages"] = $arrComments["strPages"]; $arrTemplate["postacomment_back"] = $arrComments["strBack"]; $arrTemplate["postacomment_form"] = $strForm; $arrTemplate["postacomment_new_button"] = $strNewButton; $arrTemplate["postacomment_systemid"] = $this->getSystemid(); $arrTemplate["postacomment_list"] = $strPosts; $strReturn .= $this->fillTemplate($arrTemplate, $strTemplateID); return $strReturn; }
/** * Creates the detailed-view of news * * @return string */ protected function actionNewsDetail() { $strReturn = ""; /** @var $objNews class_module_news_news */ $objNews = class_objectfactory::getInstance()->getObject($this->getSystemid()); if ($objNews != null && $objNews instanceof class_module_news_news && $objNews->rightView() && $objNews->getIntRecordStatus() == "1") { //see if we should generate a redirect instead if ($objNews->getIntRedirectEnabled() == "1" && $objNews->getStrRedirectPage() != "") { $this->portalReload(class_link::getLinkPortalHref($objNews->getStrRedirectPage())); return "<script type='text/javascript'>window.location.replace('" . class_link::getLinkPortalHref($objNews->getStrRedirectPage()) . "');</script>"; } //Load record $objMapper = new class_template_mapper($objNews); $objMapper->addPlaceholder("news_back_link", "<a href=\"javascript:history.back();\">" . $this->getLang("news_zurueck") . "</a>"); $objMapper->addPlaceholder("news_start_date", dateToString($objNews->getObjStartDate(), false)); $objMapper->addPlaceholder("news_id", $objNews->getSystemid()); $objMapper->addPlaceholder("news_title", $objNews->getStrTitle()); $objMapper->addPlaceholder("news_intro", $objNews->getStrIntro()); $objMapper->addPlaceholder("news_text", $objNews->getStrText()); //postacomment $arrPAC = $this->loadPostacomments($objNews->getSystemid(), $objNews->getStrImage() != "" ? "news_detail_image" : "news_detail"); if ($arrPAC != null) { $objMapper->addPlaceholder("news_nrofcomments", $arrPAC["nrOfComments"]); $objMapper->addPlaceholder("news_commentlist", $arrPAC["commentList"]); } //ratings if ($objNews->getFloatRating() !== null) { /** @var $objRating class_module_rating_portal */ $objRating = class_module_system_module::getModuleByName("rating")->getPortalInstanceOfConcreteModule(); $objMapper->addPlaceholder("news_rating", $objRating->buildRatingBar($objNews->getFloatRating(), $objNews->getIntRatingHits(), $objNews->getSystemid(), $objNews->isRateableByUser(), $objNews->rightRight3())); } //categories $objMapper->addPlaceholder("news_categories", $this->renderCategoryTitles($objNews)); //load template section with or without image? if ($objNews->getStrImage() != "") { $objMapper->addPlaceholder("news_image", urlencode($objNews->getStrImage())); $strReturn .= $objMapper->writeToTemplate("/module_news/" . $this->arrElementData["news_template"], "news_detail_image"); } else { $strReturn .= $objMapper->writeToTemplate("/module_news/" . $this->arrElementData["news_template"], "news_detail"); } //Add pe code $arrPeConfig = array("pe_module" => "news", "pe_action_edit" => "editNews", "pe_action_edit_params" => "&systemid=" . $this->getSystemid()); $strReturn = class_element_portal::addPortalEditorCode($strReturn, $objNews->getSystemid(), $arrPeConfig); //and count the hit $objNews->increaseHits(); //set the name of the current news to the page-title via class_pages class_module_pages_portal::registerAdditionalTitle($objNews->getStrTitle()); } else { $strReturn = $this->getLang("commons_error_permissions"); } return $strReturn; }
/** * Prints a file as a detailed-view * and generates forward / backward links + a strip of prev / next files * * @param bool $bitRegisterAdditionalTitle * @return string */ protected function actionFileDetails($bitRegisterAdditionalTitle = true) { if (!$this->checkIfRequestedIdIsInElementsTree()) { return $this->actionList(); } $bitIsImage = false; //Load record $objFile = new class_module_mediamanager_file($this->getSystemid()); //common fields $arrDetailsTemplate = array(); $arrDetailsTemplate["file_name"] = $objFile->getStrName(); $arrDetailsTemplate["file_description"] = $objFile->getStrDescription(); $arrDetailsTemplate["file_subtitle"] = $objFile->getStrSubtitle(); $arrDetailsTemplate["file_filename"] = $objFile->getStrFilename(); $arrDetailsTemplate["file_size"] = bytesToString($objFile->getIntFileSize()); $arrDetailsTemplate["file_hits"] = $objFile->getIntHits(); $arrDetailsTemplate["file_systemid"] = $objFile->getSystemid(); $arrDetailsTemplate["file_elementid"] = $this->arrElementData["content_id"]; $arrDetailsTemplate["file_lmtime"] = timeToString(filemtime(_realpath_ . $objFile->getStrFilename())); if (validateSystemid($objFile->getOwnerId())) { $objUser = new class_module_user_user($objFile->getOwnerId()); $arrDetailsTemplate["file_owner"] = $objUser->getStrUsername(); } if ($objFile->rightRight2()) { $arrDetailsTemplate["file_link_href"] = _webpath_ . "/download.php?systemid=" . $objFile->getSystemid(); $arrDetailsTemplate["file_link"] = "<a href=\"" . _webpath_ . "/download.php?systemid=" . $objFile->getSystemid() . "\">" . $this->getLang("download_link") . "</a>"; } //if its an image, provide additional information $strSuffix = uniStrtolower(uniSubstr($objFile->getStrFilename(), uniStrrpos($objFile->getStrFilename(), "."))); if (in_array($strSuffix, $this->arrImageTypes) && isset($this->arrElementData["gallery_maxh_d"]) && isset($this->arrElementData["gallery_maxw_d"])) { $bitIsImage = true; $arrDetailsTemplate["image_src"] = $this->getImageUrl($objFile->getStrFilename(), $this->arrElementData["gallery_maxh_d"], $this->arrElementData["gallery_maxw_d"], $this->arrElementData["gallery_text"], $this->arrElementData["gallery_overlay"], $objFile->getSystemid(), $this->arrElementData["content_id"]); } $arrStripIds = $this->getNextPrevIds(); $arrDetailsTemplate["backlink"] = $arrStripIds["backward_1"] != "" ? class_link::getLinkPortal($this->getPagename(), "", "", $this->getLang("commons_back"), "fileDetails", "", $arrStripIds["backward_1"]) : ""; $arrDetailsTemplate["forwardlink"] = $arrStripIds["forward_1"] != "" ? class_link::getLinkPortal($this->getPagename(), "", "", $this->getLang("commons_next"), "fileDetails", "", $arrStripIds["forward_1"]) : ""; //next /prev 3 files for ($intI = 1; $intI <= 3; $intI++) { if ($arrStripIds["forward_" . $intI] != "") { $objCurFile = new class_module_mediamanager_file($arrStripIds["forward_" . $intI]); $arrDetailsTemplate["forwardlink_" . $intI] = $this->renderFileStripEntry($objCurFile); } if ($arrStripIds["backward_" . $intI] != "") { $objCurFile = new class_module_mediamanager_file($arrStripIds["backward_" . $intI]); $arrDetailsTemplate["backlink_" . $intI] = $this->renderFileStripEntry($objCurFile); } } //current file $arrDetailsTemplate["filestrip_current"] = $this->renderFileStripEntry($objFile); $arrDetailsTemplate["overview"] = getLinkPortal($this->getPagename(), "", "", $this->getLang("overview"), "mediaFolder", "", $objFile->getPrevId()); $arrDetailsTemplate["pathnavigation"] = $this->generatePathnavi(true); //ratings available? if ($objFile->getFloatRating() !== null) { /** @var $objRating class_module_rating_portal */ $objRating = class_module_system_module::getModuleByName("rating")->getPortalInstanceOfConcreteModule(); $arrDetailsTemplate["file_rating"] = $objRating->buildRatingBar($objFile->getFloatRating(), $objFile->getIntRatingHits(), $objFile->getSystemid(), $objFile->isRateableByUser(), $objFile->rightRight3()); } $strTemplateID = $this->objTemplate->readTemplate("/module_mediamanager/" . $this->arrElementData["repo_template"], "filedetail"); $strReturn = $this->fillTemplate($arrDetailsTemplate, $strTemplateID); //Add pe code $arrPeConfig = array("pe_module" => "mediamanager", "pe_action_edit" => "editFile", "pe_action_edit_params" => "&systemid=" . $objFile->getSystemid()); $strReturn = class_element_portal::addPortalEditorCode($strReturn, $objFile->getSystemid(), $arrPeConfig); //set the name of the current image to the page title via class_pages if ($bitRegisterAdditionalTitle) { class_module_pages_portal::registerAdditionalTitle($objFile->getStrName()); } //Update view counter if ($bitIsImage) { $objFile->increaseHits(); } return $this->addPortaleditorCode($strReturn); }
/** * Returns a list of faqs. * The category is choosen from the element-data * * @return string */ protected function actionList() { $strReturn = ""; //load categories $arrCategories = array(); if ($this->arrElementData["faqs_category"] == "0") { $arrCategories = class_module_faqs_category::getObjectList(); } else { $arrCategories[] = new class_module_faqs_category($this->arrElementData["faqs_category"]); } //if no cat was created by now, use a dummy cat if (count($arrCategories) == 0) { $arrCategories[] = 1; } //load every category $strCats = ""; foreach ($arrCategories as $objCategory) { //Load faqs if (!is_object($objCategory) && $objCategory == 1) { $arrFaqs = class_module_faqs_faq::loadListFaqsPortal(1); $objCategory = new class_module_faqs_category(); } else { if ($objCategory->getIntRecordStatus() == 0) { continue; } $arrFaqs = class_module_faqs_faq::loadListFaqsPortal($objCategory->getSystemid()); } $strFaqs = ""; //Check rights foreach ($arrFaqs as $objOneFaq) { if ($objOneFaq->rightView()) { $objMapper = new class_template_mapper($objOneFaq); //legacy support $objMapper->addPlaceholder("faq_question", $objOneFaq->getStrQuestion()); $objMapper->addPlaceholder("faq_answer", $objOneFaq->getStrAnswer()); $objMapper->addPlaceholder("faq_systemid", $objOneFaq->getSystemid()); //ratings available? if ($objOneFaq->getFloatRating() !== null && class_module_system_module::getModuleByName("rating") != null) { /** @var $objRating class_module_rating_portal */ $objRating = class_module_system_module::getModuleByName("rating")->getPortalInstanceOfConcreteModule(); $objMapper->addPlaceholder("faq_rating", $objRating->buildRatingBar($objOneFaq->getFloatRating(), $objOneFaq->getIntRatingHits(), $objOneFaq->getSystemid(), $objOneFaq->isRateableByUser(), $objOneFaq->rightRight1())); } $strOneFaq = $objMapper->writeToTemplate("/module_faqs/" . $this->arrElementData["faqs_template"], "faq_faq", false); //Add pe code $arrPeConfig = array("pe_module" => "faqs", "pe_action_edit" => "editFaq", "pe_action_edit_params" => "&systemid=" . $objOneFaq->getSystemid(), "pe_action_new" => "newFaq", "pe_action_new_params" => "", "pe_action_delete" => "deleteFaq", "pe_action_delete_params" => "&systemid=" . $objOneFaq->getSystemid()); $strFaqs .= class_element_portal::addPortalEditorCode($strOneFaq, $objOneFaq->getSystemid(), $arrPeConfig); } } //wrap category around $objMapper = new class_template_mapper($objCategory); //legacy support $objMapper->addPlaceholder("faq_cat_title", $objCategory->getStrTitle()); $objMapper->addPlaceholder("faq_faqs", $strFaqs); $objMapper->addPlaceholder("faq_cat_systemid", $objCategory->getSystemid()); $strCats .= $objMapper->writeToTemplate("/module_faqs/" . $this->arrElementData["faqs_template"], "faq_category"); } //wrap list container around //wrap category around $strListTemplateID = $this->objTemplate->readTemplate("/module_faqs/" . $this->arrElementData["faqs_template"], "faqs_list"); $arrTemplate = array(); $arrTemplate["faq_categories"] = $strCats; $strReturn .= $this->objTemplate->fillTemplate($arrTemplate, $strListTemplateID); return $strReturn; }