示例#1
0
function qa_q_list_page_content($questions, $pagesize, $start, $count, $sometitle, $nonetitle, $navcategories, $categoryid, $categoryqcount, $categorypathprefix, $feedpathprefix, $suggest, $pagelinkparams = null, $categoryparams = null, $dummy = null)
{
    if (qa_to_override(__FUNCTION__)) {
        $args = func_get_args();
        return qa_call_override(__FUNCTION__, $args);
    }
    require_once QA_INCLUDE_DIR . 'app/format.php';
    require_once QA_INCLUDE_DIR . 'app/updates.php';
    $userid = qa_get_logged_in_userid();
    //	Chop down to size, get user information for display
    if (isset($pagesize)) {
        $questions = array_slice($questions, 0, $pagesize);
    }
    $usershtml = qa_userids_handles_html(qa_any_get_userids_handles($questions));
    //	Prepare content for theme
    $qa_content = qa_content_prepare(true, array_keys(qa_category_path($navcategories, $categoryid)));
    $qa_content['q_list']['form'] = array('tags' => 'method="post" action="' . qa_self_html() . '"', 'hidden' => array('code' => qa_get_form_security_code('vote')));
    $qa_content['q_list']['qs'] = array();
    if (count($questions)) {
        $qa_content['title'] = $sometitle;
        $defaults = qa_post_html_defaults('Q');
        if (isset($categorypathprefix)) {
            $defaults['categorypathprefix'] = $categorypathprefix;
        }
        foreach ($questions as $question) {
            $fields = qa_any_to_q_html_fields($question, $userid, qa_cookie_get(), $usershtml, null, qa_post_html_options($question, $defaults));
            if (!empty($fields['raw']['closedbyid'])) {
                $fields['closed'] = array('state' => qa_lang_html('main/closed'));
            }
            $qa_content['q_list']['qs'][] = $fields;
        }
    } else {
        $qa_content['title'] = $nonetitle;
    }
    if (isset($userid) && isset($categoryid)) {
        $favoritemap = qa_get_favorite_non_qs_map();
        $categoryisfavorite = @$favoritemap['category'][$navcategories[$categoryid]['backpath']];
        $qa_content['favorite'] = qa_favorite_form(QA_ENTITY_CATEGORY, $categoryid, $categoryisfavorite, qa_lang_sub($categoryisfavorite ? 'main/remove_x_favorites' : 'main/add_category_x_favorites', $navcategories[$categoryid]['title']));
    }
    if (isset($count) && isset($pagesize)) {
        $qa_content['page_links'] = qa_html_page_links(qa_request(), $start, $pagesize, $count, qa_opt('pages_prev_next'), $pagelinkparams);
    }
    if (empty($qa_content['page_links'])) {
        $qa_content['suggest_next'] = $suggest;
    }
    if (qa_using_categories() && count($navcategories) && isset($categorypathprefix)) {
        $qa_content['navigation']['cat'] = qa_category_navigation($navcategories, $categoryid, $categorypathprefix, $categoryqcount, $categoryparams);
    }
    if (isset($feedpathprefix) && (qa_opt('feed_per_category') || !isset($categoryid))) {
        $qa_content['feed'] = array('url' => qa_path_html(qa_feed_request($feedpathprefix . (isset($categoryid) ? '/' . qa_category_path_request($navcategories, $categoryid) : ''))), 'label' => strip_tags($sometitle));
    }
    return $qa_content;
}
示例#2
0
function qa_q_list_page_content($questions, $pagesize, $start, $count, $sometitle, $nonetitle, $navcategories, $categoryid, $categoryqcount, $categorypathprefix, $feedpathprefix, $suggest, $pagelinkparams = array())
{
    require_once QA_INCLUDE_DIR . 'qa-app-format.php';
    global $qa_login_userid, $qa_cookieid, $qa_request;
    // get globals from qa-page.php
    //	Chop down to size, get user information for display
    if (isset($pagesize)) {
        $questions = array_slice($questions, 0, $pagesize);
    }
    $usershtml = qa_userids_handles_html(qa_any_get_userids_handles($questions));
    //	Prepare content for theme
    $qa_content = qa_content_prepare(true, array_keys(qa_category_path($navcategories, $categoryid)));
    $qa_content['q_list']['form'] = array('tags' => 'METHOD="POST" ACTION="' . qa_self_html() . '"');
    $qa_content['q_list']['qs'] = array();
    if (count($questions)) {
        $qa_content['title'] = $sometitle;
        $options = qa_post_html_defaults('Q');
        if (isset($categorypathprefix)) {
            $options['categorypathprefix'] = $categorypathprefix;
        }
        foreach ($questions as $question) {
            $qa_content['q_list']['qs'][] = qa_any_to_q_html_fields($question, $qa_login_userid, $qa_cookieid, $usershtml, null, $options);
        }
    } else {
        $qa_content['title'] = $nonetitle;
    }
    if (isset($count) && isset($pagesize)) {
        $qa_content['page_links'] = qa_html_page_links($qa_request, $start, $pagesize, $count, qa_opt('pages_prev_next'), $pagelinkparams);
    }
    if (empty($qa_content['page_links'])) {
        $qa_content['suggest_next'] = $suggest;
    }
    if (qa_using_categories() && count($navcategories) && isset($categorypathprefix)) {
        $qa_content['navigation']['cat'] = qa_category_navigation($navcategories, $categoryid, $categorypathprefix, $categoryqcount);
    }
    if (isset($feedpathprefix) && (qa_opt('feed_per_category') || !isset($categoryid))) {
        $qa_content['feed'] = array('url' => qa_path_html(qa_feed_request($feedpathprefix . (isset($categoryid) ? '/' . qa_category_path_request($navcategories, $categoryid) : ''))), 'label' => strip_tags($sometitle));
    }
    return $qa_content;
}
        }
        $navigation[$key]['note'] = '';
        $navigation[$key]['note'] .= ' - <a href="' . qa_path_html('questions/' . implode('/', array_reverse(explode('/', $category['backpath'])))) . '">' . ($category['qcount'] == 1 ? qa_lang_html_sub('main/1_question', '1', '1') : qa_lang_html_sub('main/x_questions', qa_format_number($category['qcount'], 0, true))) . '</a>';
        if (strlen($category['content'])) {
            $navigation[$key]['note'] .= qa_html(' - ' . $category['content']);
        }
        if (isset($navlink['subnav'])) {
            qa_category_nav_to_browse($navigation[$key]['subnav'], $categories, $categoryid, $favoritemap);
        }
    }
}
//	Prepare content for theme
$qa_content = qa_content_prepare(false, array_keys(qa_category_path($categories, $categoryid)));
$qa_content['title'] = qa_lang_html('misc/browse_categories');
if (count($categories)) {
    $navigation = qa_category_navigation($categories, $categoryid, 'categories/', false);
    unset($navigation['all']);
    $favoritemap = array();
    if (isset($favoritecats)) {
        foreach ($favoritecats as $category) {
            $favoritemap[$category['categoryid']] = true;
        }
    }
    qa_category_nav_to_browse($navigation, $categories, $categoryid, $favoritemap);
    $qa_content['nav_list'] = array('nav' => $navigation, 'type' => 'browse-cat');
} else {
    $qa_content['title'] = qa_lang_html('main/no_categories_found');
    $qa_content['suggest_next'] = qa_html_suggest_qs_tags(qa_using_tags());
}
return $qa_content;
/*
}
if ($question['basetype'] == 'Q') {
    $qa_content['a_list']['title_tags'] = 'id="a_list_title"';
    if ($countfortitle > 0) {
        $split = $countfortitle == 1 ? qa_lang_html_sub_split('question/1_answer_title', '1', '1') : qa_lang_html_sub_split('question/x_answers_title', $countfortitle);
        if ($microdata) {
            $split['data'] = '<span itemprop="answerCount">' . $split['data'] . '</span>';
        }
        $qa_content['a_list']['title'] = $split['prefix'] . $split['data'] . $split['suffix'];
    } else {
        $qa_content['a_list']['title_tags'] .= ' style="display:none;" ';
    }
}
if (!$formrequested) {
    $qa_content['page_links'] = qa_html_page_links(qa_request(), $pagestart, $pagesize, $countforpages, qa_opt('pages_prev_next'), array(), false, 'a_list_title');
}
//	Some generally useful stuff
if (qa_using_categories() && count($categories)) {
    $qa_content['navigation']['cat'] = qa_category_navigation($categories, $question['categoryid']);
}
if (isset($jumptoanchor)) {
    $qa_content['script_onloads'][] = array('qa_scroll_page_to($("#"+' . qa_js($jumptoanchor) . ').offset().top);');
}
//	Determine whether this request should be counted for page view statistics
if (qa_opt('do_count_q_views') && !$formrequested && !qa_is_http_post() && qa_is_human_probably() && (!$question['views'] || ($question['lastviewip'] != qa_remote_ip_address() || !isset($question['lastviewip'])) && ($question['createip'] != qa_remote_ip_address() || !isset($question['createip'])) && ($question['userid'] != $userid || !isset($question['userid'])) && ($question['cookieid'] != $cookieid || !isset($question['cookieid'])))) {
    $qa_content['inc_views_postid'] = $questionid;
}
return $qa_content;
/*
	Omit PHP closing tag to help avoid accidental output
*/
示例#5
0
function ra_cat_list($limit = 15)
{
    $categoryslugs = qa_request_parts(1);
    $cats = qa_db_select_with_pending(qa_db_category_nav_selectspec($categoryslugs, false, false, true));
    $cats = qa_category_navigation($cats);
    $output = '<ul class="ra-cat-list clearfix">';
    $i = 1;
    foreach ($cats as $k => $c) {
        if ($k != 'all') {
            $output .= '<li><a class="icon-folder-close" title="' . @$c['popup'] . '" href="' . $c['url'] . '">' . $c['label'] . '<span>' . filter_var($c['note'], FILTER_SANITIZE_NUMBER_INT) . '</span></a></li>';
            if ($limit == $i) {
                break;
            }
            $i++;
        }
    }
    $output .= '</ul>';
    echo $output;
}
示例#6
0
 function cs_full_categories_list($show_sub = false)
 {
     $level = 1;
     $navigation = @$this->content['navigation']['cat'];
     if (!isset($navigation)) {
         $categoryslugs = qa_request_parts(1);
         $cats = qa_db_select_with_pending(qa_db_category_nav_selectspec($categoryslugs, false, false, true));
         $navigation = qa_category_navigation($cats);
     }
     if (count($navigation) > 1) {
         // if there are any categories (except 'all categories' navigation item)
         //$this->output( '<div class="qa-nav-cat">');
         //$this->output( '<ul class="qa-nav-cat-list">');
         $index = 0;
         if (isset($QA_CONST_PATH_MAP)) {
             $navigation['all']['url'] = qa_path_html($QA_CONST_PATH_MAP['categories']);
         } else {
             $navigation['all']['url'] = qa_path_html('categories');
         }
         foreach ($navigation as $key => $navlink) {
             $this->set_context('nav_key', $key);
             $this->set_context('nav_index', $index++);
             $this->cs_full_categories_list_item($key, $navlink, '', $level, $show_sub);
         }
         $this->clear_context('nav_key');
         $this->clear_context('nav_index');
         //$this->output('</ul></div>');
     }
     unset($navigation);
 }