<?php require_once('includes/requirecompere.inc.php'); $CMD_TMPL_NAME='timeavail.info'; $preselect_cs_ids=TGET('cs_id'); $op=TGET('op'); $mb_id=current_mb_id(); $timezone_bias_seconds=get_user_time_zone()*60; $dataset['ADDNEW']=array(0); $dataset['ENTERING']=array(0); $tainfo=array(); if ($op=='revise' && $_SESSION['reserv.inputcache.domain']=='timeavail') { $tainfo=$_SESSION['reserv.inputcache.data']; $dataset+=$_SESSION['reserv.inputcache.errorareas']; $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['NOT-SAVED']=array(0); } else { if ($preselect_cs_ids) { if (!is_array($preselect_cs_ids)) $preselect_cs_ids=array($preselect_cs_ids); $tainfo['cs_ids']=$preselect_cs_ids; } } $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); $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'] || $tainfo['ta_status']=='VALID'?array(0):array(); $dataset['STATUS-INVALID']=$tainfo['ta_status']=='INVALID'?array(0):array(); $dataset+=prepare_wizard_dataset(); ?>