Exemple #1
0
}
if (isset($_POST['save']) && !empty($_POST['help'])) {
    $vals = $_POST['help'];
    if (isset($_POST['id'])) {
        $id = intval($_POST['id']);
    }
    if (!empty($id)) {
        $vals['modified'] = $time_stamp;
        $result = $help->save($vals, "update", $id);
    } else {
        $vals['created'] = $vals['modified'] = $time_stamp;
        $result = $help->save($vals);
    }
    if (!$result) {
        flash();
    }
}
if (isset($_REQUEST['del']) && !empty($_REQUEST['id'])) {
    $deleted = false;
    $deleted = $help->del($_REQUEST['id']);
}
if (isset($_GET['q'])) {
    $conditions[] = "Help.title like '%" . $_GET['q'] . "%'";
}
$amount = $help->findCount(null, $conditions);
$page->setPagenav($amount);
$result = $help->findAll("Help.id,Help.title,ht.title AS typename,Help.content", array("LEFT JOIN {$tb_prefix}helptypes ht ON Help.helptype_id=ht.id"), $conditions, "Help.id DESC", $page->firstcount, $page->displaypg);
setvar("Items", $result);
setvar("HelptypeOptions", $helptype_option = $helptype->getTypeOptions('', 3));
setvar("ByPages", $page->pagenav);
template($tpl_file);