Esempio n. 1
0
include_once dirname(dirname(__FILE__)) . "/include/functions.php";
$op = isset($_REQUEST['op']) ? trim($_REQUEST['op']) : 'list';
$res_id = isset($_REQUEST['res_id']) ? trim($_REQUEST['res_id']) : '';
$category_handler =& xoops_getmodulehandler('category', 'resources');
$resources_handler =& xoops_getmodulehandler('resources', 'resources');
$attachments_handler =& xoops_getmodulehandler('attachments', 'resources');
$count_cat = $category_handler->getCount();
if (empty($count_cat)) {
    redirect_header('admin.category.php', 3, '请添加资源分类');
}
switch ($op) {
    default:
    case 'list':
        $res_weight = isset($_REQUEST['res_weight']) ? $_REQUEST['res_weight'] : '';
        if (!empty($res_weight)) {
            $ac_weight = ResourcesContentOrder($res_weight, 'resources', 'res_weight');
            if (!empty($ac_weight)) {
                redirect_header('admin.resources.php', 3, '更新成功!');
            }
        }
        //category
        $categories = $category_handler->getList();
        //resources
        $criteria = new CriteriaCompo();
        $criteria->setSort('res_weight');
        $criteria->setOrder('ASC');
        $resources = $resources_handler->getAll($criteria, null, false);
        if ($xoopsModuleConfig['timeformat'] == '1') {
            $date = 'y-m-d';
        } elseif ($xoopsModuleConfig['timeformat'] == '2') {
            $date = 'y-m-d h:i:s';
Esempio n. 2
0
<?php

include 'header.php';
xoops_cp_header();
loadModuleAdminMenu(2, "");
include_once dirname(dirname(__FILE__)) . "/include/functions.php";
$op = isset($_REQUEST['op']) ? trim($_REQUEST['op']) : 'list';
$cat_id = isset($_REQUEST['cat_id']) ? trim($_REQUEST['cat_id']) : '';
$category_handler =& xoops_getmodulehandler('category', 'resources');
switch ($op) {
    default:
    case 'list':
        $cat_weight = isset($_REQUEST['cat_weight']) ? $_REQUEST['cat_weight'] : '';
        if (!empty($cat_weight)) {
            $ac_weight = ResourcesContentOrder($cat_weight, 'category', 'cat_weight');
            if (!empty($ac_weight)) {
                redirect_header('admin.category.php', 3, '更新成功!');
            }
        }
        $criteria = new CriteriaCompo();
        $criteria->setSort('cat_weight');
        $criteria->setOrder('ASC');
        $categories = $category_handler->getAll($criteria, null, false);
        $xoopsTpl->assign('categories', $categories);
        $template_main = "resources_admin_category.html";
        break;
    case 'new':
        $cat_obj =& $category_handler->create();
        $action = 'action.category.php?ac=insert';
        $form = $cat_obj->getForm($action);
        $form->display();