@@ -65,10 +65,11 @@ function draw_print($template_p) {
65
65
66
66
$ seen_events = array ();
67
67
$ final = '' ;
68
+ $ events_week = 0 ;
68
69
foreach ($ master_array as $ key => $ val ) {
69
70
preg_match ('/([0-9]{6})([0-9]{2})/ ' , $ key , $ regs );
70
71
if (((@$ regs [1 ] == $ parse_month ) && ($ printview == 'month ' )) || (($ key == $ getdate ) && ($ printview == 'day ' )) || ((($ key >= $ week_start ) && ($ key <= $ week_end )) && ($ printview == 'week ' )) || ((substr (@$ regs [1 ],0 ,4 ) == $ parse_year ) && ($ printview == 'year ' ))) {
71
- @ $ events_week ++;
72
+ $ events_week ++;
72
73
$ dayofmonth = strtotime ($ key );
73
74
$ dayofmonth = localizeDate ($ dateFormat_day , $ dayofmonth );
74
75
$ events_tmp = $ loop_event ;
@@ -86,10 +87,10 @@ function draw_print($template_p) {
86
87
$ day_events ++;
87
88
if (isset ($ new_val2 ['event_text ' ])) {
88
89
$ event_text = stripslashes (urldecode ($ new_val2 ['event_text ' ]));
89
- $ location = stripslashes (urldecode (@ $ new_val2 ['location ' ]));
90
- $ description = stripslashes (urldecode (@ $ new_val2 ['description ' ]));
91
- $ event_start = @ $ new_val2 ['event_start ' ];
92
- $ event_end = @ $ new_val2 ['event_end ' ];
90
+ $ location = stripslashes (urldecode ($ new_val2 ['location ' ]));
91
+ $ description = stripslashes (urldecode ($ new_val2 ['description ' ]));
92
+ $ event_start = $ new_val2 ['event_start ' ];
93
+ $ event_end = $ new_val2 ['event_end ' ];
93
94
if (isset ($ new_val2 ['display_end ' ])) $ event_end = $ new_val2 ['display_end ' ];
94
95
if (!isset ($ new_val2 ['event_start ' ])) {
95
96
$ event_start = $ lang ['l_all_day ' ];
@@ -271,22 +272,73 @@ function draw_week($template_p) {
271
272
}
272
273
#echo "<pre>";print_r($nbrGridCols);
273
274
// Replaces the allday events
275
+ preg_match ("!<\!-- loop allday row on -->(.*)<\!-- loop alldaysofweek on -->!Uis " , $ this ->page , $ match1 );
276
+ $ loop_row_begin = trim ($ match1 [1 ]); # <tr>etc
274
277
preg_match ("!<\!-- loop allday on -->(.*)<\!-- loop allday off -->!Uis " , $ this ->page , $ match1 );
275
278
preg_match ("!<\!-- loop alldaysofweek on -->(.*)<\!-- loop allday on -->!Uis " , $ this ->page , $ match2 );
276
279
preg_match ("!<\!-- loop allday off -->(.*)<\!-- loop alldaysofweek off -->!Uis " , $ this ->page , $ match3 );
277
- $ loop_ad = trim ($ match1 [1 ]);
278
- $ loop_begin = trim ($ match2 [1 ]);
279
- $ loop_end = trim ($ match3 [1 ]);
280
+ $ loop_ad = trim ($ match1 [1 ]); # one day cell
281
+ $ loop_begin = trim ($ match2 [1 ]); # <td>
282
+ $ loop_end = trim ($ match3 [1 ]); # </td>
283
+ preg_match ("!<\!-- loop alldaysofweek off -->(.*)<\!-- loop allday row off -->!Uis " , $ this ->page , $ match3 );
284
+ $ loop_row_end = trim ($ match3 [1 ]); # </tr>
285
+ $ allday_uids = array ();
286
+ $ allday_uid_dates = array ();
280
287
$ weekreplace = '' ;
281
- foreach ($ weekarray as $ get_date ) {
288
+ foreach ($ weekarray as $ i =>$ get_date ){
289
+ if (isset ($ master_array [$ get_date ]['-1 ' ]) && is_array ($ master_array [$ get_date ]['-1 ' ]) && !empty ($ master_array [$ get_date ]['-1 ' ])){
290
+ foreach ($ master_array [$ get_date ]['-1 ' ] as $ uid => $ allday ){
291
+ if (!array_key_exists ($ uid , $ allday_uids )) $ allday_uids [$ uid ] = $ get_date ;
292
+ $ allday_uid_dates [$ uid ][] = $ get_date ;
293
+ }
294
+ }
295
+ }
296
+ # new allday routine is better for multiday events
297
+ while (!empty ($ allday_uids )){
298
+ $ row = $ loop_row_begin ;
299
+ $ day = 0 ;
300
+ $ replace ='' ;
301
+ while ($ day < $ phpiCal_config ->week_length ){
302
+ $ colspan = 0 ;
303
+ $ replace .= $ loop_begin ; # <td>
304
+ if (array_search ($ weekarray [$ day ], $ allday_uids )){
305
+ $ uid = array_search ($ weekarray [$ day ], $ allday_uids );
306
+ unset($ allday_uids [$ uid ]);
307
+ $ allday = $ master_array [$ weekarray [$ day ]]['-1 ' ][$ uid ];
308
+ foreach ($ allday_uid_dates [$ uid ] as $ date ){
309
+ #$ev = (!isset($ev)) ? " $uid ":"";
310
+ #$replace .= $ev;
311
+ $ colspan += $ nbrGridCols [$ weekarray [$ day ]];
312
+ $ day ++;
313
+ }
314
+ $ event_calno = $ allday ['calnumber ' ];
315
+ $ event_calno = (($ event_calno - 1 ) % $ phpiCal_config ->unique_colors ) + 1 ;
316
+ $ event = openevent ($ get_date , -1 , $ uid , $ allday , $ phpiCal_config ->allday_week_lines , 11 , 'psf ' );
317
+ $ loop_tmp = str_replace ('{ALLDAY} ' , $ event , $ loop_ad );
318
+ $ loop_tmp = str_replace ('{CALNO} ' , $ event_calno , $ loop_tmp );
319
+ $ replace .= $ loop_tmp ;
320
+ $ replace .= $ loop_end ;
321
+ }else {
322
+ $ colspan = $ nbrGridCols [$ weekarray [$ day ]];
323
+ $ replace .= $ loop_end ;
324
+ $ day ++;
325
+ }
326
+ unset ($ ev );
327
+ $ replace = str_replace ('{COLSPAN} ' , "colspan=' $ colspan' " , $ replace );
328
+ }
329
+ $ row .= "$ replace $ loop_row_end \n" ;
330
+ $ weekreplace .= "$ row \n" ;
331
+ }
332
+ /* old routine
333
+ foreach ($weekarray as $i=>$get_date) {
282
334
$replace = $loop_begin;
283
335
$colspan = 'colspan="'.$nbrGridCols[$get_date].'"';
284
336
$replace = str_replace('{COLSPAN}', $colspan, $replace);
285
337
if (isset($master_array[$get_date]['-1']) && is_array($master_array[$get_date]['-1']) && !empty($master_array[$get_date]['-1']) ) {
286
338
foreach ($master_array[$get_date]['-1'] as $uid => $allday) {
287
339
$event_calno = $allday['calnumber'];
288
340
$event_calno = (($event_calno - 1) % $phpiCal_config->unique_colors) + 1;
289
- $ event = openevent ($ get_date , -1 , $ uid , $ allday , 1 , 11 , 'psf ' );
341
+ $event = openevent($get_date, -1, $uid, $allday, $phpiCal_config->allday_week_lines , 11, 'psf');
290
342
$loop_tmp = str_replace('{ALLDAY}', $event, $loop_ad);
291
343
$loop_tmp = str_replace('{CALNO}', $event_calno, $loop_tmp);
292
344
$replace .= $loop_tmp;
@@ -295,6 +347,7 @@ function draw_week($template_p) {
295
347
$replace .= $loop_end;
296
348
$weekreplace .= $replace;
297
349
}
350
+ */
298
351
$ this ->page = preg_replace ('!<\!-- loop alldaysofweek on -->.*<\!-- loop alldaysofweek off -->!Uis ' , $ weekreplace , $ this ->page );
299
352
300
353
// Replaces the daysofweek
@@ -726,10 +779,10 @@ function tomorrows_events() {
726
779
$ event_text = strip_tags ($ event_text , '<b><i><u> ' );
727
780
if ($ event_text != "" ) {
728
781
if (!isset ($ val ["event_start " ])) {
729
- $ return_adtmp = openevent ($ next_day , $ cal_time , $ uid , $ val , $ tomorrows_events_lines , 21 , 'psf ' );
782
+ $ return_adtmp = openevent ($ next_day , $ cal_time , $ uid , $ val , $ phpiCal_config -> tomorrows_events_lines , 21 , 'psf ' );
730
783
$ replace_ad .= str_replace ('{T_ALLDAY} ' , $ return_adtmp , $ loop_t_ad );
731
784
} else {
732
- $ return_etmp = openevent ($ next_day , $ cal_time , $ uid , $ val , $ tomorrows_events_lines , 21 , 'ps3 ' );
785
+ $ return_etmp = openevent ($ next_day , $ cal_time , $ uid , $ val , $ phpiCal_config -> tomorrows_events_lines , 21 , 'ps3 ' );
733
786
$ replace_e .= str_replace ('{T_EVENT} ' , $ return_etmp , $ loop_t_e );
734
787
}
735
788
}
@@ -910,6 +963,7 @@ function draw_month($template_p, $offset = '+0', $type) {
910
963
} else {
911
964
$ temp = $ t_month [2 ];
912
965
}
966
+ $ switch ['ALLDAY ' ] = $ switch ['EVENT ' ] = '' ;
913
967
if (isset ($ master_array [$ daylink ]) && $ i <= $ phpiCal_config ->week_length ) {
914
968
if ($ type != 'small ' ) {
915
969
foreach ($ master_array [$ daylink ] as $ cal_time => $ event_times ) {
@@ -920,7 +974,7 @@ function draw_month($template_p, $offset = '+0', $type) {
920
974
if ($ cal_time == -1 ) {
921
975
if ($ type == 'large ' ) {
922
976
$ switch ['ALLDAY ' ] .= '<div class="V10"><img src="templates/ ' .$ phpiCal_config ->template .'/images/monthdot_ ' .$ event_calno .'.gif" alt="" width="9" height="9" border="0" /> ' ;
923
- $ switch ['ALLDAY ' ] .= openevent ($ daylink , $ cal_time , $ uid , $ val , $ month_event_lines , 15 , 'psf ' );
977
+ $ switch ['ALLDAY ' ] .= openevent ($ daylink , $ cal_time , $ uid , $ val , $ phpiCal_config -> month_event_lines , 15 , 'psf ' );
924
978
$ switch ['ALLDAY ' ] .= (isset ($ val ['location ' ]) && $ val ['location ' ] != '' ) ? $ val ['location ' ]."<br /> " : '' ;
925
979
$ switch ['ALLDAY ' ] .= '</div> ' ;
926
980
} else {
@@ -929,8 +983,8 @@ function draw_month($template_p, $offset = '+0', $type) {
929
983
} else {
930
984
$ start2 = date ($ timeFormat_small , $ val ['start_unixtime ' ]);
931
985
if ($ type == 'large ' ) {
932
- @ $ switch ['EVENT ' ] .= '<div class="V9"><img src="templates/ ' .$ phpiCal_config ->template .'/images/monthdot_ ' .$ event_calno .'.gif" alt="" width="9" height="9" border="0" /> ' ;
933
- $ switch ['EVENT ' ] .= openevent ($ daylink , $ cal_time , $ uid , $ val , $ month_event_lines , 10 , 'ps3 ' , "$ start2 " ).'' ;
986
+ $ switch ['EVENT ' ] .= '<div class="V9"><img src="templates/ ' .$ phpiCal_config ->template .'/images/monthdot_ ' .$ event_calno .'.gif" alt="" width="9" height="9" border="0" /> ' ;
987
+ $ switch ['EVENT ' ] .= openevent ($ daylink , $ cal_time , $ uid , $ val , $ phpiCal_config -> month_event_lines , 10 , 'ps3 ' , "$ start2 " ).'' ;
934
988
$ switch ['EVENT ' ] .= (isset ($ val ['location ' ]) && $ val ['location ' ] != '' ) ? "<br /> " .$ val ['location ' ]."<br /> " : '' ;
935
989
$ switch ['EVENT ' ] .= '</div> ' ;
936
990
} else {
@@ -1008,7 +1062,7 @@ function monthbottom() {
1008
1062
$ switch ['CALNAME ' ] = $ val ['calname ' ];
1009
1063
if (!isset ($ val ['event_start ' ])) {
1010
1064
$ switch ['START_TIME ' ] = $ lang ['l_all_day ' ];
1011
- $ switch ['EVENT_TEXT ' ] = openevent ($ m_start , $ cal_time , $ uid , $ val , @ $ month_event_lines , 15 , 'psf ' );
1065
+ $ switch ['EVENT_TEXT ' ] = openevent ($ m_start , $ cal_time , $ uid , $ val , $ phpiCal_config -> month_event_lines , 15 , 'psf ' );
1012
1066
$ switch ['DESCRIPTION ' ] = urldecode ($ val ['description ' ]);
1013
1067
} else {
1014
1068
$ event_start = $ val ['start_unixtime ' ];
0 commit comments