Beispiel #1
0
function faq_listing()
{
    global $locale, $aidlink, $show_faqs;
    $total_cat_count = dbcount("(faq_cat_id)", DB_FAQ_CATS, multilang_table("FQ") ? "faq_cat_language='" . LANGUAGE . "'" : "");
    $_GET['show_faq'] = isset($_GET['show_faq']) && isnum($_GET['show_faq']) ? $_GET['show_faq'] : 0;
    $_GET['rowstart'] = isset($_GET['rowstart']) && isnum($_GET['rowstart']) && $_GET['rowstart'] <= $total_cat_count ? $_GET['rowstart'] : 0;
    $result = dbquery("SELECT fc.faq_cat_id, fc.faq_cat_name,\n\tcount(faq_id) 'faq_count'\n\tFROM " . DB_FAQ_CATS . " fc\n\tleft join " . DB_FAQS . " f using (faq_cat_id)\n\t" . (multilang_table("FQ") ? "WHERE fc.faq_cat_language='" . LANGUAGE . "'" : "") . "\n\tgroup by fc.faq_cat_id\n\tORDER BY fc.faq_cat_name\n\tlimit " . intval($_GET['rowstart']) . ", " . intval($show_faqs) . "\n\t");
    $cat_rows = dbrows($result);
    if ($cat_rows > 0) {
        echo "<div class='m-t-10'>\n";
        echo "<div class='clearfix'>\n";
        if ($total_cat_count > $cat_rows) {
            echo "<div class='pull-right'>\n";
            echo makepagenav($_GET['rowstart'], $show_faqs, $total_cat_count, 3, FUSION_SELF . $aidlink . "&amp;", "rowstart");
            echo "</div>\n";
        }
        echo sprintf($locale['faq_0115'], $cat_rows, $total_cat_count);
        echo "</div>\n";
        echo "</div>\n";
        echo "<table class='table table-responsive table-striped m-t-20'>\n<thead><tr>\n";
        echo "<th class='col-xs-4'>" . $locale['faq_0103'] . "</th>\n";
        echo "<th>" . $locale['faq_0104'] . "</th>\n";
        echo "<th>" . $locale['faq_0105'] . "</th>\n";
        echo "<th class='text-right'>" . $locale['faq_0106'] . "</th>\n";
        echo "</tr>\n";
        echo "</thead>\n<tbody>\n";
        while ($data = dbarray($result)) {
            echo "<tr>\n";
            // let us use 2 page nav. :)
            echo "<td><a href='" . FUSION_SELF . $aidlink . "&amp;show_faq=" . $data['faq_cat_id'] . "'>" . $data['faq_cat_name'] . "</a></td>\n";
            echo "<td><span class='badge'>" . $data['faq_count'] . "</span></td>\n";
            echo "<td>" . $data['faq_cat_id'] . "</td>\n";
            echo "<td class='text-right'>\n\t\t\t<a href='" . FUSION_SELF . $aidlink . "&amp;action=edit&amp;cat_id=" . $data['faq_cat_id'] . "&amp;section=faq-category'>" . $locale['faq_0107'] . "</a> -\n";
            echo "<a href='" . FUSION_SELF . $aidlink . "&amp;action=delete&amp;cat_id=" . $data['faq_cat_id'] . "&amp;section=faq-category' onclick=\"return confirm('" . $locale['faq_0109'] . "');\">" . $locale['faq_0108'] . "</a></td>\n";
            echo "</tr>\n";
            if ($_GET['show_faq'] == $data['faq_cat_id']) {
                show_faq($data['faq_cat_id'], $data['faq_count']);
            }
        }
        // simple toggle
        add_to_jquery("\n\t\t\$('.faq_toggle').bind('click', function() {\n\t\t\tvar faqs = \$(this).data('target');\n\t\t\tvar faq_length = \$('#' + faqs + ':visible').length;\n\t\t\t\$('.faq_list').hide();\n\t\t\tif (faq_length > 0) {\n\t\t\t\t\$('#'+faqs).hide();\n\t\t\t} else {\n\t\t\t\t\$('#'+faqs).show();\n\t\t\t}\n\t\t});\n\t\t");
        echo "</table>\n";
    } else {
        echo "<div class='well text-center'>" . $locale['faq_0116'] . "<br />\n</div>\n";
    }
}
Beispiel #2
0
/**
 * @since 1.0
 */
function faq()
{
    show_faq();
}