* @author Susheng Yang <*****@*****.**> * @version $Id: admin.category.php 1 2010-1-22 ezsky$ */ include "header.php"; xoops_cp_header(); loadModuleAdminMenu(1); include_once "../include/functions.php"; $op = isset($_REQUEST['op']) ? $_REQUEST['op'] : (isset($_REQUEST['cat_id']) ? 'edit' : 'display'); $cat_id = isset($_REQUEST['cat_id']) ? $_REQUEST['cat_id'] : ''; $cat_handler =& xoops_getmodulehandler('category', 'links'); switch ($op) { default: case 'display': $cat_order = isset($_REQUEST['cat_order']) ? $_REQUEST['cat_order'] : ''; if (!empty($cat_order)) { $ac_order = LinksContentOrder($cat_order, 'category', 'cat_order'); if (!empty($ac_order)) { redirect_header('admin.category.php', 3, _AM_LINKS_UPDATEDSUCCESS); } } $criteria = new CriteriaCompo(); $criteria->setSort('cat_order'); $criteria->setOrder('ASC'); $categories = $cat_handler->getAll($criteria, array('cat_id', 'cat_name', 'cat_order'), false, false); foreach ($categories as $k => $v) { if (empty($v['cat_order'])) { $categories[$k]['cat_order'] = '99'; } } $xoopsTpl->assign('categories', $categories); $xoopsTpl->display("db:links_admin_category.html");
$sorts_list = array('published' => _AM_LINKS_BYPUBLISH, 'datetime' => _AM_LINKS_BYUPDATE, 'release' => _AM_LINKS_PUBLISHLIK, 'draft' => _AM_LINKS_NOTPUBLISHLIK); $xoopsTpl->assign('sort', $sort); $xoopsTpl->assign('sorts_list', $sorts_list); $xoopsTpl->assign('links', $links); $xoopsTpl->assign('op', $op); $xoopsTpl->assign('logo', $xoopsModuleConfig['logo']); $xoopsTpl->display("db:links_admin_links.html"); break; case 'category_display': $cat_obj = $cat_handler->get($cat_id); if (!is_object($cat_obj)) { redirect_header('admin.links.php', 3, _AM_LINKS_CATIDERROR); } $link_order = isset($_REQUEST['link_order']) ? $_REQUEST['link_order'] : ''; if ($link_order) { $ac_order = LinksContentOrder($link_order, 'links', 'link_order'); if ($ac_order) { redirect_header('admin.links.php?cat_id=' . $cat_id, 3, _AM_LINKS_UPDATEDSUCCESS); } } $criteria = new CriteriaCompo(); $criteria->add(new Criteria('cat_id', $cat_id)); $criteria->setSort('link_order'); $criteria->setOrder('ASC'); $links = $link_handler->getAll($criteria, null, false, false); foreach ($links as $k => $v) { $links[$k]['published'] = formatTimestamp($v['published'], 'Y-m-d H:i:s'); $links[$k]['datetime'] = formatTimestamp($v['datetime'], 'Y-m-d H:i:s'); $links[$k]['link_image'] = XOOPS_URL . $xoopsModuleConfig['logo_dir'] . $v['link_image']; $links[$k]['cat_name'] = $cat_obj->getVar('cat_name'); if (empty($v['link_order'])) {