예제 #1
0
$display_date = localizeDate($dateFormat_day, $unix_time);
// For the side months
ereg('([0-9]{4})([0-9]{2})([0-9]{2})', $getdate, $day_array2);
$this_day = $day_array2[3];
$this_month = $day_array2[2];
$this_year = $day_array2[1];
$parse_month = date('Ym', $unix_time);
$thisday2 = localizeDate($dateFormat_week_list, $unix_time);
$start_week_time = strtotime(dateOfWeek($getdate, $week_start_day));
$dayborder = 0;
$nbrGridCols = 1;
if (isset($master_array[$getdate])) {
    foreach ($master_array[$getdate] as $ovlKey => $ovlValue) {
        if ($ovlKey != '-1') {
            foreach ($ovlValue as $ovl2Value) {
                $nbrGridCols = kgv($nbrGridCols, $ovl2Value['event_overlap'] + 1);
            }
        }
    }
}
include BASE . 'includes/header.inc.php';
?>
<center>
<table border="0" width="700" cellspacing="0" cellpadding="0">
	<tr>
		<td width="520" valign="top">
<table width="520" border="0" cellspacing="0" cellpadding="0" class="calborder">
    <tr>
     	<td align="center" valign="middle">
      		<table width="100%" border="0" cellspacing="0" cellpadding="0">
      			<tr>
예제 #2
0
파일: week.php 프로젝트: dalinhuang/sutoj
$display_date = "{$start_week} - {$end_week}";
// For the side months
ereg("([0-9]{4})([0-9]{2})([0-9]{2})", $getdate, $day_array2);
$this_day = $day_array2[3];
$this_month = $day_array2[2];
$this_year = $day_array2[1];
$dayborder = 0;
$thisdate = $start_week_time;
for ($i = 0; $i < 7; $i++) {
    $thisday = date("Ymd", $thisdate);
    $nbrGridCols[$thisday] = 1;
    if (isset($master_array[$thisday])) {
        foreach ($master_array[$thisday] as $ovlKey => $ovlValue) {
            if ($ovlKey != "-1") {
                foreach ($ovlValue as $ovl2Value) {
                    $nbrGridCols[$thisday] = kgv($nbrGridCols[$thisday], $ovl2Value["event_overlap"] + 1);
                }
            }
        }
    }
    $thisdate = $thisdate + 25 * 60 * 60;
}
include BASE . 'includes/header.inc.php';
?>

<center>
<table border="0" width="720" cellspacing="0" cellpadding="0">
	<tr>
		<td width="540" valign="top">
			<table width="540" border="0" cellspacing="0" cellpadding="0" class="calborder">
				<tr>
