function b_faqs_recent_questions_show($options)
{
    include_once XOOPS_ROOT_PATH . "/modules/smartfaq/include/functions.php";
    $block = array();
    if ($options[0] == 0) {
        $categoryid = -1;
    } else {
        $categoryid = $options[0];
    }
    $sort = $options[1];
    $limit = $options[2];
    $maxQuestionLength = $options[3];
    // Creating the faq handler object
    $faq_handler =& sf_gethandler('faq');
    // creating the FAQ objects that belong to the selected category
    $faqsObj = $faq_handler->getFaqs($limit, 0, _SF_STATUS_OPENED, $categoryid, $sort);
    $totalfaqs = count($faqsObj);
    if ($faqsObj) {
        for ($i = 0; $i < $totalfaqs; $i++) {
            $newfaqs = array();
            $newfaqs['linktext'] = $faqsObj[$i]->question($maxQuestionLength);
            $newfaqs['id'] = $faqsObj[$i]->faqid();
            if ($sort == "datesub") {
                $newfaqs['new'] = $faqsObj[$i]->datesub();
            } elseif ($sort == "counter") {
                $newfaqs['new'] = $faqsObj[$i]->counter();
            } elseif ($sort == "weight") {
                $newfaqs['new'] = $faqsObj[$i]->weight();
            }
            $block['newfaqs'][] = $newfaqs;
        }
        $block['lang_allunanswered'] = _MB_SF_ALLUNANSWERED;
    }
    return $block;
}
Exemple #2
0
function b_faqs_new_show($options)
{
    include_once XOOPS_ROOT_PATH . "/modules/smartfaq/include/functions.php";
    $block = array();
    if ($options[0] == 0) {
        $categoryid = -1;
    } else {
        $categoryid = $options[0];
    }
    $sort = $options[1];
    $limit = $options[2];
    $maxQuestionLength = $options[3];
    // Creating the faq handler object
    $faq_handler =& sf_gethandler('faq');
    // creating the FAQ objects that belong to the selected category
    $faqsObj = $faq_handler->getAllPublished($limit, 0, $categoryid, $sort);
    $totalfaqs = count($faqsObj);
    if ($faqsObj) {
        for ($i = 0; $i < $totalfaqs; $i++) {
            $newfaqs = array();
            $newfaqs['linktext'] = $faqsObj[$i]->question($maxQuestionLength);
            $newfaqs['id'] = $faqsObj[$i]->faqid();
            if ($sort == "datesub") {
                $newfaqs['new'] = $faqsObj[$i]->datesub();
            } elseif ($sort == "counter") {
                $newfaqs['new'] = $faqsObj[$i]->counter();
            } elseif ($sort == "weight") {
                $newfaqs['new'] = $faqsObj[$i]->weight();
            }
            $newfaqs['show_date'] = $options[4];
            $block['newfaqs'][] = $newfaqs;
        }
    }
    return $block;
}
function b_faqs_context_show($options)
{
    include_once XOOPS_ROOT_PATH . "/modules/smartfaq/include/functions.php";
    $block = array();
    if ($options[0] == 0) {
        $categoryid = -1;
    } else {
        $categoryid = $options[0];
    }
    $limit = $options[0];
    // Creating the faq handler object
    $faq_handler =& sf_gethandler('faq');
    // creating the FAQ objects that belong to the selected category
    $faqsObj = $faq_handler->getContextualFaqs($limit);
    $totalfaqs = count($faqsObj);
    if ($faqsObj) {
        for ($i = 0; $i < $totalfaqs; $i++) {
            $faq = array();
            $faq['id'] = $faqsObj[$i]->faqid();
            $faq['question'] = $faqsObj[$i]->question();
            $block['faqs'][] = $faq;
        }
    }
    return $block;
}
Exemple #4
0
function b_faqs_recent_show($options)
{
    include_once XOOPS_ROOT_PATH . "/modules/smartfaq/include/functions.php";
    $myts =& MyTextSanitizer::getInstance();
    $smartModule =& sf_getModuleInfo();
    $smartModuleConfig =& sf_getModuleConfig();
    $block = array();
    if ($options[0] == 0) {
        $categoryid = -1;
    } else {
        $categoryid = $options[0];
    }
    $sort = $options[1];
    $limit = $options[2];
    $maxQuestionLength = $options[3];
    // Creating the faq handler object
    $faq_handler =& sf_gethandler('faq');
    // Creating the category handler object
    $category_handler =& sf_gethandler('category');
    // Creating the last FAQs
    $faqsObj = $faq_handler->getAllPublished($limit, 0, $categoryid, $sort);
    $allcategories = $category_handler->getObjects(null, true);
    if ($faqsObj) {
        $userids = array();
        foreach ($faqsObj as $key => $thisfaq) {
            $faqids[] = $thisfaq->getVar('faqid');
            $userids[$thisfaq->uid()] = 1;
        }
        $answer_handler =& sf_gethandler('answer');
        $allanswers = $answer_handler->getLastPublishedByFaq($faqids);
        foreach ($allanswers as $key => $thisanswer) {
            $userids[$thisanswer->uid()] = 1;
        }
        $member_handler =& xoops_gethandler('member');
        $users = $member_handler->getUsers(new Criteria('uid', "(" . implode(',', array_keys($userids)) . ")", "IN"), true);
        for ($i = 0; $i < count($faqsObj); $i++) {
            $faqs['categoryid'] = $faqsObj[$i]->categoryid();
            $faqs['question'] = $faqsObj[$i]->question($maxQuestionLength);
            $faqs['faqid'] = $faqsObj[$i]->faqid();
            $faqs['categoryname'] = $allcategories[$faqsObj[$i]->categoryid()]->getVar('name');
            // Creating the answer object
            $answerObj =& $allanswers[$faqsObj[$i]->faqid()];
            $faqs['date'] = $faqsObj[$i]->datesub();
            $faqs['poster'] = sf_getLinkedUnameFromId($answerObj->uid(), $smartModuleConfig['userealname'], $users);
            $block['faqs'][] = $faqs;
        }
        $block['lang_question'] = _MB_SF_FAQS;
        $block['lang_category'] = _MB_SF_CATEGORY;
        $block['lang_poster'] = _MB_SF_ANSWEREDBY;
        $block['lang_date'] = _MB_SF_DATE;
        $modulename = $myts->htmlSpecialChars($smartModule->getVar('name'));
        $block['lang_visitfaq'] = _MB_SF_VISITFAQ . " " . $modulename;
    }
    return $block;
}
Exemple #5
0
function smartfaq_search($queryarray, $andor, $limit, $offset, $userid)
{
    include_once XOOPS_ROOT_PATH . '/modules/smartfaq/include/functions.php';
    $ret = array();
    $faq_handler =& sf_gethandler('faq');
    $faqsObj =& $faq_handler->getFaqsFromSearch($queryarray, $andor, $limit, $offset, $userid);
    for ($i = 0; $i < count($faqsObj); $i++) {
        $ret[$i]['image'] = "images/smartfaq.gif";
        $ret[$i]['link'] = "faq.php?faqid=" . $faqsObj[$i]->faqid();
        $ret[$i]['title'] = $faqsObj[$i]->question(50);
        $ret[$i]['time'] = $faqsObj[$i]->getVar('datesub');
        $ret[$i]['uid'] = $faqsObj[$i]->uid();
    }
    return $ret;
}
function b_faqs_random_how_show()
{
    include_once XOOPS_ROOT_PATH . "/modules/smartfaq/include/functions.php";
    $block = array();
    // Creating the faq handler object
    $faq_handler =& sf_gethandler('faq');
    // creating the FAQ object
    $faqsObj = $faq_handler->getRandomFaq('howdoi', array(_SF_STATUS_PUBLISHED, _SF_STATUS_NEW_ANSWER));
    if ($faqsObj) {
        $block['content'] = $faqsObj->howdoi();
        $block['id'] = $faqsObj->faqid();
        $block['lang_answer'] = _MB_SF_ANSWERHERE;
    }
    return $block;
}
function b_marquee_smartfaq($limit, $dateformat, $itemssize)
{
    include_once XOOPS_ROOT_PATH . "/modules/smartfaq/include/functions.php";
    $block = array();
    $smartModule =& sf_getModuleInfo();
    $smartModuleConfig =& sf_getModuleConfig();
    $categoryid = -1;
    $sort = 'datesub';
    if ($itemssize > 0) {
        $maxQuestionLength = $itemssize;
    } else {
        $maxQuestionLength = 99999;
    }
    // Creating the faq handler object
    $faq_handler =& sf_gethandler('faq');
    // Creating the category handler object
    $category_handler =& sf_gethandler('category');
    // Creating the last FAQs
    $faqsObj = $faq_handler->getAllPublished($limit, 0, $categoryid, $sort);
    $allcategories = $category_handler->getObjects(null, true);
    if ($faqsObj) {
        $userids = array();
        foreach ($faqsObj as $key => $thisfaq) {
            $faqids[] = $thisfaq->getVar('faqid');
            $userids[$thisfaq->uid()] = 1;
        }
        $answer_handler =& sf_gethandler('answer');
        $allanswers = $answer_handler->getLastPublishedByFaq($faqids);
        foreach ($allanswers as $key => $thisanswer) {
            $userids[$thisanswer->uid()] = 1;
        }
        $member_handler =& xoops_gethandler('member');
        $users = $member_handler->getUsers(new Criteria('uid', "(" . implode(',', array_keys($userids)) . ")", "IN"), true);
        for ($i = 0; $i < count($faqsObj); $i++) {
            $answerObj =& $allanswers[$faqsObj[$i]->faqid()];
            $title = $faqsObj[$i]->question($maxQuestionLength);
            $block[] = array('date' => $faqsObj[$i]->datesub(), 'category' => $allcategories[$faqsObj[$i]->categoryid()]->getVar('name'), 'author' => sf_getLinkedUnameFromId($answerObj->uid(), $smartModuleConfig['userealname'], $users), 'title' => $title, 'link' => "<a href='" . XOOPS_URL . '/modules/smartfaq/faq.php?faqid=' . $faqsObj[$i]->faqid() . "'>" . $title . '</a>');
        }
    }
    return $block;
}
Exemple #8
0
 /**
  * storeFaq: store the FAQ in the application's specific database (required)
  * @param xhelpFaq $faq The faq to add
  * @return bool true (success) / false (failure)
  * @access public
  */
 function storeFaq(&$faq)
 {
     global $xoopsUser;
     $uid = $xoopsUser->getVar('uid');
     // Take xhelpFaq and create faq for smartfaq
     $hFaq =& sf_gethandler('faq');
     $hAnswer =& sf_gethandler('answer');
     $myFaq =& $hFaq->create();
     $myAnswer =& $hAnswer->create();
     // Creating the answer object
     //$faq->getVar('categories') is an array. If your application
     //only supports single categories use the first element
     //in the array
     $categories = $faq->getVar('categories');
     $categories = intval($categories[0]);
     // Change array of categories to 1 category
     $myFaq->setVar('uid', $uid);
     $myFaq->setVar('question', $faq->getVar('problem'));
     $myFaq->setVar('datesub', time());
     $myFaq->setVar('categoryid', $categories);
     $myFaq->setVar('status', _SF_STATUS_PUBLISHED);
     $ret = $hFaq->insert($myFaq);
     $faq->setVar('id', $myFaq->getVar('faqid'));
     if ($ret) {
         // If faq was stored, store answer
         // Trigger event for question being stored
         $myAnswer->setVar('status', _SF_AN_STATUS_APPROVED);
         $myAnswer->setVar('faqid', $myFaq->faqid());
         $myAnswer->setVar('answer', $faq->getVar('solution'));
         $myAnswer->setVar('uid', $uid);
         $ret = $hAnswer->insert($myAnswer);
     }
     if ($ret) {
         // Set the new url for the saved FAQ
         $faq->setVar('url', $this->makeFaqUrl($faq));
         // Trigger any module events
         $myFaq->sendNotifications(array(_SF_NOT_FAQ_PUBLISHED));
     }
     return $ret;
 }
