<?php require_once('includes/requirecompere.inc.php'); $CMD_TMPL_NAME='timeavail.info'; $ta_id=0+TGET('ta_id'); $op=TGET('op'); $mb_id=current_mb_id(); $timezone_bias_seconds=get_user_time_zone()*60; $dataset['MODIFY']=array(0); $dataset['ENTERING']=array(0); if ($op=='saved') $dataset['SAVED']=array(0); $DBConn->connect(true); $team_mb_ids=array_projection(db_load_team($DBConn,$mb_id,'VALID','ALIAS'),'mb_id_member'); array_push($team_mb_ids,$mb_id); $courses=db_load_course_by_staff($DBConn,$team_mb_ids); $tainfo=array(); if ($op=='revise' && $_SESSION['reserv.inputcache.domain']=='timeavail') { $tainfo=$_SESSION['reserv.inputcache.data']; $dataset+=$_SESSION['reserv.inputcache.errorareas']; } else { $tainfo=db_load_timeavail($DBConn,$ta_id); $tacs=db_load_timeavail_course_ids($DBConn,$ta_id); $tainfo['cs_ids']=array_projection($tacs,'cs_id'); } $dataset['ta_id']=$ta_id; $dataset+=array_key_prepend(split_datetime($tainfo['ta_begin'],$timezone_bias_seconds),'since_'); $dataset+=array_key_prepend(split_datetime($tainfo['ta_end'],$timezone_bias_seconds),'expire_'); $dataset['COURSE']=$courses; foreach ($dataset['COURSE'] as &$c) { if ($tainfo['cs_ids'] && in_array($c['cs_id'],$tainfo['cs_ids'])) $c['CHECKED']=array(0); else $c['UNCHECKED']=array(0); } $dataset['STATUS-VALID']=$tainfo['ta_status']=='VALID'?array(0):array(); $dataset['STATUS-INVALID']=!$tainfo['ta_status'] || $tainfo['ta_status']=='INVALID'?array(0):array(); ?>