예제 #3
0
 function draw_day($template_p)
 {
     global $template, $getdate, $cal, $master_array, $unique_colors, $daysofweek_lang, $week_start_day, $dateFormat_week_list, $current_view, $day_array, $timeFormat, $gridLength, $day_start;
     // Replaces the allday events
     $replace = '';
     if (is_array($master_array[$getdate]['-1'])) {
         preg_match("!<\\!-- loop allday on -->(.*)<\\!-- loop allday off -->!is", $this->page, $match1);
         $loop_ad = trim($match1[1]);
         foreach ($master_array[$getdate]['-1'] as $uid => $allday) {
             $event_calno = $allday['calnumber'];
             $event_calno = ($event_calno - 1) % $unique_colors + 1;
             $event = openevent($getdate, -1, $uid, $allday);
             $loop_tmp = str_replace('{ALLDAY}', $event, $loop_ad);
             $loop_tmp = str_replace('{CALNO}', $event_calno, $loop_tmp);
             $replace .= $loop_tmp;
         }
     }
     $this->page = preg_replace('!<\\!-- loop allday on -->(.*)<\\!-- loop allday off -->!is', $replace, $this->page);
     // Replaces the daysofweek
     preg_match("!<\\!-- loop daysofweek on -->(.*)<\\!-- loop daysofweek off -->!is", $this->page, $match1);
     $loop_dof = trim($match1[1]);
     $start_wt = strtotime(dateOfWeek($getdate, $week_start_day));
     $start_day = strtotime(dateOfWeek($getdate, $week_start_day));
     for ($i = 0; $i < 7; $i++) {
         $day_num = date("w", $start_day);
         $daylink = date('Ymd', $start_wt);
         if ($current_view == 'day') {
             $weekday = $daysofweek_lang[$day_num];
         } else {
             $weekday = localizeDate($dateFormat_week_list, strtotime($daylink));
         }
         if ($daylink == $getdate) {
             $row1 = 'rowToday';
             $row2 = 'rowOn';
             $row3 = 'rowToday';
         } else {
             $row1 = 'rowOff';
             $row2 = 'rowOn';
             $row3 = 'rowOff';
         }
         $start_day = strtotime("+1 day", $start_day);
         $start_wt = strtotime("+1 day", $start_wt);
         $search = array('{DAY}', '{DAYLINK}', '{ROW1}', '{ROW2}', '{ROW3}');
         $replace = array($weekday, $daylink, $row1, $row2, $row3);
         $loop_tmp = str_replace($search, $replace, $loop_dof);
         $weekday_loop .= $loop_tmp;
     }
     $this->page = preg_replace('!<\\!-- loop daysofweek on -->(.*)<\\!-- loop daysofweek off -->!is', $weekday_loop, $this->page);
     // Build the body
     $dayborder = 0;
     $nbrGridCols = 1;
     if (isset($master_array[$getdate])) {
         foreach ($master_array[$getdate] as $ovlKey => $ovlValue) {
             if ($ovlKey != '-1') {
                 foreach ($ovlValue as $ovl2Value) {
                     $nbrGridCols = kgv($nbrGridCols, $ovl2Value['event_overlap'] + 1);
                 }
             }
         }
     }
     preg_match("!<\\!-- loop row on -->(.*)<\\!-- loop row off -->!is", $this->page, $match2);
     preg_match("!<\\!-- loop event on -->(.*)<\\!-- loop event off -->!is", $this->page, $match3);
     $loop_hours = trim($match2[1]);
     $loop_event = trim($match3[1]);
     $event_length = array();
     $border = 0;
     preg_match('/([0-9]{4})([0-9]{2})([0-9]{2})/', $getdate, $day_array2);
     $this_day = $day_array2[3];
     $this_month = $day_array2[2];
     $this_year = $day_array2[1];
     foreach ($day_array as $key) {
         preg_match('/([0-9]{2})([0-9]{2})/', $key, $regs_tmp);
         $cal_time = $key;
         $key = mktime($regs_tmp[1], $regs_tmp[2], 0, $this_month, $this_day, $this_year);
         $key = date($timeFormat, $key);
         unset($this_time_arr);
         // add events that overlap $day_start instead of cutting them out completely
         if ($day_start == $cal_time && isset($master_array[$getdate])) {
             foreach ($master_array[$getdate] as $time_key => $time_arr) {
                 if ((int) $time_key <= (int) $cal_time) {
                     if (is_array($time_arr) && $time_key != '-1') {
                         foreach ($time_arr as $uid => $event_tmp) {
                             if ((int) $event_tmp['event_end'] > (int) $cal_time) {
                                 $this_time_arr[$uid] = $event_tmp;
                             }
                         }
                     }
                 } else {
                     break;
                 }
             }
         } else {
             // add events that overlap the start time
             if (isset($master_array[$getdate][$cal_time]) && sizeof($master_array[$getdate][$cal_time]) > 0) {
                 $this_time_arr = $master_array[$getdate][$cal_time];
             }
         }
         // check for eventstart
         if (isset($this_time_arr) && sizeof($this_time_arr) > 0) {
             foreach ($this_time_arr as $eventKey => $loopevent) {
                 $drawEvent = drawEventTimes($cal_time, $loopevent['event_end']);
                 $j = 0;
                 while (isset($event_length[$j])) {
                     if ($event_length[$j]['state'] == 'ended') {
                         $event_length[$j] = array('length' => $drawEvent['draw_length'] / $gridLength, 'key' => $eventKey, 'overlap' => $loopevent['event_overlap'], 'state' => 'begin');
                         break;
                     }
                     $j++;
                 }
                 if ($j == sizeof($event_length)) {
                     array_push($event_length, array('length' => $drawEvent['draw_length'] / $gridLength, 'key' => $eventKey, 'overlap' => $loopevent['event_overlap'], 'state' => 'begin'));
                 }
             }
         }
         if (preg_match('/([0-9]{1,2}):00/', $key)) {
             $daydisplay .= '<tr>' . "\n";
             $daydisplay .= '<td rowspan="' . 60 / $gridLength . '" align="center" valign="top" width="60" class="timeborder">' . $key . '</td>' . "\n";
             $daydisplay .= '<td bgcolor="#a1a5a9" width="1" height="' . $gridLength / 1.5 . '"></td>' . "\n";
         } elseif ($cal_time == $day_start) {
             $size_tmp = 60 - (int) substr($cal_time, 2, 2);
             $daydisplay .= '<tr>' . "\n";
             $daydisplay .= "<td rowspan=\"" . $size_tmp / $gridLength . "\" align=\"center\" valign=\"top\" width=\"60\" class=\"timeborder\">{$key}</td>\n";
             $daydisplay .= '<td bgcolor="#a1a5a9" width="1" height="' . $gridLength / 1.5 . '"></td>' . "\n";
         } else {
             $daydisplay .= '<tr>' . "\n";
             $daydisplay .= '<td bgcolor="#a1a5a9" width="1" height="' . $gridLength / 1.5 . '"></td>' . "\n";
         }
         if ($dayborder == 0) {
             $class = ' class="dayborder"';
             $dayborder++;
         } else {
             $class = ' class="dayborder2"';
             $dayborder = 0;
         }
         if (sizeof($event_length) == 0) {
             $daydisplay .= '<td colspan="' . $nbrGridCols . '" ' . $class . '>&nbsp;</td>' . "\n";
         } else {
             $emptyWidth = $nbrGridCols;
             // Used to "join" ended events, so the ended case below results in one colspan'd td instead of multiple tds.
             $ended_counter = 0;
             for ($i = 0; $i < sizeof($event_length); $i++) {
                 $drawWidth = $nbrGridCols / ($event_length[$i]['overlap'] + 1);
                 $emptyWidth = $emptyWidth - $drawWidth;
                 switch ($event_length[$i]['state']) {
                     case 'begin':
                         if ($ended_counter) {
                             $daydisplay .= '<td colspan="' . $ended_counter . '" ' . $class . '>&nbsp;</td>';
                             $ended_counter = 0;
                         }
                         $event_length[$i]['state'] = 'started';
                         $uid = $event_length[$i]['key'];
                         $event_start = strtotime($this_time_arr[$uid]['event_start']);
                         $event_end = strtotime($this_time_arr[$uid]['event_end']);
                         if (isset($this_time_arr[$uid]['display_end'])) {
                             $event_end = strtotime($this_time_arr[$uid]['display_end']);
                         }
                         $event_start = date($timeFormat, $event_start);
                         $event_end = date($timeFormat, $event_end);
                         $event_calno = $this_time_arr[$uid]['calnumber'];
                         $event_recur = $this_time_arr[$uid]['recur'];
                         $event_status = strtolower($this_time_arr[$uid]['status']);
                         $event_calno = ($event_calno - 1) % $unique_colors + 1;
                         if ($event_status != '') {
                             $confirmed = '<img src="images/' . $event_status . '.gif" width="9" height="9" alt="" border="0" hspace="0" vspace="0" />&nbsp;';
                         } elseif (is_array($event_recur)) {
                             $confirmed = '<img src="images/recurring.gif" width="9" height="9" alt="" border="0" hspace="0" vspace="0" />&nbsp;';
                         }
                         $colspan_width = round(460 / $nbrGridCols * $drawWidth);
                         $daydisplay .= '<td rowspan="' . $event_length[$i]['length'] . '" width="' . $colspan_width . '" colspan="' . $drawWidth . '" align="left" valign="top" class="eventbg2_' . $event_calno . '">' . "\n";
                         // Start drawing the event
                         $event_temp = $loop_event;
                         $event = openevent($getdate, $cal_time, $uid, $this_time_arr[$uid], 0, 0, 'ps');
                         $event_temp = str_replace('{EVENT}', $event, $event_temp);
                         $event_temp = str_replace('{EVENT_START}', $event_start, $event_temp);
                         $event_temp = str_replace('{EVENT_END}', $event_end, $event_temp);
                         $event_temp = str_replace('{CONFIRMED}', $confirmed, $event_temp);
                         $event_temp = str_replace('{EVENT_CALNO}', $event_calno, $event_temp);
                         $daydisplay .= $event_temp;
                         $daydisplay .= '</td>';
                         // End event drawing
                         break;
                     case 'started':
                         if ($ended_counter) {
                             $daydisplay .= '<td colspan="' . $ended_counter . '" ' . $class . '>&nbsp;</td>';
                             $ended_counter = 0;
                         }
                         break;
                     case 'ended':
                         $daydisplay .= '<td colspan="' . $drawWidth . '" ' . $class . '>&nbsp;</td>' . "\n";
                         break;
                 }
                 $event_length[$i]['length']--;
                 if ($event_length[$i]['length'] == 0) {
                     $event_length[$i]['state'] = 'ended';
                 }
             }
             // Clean up.
             $emptyWidth += $ended_counter;
             //fill empty space on the right
             if ($emptyWidth > 0) {
                 $daydisplay .= '<td colspan="' . $emptyWidth . '" ' . $class . '>&nbsp;</td>' . "\n";
             }
             while (isset($event_length[sizeof($event_length) - 1]) && $event_length[sizeof($event_length) - 1]['state'] == 'ended') {
                 array_pop($event_length);
             }
         }
         $daydisplay .= '</tr>' . "\n";
     }
     $this->page = preg_replace('!<\\!-- loop row on -->(.*)<\\!-- loop event off -->!is', $daydisplay, $this->page);
 }