📄 check_availability.inc
字号:
$subcell->innerHTML = $link->get_html(); }else { $subcell->set_attribute('class','unavailable'); } $availability_merged[$hour][$min] = !$availability_member[$hour][$min] ? $availability_member[$hour][$min]: $availability_merged[$hour][$min]; $subrow->add_cell($subcell); } } $subtable->add_row($subrow); $cell->add_html_element($subtable); $row->add_cell($cell); $availability_table->add_row($row); } }} $calendars = isset($_POST['calendars']) ? $_POST['calendars'] : array();if(count($calendars)){ $row = new table_row(); $th = new table_heading('<h2>'.$sc_calendars.'</h2>'); $th->set_attribute('class','caption'); $th->set_attribute('colspan','2'); $row->add_cell($th); $availability_table->add_row($row); add_calendars($calendars);}$resources = isset($_POST['resources']) ? $_POST['resources'] : array();if(count($resources)){ $row = new table_row(); $th = new table_heading('<h2>'.$cal_resources.'</h2>'); $th->set_attribute('class','caption'); $th->set_attribute('colspan','2'); $row->add_cell($th); $availability_table->add_row($row); add_calendars($resources);}function add_calendars($calendars){ global $availability_table, $cal, $to_hour, $from_hour, $interval_start_time, $interval_end_time, $current_cal, $availability_merged, $new_time; foreach($calendars as $cal_id) { $calendar= $cal->get_calendar($cal_id); for($hour=$from_hour;$hour<=$to_hour;$hour++) { for($min=0;$min<=45;$min+=15) { $availability_cal[$hour][$min] = true; } } $cal_events = $cal->get_events_in_array($calendar['id'], 0, 0, $interval_start_time, $interval_end_time); $row = new table_row(); $img = new image('calendar_small'); $img->set_attribute('style','border:0px;height:16px;width:16px;margin-right:5px;'); $img->set_attribute('align','absmiddle'); $th = new table_heading($img->get_html().$calendar['name']); $th->set_attribute('style','white-space:nowrap'); $th->set_attribute('class','caption'); $row->add_cell($th); $cell = new table_cell(); $cell->set_attribute('style','width:100%'); $subtable = new table(); $subtable->set_attribute('style','width:100%'); $subrow = new table_row(); for($hour=$from_hour;$hour<=$to_hour;$hour++) { $tooltip = $hour.':00'; $link = new hyperlink('javascript:goto_event(\''.$hour.'\',\''.($hour+1).'\',\'00\');', $hour); $link->set_attribute('class','hour'); $subcell = new table_cell($link->get_html()); $subcell->set_attribute('class','hour'); $subcell->set_attribute('colspan','4'); $subcell->set_tooltip(new tooltip($tooltip, $current_cal['name'], 'WRAP')); $subrow->add_cell($subcell); } $subtable->add_row($subrow); while ($cal_event = array_shift($cal_events)) { $availability_cal = set_availability($availability_cal, $from_hour, $to_hour, $cal_event, $new_time); } $subrow = new table_row(); //foreach($availability_cal as $hour => $value) for($hour=$from_hour;$hour<=$to_hour;$hour++) { for($min=0;$min<=45;$min+=15) { $minute = strlen($min) == 1 ? '0'.$min : $min; $tooltip = $hour.':'.$minute; $subcell = new table_cell(' '); $subcell->set_tooltip(new tooltip($tooltip, $current_cal['name'], 'WRAP')); if($availability_cal[$hour][$min]) { $subcell->set_attribute('class','available'); $link = new hyperlink('javascript:goto_event(\''.$hour.'\',\''.($hour+1).'\',\''.$min.'\');', ' '); $link->set_attribute('class','hour'); $subcell->innerHTML = $link->get_html(); }else { $subcell->set_attribute('class','unavailable'); } $availability_merged[$hour][$min] = !$availability_cal[$hour][$min] ? $availability_cal[$hour][$min] : $availability_merged[$hour][$min]; $subrow->add_cell($subcell); } } $subtable->add_row($subrow); $cell->add_html_element($subtable); $row->add_cell($cell); $availability_table->add_row($row); }}if((count($participants_array) + count($calendars)+count($resources))>1){ $row = new table_row(); $th = new table_heading('<h2>'.$cal_merged_overview.'</h2>'); $th->set_attribute('class','caption'); $th->set_attribute('colspan','2'); $row->add_cell($th); $availability_table->add_row($row); $row = new table_row(); $img = new image('users_small'); $img->set_attribute('style','border:0px;height:16px;width:16px;margin-right:5px;'); $img->set_attribute('align','absmiddle'); $th = new table_heading($img->get_html().$cal_merged_overview); $th->set_attribute('style','white-space:nowrap'); $th->set_attribute('class','caption'); $row->add_cell($th); $cell = new table_cell(); $cell->set_attribute('style','width:100%'); $subtable = new table(); $subtable->set_attribute('style','width:100%'); $subrow = new table_row(); for($hour=$from_hour;$hour<=$to_hour;$hour++) { $tooltip = $hour.':00'; $link = new hyperlink('javascript:goto_event(\''.$hour.'\',\''.($hour+1).'\',\'00\');', $hour); $link->set_attribute('class','hour'); $subcell = new table_cell($link->get_html()); $subcell->set_attribute('class','hour'); $subcell->set_attribute('colspan','4'); $subcell->set_tooltip(new tooltip($tooltip, $current_cal['name'], 'WRAP')); $subrow->add_cell($subcell); } $subtable->add_row($subrow); $subrow = new table_row(); foreach($availability_merged as $hour => $value) { $tooltip = $hour.':00'; for($min=0;$min<=45;$min+=15) { $minute = strlen($min) == 1 ? '0'.$min : $min; $tooltip = $hour.':'.$minute; $subcell = new table_cell(' '); $subcell->set_tooltip(new tooltip($tooltip, $current_cal['name'], 'WRAP')); if($value[$min]) { $subcell->set_attribute('class','available'); $link = new hyperlink('javascript:goto_event(\''.$hour.'\',\''.($hour+1).'\',\''.$min.'\');', ' '); $link->set_attribute('class','hour'); $subcell->innerHTML = $link->get_html(); }else { $subcell->set_attribute('class','unavailable'); } $subrow->add_cell($subcell); } } $subtable->add_row($subrow); $cell->add_html_element($subtable); $row->add_cell($cell); $availability_table->add_row($row);}if(!isset($_POST['day'])){ $form->add_html_element(new input('hidden','day',$day, false)); $form->add_html_element(new input('hidden','month',$month, false)); $form->add_html_element(new input('hidden','year',$year, false));}unset($_POST['event_table'], $_POST['end_date'], $_POST['start_date'], $_POST['ignore_conflicts']);$form->innerHTML .= array_to_form($_POST);$table = new table();$img_back = new image('back_small');$img_back->set_attribute('style','border:0px;height:16px;width:16px;margin-right:5px;');$img_back->set_attribute('align','absmiddle');$img_forw = new image('forward_small');$img_forw->set_attribute('style','border:0px;height:16px;width:16px;margin-left:5px;');$img_forw->set_attribute('align','absmiddle');$prev_day = date($_SESSION['GO_SESSION']['date_format'], mktime(0, 0, 0, $date["mon"], $date["mday"]-1, $date["year"]));$next_day = date($_SESSION['GO_SESSION']['date_format'], mktime(0, 0, 0, $date["mon"], $date["mday"]+1, $date["year"]));$link_back = new hyperlink('javascript:goto_date('.($date['mday']-1).', '.$date['mon'].', '.$date['year'].');',$img_back->get_html());$link_forw = new hyperlink('javascript:goto_date('.($date['mday']+1).', '.$date['mon'].', '.$date['year'].');',$img_forw->get_html());$row = new table_row();$row->add_cell(new table_cell($strDate.':'));$row->add_cell(new table_cell($link_back->get_html().$link_forw->get_html()));$datepicker= new date_picker('start_date', $_SESSION['GO_SESSION']['date_format'], $start_date, '', '', 'onchange="javascript:date_picker(calendar);"');$row->add_cell(new table_cell($datepicker->get_html()));$form->add_html_element(new input('hidden','end_date',$end_date, false));$table->add_row($row);$form->add_html_element($table);$form->add_html_element($availability_table);$form->add_html_element(new button($cmdBack,"javascript:document.event_form.task.value='change_event';document.event_form.submit();"));?><script type="text/javascript" language="javascript"> function date_picker(calendar) { // Beware that this function is called even if the end-user only // changed the month/year. In order to determine if a date was // clicked you can use the dateClicked property of the calendar: if (calendar.dateClicked) { // OK, a date was clicked, redirect to /yyyy/mm/dd/index.php var y = calendar.date.getFullYear(); var m = calendar.date.getMonth()+1; // integer, 0..11 var d = calendar.date.getDate(); // integer, 1..31 goto_date(d,m,y); } }; function goto_date(day, month, year){ document.event_form.task.value='availability'; document.event_form.day.value = day; document.event_form.month.value = month; document.event_form.year.value = year; document.event_form.submit();}function goto_event(start_hour,end_hour, min){ document.event_form.task.value='change_event'; document.event_form.start_hour.value=start_hour; document.event_form.end_hour.value=end_hour; document.event_form.start_min.value=min; document.event_form.end_min.value=min; document.event_form.submit();}</script>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -