Exemplo n.º 1
0
        setvar("BrandtypeOptions", $brandtypes->getTypeOptions());
        $tpl_file = "brand.edit";
        template($tpl_file);
        exit;
    }
}
if (isset($_POST['del']) && is_array($_POST['id'])) {
    foreach ($_POST['id'] as $key => $val) {
        $attach_filename = $pdb->GetOne("select picture from {$tb_prefix}brands where id=" . $val);
        $attachment->deleteBySource($attach_filename);
    }
    $deleted = $brand->del($_POST['id']);
    if (!$deleted) {
        flash();
    }
    $cache->updateIndexCache();
}
if (isset($_POST['recommend'])) {
    foreach ($_POST['id'] as $val) {
        $commend_now = $brand->field("if_commend", "id=" . $val);
        if ($commend_now == "0") {
            $result = $brand->saveField("if_commend", "1", intval($val));
        } else {
            $result = $brand->saveField("if_commend", "0", intval($val));
        }
    }
    if ($result) {
        flash("success");
    } else {
        flash();
    }