From: <cl...@us...> - 2004-05-16 04:13:36
|
Update of /cvsroot/phpicalendar/phpicalendar/functions In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv24398/functions Modified Files: template.php Log Message: Fixed week template, streamlined CSS. Index: template.php =================================================================== RCS file: /cvsroot/phpicalendar/phpicalendar/functions/template.php,v retrieving revision 1.37 retrieving revision 1.38 diff -C2 -d -r1.37 -r1.38 *** template.php 15 May 2004 23:56:19 -0000 1.37 --- template.php 16 May 2004 04:13:28 -0000 1.38 *************** *** 62,66 **** function draw_week($template_p) { ! global $start_week_time, $template, $getdate, $cal, $master_array, $daysofweek_lang, $week_start_day, $dateFormat_week_list, $current_view, $day_array, $timeFormat, $gridLength; for ($i=0; $i<7; $i++) { --- 62,85 ---- function draw_week($template_p) { ! global $start_week_time, $template, $getdate, $cal, $master_array, $daysofweek_lang, $week_start_day, $dateFormat_week_list, $current_view, $day_array, $timeFormat, $gridLength, $timeFormat_small; ! ! // Figure out colspans ! $dayborder = 0; ! $thisdate = $start_week_time; ! $swt = $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)); ! } for ($i=0; $i<7; $i++) { *************** *** 68,72 **** $weekarray[$i] = $thisdate; $start_week_time = strtotime('+1 day', $start_week_time); ! } // Replaces the allday events --- 87,91 ---- $weekarray[$i] = $thisdate; $start_week_time = strtotime('+1 day', $start_week_time); ! } // Replaces the allday events *************** *** 78,82 **** $loop_end = trim($match3[1]); foreach ($weekarray as $key => $get_date) { ! $replace = $loop_begin; if (is_array($master_array[$get_date]['-1'])) { foreach ($master_array[$get_date]['-1'] as $allday) { --- 97,103 ---- $loop_end = trim($match3[1]); foreach ($weekarray as $key => $get_date) { ! $replace = $loop_begin; ! $colspan = 'colspan="'.$nbrGridCols[$get_date].'"'; ! $replace = str_replace('{COLSPAN}', $colspan, $replace); if (is_array($master_array[$get_date]['-1'])) { foreach ($master_array[$get_date]['-1'] as $allday) { *************** *** 122,130 **** $start_day = strtotime("+1 day", $start_day); $start_wt = strtotime("+1 day", $start_wt); ! $loop_tmp = str_replace('{DAY}', $weekday, $loop_dof); ! $loop_tmp = str_replace('{DAYLINK}', $daylink, $loop_tmp); ! $loop_tmp = str_replace('{ROW1}', $row1, $loop_tmp); ! $loop_tmp = str_replace('{ROW2}', $row2, $loop_tmp); ! $loop_tmp = str_replace('{ROW3}', $row3, $loop_tmp); $weekday_loop .= $loop_tmp; } --- 143,150 ---- $start_day = strtotime("+1 day", $start_day); $start_wt = strtotime("+1 day", $start_wt); ! $colspan = 'colspan="'.$nbrGridCols[$daylink].'"'; ! $search = array('{DAY}', '{DAYLINK}', '{ROW1}', '{ROW2}', '{ROW3}', '{COLSPAN}'); ! $replace = array($weekday, $daylink, $row1, $row2, $row3, $colspan); ! $loop_tmp = str_replace($search, $replace, $loop_dof); $weekday_loop .= $loop_tmp; } *************** *** 132,151 **** // Build the body - $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)); - } preg_match("!<\!-- loop row on -->(.*)<\!-- loop row off -->!is", $this->page, $match2); preg_match("!<\!-- loop event on -->(.*)<\!-- loop event off -->!is", $this->page, $match3); --- 152,155 ---- *************** *** 159,163 **** $this_month = $day_array2[2]; $this_year = $day_array2[1]; ! $thisdate = $start_week_time; for ($i=0;$i<7;$i++) { $thisday = date("Ymd", $thisdate); --- 163,167 ---- $this_month = $day_array2[2]; $this_year = $day_array2[1]; ! $thisdate = $swt; for ($i=0;$i<7;$i++) { $thisday = date("Ymd", $thisdate); *************** *** 174,186 **** if (ereg("([0-9]{1,2}):00", $key)) { $weekdisplay .= '<tr>'; ! $weekdisplay .= '<td rowspan="' . (60 / $gridLength) . '" align="center" valign="top" width="60" class="timeborder">'.$key.'</td>'; $weekdisplay .= '<td bgcolor="#a1a5a9" width="1" height="' . $gridLength . '"></td>'; } elseif ($cal_time == $day_start) { $size_tmp = 60 - (int)substr($cal_time,2,2); $weekdisplay .= '<tr>'; ! $weekdisplay .= '<td rowspan="' . ($size_tmp / $gridLength) . '" align="center" valign="top" width="60" class="timeborder">'.$key.'</td>'; $weekdisplay .= '<td bgcolor="#a1a5a9" width="1" height="' . $gridLength . '"></td>'; } else { - $weekdisplay .= '<tr>'; $weekdisplay .= '<td bgcolor="#a1a5a9" width="1" height="' . $gridLength . '"></td>'; --- 178,189 ---- if (ereg("([0-9]{1,2}):00", $key)) { $weekdisplay .= '<tr>'; ! $weekdisplay .= '<td colspan="4" rowspan="' . (60 / $gridLength) . '" align="center" valign="top" width="60" class="timeborder">'.$key.'</td>'; $weekdisplay .= '<td bgcolor="#a1a5a9" width="1" height="' . $gridLength . '"></td>'; } elseif ($cal_time == $day_start) { $size_tmp = 60 - (int)substr($cal_time,2,2); $weekdisplay .= '<tr>'; ! $weekdisplay .= '<td colspan="4" rowspan="' . ($size_tmp / $gridLength) . '" align="center" valign="top" width="60" class="timeborder">'.$key.'</td>'; $weekdisplay .= '<td bgcolor="#a1a5a9" width="1" height="' . $gridLength . '"></td>'; } else { $weekdisplay .= '<tr>'; $weekdisplay .= '<td bgcolor="#a1a5a9" width="1" height="' . $gridLength . '"></td>'; *************** *** 188,192 **** // initialize $thisdate again ! $thisdate = $start_week_time; // loop this part 7 times, one for each day --- 191,195 ---- // initialize $thisdate again ! $thisdate = $swt; // loop this part 7 times, one for each day *************** *** 241,245 **** } ! $weekdisplay .= "<td colspan=\"" . $nbrGridCols[$thisday] . "\" $class> </td>\n"; } else { --- 244,250 ---- } ! $drawWidth = 1; ! $colspan_width = round((80 / $nbrGridCols[$thisday]) * $drawWidth); ! $weekdisplay .= "<td width=\"$colspan_width\" colspan=\"" . $nbrGridCols[$thisday] . "\" $class> </td>\n"; } else { *************** *** 253,257 **** $event_length[$thisday][$i]["state"] = "started"; $event_start = $this_time_arr[($event_length[$thisday][$i]["key"])]["start_unixtime"]; ! $event_start = date ($timeFormat, $event_start); $event_calno = $this_time_arr[($event_length[$thisday][$i]['key'])]['calnumber']; $event_status = strtolower($this_time_arr[($event_length[$thisday][$i]['key'])]['status']); --- 258,262 ---- $event_length[$thisday][$i]["state"] = "started"; $event_start = $this_time_arr[($event_length[$thisday][$i]["key"])]["start_unixtime"]; ! $event_start = date ($timeFormat_small, $event_start); $event_calno = $this_time_arr[($event_length[$thisday][$i]['key'])]['calnumber']; $event_status = strtolower($this_time_arr[($event_length[$thisday][$i]['key'])]['status']); *************** *** 261,265 **** $confirmed = '<img src="images/'.$event_status.'.gif" width="9" height="9" alt="" border="0" hspace="0" vspace="0" /> '; } ! $weekdisplay .= '<td rowspan="' . $event_length[$thisday][$i]['length'] . '" colspan="' . $drawWidth . '" align="left" valign="top" class="eventbg2_'.$event_calno.'">'."\n"; $event_end = $this_time_arr[($event_length[$thisday][$i]["key"])]["end_unixtime"]; --- 266,271 ---- $confirmed = '<img src="images/'.$event_status.'.gif" width="9" height="9" alt="" border="0" hspace="0" vspace="0" /> '; } ! $colspan_width = round((80 / $nbrGridCols[$thisday]) * $drawWidth); ! $weekdisplay .= '<td width="'.$colspan_width.'" rowspan="' . $event_length[$thisday][$i]['length'] . '" colspan="' . $drawWidth . '" align="left" valign="top" class="eventbg2_'.$event_calno.'">'."\n"; $event_end = $this_time_arr[($event_length[$thisday][$i]["key"])]["end_unixtime"]; *************** *** 357,365 **** $start_day = strtotime("+1 day", $start_day); $start_wt = strtotime("+1 day", $start_wt); ! $loop_tmp = str_replace('{DAY}', $weekday, $loop_dof); ! $loop_tmp = str_replace('{DAYLINK}', $daylink, $loop_tmp); ! $loop_tmp = str_replace('{ROW1}', $row1, $loop_tmp); ! $loop_tmp = str_replace('{ROW2}', $row2, $loop_tmp); ! $loop_tmp = str_replace('{ROW3}', $row3, $loop_tmp); $weekday_loop .= $loop_tmp; } --- 363,369 ---- $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; } *************** *** 527,531 **** function tomorrows_events() { ! global $template, $getdate, $master_array, $next_day, $timeFormat; preg_match("!<\!-- switch t_allday on -->(.*)<\!-- switch t_allday off -->!is", $this->page, $match1); --- 531,535 ---- function tomorrows_events() { ! global $template, $getdate, $master_array, $next_day, $timeFormat, $tomorrows_events_lines; preg_match("!<\!-- switch t_allday on -->(.*)<\!-- switch t_allday off -->!is", $this->page, $match1); *************** *** 572,576 **** function get_vtodo() { ! global $template, $getdate, $master_array, $next_day, $timeFormat; preg_match("!<\!-- switch show_completed on -->(.*)<\!-- switch show_completed off -->!is", $this->page, $match1); --- 576,580 ---- function get_vtodo() { ! global $template, $getdate, $master_array, $next_day, $timeFormat, $tomorrows_events_lines; preg_match("!<\!-- switch show_completed on -->(.*)<\!-- switch show_completed off -->!is", $this->page, $match1); |