/** * Returns a list of news. * As defined in the element, this could be an archive or a normal list * * @return string */ protected function actionNewsList() { $strReturn = ""; //Load news using the correct filter if ($this->getParam("filterid") != "") { $strFilterId = $this->getParam("filterid"); } else { $strFilterId = $this->arrElementData["news_category"]; } $strPageview = 1; if ($this->getParam("pv") != 1 && $this->getSystemid() == $this->arrElementData["content_id"]) { $strPageview = $this->getParam("pv"); } //Load all posts $objArraySectionIterator = new class_array_section_iterator(class_module_news_news::getNewsCountPortal($this->arrElementData["news_mode"], $strFilterId)); $objArraySectionIterator->setIntElementsPerPage($this->arrElementData["news_amount"]); $objArraySectionIterator->setPageNumber((int) $strPageview); $objArraySectionIterator->setArraySection(class_module_news_news::loadListNewsPortal($this->arrElementData["news_mode"], $strFilterId, $this->arrElementData["news_order"], $objArraySectionIterator->calculateStartPos(), $objArraySectionIterator->calculateEndPos())); $arrNews = $this->objToolkit->simplePager($objArraySectionIterator, $this->getLang("commons_next"), $this->getLang("commons_back"), "", $this->getPagename(), "&systemid=" . $this->arrElementData["content_id"], "pv", "/module_news/" . $this->arrElementData["news_template"]); //Check rights if (!$objArraySectionIterator->valid()) { $strReturn .= $this->getLang("news_list_empty"); } foreach ($objArraySectionIterator as $objOneNews) { /** @var $objOneNews class_module_news_news */ if ($objOneNews instanceof class_module_news_news && $objOneNews->rightView()) { $objMapper = new class_template_mapper($objOneNews); //generate a link to the details $objMapper->addPlaceholder("news_more_link", class_link::getLinkPortal($this->arrElementData["news_detailspage"], "", "", $this->getLang("news_mehr"), "newsDetail", "", $objOneNews->getSystemid(), "", "", $objOneNews->getStrTitle())); $objMapper->addPlaceholder("news_more_link_href", class_link::getLinkPortalHref($this->arrElementData["news_detailspage"], "", "newsDetail", "", $objOneNews->getSystemid(), "", $objOneNews->getStrTitle())); $objMapper->addPlaceholder("news_start_date", dateToString($objOneNews->getObjStartDate(), false)); $objMapper->addPlaceholder("news_id", $objOneNews->getSystemid()); $objMapper->addPlaceholder("news_title", $objOneNews->getStrTitle()); $objMapper->addPlaceholder("news_intro", $objOneNews->getStrIntro()); $objMapper->addPlaceholder("news_text", $objOneNews->getStrText()); //reset more link? -> no text, no image and no redirect page if (uniStrlen(htmlStripTags($objOneNews->getStrText())) == 0 && uniStrlen($objOneNews->getStrImage()) == 0 && ($objOneNews->getIntRedirectEnabled() == "0" || $objOneNews->getStrRedirectPage() == "")) { $objMapper->addPlaceholder("news_more_link", ""); } //postacomment $arrPAC = $this->loadPostacomments($objOneNews->getSystemid(), $objOneNews->getStrImage() != "" ? "news_list_image" : "news_list"); if ($arrPAC != null) { $objMapper->addPlaceholder("news_nrofcomments", $arrPAC["nrOfComments"]); $objMapper->addPlaceholder("news_commentlist", $arrPAC["commentList"]); } //ratings if ($objOneNews->getFloatRating() !== null) { /** @var $objRating class_module_rating_portal */ $objRating = class_module_system_module::getModuleByName("rating")->getPortalInstanceOfConcreteModule(); $objMapper->addPlaceholder("news_rating", $objRating->buildRatingBar($objOneNews->getFloatRating(), $objOneNews->getIntRatingHits(), $objOneNews->getSystemid(), $objOneNews->isRateableByUser(), $objOneNews->rightRight3())); } //categories $objMapper->addPlaceholder("news_categories", $this->renderCategoryTitles($objOneNews)); //load template section with or without image? if ($objOneNews->getStrImage() != "") { $objMapper->addPlaceholder("news_image", urlencode($objOneNews->getStrImage())); $strOneNews = $objMapper->writeToTemplate("/module_news/" . $this->arrElementData["news_template"], "news_list_image"); } else { $strOneNews = $objMapper->writeToTemplate("/module_news/" . $this->arrElementData["news_template"], "news_list"); } //Add pe code $arrPeConfig = array("pe_module" => "news", "pe_action_edit" => "editNews", "pe_action_edit_params" => "&systemid=" . $objOneNews->getSystemid(), "pe_action_new" => "newNews", "pe_action_new_params" => "", "pe_action_delete" => "delete", "pe_action_delete_params" => "&systemid=" . $objOneNews->getSystemid()); $strReturn .= class_element_portal::addPortalEditorCode($strOneNews, $objOneNews->getSystemid(), $arrPeConfig); } } $arrWrapperTemplate = array(); $arrWrapperTemplate["news"] = $strReturn; $arrWrapperTemplate["link_forward"] = $arrNews["strForward"]; $arrWrapperTemplate["link_pages"] = $arrNews["strPages"]; $arrWrapperTemplate["link_back"] = $arrNews["strBack"]; $strReturn = $this->fillTemplate($arrWrapperTemplate, $this->objTemplate->readTemplate("/module_news/" . $this->arrElementData["news_template"], "news_list_wrapper")); return $strReturn; }