예제 #1
0
 /**
  * Generate box output
  *
  * @param array $params Parameters
  */
 function generate_output($params)
 {
     $this->set_template($params);
     $params += array('pg' => 1, 'fields' => '');
     // defaults
     require_once VIVVO_FS_INSTALL_ROOT . 'lib/vivvo/core/Articles.class.php';
     $al = new Articles_list(null, $params['fields']);
     $sm = vivvo_lite_site::get_instance();
     if (isset($params['exclude_printed'])) {
         $params['search_exclude_id'] = $sm->printed_articles;
     }
     if (isset($params['use_view']) && !empty($params['use_view'])) {
         $al->_sql_table = secure_sql($params['use_view']);
     }
     $search_params = $al->get_search_params(null, $params);
     $al->search($search_params['search_options'], $search_params['search_sort_by'], $search_params['search_order'], $search_params['search_limit'], $search_params['offset']);
     if (isset($params['add_to_printed'])) {
         $sm->printed_articles = array_merge($sm->printed_articles, $al->get_list_ids());
         $sm->printed_articles = array_unique($sm->printed_articles);
     }
     $search_params['search_do_advanced'] = true;
     $feed_url = make_absolute_url('index.html?search_options=' . rtrim(base64_encode(serialize($search_params)), '=') . '&type=rss');
     $this->_template->assign('feed_url', $feed_url);
     if (!empty($al->list)) {
         $this->_template->assign('article_list_object', $al);
         $al->set_pagination($params['pg']);
         $this->_template->assign('article_list', $al->list);
     } else {
         $this->_template->assign('article_list_object', strval('0'));
         $this->_template->assign('article_list', strval('0'));
     }
     if (isset($params['TITLE'])) {
         $this->_template->assign('TITLE', $params['TITLE']);
     }
     if (isset($params['BOX_ID'])) {
         $this->_template->assign('BOX_ID', $params['BOX_ID']);
     }
 }