<?php require_once('includes/requirecompere.inc.php'); $clsr_id=0+TGET('clsr_id'); $op=TGET('op'); $mb_id=current_mb_id(); $DBConn->connect(true); $classroom=db_load_classroom($DBConn,$clsr_id); $seatinfos=db_load_seats_of_classroom($DBConn,$clsr_id); $availableplaces=db_load_places_with_unassigned_seats($DBConn,$mb_id); $seat_id2no=rowset2map($seatinfos,'st_id','st_no'); $seatmap=array(); foreach ($seatinfos as &$seat) { if (!isset($seatmap[$seat['plc_id']])) $seatmap[$seat['plc_id']]=array(); array_push($seatmap[$seat['plc_id']],$seat); } $dataset['PLACE']=array(); foreach ($seatmap as $plc_id=>$seats) { $place=array( 'plc_id'=>$plc_id, 'plc_name'=>$seats[0]['plc_name'], 'SEAT'=>$seats ); array_push($dataset['PLACE'],$place); } $dataset+=$classroom; $dataset['NO-SEAT']=$seatinfos?array():array(0); $dataset['HAVE-SEATS']=$seatinfos?array(0):array(); $dataset['PLACEAVAIL']=$availableplaces; $dataset['NO-PLACEAVAIL']=$availableplaces?array():array(0); if ($op=='done' && $_SESSION['reserv.inputcache.domain']=='seats.delete') { $dataset['ERROR-DEL-FAIL']=array(0); $failed_ids=$_SESSION['reserv.inputcache.data']['failed_ids']; $dataset['FAILEDIDS']=array(); foreach ($failed_ids as $id) array_push($dataset['FAILEDIDS'],array('st_no'=>$seat_id2no[$id])); } $dataset['SEATS-ADDABLE']=sizeof($seatinfos)<get_compere_limit($DBConn,$mb_id,'classroom.seat.count')?array(0):array(); $dataset+=prepare_wizard_dataset(); ?>