Exemplo n.º 1
0
    if (!$res || $xoopsDB->getRowsNum($res) == 0) {
        // invalid category ID
        redirect_header('category.php', 3, _NOPERM);
        exit;
    }
    $cat = $xoopsDB->fetchArray($res);
    $editid[$catid] = " edit";
} else {
    $cat = array('catid' => 0, 'cname' => '', 'description' => '');
}
include XOOPS_ROOT_PATH . '/header.php';
$xoopsOption['template_main'] = 'logtick_category.html';
set_logtick_breadcrumbs(array(_MD_CATEGORY_EDIT => 'category.php'));
$xoopsTpl->assign('edit', $cat);
$xoopsTpl->assign('uid', $uid);
$cats = lt_get_categories($uid, 1);
foreach ($editid as $id => $mark) {
    if (isset($cats[$id])) {
        $cats[$id]['class'] = $mark;
    }
}
$xoopsTpl->assign('categories', $cats);
// not selected categories
$res = $xoopsDB->query("SELECT c.* FROM " . TCAT . " c LEFT JOIN " . TUC . " ON uidref={$uid} AND catref=catid WHERE catref IS NULL ORDER BY cname");
$rests = array();
while ($data = $xoopsDB->fetchArray($res)) {
    $id = $data['catid'];
    $data['cname'] = htmlspecialchars($data['cname']);
    $rests[$id] = $data;
}
$xoopsTpl->assign('restcats', $rests);
Exemplo n.º 2
0
}
$res = $xoopsDB->query("SELECT catid, cname FROM " . TCAT . " WHERE catid IN (" . get_exists_ids(TLOG, 'pcat') . ")");
$categ = array();
if ($res && $xoopsDB->getRowsNum($res)) {
    if (isset($_SESSION['logtick']['cats']) && empty($catid)) {
        $catid = $_SESSION['logtick']['cats'];
    }
    $cats = split(',', $catid);
    while ($cat = $xoopsDB->fetchArray($res)) {
        $cat['cname'] = htmlspecialchars($cat['cname']);
        $cat['checked'] = in_array($cat['catid'], $cats);
        $categ[] = $cat;
    }
}
// input form
$xoopsTpl->assign('mycategories', lt_get_categories());
$xoopsTpl->assign('timespans', lt_split_options($xoopsModuleConfig['timespans']));
$xoopsTpl->assign('users', $users);
$xoopsTpl->assign('categories', $categ);
$xoopsTpl->assign('interval', $xoopsModuleConfig['interval']);
$modurl = XOOPS_URL . '/modules/' . basename(dirname(__FILE__));
$xoopsTpl->assign('logresult', show_list($uid, $catid));
$xoopsTpl->assign("xoops_js", $xoopsTpl->get_template_vars('xoops_js') . "\n//--></script><script type='text/javascript' src='{$modurl}/logtick.js'><!--");
$xoopsTpl->assign('now', $now);
include XOOPS_ROOT_PATH . '/footer.php';
function get_exists_ids($table, $idname)
{
    global $xoopsDB;
    $res = $xoopsDB->query("SELECT {$idname} FROM {$table} GROUP BY {$idname}");
    $ids = array();
    while (list($u) = $xoopsDB->fetchRow($res)) {