<?php require_once('includes/requirecompere.inc.php'); require_once('includes/phptools/calendar.inc.php'); require_once("includes/timeavail.inc.php"); $op=TGET('op'); $mb_id=current_mb_id(); $timezone_bias_seconds=get_user_time_zone()*60; $dataset['MANAGE']=array(0); $DBConn->connect(true); $timeavails=db_load_timeavail_of_compere($DBConn,$mb_id,seconds_to_datetime(),'9999-12-31 23:59:59',false); $ta_ids=array_projection($timeavails,'ta_id'); $tacsidlist=db_load_timeavail_course_ids($DBConn,$ta_ids); $cs_ids=array_projection($tacsidlist,'cs_id'); $ta_cs_id_map=rowset2multimap($tacsidlist,'ta_id','cs_id'); $cslist=db_load_course($DBConn,$cs_ids); $csmap=rowset2map($cslist,'cs_id'); $monthtable=distribute_timeavail_into_calendar($timeavails,$mb_id,$ta_cs_id_map,$csmap,$timezone_bias_seconds); $dataset['MONTH']=array_projection($monthtable,'dataset'); $dataset['ADDABLE']=sizeof($timeavails)<get_compere_limit($DBConn,$mb_id,'timeavail.count')?array(0):array(); $dataset['ta_count.addable']=get_compere_limit($DBConn,$mb_id,'timeavail.count')-sizeof($timeavails); $dataset['HAS-ALIAS']=db_count_alias_member_of($DBConn,$mb_id)>0?array(0):array(); $dataset['COPIED-OK']=$op=='copied-ok'?array(0):array(); $dataset['NO-PERIOD']=$timeavails?array():array(0); $dataset['BATCH-GUIDE-1']=sizeof($timeavails) && sizeof($timeavails)<5?array(0):array(); $dataset+=prepare_wizard_dataset(); ?>