📄 calendar_view.class.inc
字号:
if(isset($this->colspans[$i]) && $this->colspans[$i]>1) { $th->set_attribute('colspan',$this->colspans[$i]); } $row->add_cell($th); } $this->add_row($row); } function set_rows() { global $GO_MODULES, $GO_LINKS; for($week=0;$week<$this->weeks;$week++) { $this->set_headings($week); $week_start_day = ($week*7); $week_end_day = ($week*7)+$this->_offset; if(isset($this->all_day_events)) { $all_day_events=false; $row = new table_row(); $row->set_attribute('class','all_day_event_row'); $row->add_cell(new table_cell(' ')); for($display_day=$week_start_day;$display_day<$week_end_day ;$display_day++) { $current_time = mktime(0,0,0,$this->month, $this->day+$display_day, $this->year); $cell = new table_cell(); if($this->colspans[$display_day] > 1) { $cell->set_attribute('colspan',$this->colspans[$display_day]); } if(isset($this->all_day_events[$current_time])) { $all_day_events=true; foreach($this->all_day_events[$current_time] as $event) { $cell->add_html_element(new event($event, $this->return_to, true)); } } $row->add_cell($cell); } if($all_day_events) { $this->add_row($row); } } $time_cell_rowspan = 3600/$this->time_interval; $row_height = 30/$time_cell_rowspan; $time = $this->calendar_start_time; for($time=$this->calendar_start_time;$time<$this->calendar_end_time;$time+=$this->time_interval) { $row = new table_row(); $row->set_attribute('style','height:'.$row_height.'px'); $row->set_attribute('onmouseover','javascript:glow(this);'); $row->set_attribute('onmouseout','javascript:unglow(this);'); if(gmdate('i',$time) == '00') { $time_cell = new table_cell(gmdate($_SESSION['GO_SESSION']['time_format'], $time)); $time_cell->set_attribute('class','cal_hour'); $rowspan = $time_cell_rowspan; while(($time+$rowspan*$this->time_interval) > $this->calendar_end_time) { $rowspan--; } $time_cell->set_attribute('rowspan',$rowspan); $row->add_cell($time_cell); } for($display_day=$week_start_day;$display_day<$week_end_day;$display_day++) { $day_start_time = mktime(0,0,$this->calendar_start_time,$this->month, $this->day+$display_day, $this->year); //$day_end_time = get_time(mktime(0,0,$this->calendar_end_time,$this->month, $this->day+$display_day, $this->year)); $day_end_time = $day_start_time + $this->calendar_end_time-$this->calendar_start_time; $current_time = mktime(0,0,$time,$this->month, $this->day+$display_day, $this->year); //echo date('Ymd G:i',$current_time).'<br />'; $hour = date('G', $current_time); $min = date('i', $current_time); $day = date('j', $current_time); $month = date('n', $current_time); $year = date('Y', $current_time); if(isset($this->events[$current_time])) { $cells=array(); for($n=0;$n<count($this->events[$current_time]);$n++) { if(!isset($this->events[$current_time][$n]['days'][$display_day]['added'])) { $this->events[$current_time][$n]['days'][$display_day]['added']=true; if($this->events[$current_time][$n]['read_permission']) { $event_str = cut_string(date($_SESSION['GO_SESSION']['time_format'], $this->events[$current_time][$n]['start_time']).' '. $this->events[$current_time][$n]['name'], 30, false); $link = 'event.php?event_id='.$this->events[$current_time][$n]['id']. '&gmt_start_time='.local_to_gmt_time($this->events[$current_time][$n]['start_time']). '&return_to='.urlencode($this->return_to); if($links = $GO_LINKS->get_links($this->events[$current_time][$n]['link_id'])) { $img = new image('links_small'); $img->set_attribute('style','margin-right:1px;margin-left:2px;border:0'); $img->set_attribute('align','absmiddle'); $link_obj = new hyperlink(add_params_to_url($link, 'event_strip=links&create_exception=false'), $img->get_html()); switch(count($links)) { case 0: //do nothing break; case 1: if($links[0]['type'] == 6) //folder link { global $GO_CONFIG; require_once($GO_CONFIG->class_path.'filesystem.class.inc'); $fs = new filesystem(); $fs->get_linked_shares(array($links[0]['link_id'])); if($fs->next_record()) { $files = $fs->get_files($fs->f('path')); if(count($files) > 0) { $event_str .= $link_obj->get_html(); } } }else { $event_str .= $link_obj->get_html(); } break; default: $event_str .= $link_obj->get_html(); break; } } $event_cell = new table_cell($event_str); $event_cell->set_attribute('onclick', "javascript:document.location='". $GO_MODULES->modules['calendar']['url'].$link."';"); }else { $event_str = cut_string(date($_SESSION['GO_SESSION']['time_format'], $this->events[$current_time][$n]['start_time']).' '. htmlspecialchars($GLOBALS['sc_private_event']), 30, false); $event_cell = new table_cell($event_str); } $event_cell->set_tooltip(new event_tooltip($this->events[$current_time][$n], true)); $event_cell ->set_attribute('style','background-color: #'.$this->events[$current_time][$n]['background']); $this->events[$current_time][$n]['days'][$display_day]['colspan']=1; if($this->colspans[$display_day]>1) { if(!isset($this->events[$current_time][$n]['days'][$display_day]['neighbour'])) { $this->events[$current_time][$n]['days'][$display_day]['colspan']= $this->colspans[$display_day]-$this->events[$current_time][$n]['days'][$display_day]['position']; $event_cell->set_attribute('colspan',$this->events[$current_time][$n]['days'][$display_day]['colspan']); } } //$event_cell->innerHTML .= $this->events[$current_time][$n]['days'][$display_day]['colspan']; //$event_cell->innerHTML .= $this->events[$current_time][$n]['name']; $rowspan_start_time = $this->events[$current_time][$n]['display_start_time'] < $day_start_time ? $day_start_time : $this->events[$current_time][$n]['display_start_time']; $rowspan_end_time = $this->events[$current_time][$n]['display_end_time'] > $day_end_time ? $day_end_time : $this->events[$current_time][$n]['display_end_time']; $tz_start = get_timezone_offset($rowspan_start_time)*3600; $tz_end = get_timezone_offset($rowspan_end_time)*3600; $rowspan = ($rowspan_end_time - $rowspan_start_time+ $tz_end- $tz_start) / $this->time_interval ; if($rowspan>1) { $event_cell->set_attribute('rowspan', $rowspan); } $last_position = $this->events[$current_time][$n]['days'][$display_day]['colspan']+$this->events[$current_time][$n]['days'][$display_day]['position']; $first_position = $this->events[$current_time][$n]['days'][$display_day]['position']+1; $cells[$this->events[$current_time][$n]['days'][$display_day]['position']] = $event_cell; }else { $first_position = $this->events[$current_time][$n]['days'][$display_day]['position']+1; $last_position = $this->events[$current_time][$n]['days'][$display_day]['colspan']+$this->events[$current_time][$n]['days'][$display_day]['position']; $cells[$this->events[$current_time][$n]['days'][$display_day]['position']] ='skip'; } } for($position=$first_position;$position<$last_position;$position++) { $cells[$position] = 'skip'; } for($n=0;$n<$this->colspans[$display_day];$n++) { if(isset($cells[$n])) { if($cells[$n] != 'skip' ) { $row->add_cell($cells[$n]); } }else { $next_cell = $n+1; $colspan = 1; while($next_cell <$this->colspans[$display_day] && !isset($cells[$next_cell])) { $next_cell++; $colspan++; $n++; } $cell = new table_cell(); $cell->set_attribute('colspan', $colspan); $cell->set_attribute('onclick', "javascript:new_event($year,$month,$day,$hour,$min);"); //$cell->innerHTML .= $colspan; $row->add_cell($cell); } } }else { $cell = new table_cell(); if($this->colspans[$display_day] > 1) { $cell->set_attribute('colspan',$this->colspans[$display_day]); } $cell->set_attribute('onclick', "javascript:new_event($year,$month,$day,$hour,$min);"); //$cell->innerHTML .= $this->colspans[$display_day]; $row->add_cell($cell); } } $this->add_row($row); } } } function get_html() { global $GO_MODULES; $this->add_outerhtml_element(new input('hidden',$this->id.'[day]', $this->day, false)); $this->add_outerhtml_element(new input('hidden',$this->id.'[month]', $this->month, false)); $this->add_outerhtml_element(new input('hidden',$this->id.'[year]', $this->year, false)); $this->add_outerhtml_element(new input('hidden',$this->id.'[hour]', $this->hour, false)); $this->add_outerhtml_element(new input('hidden',$this->id.'[min]', $this->min, false)); $this->add_outerhtml_element(new input('hidden',$this->id.'[offset]', $this->offset, false)); $javascript = " <script type=\"text/javascript\"> function new_event(year, month, day, hour, min) { document.location='".$GO_MODULES->modules['calendar']['url']. "event.php?hour='+hour+ '&min='+min+ '&day='+day+ '&month='+month+ '&year='+year+ '&view_id='+document.forms['".$this->form_name."'].view_id.value+ '&calendar_id='+document.forms['".$this->form_name."'].calendar_id.value+ '&todo='+document.forms['".$this->form_name."'].todo.value+ '&return_to=".urlencode($this->return_to)."'; } document.getElementById('".$this->id."').style.borderCollapse='collapse'; </script>";/* //$this->set_attribute('bordercolor','#7d7d7d;'); $this->set_attribute('cellpadding','0'); $this->set_attribute('cellspacing','0'); //$this->set_attribute('style','border:1px solid #7d7d7d;');*/ $this->set_attribute('class','cal'); $this->set_attribute('id',$this->id); $this->set_attribute('cellpadding','0'); $this->set_attribute('cellspacing','0'); //$this->set_attribute('style','border-collapse:collapse'); $this->calculate_colspans(); $this->set_rows(); return parent::get_html().$javascript; }}?>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -