<?php $cp_id=compere_id_requested(); $lcl_from=TGET('lcl_from'); $lcl_to=TGET('lcl_to'); $utc_from=TGET('utc_from'); $utc_to=TGET('utc_to'); $period=TGET('period'); if ($cp_id && (($utc_from || $lcl_from) && ($utc_to || $lcl_to) || $period=='today' || $period=='today_utc')) { $DBConn->connect(true); $compere=db_load_compere($DBConn,$cp_id); $dataset+=$compere; $timezone_bias_seconds=$compere['cp_timezone']*60; if ($period=='today') { $utc_from=seconds_to_datetime(seconds_set_time_in_day(uniwits_time(null,$timezone_bias_seconds),0),-$timezone_bias_seconds); $utc_to=seconds_to_datetime(seconds_set_time_in_day(uniwits_time(null,$timezone_bias_seconds),-$timezone_bias_seconds+3600*24)); } else if ($period=='today_utc') { $utc_from=seconds_to_datetime(seconds_set_time_in_day(uniwits_time(null),0)); $utc_to=seconds_to_datetime(seconds_set_time_in_day(uniwits_time(null),3600*24)); } else { if ($lcl_from) $utc_from=bias_datetime($lcl_from,-$timezone_bias_seconds); if ($lcl_to) $utc_to=bias_datetime($lcl_to,-$timezone_bias_seconds); } $times=db_list_vacant_time($DBConn,$cp_id,$utc_from,$utc_to); $dataset['VACANCY']=array(); foreach ($times as $t) { $v=array(); $v+=array_key_prepend(split_datetime($t['la_since'],$timezone_bias_seconds),'since_'); $v+=array_key_prepend(split_datetime($t['la_expire'],$timezone_bias_seconds),'expire_'); $v['since_weekday']=datetime_to_weekday($t['la_since'],$timezone_bias_seconds); $v['expire_weekday']=datetime_to_weekday($t['la_expire'],$timezone_bias_seconds); $v['DAY-DIFFERRED']=datetime_same_date($t['la_since'],$t['la_expire'],$timezone_bias_seconds)?array():array(0); array_push($dataset['VACANCY'],$v); } $dataset['NO-VACANCY']=$times?array():array(0); } ?>