示例#1
0
文件: help.php 项目: reboxhost/phpb2b
$helptype = new Helptypes();
$tpl_file = "help";
setvar("HelpTypes", $helptype->data);
if (isset($_GET['do'])) {
    $do = trim($_GET['do']);
    if (!empty($_GET['id'])) {
        $id = intval($_GET['id']);
    }
    if ($do == "search") {
        if (!empty($_GET['help']['title'])) {
            $search_title = $_GET['help']['title'];
            $conditions = "title like '%" . $search_title . "%'";
        }
    }
    if ($do == "edit") {
        setvar("HelptypeOptions", $helptype_option = $helptype->getTypeOptions('', 3));
        if (!empty($id)) {
            setvar("HelptypeOptions", $helptype_option = $helptype->getTypeOptions($item['helptype_id'], 3));
            setvar("item", $item = $help->read("*", $id));
        }
        $tpl_file = "help.edit";
        template($tpl_file);
        exit;
    }
}
if (isset($_POST['save']) && !empty($_POST['help'])) {
    $vals = $_POST['help'];
    if (isset($_POST['id'])) {
        $id = intval($_POST['id']);
    }
    if (!empty($id)) {
示例#2
0
if (isset($_POST['del']) && is_array($_POST['id'])) {
    $deleted = $helptype->del($_POST['id']);
    if (!$deleted) {
        flash();
    }
}
if (isset($_GET['do'])) {
    $do = trim($_GET['do']);
    if ($do == "search" && !empty($_GET['q'])) {
        $conditions[] = "title like '%" . trim($_GET['q']) . "%'";
    }
    if ($do == "del" && !empty($_GET['id'])) {
        $helptype->del($_GET['id']);
    }
    if ($do == "edit") {
        setvar("HelptypeOptions", $helptype->getTypeOptions());
        if (isset($_GET['id'])) {
            $id = intval($_GET['id']);
            $res = $helptype->read("*", $id);
            setvar("HelptypeOptions", $helptype->getTypeOptions($res['parent_id']));
            setvar("item", $res);
        }
        $tpl_file = "helptype.edit";
        template($tpl_file);
        exit;
    }
}
if (isset($_POST['save'])) {
    $vals = array();
    $vals = $_POST['data']['helptype'];
    //¸ù¾Ýparent_idÅжÏlevel