Esempio n. 1
0
 /**
  * Build sort object.
  *
  * @param int $subscription_count
  */
 protected function build_sort($subscription_count)
 {
     // Setup the sort tool
     $this->sort->request();
     $this->sort->total = $subscription_count;
     $this->sort->build_pagination($this->u_action);
 }
Esempio n. 2
0
 /**
  * Perform search and output results.
  *
  * @param string $sort_url		Base sort url.
  * @return \Symfony\Component\HttpFoundation\Response
  */
 protected function show_results($sort_url)
 {
     // Setup the sort tool
     $this->sort->set_defaults($this->config['posts_per_page'])->request();
     // Do the search
     $results = $this->query_index();
     // Grab the users
     \users_overlord::load_users($results['user_ids']);
     $this->display->assign_global_vars();
     $this->assign_doc_vars($results['documents']);
     $this->assign_result_vars($this->sort->total);
     $parameters = array();
     $expected_parameters = array('versions' => array(array(''), false), 'c' => array(array(0), false), 'sc' => array(false, false), 'keywords' => array('', true), 'sf' => array('', false), 'author' => array('', true), 'u' => array(0, false), 'type' => array(0, false), 'contrib' => array(0, false));
     foreach ($expected_parameters as $name => $properties) {
         if ($this->request->is_set($name)) {
             list($default_value, $multibyte) = $properties;
             $value = $this->request->variable($name, $default_value, $multibyte);
             // Clean up URL by not including default values.
             if ($value !== $default_value) {
                 $parameters[$name] = $value;
             }
         }
     }
     $this->sort->build_pagination($sort_url, $parameters);
     return $this->helper->render('search_results.html', $this->user->lang['SEARCH']);
 }
Esempio n. 3
0
    /**
     * Get contribution's FAQ items limited by the $sort options.
     *
     * @return array Returns FAQ item data matching the sort options.
     */
    protected function get_items()
    {
        $items = array();
        $sql_ary = array('SELECT' => 'f.*', 'FROM' => array(TITANIA_CONTRIB_FAQ_TABLE => 'f'), 'WHERE' => 'f.contrib_id = ' . (int) $this->contrib->contrib_id . '
				AND f.faq_access >= ' . $this->access->get_level(), 'ORDER_BY' => 'f.left_id ASC');
        // Main SQL Query
        $sql = $this->db->sql_build_query('SELECT', $sql_ary);
        // Handle pagination
        if ($this->sort->sql_count($sql_ary, 'faq_id')) {
            $this->sort->build_pagination($this->contrib->get_url('faq'));
            // Get the data
            $result = $this->db->sql_query_limit($sql, $this->sort->limit, $this->sort->start);
            while ($row = $this->db->sql_fetchrow($result)) {
                $items[$row['faq_id']] = $row;
            }
            $this->db->sql_freeresult($result);
            // Grab the tracking info
            $this->tracking->get_tracks(TITANIA_FAQ, array_keys($items));
        }
        return $items;
    }