<?php require_once('includes/requirecompere.inc.php'); require_once('includes/requirepost.inc.php'); $clsr_id=0+TPOST('clsr_id'); $st_ids=TPOST('st_ids'); $mb_id=current_mb_id(); $DBConn->connect(); $classroom=db_load_classroom($DBConn,$clsr_id); if ($classroom['mb_id_owner']!=$mb_id) { redirect("./"); return; } if (TPOST('delete')) { $DBConn->begin(true); $seats=db_load_unreserved_seats_of_classroom($DBConn,$clsr_id); $okids=array_projection($seats,'st_id'); $delids=array_intersect($st_ids,$okids); db_delete_seats_from_classroom($DBConn,$clsr_id,$delids); $DBConn->commit(); $failedids=array_diff($st_ids,$delids); purge_array_by_key_prefix($_SESSION,'reserv.inputcache.'); if ($failedids) { $_SESSION['reserv.inputcache.domain']='seats.delete'; $_SESSION['reserv.inputcache.data']=array('failed_ids'=>$failedids); } redirect("qx-cmd-classroom.seats-op-done-clsr_id-".$clsr_id.".html"); } else redirect("./"); ?>