Example #1
0
    }
    if ($do == "search") {
        if (isset($_GET['q'])) {
            $conditions[] = "Brand.name like '%" . trim($_GET['q']) . "%'";
        }
    }
    if ($do == "del" && !empty($id)) {
        $sql = "SELECT picture FROM {$tb_prefix}brands WHERE id=" . $id;
        $attach_filename = $pdb->GetOne($sql);
        $brand->del($_GET['id']);
        $attachment->deleteBySource($attach_filename);
    }
    if ($do == "edit") {
        $brand_info = null;
        if (!empty($id)) {
            $item_info = $brand->getInfo($id);
            if ($item_info['picture']) {
                $item_info['image'] = pb_get_attachmenturl($item_info['picture'], "../", 'small');
            }
        }
        if (!empty($item_info)) {
            setvar("item", $item_info);
        }
        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) {