Exemple #9
0
 function faqsCount($cat_id = 0, $status = '')
 {
     global $xoopsUser;
     include_once XOOPS_ROOT_PATH . '/modules/smartfaq/include/functions.php';
     $faq_handler =& sf_gethandler('faq');
     return $faq_handler->getCountsByCat($cat_id, $status);
 }
Exemple #10
0
<?php

/**
* $Id: question.php,v 1.25 2006/09/29 18:49:10 malanciault Exp $
* Module: SmartFAQ
* Author: The SmartFactory <www.smartfactory.ca>
* Licence: GNU
*/
include_once "admin_header.php";
// Creating the faq handler object
$faq_handler =& sf_gethandler('faq');
// Creating the category handler object
$category_handler =& sf_gethandler('category');
$op = '';
if (isset($_GET['op'])) {
    $op = $_GET['op'];
}
if (isset($_POST['op'])) {
    $op = $_POST['op'];
}
// Where shall we start?
$startfaq = isset($_GET['startfaq']) ? intval($_GET['startfaq']) : 0;
function editfaq($showmenu = false, $faqid = -1)
{
    global $faq_handler, $category_handler, $xoopsUser, $xoopsUser, $xoopsConfig, $xoopsDB, $modify, $xoopsModuleConfig, $xoopsModule, $XOOPS_URL, $myts;
    include_once XOOPS_ROOT_PATH . '/class/xoopsformloader.php';
    // If there is a parameter, and the id exists, retrieve data: we're editing a faq
    if ($faqid != -1) {
        // Creating the FAQ object
        $faqObj = new sfFaq($faqid);
        if ($faqObj->notLoaded()) {
Exemple #11
0
}
if (isset($_POST['op'])) {
    $op = $_POST['op'];
}
// Getting the faqid
$faqid = isset($_GET['faqid']) ? intval($_GET['faqid']) : 0;
$faqid = isset($_POST['faqid']) ? intval($_POST['faqid']) : $faqid;
// If no FAQ is selected, exit
if ($faqid == 0) {
    redirect_header("javascript:history.go(-1)", 1, _MD_SF_NOFAQSELECTED);
    exit;
}
// Creating the FAQ handler object
$faq_handler =& sf_gethandler('faq');
// Creating the answer handler object
$answer_handler =& sf_gethandler('answer');
switch ($op) {
    // The answer is posted
    case 'post':
        global $faqObj, $xoopsUser, $xoopsConfig, $xoopsModule, $xoopsModuleConfig, $xoopsDB;
        // If user is anonymous and we don't allow anonymous posting, exit; else, get the uid
        if (!$xoopsUser) {
            if ($xoopsModuleConfig['anonpost'] == 1) {
                $uid = 0;
            } else {
                redirect_header("index.php", 3, _NOPERM);
                exit;
            }
        } else {
            $uid = $xoopsUser->uid();
        }
Exemple #12
0
function sf_createCategorySelect($selectedid = 0, $parentcategory = 0, $allCatOption = true)
{
    $ret = "" . _MB_SF_SELECTCAT . "&nbsp;<select name='options[]'>";
    if ($allCatOption) {
        $ret .= "<option value='0'";
        $ret .= ">" . _MB_SF_ALLCAT . "</option>\n";
    }
    // Creating the category handler object
    $category_handler =& sf_gethandler('category');
    // Creating category objects
    $categoriesObj = $category_handler->getCategories(0, 0, $parentcategory);
    if (count($categoriesObj) > 0) {
        foreach ($categoriesObj as $catID => $categoryObj) {
            $ret .= sf_addCategoryOption($categoryObj, $selectedid);
        }
    }
    $ret .= "</select>\n";
    return $ret;
}
Exemple #13
0
$totalCategoriesOnPage = count($categoriesObj);
if ($totalCategoriesOnPage == 0) {
    redirect_header("javascript:history.go(-1)", 2, _AM_SF_NO_CAT_EXISTS);
    exit;
}
$xoopsOption['template_main'] = 'smartfaq_index.html';
include_once XOOPS_ROOT_PATH . "/header.php";
include_once "footer.php";
//get all categories for future reference
$allcategories = $category_handler->getObjects(null, true);
// Arrays that will hold the informations passed on to smarty variables
$qnas = array();
$categories = array();
$subcats = $category_handler->getSubCats($categoriesObj);
$totalQnas = $category_handler->faqsCount(0, array(_SF_STATUS_OPENED));
$faq_handler =& sf_gethandler('faq');
$last_qnaObj = $faq_handler->getLastPublishedByCat(array(_SF_STATUS_OPENED));
foreach ($categoriesObj as $cat_id => $category) {
    $total = 0;
    if (isset($subcats[$cat_id]) && count($subcats[$cat_id]) > 0) {
        foreach ($subcats[$cat_id] as $key => $subcat) {
            $subcat_id = $subcat->getVar('categoryid');
            if (isset($totalQnas[$subcat_id]) && $totalQnas[$subcat_id] > 0) {
                if (isset($last_qnaObj[$subcat_id])) {
                    $subcat->setVar('last_faqid', $last_qnaObj[$subcat_id]->getVar('faqid'));
                    $subcat->setVar('last_question_link', "<a href='faq.php?faqid=" . $last_qnaObj[$subcat_id]->getVar('faqid') . "'>" . $last_qnaObj[$subcat_id]->question(50) . "</a>");
                }
                $subcat->setVar('faqcount', $totalQnas[$subcat_id]);
                $categories[$cat_id]['subcats'][$subcat_id] = $subcat->toArray(null, true);
                $total += $totalQnas[$subcat_id];
            }
Exemple #14
0
function xoops_module_update_smartfaq($module)
{
    // Load SmartDbUpdater from the SmartObject Framework if present
    $smartdbupdater = XOOPS_ROOT_PATH . "/modules/smartobject/class/smartdbupdater.php";
    if (!file_exists($smartdbupdater)) {
        $smartdbupdater = XOOPS_ROOT_PATH . "/modules/smartfaq/class/smartdbupdater.php";
    }
    include_once $smartdbupdater;
    $dbupdater = new SmartobjectDbupdater();
    ob_start();
    echo "<code>" . _SDU_UPDATE_UPDATING_DATABASE . "<br />";
    // Adding partialview field
    $table = new SmartDbTable('smartfaq_faq');
    if (!$table->fieldExists('partialview')) {
        $table->addNewField('partialview', "tinyint(1) NOT NULL default '0'");
    }
    // Changing categoryid type to int(11)
    $table->addAlteredField('categoryid', "int(11) NOT NULL default '0'", false);
    if (!$dbupdater->updateTable($table)) {
        /**
         * @todo trap the errors
         */
    }
    unset($table);
    // Editing smartfaq_categories table
    $table = new SmartDbTable('smartfaq_categories');
    // Changing categoryid type to int(11)
    $table->addAlteredField('categoryid', "int(11) NOT NULL default '0'", false);
    // Changing parentid type to int(11)
    $table->addAlteredField('parentid', "int(11) NOT NULL default '0'", false);
    if (!$dbupdater->updateTable($table)) {
        /**
         * @todo trap the errors
         */
    }
    unset($table);
    // Editing smartfaq_answers table
    $table = new SmartDbTable('smartfaq_answers');
    // Changing categoryid type to int(11)
    $table->addAlteredField('answerid', "int(11) NOT NULL default '0'", false);
    // Changing parentid type to int(11)
    $table->addAlteredField('faqid', "int(11) NOT NULL default '0'", false);
    if (!$dbupdater->updateTable($table)) {
        /**
         * @todo trap the errors
         */
    }
    unset($table);
    /**
     * Check for items with categoryid=0
     */
    include_once XOOPS_ROOT_PATH . "/modules/smartfaq/include/functions.php";
    $smartfaq_faq_handler = $answer_handler =& sf_gethandler('faq');
    $smartfaq_category_handler = $answer_handler =& sf_gethandler('category');
    //find a valid categoryid
    $categoriesObj = $smartfaq_category_handler->getCategories(1, 0, 0, 'weight', 'ASC', false);
    if (count($categoriesObj) > 0) {
        $categoryid = $categoriesObj[0]->getVar('categoryid');
        $criteria = new CriteriaCompo();
        $criteria->add(new Criteria('categoryid', 0));
        $smartfaq_faq_handler->updateAll('categoryid', $categoryid, $criteria);
        echo "&nbsp;&nbsp;Cleaning up questions with categoryid=0<br />";
    }
    echo "</code>";
    $feedback = ob_get_clean();
    if (method_exists($module, "setMessage")) {
        $module->setMessage($feedback);
    } else {
        echo $feedback;
    }
    return true;
}
Exemple #15
0
function editcat($showmenu = false, $categoryid = 0)
{
    //$moderators = array(); // just to define the variable
    //$allmods = array();
    $startfaq = isset($_GET['startfaq']) ? intval($_GET['startfaq']) : 0;
    global $category_handler, $xoopsUser, $xoopsUser, $myts, $xoopsConfig, $xoopsDB, $modify, $xoopsModuleConfig, $xoopsModule, $_GET;
    include_once XOOPS_ROOT_PATH . '/class/xoopsformloader.php';
    // Creating the faq handler object
    $faq_handler =& sf_gethandler('faq');
    echo "<script type=\"text/javascript\" src=\"funcs.js\"></script>";
    echo "<style>";
    echo "<!-- ";
    echo "select { width: 130px; }";
    echo "-->";
    echo "</style>";
    // If there is a parameter, and the id exists, retrieve data: we're editing a category
    if ($categoryid != 0) {
        // Creating the category object for the selected category
        $categoryObj = new sfCategory($categoryid);
        if ($showmenu) {
            sf_adminMenu(1, _AM_SF_CATEGORIES . " > " . _AM_SF_EDITING);
        }
        echo "<br />\n";
        if ($categoryObj->notLoaded()) {
            redirect_header("category.php", 1, _AM_SF_NOCOLTOEDIT);
            exit;
        }
        sf_collapsableBar('bottomtable', 'bottomtableicon');
        echo "<img id='bottomtableicon' src=" . XOOPS_URL . "/modules/" . $xoopsModule->dirname() . "/images/icon/close12.gif alt='' /></a>&nbsp;" . _AM_SF_EDITCOL . "</h3>";
        echo "<div id='bottomtable'>";
    } else {
        $categoryObj = $category_handler->create();
        if ($showmenu) {
            sf_adminMenu(1, _AM_SF_CATEGORIES . " > " . _AM_SF_CREATINGNEW);
        }
        echo "<br />\n";
        sf_collapsableBar('bottomtable', 'bottomtableicon');
        echo "<img id='bottomtableicon' src=" . XOOPS_URL . "/modules/" . $xoopsModule->dirname() . "/images/icon/close12.gif alt='' /></a>&nbsp;" . _AM_SF_CATEGORY_CREATE . "</h3>";
        echo "<div id='bottomtable'>";
    }
    // Start category form
    $sform = new XoopsThemeForm(_AM_SF_CATEGORY, "op", xoops_getenv('PHP_SELF'));
    $sform->setExtra('enctype="multipart/form-data"');
    // Name
    $sform->addElement(new XoopsFormText(_AM_SF_CATEGORY, 'name', 50, 255, $categoryObj->name('e')), true);
    // Parent Category
    $mytree = new XoopsTree($xoopsDB->prefix("smartfaq_categories"), "categoryid", "parentid");
    ob_start();
    $mytree->makeMySelBox("name", "weight", $categoryObj->parentid(), 1, 'parentid');
    //makeMySelBox($title,$order="",$preset_id=0, $none=0, $sel_name="", $onchange="")
    $sform->addElement(new XoopsFormLabel(_AM_SF_PARENT_CATEGORY_EXP, ob_get_contents()));
    ob_end_clean();
    /*	$mytree = new XoopsTree($xoopsDB->prefix("smartfaq_categories"), "categoryid" , "parentid");
    	ob_start();
    	$sform->addElement(new XoopsFormHidden('categoryid', $categoryObj->categoryid()));
    	$mytree->makeMySelBox("name", "weight", $categoryObj->categoryid());
    	$sform->addElement(new XoopsFormLabel(_AM_SF_CATEGORY_FAQ, ob_get_contents()));
    	ob_end_clean();
    	*/
    // Decsription
    $sform->addElement(new XoopsFormTextArea(_AM_SF_COLDESCRIPT, 'description', $categoryObj->description('e'), 7, 60));
    // Weight
    $sform->addElement(new XoopsFormText(_AM_SF_COLPOSIT, 'weight', 4, 4, $categoryObj->weight()));
    // READ PERMISSIONS
    $member_handler =& xoops_gethandler('member');
    $group_list =& $member_handler->getGroupList();
    $groups_read_checkbox = new XoopsFormCheckBox(_AM_SF_PERMISSIONS_CAT_READ, 'groups_read[]', $categoryObj->getGroups_read());
    foreach ($group_list as $group_id => $group_name) {
        if ($group_id != XOOPS_GROUP_ADMIN) {
            $groups_read_checkbox->addOption($group_id, $group_name);
        }
    }
    $sform->addElement($groups_read_checkbox);
    // Apply permissions on all faqs
    $addapplyall_radio = new XoopsFormRadioYN(_AM_SF_PERMISSIONS_APPLY_ON_FAQS, 'applyall', 0, ' ' . _AM_SF_YES . '', ' ' . _AM_SF_NO . '');
    $sform->addElement($addapplyall_radio);
    // MODERATORS
    //$moderators_tray = new XoopsFormElementTray(_AM_SF_MODERATORS_DEF, '');
    $module_id = $xoopsModule->getVar('mid');
    /*$gperm_handler = &xoops_gethandler('groupperm');
    	$mod_perms = $gperm_handler->getGroupIds('category_moderation', $categoryid, $module_id);
    
    	$moderators_select = new XoopsFormSelect('', 'moderators', $moderators, 5, true);
    	$moderators_tray->addElement($moderators_select);
    
    	$butt_mngmods = new XoopsFormButton('', '', 'Manage mods', 'button');
    	$butt_mngmods->setExtra('onclick="javascript:small_window(\'pop.php\', 370, 350);"');
    	$moderators_tray->addElement($butt_mngmods);
    
    	$butt_delmod = new XoopsFormButton('', '', 'Delete mod', 'button');
    	$butt_delmod->setExtra('onclick="javascript:deleteSelectedItemsFromList(this.form.elements[\'moderators[]\']);"');
    	$moderators_tray->addElement($butt_delmod);
    
    	$sform->addElement($moderators_tray);
    	*/
    $sform->addElement(new XoopsFormHidden('categoryid', $categoryid));
    // Action buttons tray
    $button_tray = new XoopsFormElementTray('', '');
    /*for ($i = 0; $i < sizeof($moderators); $i++) {
    	$allmods[] = $moderators[$i];
    	}
    
    	$hiddenmods = new XoopsFormHidden('allmods', $allmods);
    	$button_tray->addElement($hiddenmods);
    	*/
    $hidden = new XoopsFormHidden('op', 'addcategory');
    $button_tray->addElement($hidden);
    // No ID for category -- then it's new category, button says 'Create'
    if (!$categoryid) {
        $butt_create = new XoopsFormButton('', '', _AM_SF_CREATE, 'submit');
        $butt_create->setExtra('onclick="this.form.elements.op.value=\'addcategory\'"');
        $button_tray->addElement($butt_create);
        $butt_clear = new XoopsFormButton('', '', _AM_SF_CLEAR, 'reset');
        $button_tray->addElement($butt_clear);
        $butt_cancel = new XoopsFormButton('', '', _AM_SF_CANCEL, 'button');
        $butt_cancel->setExtra('onclick="history.go(-1)"');
        $button_tray->addElement($butt_cancel);
    } else {
        // button says 'Update'
        $butt_create = new XoopsFormButton('', '', _AM_SF_MODIFY, 'submit');
        $butt_create->setExtra('onclick="this.form.elements.op.value=\'addcategory\'"');
        $button_tray->addElement($butt_create);
        $butt_cancel = new XoopsFormButton('', '', _AM_SF_CANCEL, 'button');
        $butt_cancel->setExtra('onclick="history.go(-1)"');
        $button_tray->addElement($butt_cancel);
    }
    $sform->addElement($button_tray);
    $sform->display();
    echo "</div>";
    if ($categoryid) {
        include_once XOOPS_ROOT_PATH . "/modules/smartfaq/include/displayfaqs.php";
    }
    unset($hidden);
}