/** * 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; }
/** * @param array $arrErrors * * @return string * @permissions view,right1 */ protected function actionRegisterForEvent($arrErrors = array()) { $strReturn = ""; $objEvent = new class_module_eventmanager_event($this->getSystemid()); if ($objEvent->getIntLimitGiven() == "1" && $objEvent->getIntParticipantsLimit() <= class_module_eventmanager_participant::getActiveParticipantsCount($this->getSystemid())) { $strMessage = $this->getLang("participantLimitReached"); $strWrapperID = $this->objTemplate->readTemplate("/module_eventmanager/" . $this->arrElementData["char1"], "event_register_message"); $strReturn = $this->objTemplate->fillTemplate(array("title" => $objEvent->getStrTitle(), "message" => $strMessage), $strWrapperID); return $strReturn; } $bitIsLoggedin = false; if ($this->objSession->isLoggedin() && $this->objTemplate->containsSection($this->objTemplate->readTemplate("/module_eventmanager/" . $this->arrElementData["char1"]), "event_register_loggedin")) { $bitIsLoggedin = true; if ($objEvent->isParticipant($this->objSession->getUserID())) { $objParticpant = class_module_eventmanager_participant::getParticipantByUserid($this->objSession->getUserID(), $objEvent->getSystemid()); $this->setParam("comment", $objParticpant->getStrComment()); $this->setParam("participant_status", $objParticpant->getIntParticipationStatus()); } } $objMapper = new class_template_mapper($objEvent); $objMapper->addPlaceholder("forename", $this->getParam("forename")); $objMapper->addPlaceholder("lastname", $this->getParam("lastname")); $objMapper->addPlaceholder("phone", $this->getParam("phone")); $objMapper->addPlaceholder("comment", $this->getParam("comment")); $objMapper->addPlaceholder("email", $this->getParam("email")); $objMapper->addPlaceholder("participant_status", $this->getParam("participant_status")); $objMapper->addPlaceholder("title", $objEvent->getStrTitle()); $objMapper->addPlaceholder("dateTimeFrom", dateToString($objEvent->getObjStartDate(), true)); $objMapper->addPlaceholder("dateFrom", dateToString($objEvent->getObjStartDate(), false)); $objMapper->addPlaceholder("dateTimeUntil", dateToString($objEvent->getObjEndDate(), true)); $objMapper->addPlaceholder("dateUntil", dateToString($objEvent->getObjEndDate(), false)); $objMapper->addPlaceholder("formaction", class_link::getLinkPortalHref($this->getPagename(), "", "saveRegisterForEvent", "", $this->getSystemid(), "", $objEvent->getStrTitle())); if ($bitIsLoggedin) { $objUser = new class_module_user_user($this->objSession->getUserID()); $objMapper->addPlaceholder("username", $objUser->getStrUsername()); } $strErrors = ""; if (count($arrErrors) > 0) { $strErrTemplate = $this->objTemplate->readTemplate("/module_eventmanager/" . $this->arrElementData["char1"], "error_row"); foreach ($arrErrors as $strOneError) { $strErrors .= "" . $this->objTemplate->fillTemplate(array("error" => $strOneError), $strErrTemplate); } } $objMapper->addPlaceholder("formErrors", $strErrors); $strReturn .= $objMapper->writeToTemplate("/module_eventmanager/" . $this->arrElementData["char1"], "event_register" . ($bitIsLoggedin ? "_loggedin" : "")); class_module_pages_portal::registerAdditionalTitle($objEvent->getStrTitle()); return $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; }