Esempio n. 1
0
$color_detail = $_get->get_color($color_id);
$color_visibility_active = '';
$color_visibility_inactive = '';
if ($color_detail->collection_visibility_status == 'yes') {
    $color_visibility_active = 'checked="checked"';
} else {
    if ($color_Detail->collection_visibility_status == 'no') {
        $color_visibility_inactive = 'checked="checked"';
    }
}
if (isset($_POST['btn-detail-collection']) && $_POST['btn-detail-collection'] == 'Save Changes') {
    $collection_id = $color_detail->collection_id;
    $visibility = filter_var($_POST['visibility'], FILTER_SANITIZE_STRING);
    $name = filter_var($_POST['name'], FILTER_SANITIZE_STRING);
    $description = filter_var($_POST['description'], FILTER_SANITIZE_STRING);
    $check_name = $_get->count_name($name, $collection_id);
    if ($check_name->rows > 0) {
        $page = 'self';
        $type = 'danger';
        $msg = $name . ' has already existed, please choose another collection name';
        set_alert($type, $msg);
        safe_redirect($page);
    }
    $_update->update($name, $description, 'active', $visibility, $collection_id);
    $page = 'detail-collection/' . $collection_id . '/' . cleanurl($name);
    $type = 'success';
    $msg = 'Changes successfuly saved';
    set_alert($type, $msg);
    safe_redirect($page);
}
if (isset($_POST['btn-detail-collection']) && $_POST['btn-detail-collection'] == 'Delete') {