Exemplo n.º 1
0
 /**
  * News tag
  * 
  * @access  public
  * @return  Response
  */
 public function action_tag($tag_string = null)
 {
     $tags = \Site_Util::validate_tags($tag_string);
     if (!$tags || !($ids = \News\Model_NewsTag::get_news_ids4tags($tags))) {
         throw new \HttpNotFoundException();
     }
     list($limit, $page) = $this->common_get_pager_list_params();
     $data = Site_Model::get_list($limit, $page, \Auth::check(), null, $ids);
     $data['tag_string'] = implode(', ', $tags);
     $this->set_title_and_breadcrumbs(sprintf('%s: %s', term('site.tag'), implode(', ', $tags)), array('news/list' => term('site.latest', 'news.view', 'site.list')));
     $this->template->post_footer = \View::forge('_parts/list_footer');
     $this->template->content = \View::forge('_parts/list', $data);
     $this->template->content->set_safe('html_bodys', Site_Model::convert_raw_bodys($data['list']));
 }
Exemplo n.º 2
0
 /**
  * Get note list
  * 
  * @access  public
  * @return  Response (html)
  * @throws  Exception in Controller_Base::controller_common_api
  * @see  Controller_Base::controller_common_api
  */
 public function get_list()
 {
     $this->api_accept_formats = 'html';
     $this->controller_common_api(function () {
         $category_name = \Input::get('category');
         $news_category = $category_name ? Model_NewsCategory::get4name($category_name) : null;
         $tag_string = \Input::get('tag');
         $tags = \Site_Util::validate_tags($tag_string);
         $ids = $tags ? Model_NewsTag::get_news_ids4tags($tags) : array();
         list($limit, $page) = $this->common_get_pager_list_params();
         $data = Site_Model::get_list($limit, $page, \Auth::check(), $news_category ? $news_category->id : 0, $ids);
         $data['category_name'] = $category_name;
         $data['tag_string'] = implode(', ', $tags);
         $this->set_response_body_api($data, '_parts/list', array('html_bodys' => Site_Model::convert_raw_bodys($data['list'])));
     });
 }