/**
  * Renders the news category titles
  * @param class_module_news_news $objNews
  *
  * @return string
  */
 private function renderCategoryTitles(class_module_news_news $objNews)
 {
     if (count(class_module_news_category::getNewsMember($objNews->getSystemid())) == 0) {
         return "";
     }
     $strCategories = "";
     foreach (class_module_news_category::getNewsMember($objNews->getSystemid()) as $objCat) {
         $objMapper = new class_template_mapper($objCat);
         $strCategories .= $objMapper->writeToTemplate("/module_news/" . $this->arrElementData["news_template"], "categories_category");
     }
     $strWrapper = $this->objTemplate->readTemplate("/module_news/" . $this->arrElementData["news_template"], "categories_wrapper");
     return $this->objTemplate->fillTemplate(array("categories" => $strCategories), $strWrapper);
 }
 /**
  * @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;
 }