<?php require_once('includes/requirecompere.inc.php'); $DBConn->connect(true); $mb_id=current_mb_id(); $summaries=db_list_classroom_summaries_by_compere($DBConn,$mb_id); $classrooms=array(); foreach ($summaries as $cs) $classrooms[$cs['clsr_id']][$cs['plc_id']]=$cs; $dataset['CLASSROOM']=array(); foreach ($classrooms as $clsr_id=>$classroom) { $clsrrow=array('PLACE'=>array()); $clsrrow['seat_count']=0; foreach ($classroom as $plc_id=>$csp) { $clsrrow['clsr_name']=$csp['clsr_name']; $clsrrow['clsr_id']=$csp['clsr_id']; $clsrrow['clsr_desc']=$csp['clsr_desc']; if ($csp['plc_id']) { array_push($clsrrow['PLACE'], array( 'seat_count'=>$csp['clsr_size'], 'plc_id'=>$csp['plc_id'], 'plc_name'=>$csp['plc_name'] ) ); } $clsrrow['seat_count']+=$csp['clsr_size']; } if (!$clsrrow['PLACE']) $clsrrow['NOPLACE']=array(0); array_push($dataset['CLASSROOM'],$clsrrow); } $dataset['NO-CLASSROOM']=$classrooms?array():array(0); $dataset['count.addable']=get_compere_limit($DBConn,$mb_id,'classroom.count')-sizeof($classrooms); $dataset['ADD-CLASSROOM']=$dataset['count.addable']>0?array(0):array(); ?>