Esempio n. 1
0
 /**
  * Get selected pages for a block to display in overview page
  * @see $this->_showOverview()
  *
  * @param integer                                                 $blockId            Block id
  * @param string                                                  $placeholder        Placeholder (global, direct)
  * @param \ContentTree                                            $objContentTree     ContentTree instance
  * @param \Cx\Core\ContentManager\Model\Repository\PageRepository $pageRepo           PageRepository instance
  *
  * @return string Return the selected pages as <ul><li></li></ul>
  */
 function getSelectedPages($blockId, $placeholder, \ContentTree $objContentTree, \Cx\Core\ContentManager\Model\Repository\PageRepository $pageRepo)
 {
     $pageLinkTemplate = '<li><a href="%1$s" target="_blank">%2$s</a></li>';
     $blockAssociatedPageIds = $this->_getAssociatedPageIds($blockId, $placeholder);
     $selectedPages = array();
     $strSelectedPages = '';
     foreach ($objContentTree->getTree() as $arrData) {
         if (!in_array($arrData['catid'], $blockAssociatedPageIds)) {
             continue;
         }
         $page = $pageRepo->findOneById($arrData['catid']);
         if (!$page) {
             continue;
         }
         $selectedPages[] = sprintf($pageLinkTemplate, \Cx\Core\Routing\Url::fromPage($page)->toString(), contrexx_raw2xhtml($arrData['catname']));
     }
     if ($selectedPages) {
         $strSelectedPages = '<ul>' . implode($selectedPages) . '</ul>';
     }
     return $strSelectedPages;
 }