Exemple #1
0
function catManager()
{
    global $mytree, $xoopsModule, $xoopsModuleConfig;
    include_once sprintf('%s/modules/%s/class/class.weblogcategories.php', XOOPS_ROOT_PATH, $xoopsModule->dirname());
    include_once sprintf('%s/modules/%s/admin/mygrouppermform.php', XOOPS_ROOT_PATH, $xoopsModule->dirname());
    include_once sprintf('%s/modules/%s/include/gtickets.php', XOOPS_ROOT_PATH, $xoopsModule->dirname());
    xoops_cp_header();
    echo sprintf('<h4>%s&nbsp;&raquo;&raquo;&nbsp;%s</h4>', indexLink(), _AM_WEBLOG_CATMANAGER);
    $gperm_handler =& xoops_gethandler('groupperm');
    $weblogcats =& WeblogCategories::getInstance();
    //    $mytree->makeMySelBox('cat_title', 'cat_title');
    include_once XOOPS_ROOT_PATH . '/class/xoopsformloader.php';
    $form_add = new XoopsThemeForm(_AM_WEBLOG_ADDCAT, 'weblog_cat_form', 'catmanager.php');
    $form_add->addElement(new XoopsFormText(_AM_WEBLOG_TITLE, 'cat_title', 50, 255, ''), true);
    $form_add->addElement(new XoopsFormLabel(_AM_WEBLOG_PCAT, $weblogcats->getMySelectBox(0, 1, 'cat_pid')));
    if (isset($xoopsModuleConfig['category_post_permission']) && $xoopsModuleConfig['category_post_permission']) {
        $form_add->addElement(new XoopsFormSelectGroup(_AM_WEBLOG_CAT_GPERM, 'postgroup', true, '', 5, true));
    }
    $form_add->addElement(new XoopsFormHidden('action', 'addCat'));
    $form_add->addElement(new XoopsFormButton('', 'catadd_button', _SUBMIT, 'submit'));
    $form_add->display();
    $form_mod = new XoopsThemeForm(_AM_WEBLOG_MODCAT, 'weblog_cat_form', 'catmanager.php');
    $form_mod->addElement(new XoopsFormLabel(_AM_WEBLOG_CAT, $weblogcats->getMySelectBox(0, 0, 'cat_id')));
    $form_mod->addElement(new XoopsFormButton('', 'catmod_button', _AM_WEBLOG_GO, 'submit'));
    $form_mod->addElement(new XoopsFormHidden('action', 'modCat'));
    $form_mod->display();
    // All category permit list
    if (isset($xoopsModuleConfig['category_post_permission']) && $xoopsModuleConfig['category_post_permission']) {
        $wb_cat_array = $weblogcats->getChildTreeArray();
        $global_perms_array = array();
        foreach ($wb_cat_array as $category_data) {
            $global_perms_array[$category_data['cat_id']] = $category_data['cat_title'];
        }
        $form_catgperm = new MyXoopsGroupPermForm('', $xoopsModule->mid(), 'weblog_cat_post', "<br /><hr /><br /><h4>" . _AM_WEBLOG_CAT_SETALL . "</h4>");
        foreach ($global_perms_array as $perm_id => $perm_name) {
            $form_catgperm->addItem($perm_id, $perm_name);
        }
        $form_catgperm->addElement(new XoopsFormHidden('action', 'modCatall'));
        echo $form_catgperm->render();
    }
    /*
        echo "<table width='100%' class='outer' cellspacing='1'>\r\n";
        echo sprintf("<tr><th colspan='2'>%s</th></tr>", _AM_WEBLOG_CATMANAGER);
    
        echo sprintf('<tr valign=\'top\' align=\'left\'><form method=\'post\', action=\'catmanager.php\'><td class=\'head\'>%s<br /><br />',
                     _AM_WEBLOG_ADDCAT);
        echo "<div style='font-weight:normal;'>";
        echo sprintf('%s: <input type=\'text\' name=\'title\' size=\'30\' maxlength=\'50\'><br />', _AM_WEBLOG_TITLE);
        if ($count > 0) {
            echo sprintf('%s: ', _AM_WEBLOG_PCAT);
            $mytree->makeMySelBox('cat_title', 'cat_title', 0, 1, 'cat_pid');
        } else {
            echo "<input type=hidden name=cat_pid value='0'>\r\n";
        }
        echo "<input type=hidden name=desc value=''>\r\n";
        echo "<input type=hidden name=imgurl value=''>\r\n";
        echo "<input type=hidden name=action value=addCat>\r\n";
        echo "</dev>";
        echo "</td>";
        echo "<td class='even'>\r\n";
        echo sprintf('<input type=submit value=\'%s\'><br />', _AM_WEBLOG_GO);
        echo "</td></form></tr>\r\n";
    
        if ($count > 0) {
            // Modify Category
            echo sprintf('<tr valign=\'top\' align=\'left\'><form method=\'post\', action=\'catmanager.php\'><td class=\'head\'>%s<br /><br />',
                         _AM_WEBLOG_MODCAT);
            echo "<div style='font-weight:normal;'>";
            echo sprintf('%s: ', _AM_WEBLOG_CAT);
            $mytree->makeMySelBox('cat_title', 'cat_title');
            echo "<input type=hidden name=action value=modCat>\r\n";
            echo "</dev>";
            echo "</td>";
            echo "<td class='even'>\r\n";
            echo sprintf('<input type=submit value=\'%s\'><br />', _AM_WEBLOG_GO);
            echo "</td></form></tr>\r\n";
        }
    
        echo "</table>\r\n";
    */
    xoops_cp_footer();
}