示例#1
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;
    }