0) { $client = new Clients; $client->del($get['id']); } } if(isset($get['restore']) && is_numeric($get['restore'])) { $client = new Clients; $client->restore($get['restore']); } /*if(is_numeric($get['reason'])) { $client = new Clients(); $get['id_del_client'] = $get['reason']; $client->delReason($get); }*/ if(isset($_POST['id_del_client'])) { $post = clearInputData($_POST); if($post['req_id'] > 0){ $pdo = new MysqlPdo(hst, ndb, user, pass); $sql = "SET NAMES 'utf8'"; $pdo->query($sql); $req = new Requisitions($pdo); $req->deleteReq($post['req_id'], $_SESSION['id'], $post); } else if($post['id_del_client']){ $client = new Clients; $client->delReason($post); } } if(!empty($_POST['id_del_client_all'])) { $all = 0; $clients = json_decode($_POST['id_del_client_all']); if(isset($_POST['all']) && $_POST['all'] > 0){ $all = (int)$_POST['all']; } $pdo = new MysqlPdo(hst, ndb, user, pass); $sql = "SET NAMES 'utf8'"; $pdo->query($sql); if($all == 1){ if(isset($_SESSION['where_campaigns'])){ $where = $_SESSION['where_campaigns']; $sql = "SELECT id FROM clients WHERE 1 ".$where; $q = $pdo->query($sql); while($r = $pdo->fetch_assoc($q)){ $_POST['id_del_client'] = $r['id']; $post = clearInputData($_POST); $client = new Clients; $client->delReason($post); } } else { exit(); } } else { foreach($clients as $cl){ $_POST['id_del_client'] = $cl; $post = clearInputData($_POST); $client = new Clients; $client->delReason($post); } } } if(isset($_POST['id_del_req_all'])) { $reqs = json_decode($_POST['id_del_req_all']); $all = 0; if(isset($_POST['all']) && $_POST['all'] > 0){ $all = (int)$_POST['all']; } $pdo = new MysqlPdo(hst, ndb, user, pass); $sql = "SET NAMES 'utf8'"; $pdo->query($sql); $ids = array(); if(isset($_POST['ids_exception'])){ $ids = $_POST['ids_exception']; } if($all == 1){ $reqs = array(); if(isset($_SESSION['where_req_campaigns'])){ $sql = $_SESSION['where_req_campaigns']; if (!empty($ids)){ $sql .= " AND ID NOT IN (".implode(',', $ids).")"; } echo $sql; $q = $pdo->query($sql); while($r = $pdo->fetch_assoc($q)) { $reqs[] = $r['id']; } } else { exit(); } } $req = new Requisitions($pdo); $post = clearInputData($_POST); //var_dump($reqs); foreach($reqs as $req_id){ $req->deleteReq($req_id, $_SESSION['id'], $post); } } ?>