예제 #1
0
 public static function byCategory($cat, $activeOnly = true)
 {
     $type = new \ATPCms\Model\Category();
     $type->loadByUrl($cat);
     $blocks = array();
     $blocksRaw = $type->getAtpcmsStaticBlocksByCategory();
     foreach ($blocksRaw as $block) {
         if (!$activeOnly || $block->isActive) {
             $blocks[] = $block;
         }
     }
     return $blocks;
 }
예제 #2
0
 public function categoryAction()
 {
     $this->init();
     $catUrl = $this->params('id');
     $category = new \ATPCms\Model\Category();
     $category->loadByUrl($catUrl);
     if (!$category->id) {
         $this->getResponse()->setStatusCode(404);
         return;
     }
     //Create the view
     $view = new \Zend\View\Model\ViewModel();
     $view->category = $category;
     //Create post list widget
     $posts = new \ATPCms\View\Widget\MostRecentPost();
     $posts->category = $category;
     $posts->postCount = 0;
     $view->addChild($posts, 'posts');
     return $view;
 }
예제 #3
0
 protected function _loadObject($url)
 {
     $category = new \ATPCms\Model\Category();
     $category->loadByUrl($url);
     return $category;
 }