<?php require_once('includes/requirecompere.inc.php'); require_once('includes/reservation.inc.php'); $lctr_id=0+TGET('lctr_id'); $op=TGET('op'); $mb_id_staff=current_mb_id(); $timezone_bias_seconds=get_user_time_zone()*60; $DBConn->connect(true); $lecture=db_load_lecture_by_id($DBConn,$lctr_id); if ($lecture) $course=db_load_course_by_id($DBConn,$lecture['cs_id']); $lecture_staff_ids=db_load_lecture_staff_ids($DBConn,$lctr_id); if (!$course || $mb_id_staff!=$course['mb_id_owner'] && !in_array($mb_id_staff,$lecture_staff_ids)) { redirect("./"); return; } $csowner_qualified=db_is_compere_qualified($DBConn,$course['mb_id_owner']); $staff_ids=db_load_lecture_staff_ids($DBConn,$lctr_id); $staff=db_load_comperes($DBConn,$staff_ids); $classroom=db_load_classroom($DBConn,$lecture['clsr_id']); $participants=db_list_participants($DBConn,$lctr_id); $mb_id_participants=array_projection($participants,'mb_id'); $rsv_ids=array_projection($participants,'rsv_id'); $participant_id2rsv_id=rowset2map($participants,'mb_id','rsv_id'); $rsv_options=db_load_reservation_options($DBConn,$rsv_ids); $rsv_id2options=rowset2multimap($rsv_options,'rsv_id'); $dataset+=array_key_prepend(split_datetime($lecture['lctr_since'],$timezone_bias_seconds),'since_'); $dataset+=array_key_prepend(split_datetime($lecture['lctr_expire'],$timezone_bias_seconds),'expire_'); $dataset['since_weekday']=datetime_to_weekday($lecture['lctr_since'],$timezone_bias_seconds); $dataset['expire_weekday']=datetime_to_weekday($lecture['lctr_expire'],$timezone_bias_seconds); $circle=db_load_course_circle($DBConn,$lecture['cs_id'],null); $mb_id_circle=array_projection($circle,'mb_id'); $mb_id_addables=array_diff($mb_id_circle,$mb_id_participants); $members_addable=db_load_members($DBConn,$mb_id_addables); $places=db_list_places_of_lecture($DBConn,$lctr_id); $dataset+=$lecture; $dataset+=$course; $dataset+=$classroom; $dataset['ONDUTY']=$staff; $dataset['ADDED']=$op=='added'?array(0):array(); $dataset['MODIFIED']=$op=='modified'?array(0):array(); $dataset['CANCELLED']=$op=='cancelled'?array(0):array(); $dataset['CONFIRMED']=$op=='confirmed'?array(0):array(); $dataset['DENIED']=$op=='denied'?array(0):array(); $dataset['RESERVED']=$op=='reserve.ok'?array(0):array(); $dataset['FAIL-OVERBOOKING']=$op=='fail.overbooking'?array(0):array(); $dataset['ERROR-LACK-UNILAR']=$op=='fail.lackunilar'?array(0):array(); $dataset['ERROR-CANCEL-AFTERSTART']=$op=='fail.cancel.afterstart'?array(0):array(); $dataset['PARTICIPANT-NONE']=$participants?array():array(0); $dataset['PARTICIPANT']=$participants; $dataset['MEMBERADD']=$members_addable; $dataset['MEMBERADD-NONE']=$members_addable?array():array(0); $dataset['MEMBERADD-EXIST']=$members_addable?array(0):array(); $dataset['CS-OWNER-ONLY']=$mb_id_staff==$course['mb_id_owner']?array(0):array(); $dataset+=prepare_lecture_reservable_place_classroom_dataset($DBConn,$lctr_id,$lecture,$course,true); $cs_option_count=db_count_course_option($DBConn,$course['cs_id']); $idx=0; foreach ($dataset['PARTICIPANT'] as &$par) { if ($par['rsv_timestamp_confirmed']) $par['COMPLETE']=array(0); else $par['PROVISIONAL']=array(0); $par['idx']=$idx++; $par['OPTION']=$rsv_id2options[$participant_id2rsv_id[$par['mb_id']]]; $par['HAS-OPTION']=$cs_option_count?array(0):array(); } $dataset['PARTICIPANT-ADDABLE']=$dataset['total_vacancy']?array(0):array(); $dataset['CANCELLABLE']=datetime_to_seconds($lecture['lctr_expire'])>uniwits_time()?array(0):array(); $dataset['WARNING-CONTENT-NOT-RESERVABLE']=$csowner_qualified?array():array(0); ?>