Esempio n. 1
0
 /**
  * Основной метод, выполняющий построение контроллера для просмотра постов.
  * Контроллер может быть отображен в двух случаях: 
  * 1. На странице с просмотром всех постов
  * 2. На странице с рубрикой
  * 
  * @return ShowcasesControllerPanel
  */
 private function getScPanel($postType, Rubric $rubric = null)
 {
     $key = $postType . '-' . ($rubric ? $rubric->getIdent() : '');
     if (!$this->CACHE->has($key)) {
         $plugins[] = $this->getBaseControllerIdents();
         if ($rubric) {
             $plugins[] = Mappings::RUBRIC_2_SCCONTROLLERS($postType)->getMappedEntitys($rubric->getIdent());
         }
         $insts = $this->getUserAcessibleClassInsts(to_array_expand($plugins));
         $ctxt = new ShowcasesControllerCtxt($rubric);
         $result = array();
         /** @var ShowcasesControllerItem */
         foreach ($insts as $ident => $inst) {
             $inst->doProcess($ctxt);
             $result[$ident] = $inst;
         }
         $this->CACHE->set($key, new ShowcasesControllerPanel($result));
     }
     return $this->CACHE->get($key);
 }