Пример #1
0
if (!defined('PATHOS')) {
    exit('');
}
$qna = null;
if (isset($_GET['id'])) {
    $qna = $db->selectObject('faq', 'id=' . $_GET['id']);
    if ($qna != null) {
        $loc = unserialize($qna->location_data);
    }
}
if (pathos_permissions_check('manage', $loc)) {
    $config = $db->selectObject('faqmodule_config', "location_data='" . serialize($loc) . "'");
    if ($config == null) {
        $config->enable_categories = 0;
    }
    $form = faq::form($qna);
    $form->location($loc);
    $form->meta('action', 'save_faq');
    $template = new template('faqmodule', '_form_editfaq', $loc);
    if ($config->enable_categories) {
        $allcats = $db->selectObjects('category', "location_data='" . serialize($loc) . "'");
        if (!defined('SYS_SORTING')) {
            require_once BASE . 'subsystems/sorting.php';
        }
        usort($allcats, 'pathos_sorting_byRankAscending');
        $catarray = array();
        foreach ($allcats as $cat) {
            $catarray[$cat->id] = $cat->name;
        }
        $form->registerBefore('question', 'categories', 'Select Category', new dropdowncontrol('', $catarray));
    }