Exponential Basic 2.4.0.1 Exponential Basic CMS — PHP Class Reference

eventedit.php
Go to the documentation of this file.
1 <?
3 //
4 // $Id: eventedit.php,v 1.36 2001/03/12 13:55:47 fh Exp $
5 //
6 // Adam Fallert <FallertA@umsystem.edu>
7 // Created on: <3-Oct-2001 14:36:00>
8 //
9 // This source file is part of Exponential Basic, publishing software.
10 // Copyright (C) 1999-2001 eZ systems as
11 //
12 // This program is free software; you can redistribute it and/or
13 // modify it under the terms of the GNU General Public License
14 // as published by the Free Software Foundation; either version 2
15 // of the License, or (at your option) any later version.
16 //
17 // This program is distributed in the hope that it will be useful,
18 // but WITHOUT ANY WARRANTY; without even the implied warranty of
19 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
20 // GNU General Public License for more details.
21 //
22 // You should have received a copy of the GNU General Public License
23 // along with this program; if not, write to the Free Software
24 // Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, US
25 //
26
27 // include_once( "classes/ezhttptool.php" );
28
29 $URL = explode( "/", $_SERVER['REQUEST_URI'] );
30
31 if( isset( $URL[8] ) && is_numeric( $URL[8] ) )
32 $masterGroupID = $URL[8];
33 else
34 $masterGroupID = 0;
35
36
37 if ( isset( $DeleteEvents ) )
38 {
39 $Action = "DeleteEvents";
40 }
41
42 if ( isset( $GoDay ) )
43 {
44 //include_once( "classes/ezdate.php" );
45
46 $session =& eZSession::globalSession();
47 $session->fetch();
48
49 $year = $session->variable( "Year" );
50 $month = $session->variable( "Month" );
51 $day = $session->variable( "Day" );
52
53 $date = new eZDate( $year, $month, $day );
54 if ( $date->daysInMonth() < $day )
55 $day = $date->daysInMonth();
56
57 eZHTTPTool::header( "Location: /groupeventcalendar/dayview/$year/$month/$day/" );
58 exit();
59 }
60 else if ( isSet( $GoWeek ) )
61 {
62 //include_once( "classes/ezdate.php" );
63
64 $session =& eZSession::globalSession();
65 $session->fetch();
66
67 $year = $session->variable( "Year" );
68 $month = $session->variable( "Month" );
69 $day = $session->variable( "Day" );
70
71 $date = new eZDate( $year, $month, $day );
72 if ( $date->daysInMonth() < $day )
73 $day = $date->daysInMonth();
74
75 eZHTTPTool::header( "Location: /groupeventcalendar/weekview/$year/$month/$day/" );
76 exit();
77 }
78 else if ( isSet( $GoMonth ) )
79 {
80 $session =& eZSession::globalSession();
81 $session->fetch();
82
83 $year = $session->variable( "Year" );
84 $month = $session->variable( "Month" );
85
86 eZHTTPTool::header( "Location: /groupeventcalendar/monthview/$year/$month/" );
87 exit();
88 }
89 else if ( isSet( $GoYear ) )
90 {
91 $session =& eZSession::globalSession();
92 $session->fetch();
93
94 $year = $session->variable( "Year" );
95
96 eZHTTPTool::header( "Location: /groupeventcalendar/yearview/$year/" );
97 exit();
98 }
99 else if ( isSet( $GoToday ) )
100 {
101 $today = new eZDate();
102
103 $year = addZero( $today->year() );
104 $month = addZero( $today->month() );
105 $day = addZero( $today->day() );
106
107 eZHTTPTool::header( "Location: /groupeventcalendar/dayview/$year/$month/$day/" );
108 exit();
109 }
110 else if ( isSet( $GoNew ) )
111 {
112 $today = new eZDate();
113
114 $year = addZero( $today->year() );
115 $month = addZero( $today->month() );
116 $day = addZero( $today->day() );
117
118 eZHTTPTool::header( "Location: /groupeventcalendar/eventedit/new/$year/$month/$day/" );
119 exit();
120 }
121
122 if ( isSet( $AddFile ) )
123 {
124 // $Action = "AddFile";
125 // add files
126 eZHTTPTool::header( "Location: /groupeventcalendar/eventedit/filelist/$eventID/" );
127 exit();
128 }
129
130
131 // include_once( "classes/INIFile.php" );
132 // include_once( "classes/eztemplate.php" );
133 // include_once( "classes/ezlog.php" );
134 // include_once( "classes/ezlocale.php" );
135
136 // include_once( "classes/ezdate.php" );
137 // include_once( "classes/eztime.php" );
138 // //include_once( "classes/eztimetime.php" );
139
140 // include_once( "ezuser/classes/ezuser.php" );
141 // include_once( "ezuser/classes/ezpermission.php" );
142
143 // include_once( "ezgroupeventcalendar/classes/ezgroupevent.php" );
144 // include_once( "ezgroupeventcalendar/classes/ezgroupeventtype.php" );
145 // include_once( "ezgroupeventcalendar/classes/ezgroupeventcategory.php" );
146
147 // include_once( "ezgroupeventcalendar/classes/ezgroupeditor.php" );
148 // include_once( "ezgroupeventcalendar/classes/ezgroupnoshow.php" );
149
150 $ini =& eZINI::instance( 'site.ini' );
151
152 $SiteDesign = $ini->variable( "site", "SiteDesign" );
153 $Language = $ini->variable( "eZGroupEventCalendarMain", "Language" );
154 $StartTimeStr = $ini->variable( "eZGroupEventCalendarMain", "DayStartTime" );
155 $StopTimeStr = $ini->variable( "eZGroupEventCalendarMain", "DayStopTime" );
156 $timeSelect = $ini->variable( "eZGroupEventCalendarMain", "TwelveHourSelect" );
157
158 $Locale = new eZLocale( $Language );
159
160 $user = eZUser::currentUser();
161
162
163
165 // die("Hello");
166 /*
167
168 $stamp = '20361230235959';
169
170 $the_stamp = new eZDateTime;
171 // $the_stamp = $the_stamp->setMySQLTimeStamp($stamp);
172 $the_stamp_unix = $the_stamp->timeStamp();
173
174 die("core: $the_stamp_unix");
175
176 */
178
179 if ( $user == false )
180 $userID = false;
181 else
182 $userID = $user->id();
183
184 if ( isset( $Action ) && $Action == "New" )
185 {
186 $event = new eZGroupEvent();
187 }
188 else
189 $event = new eZGroupEvent( $EventID );
190
191 // We don't need to record this
192 // $session->setVariable( "ShowOtherCalenderGroups", $groupID );
193
194 $t = new eZTemplate( "kernel/ezgroupeventcalendar/user/" . $ini->variable( "eZGroupEventCalendarMain", "TemplateDir" ),
195 "kernel/ezgroupeventcalendar/user/intl/", $Language, "eventedit.php" );
196
197 $t->set_file( "event_edit_tpl", "eventedit.tpl" );
198
199 $t->setAllStrings();
200
201 $t->set_block( "event_edit_tpl", "user_error_tpl", "user_error" );
202 $t->set_block( "user_error_tpl", "no_user_error_tpl", "no_user_error" );
203 $t->set_block( "user_error_tpl", "wrong_user_error_tpl", "wrong_user_error" );
204 $t->set_block( "user_error_tpl", "wrong_user_error_new_tpl", "wrong_user_error_new" );
205
206 $t->set_block( "event_edit_tpl", "no_error_tpl", "no_error" );
207 $t->set_block( "no_error_tpl", "title_error_tpl", "title_error" );
208 $t->set_block( "no_error_tpl", "group_error_tpl", "group_error" );
209
210 $t->set_block( "no_error_tpl", "start_hour_item_tpl", "start_hour_item" );
211 $t->set_block( "no_error_tpl", "start_minute_item_tpl", "start_minute_item" );
212 $t->set_block( "no_error_tpl", "stop_hour_item_tpl", "stop_hour_item" );
213 $t->set_block( "no_error_tpl", "stop_minute_item_tpl", "stop_minute_item" );
214 $t->set_block( "no_error_tpl", "start_ampm_radio_tpl", "start_ampm_radio" );
215 $t->set_block( "no_error_tpl", "stop_ampm_radio_tpl", "stop_ampm_radio" );
216
217 $t->set_block( "no_error_tpl", "start_time_error_tpl", "start_time_error" );
218 $t->set_block( "no_error_tpl", "stop_time_error_tpl", "stop_time_error" );
219 $t->set_block( "no_error_tpl", "value_tpl", "value" );
220 $t->set_block( "no_error_tpl", "category_value_tpl", "category_value" );
221
222 $t->set_block( "no_error_tpl", "month_tpl", "month" );
223 $t->set_block( "no_error_tpl", "day_tpl", "day" );
224 $t->set_block( "no_error_tpl", "year_tpl", "year" );
225 $t->set_block( "no_error_tpl", "group_name_edit_tpl", "group_name_edit" );
226 $t->set_block( "no_error_tpl", "group_name_new_tpl", "group_name_new" );
227
228 $t->set_block( "no_error_tpl", "add_file_list_tpl", "add_file_list" );
229
230 $t->set_block( "group_name_new_tpl", "group_item_tpl", "group_item" );
231
232 $t->set_block ( "no_error_tpl", "top_buttons_tpl", "top_buttons");
233
234 //history bar block
235 $t->set_block( "event_edit_tpl", "group_history_tpl", "group_history" );
236 $t->set_block( "event_edit_tpl", "edit_history_tpl", "edit_history" );
237 $t->set_block( "event_edit_tpl", "new_history_tpl", "new_history" );
238
239 $t->set_block( "no_error_tpl", "recur_exceptions_tpl", "recur_exceptions");
240 $t->set_var( "sitedesign", $SiteDesign );
241
242 $t->set_var( "group_history", "" );
243
244
246
247 if ( isset( $Action ) && "Edit" == $Action)
248 {
249 $theDate = $event->dateTime();
250 $curDate = new eZDate();
251 $t->set_var( "the_year", $theDate->year() );
252 $t->set_var( "the_month", addZero($theDate->month()) );
253 $t->set_var( "the_day", addZero($theDate->day()) );
254 $t->set_var( "year_cur", $curDate->year() );
255 $t->set_var( "month_cur", $curDate->month() );
256 $t->set_var( "day_cur", $curDate->day() );
257 $t->parse( "top_buttons", "top_buttons_tpl");
258 }
259 else
260 {
261 $t->set_var( "top_buttons", "" );
262 }
263
264 //print the group name in the history bar if a group is selected
265 if( $masterGroupID != 0 )
266 {
267 $group = new eZUserGroup( $masterGroupID );
268
269 $t->set_var( "group_print_name", $group->name() );
270 $t->set_var( "group_print_id", $group->id() );
271 $t->parse( "group_history", "group_history_tpl", true );
272 }
273 elseif ( $event->groupID() && $masterGroupID == 0 )
274 {
275 $group = new eZUserGroup( $event->groupID() );
276
277 $t->set_var( "group_print_name", $group->name() );
278 $t->set_var( "group_print_id", $group->id() );
279 $t->parse( "group_history", "group_history_tpl", true );
280 }
281 else
282 $t->set_var( "group_history", "" );
283
284
285 $t->set_var( "edit_history", "" );
286 $t->set_var( "new_history", "" );
287
288 $t->set_var( "group_name_edit", "" );
289 $t->set_var( "group_name_new", "" );
290
291
292 $t->set_var( "add_file_list", "" );
293
294 // no user logged on
295 if( $userID == false )
296 {
297 $t->set_var( "no_error", "" );
298 $t->set_var( "wrong_user_error", "" );
299
300 $t->parse( "no_user_error", "no_user_error_tpl" );
301 $t->parse( "user_error", "user_error_tpl" );
302 $t->pparse( "output", "event_edit_tpl" );
303
304 $groupError = true;
305 $errorPrint = true;
306 }
307
308 //set the group to a non valid group
309 $groupID = "-1";
310
311 // Groups that should not use be used with the calendar
312 $noShowGroup = new eZGroupNoShow();
313
314 // Determine editing permissions
315 $permission = new eZGroupEditor();
316 $editor = false;
317
318
320 // ifAuthenticatUser
321 if ( $user == true )
322 {
323 //if the user has root access, return all the groups else just return the group they are a member of
324 if( $user->hasRootAccess() == true || eZPermission::checkPermission( $user, "eZGroupEventCalendar", "WriteToRoot" ) )
325 {
326 $groups = new eZUserGroup();
327 $groupsList = $groups->getAll( true );
328
329 $editor = true;
330 }
331 else
332 $groupsList = $user->groups();
333
334 // die( "editor:" . $editor );
335
336 if( isset( $Action ) && $Action == "New" )
337 {
338 $Group = $masterGroupID;
339 }
340 else
341 {
342 $Group = $event->groupID();
343 }
344
345 //Determin if the user has editing permissions
346 if( $editor == true )
347 {
348 $groupID = $Group;
349 }
350 elseif( $permission->hasEditPermission( $user->id(), $Group ) == true && $editor == false )
351 {
352 $editor = true;
353 $groupID = $Group;
354 }
355 elseif( $permission->getByGroup( $Group ) == false && $editor == false )
356 {
357 foreach( $groupsList as $groups )
358 {
359 if( $permission->groupHasEditor( $groups->id() ) == false && $noShowGroup->groupEntry( $groups->id() ) == false )
360 {
361 if( $Group != 0 && $Group )
362 {
363 $editor = true;
364 $groupID = $Group;
365 break;
366 }
367 elseif( $Group == 0 )
368 {
369 $editor = true;
370 $groupID = $Group;
371 break;
372 }
373 }
374 }
375 }
376 }
377 else
378 {
379 $groupsList = array();
380 }
381
382
383 if ( ( isset( $Action ) && $Action == "New" || isset( $Action ) && $Action == "Insert" || isset( $Action ) && $Action == "Update" || isset( $Action ) && $Action == "Edit" ) && $groupsList )
384 {
385
386 $groupError = true;
387 foreach ( $groupsList as $groups )
388 {
389 if( isset( $Action ) && $Action == "New" )
390 {
391 if( ($masterGroupID == $groups->id() || $masterGroupID == 0) && $editor == true )
392 {
393 $groupError = false;
394 break;
395 }
396 }
397
398 if( isset( $Action ) && $Action == "Edit" )
399 {
400 // kracker: add support for event->groupID == 0
401 if( $event->groupID() == 0 && $editor == true || $event->groupID() == $groups->id() && $editor == true )
402 {
403 $groupError = false;
404 break;
405 }
406 }
407
408 if( isset( $Action ) && $Action == "Insert" || isset( $Action ) && $Action == "Update")
409 {
410 if( ($StoreByGroupID == $groups->id() || $StoreByGroupID == 0) && $editor == true )
411 {
412 $groupError = false;
413 break;
414 }
415 }
416 }
417 }
418
419 if ( $event->groupID() )
420 $session->setVariable( "ShowOtherCalenderGroups", $event->groupID() );
421 elseif( $masterGroupID != 0 && !isset( $EventID ) )
422 $session->setVariable( "ShowOtherCalenderGroups", $masterGroupID );
423
424
425 // only the specified group member is allowed to edit or delete an event
426 if ( isset( $Action ) && $Action == "Edit" && $groupError == true )
427 {
428
429 $t->set_var( "no_error", "" );
430 $t->set_var( "no_user_error", "" );
431
432 $t->parse( "wrong_user_error", "wrong_user_error_tpl" );
433 $t->parse( "user_error", "user_error_tpl" );
434 $t->pparse( "output", "event_edit_tpl" );
435
436 $groupError = true;
437 }
438
439
440 if ( isset( $Action ) && $Action == "DeleteEvents" )
441 {
442 //initialize the error array
443 $error = array();
444
445 //get the date from the first event to be deleted
446 $tmpAppointment = new eZGroupEvent( $eventArrayID[0]);
447 $datetime = $tmpAppointment->dateTime();
448
449 if ( count ( $eventArrayID ) != 0 )
450 {
451 foreach( $eventArrayID as $ID )
452 {
453 array_push( $error, $ID );
454 $event = new eZGroupEvent( $ID );
455 foreach ( $groupsList as $groups )
456 {
457 //If the user has a matching group set their group id to the matching group else there group id will be -1.
458 if( $event->groupID() == $groups->id() || $event->groupID() == 0 )
459 {
460 $dump = array_pop( $error );
461 $event->delete();
462 exec("secure_clearcache.sh");
463 break;
464 }
465 }
466 }
467 }
468
469 // user not allowed to delete this appointment
470 if( count( $error ) > 0 )
471 {
472 $t->set_var( "no_error", "" );
473 $t->set_var( "no_user_error", "" );
474
475 $t->parse( "wrong_user_error", "wrong_user_error_tpl" );
476 $t->parse( "user_error", "user_error_tpl" );
477 $t->pparse( "output", "appointment_edit_tpl" );
478
479 $groupError = true;
480 }
481 else
482 {
483 $year = addZero( $datetime->year() );
484 $month = addZero( $datetime->month() );
485 $day = addZero( $datetime->day() );
486 //deleteCache( "default", $Language, $year, $month, $day, $groupID );
487
488 eZHTTPTool::header( "Location: /groupeventcalendar/dayview/$year/$month/$day/" );
489 exit();
490 }
491 }
492
493
494 // Allowed format for start and stop time:
495 // 14 14:30 14:0 1430
496 // the : can be replaced with any non number character
497
498 if ( ( isset( $Action ) && $Action == "Insert" || isset( $Action ) && $Action == "Update") && $groupError == false )
499 {
500 //die("what?");
501 $dateArr = explode("-", $dateCal);
502 $Year = $dateArr[0];
503 $Month = $dateArr[1];
504 $Day = $dateArr[2];
505
506 // die("$Year $Month $Day");
507 if ( isSet( $Cancel ) )
508 {
509 $event = new eZGroupEvent( $EventID );
510 $dt = $event->dateTime();
511 $year = $dt->year();
512 $month = $dt->month();
513 $day = $dt->day();
514
515 eZHTTPTool::header( "Location: /groupeventcalendar/dayview/$year/$month/$day/" );
516 exit();
517 }
518
519 $user = eZUser::currentUser();
520
521 if ( $user )
522 {
523 if( isset( $TypeID ) && is_numeric( $TypeID ) )
524 {
525 $TypeID = (int)$TypeID;
526 }
527 else
528 {
529 $TypeID = 0;
530 }
531
532 $type = new eZGroupEventType( $TypeID );
533
534 if ( isset( $Action ) && $Action == "Update" )
535 $event = new eZGroupEvent( $EventID );
536 else
537 $event = new eZGroupEvent();
538
539 $category = new eZGroupEventCategory( $CategoryID );
540
541 $event->setDescription( $Description );
542 $event->setLocation( $Location );
543 $event->setUrl( $Url );
544
545 $event->setType( $type );
546 $event->setCategory( $category );
547
548 $event->setPriority( $Priority );
549 $event->setStatus( $Status );
550
551
552 if ( isset( $IsPrivate ) && $IsPrivate == "on" )
553 $event->setIsPrivate( true );
554 else
555 $event->setIsPrivate( false );
556
557 if ( isset( $IsEventAlarmNotice ) && $IsEventAlarmNotice == "on" )
558 $event->setEventAlarmNotice( true );
559 else
560 $event->setEventAlarmNotice( false );
561
562 if ( $Name != "" )
563 {
564 $event->setName( $Name );
565 }
566 else
567 {
568 $TitleError = true;
569 }
570
571 // wanted to reserve 0 for events in all group category
572 // if ( $StoreByGroupID != 0 )
573 if ( $StoreByGroupID != "" )
574 {
575 $group = new eZUserGroup( $StoreByGroupID );
576 $event->setGroup( $group );
577 }
578 else
579 {
580 $GroupInsertError = true;
581 }
582
583 // start/stop time for the day
584 $dayStartTime = new eZTime();
585 $dayStopTime = new eZTime();
586
587 if ( preg_match( "#(^([0-9]{1,2})[^0-9]{0,1}([0-9]{0,2})$)#", $StartTimeStr, $dayStartArray ) )
588 {
589 $hour = $dayStartArray[2];
590 $dayStartTime->setHour( $hour );
591
592 $min = $dayStartArray[3];
593 $dayStartTime->setMinute( $min );
594
595 $dayStartTime->setSecond( 0 );
596 }
597
598 if ( preg_match( "#(^([0-9]{1,2})[^0-9]{0,1}([0-9]{0,2})$)#", $StopTimeStr, $dayStopArray ) )
599 {
600 $hour = $dayStopArray[2];
601 $dayStopTime->setHour( $hour );
602
603 $min = $dayStopArray[3];
604 $dayStopTime->setMinute( $min );
605
606 $dayStopTime->setSecond( 0 );
607 }
608
609 // start/stop time for the appointment
610 $startTime = new eZTime();
611 $stopTime = new eZTime();
612
613 $startTime->setSecond( 0 );
614 $stopTime->setSecond( 0 );
615
616 if ( isset( $IsAllDay ) && $IsAllDay == "on" )
617 {
618 $starthour = $dayStartArray[2];
619 $startmin = $dayStartArray[3];
620 $stophour = $dayStopArray[2];
621 $stopmin = $dayStopArray[3];
622
623 $startTime->setHour( $starthour );
624 $startTime->setMinute( $startmin );
625 $stopTime->setHour( $stophour );
626 $stopTime->setMinute( $stopmin );
627 }
628 else
629 {
630 if ( $Start_Hour != '' && $Start_Minute != '' )
631 {
632 $hour = $Start_Hour;
633 $hour = convertToTwentyFour( $hour, $Start_AM_PM );
634
635 settype( $hour, "integer" );
636 $startHour = $hour;
637
638 $startTime->setHour( $hour );
639
640 $min = $Start_Minute;
641 settype( $min, "integer" );
642
643 $startTime->setMinute( $min );
644 }
645 else
646 {
647 $StartTimeError = true;
648 }
649
650 if ( $Stop_Hour != '' && $Stop_Minute != '')
651 {
652 $hour = $Stop_Hour;
653
654 $hour = convertToTwentyFour( $hour, $Stop_AM_PM );
655 settype( $hour, "integer" );
656
657 if( $hour >= $startHour )
658 {
659 $stopTime->setHour( $hour );
660
661 $min = $Stop_Minute;
662 settype( $min, "integer" );
663
664 $stopTime->setMinute( $min );
665 }
666 else
667 $StopTimeError = true;
668 }
669 else
670 {
671 $StopTimeError = true;
672 }
673 }
674
675 $pStartTimeHour = $startTime->hour();
676 $pStartTimeMinute = addZero( $startTime->minute() );
677
678 $pStopTimeHour = $stopTime->hour();
679 $pStopTimeMinute = addZero( $stopTime->minute() );
680
681 var_dump( $Year, $Month, $Day, $startTime->hour(),
682 $startTime->minute(), $startTime->second() );
683
684 $datetime = new eZDateTime( $Year, $Month, $Day,
685 $startTime->hour() , $startTime->minute(),
686 $startTime->second() );
687
688 // $datetime->setSecondsElapsedHMS( $pStartTimeHour, $pStartTimeMinute, 0 );
689
690 $event->setDateTime( $datetime );
691 //die();
692 if ( $stopTime->isGreater( $startTime, true ) )
693 {
694 $StopTimeError = true;
695 }
696
697 // setting recurrance variables to be used by the store() function
698 $event->setRecurFreq ($RecurFreq );
699 $event->setIsRecurring ( isset( $IsRecurring ) ? $IsRecurring : 0 );
700 $event->setRecurType ( $RecurType );
701 // we will now check the RecurType to see if it is a weekly recurrance
702 if ($event->RecurType == 'week')
703 // it is, so let's set the RecurDay property (checkbox group is named RecurWeekly)
704 $event->setRecurDay( $RecurWeekly );
705 else
706 // if not, we will set it as blank (which is the default of the setRecurDay method)
707 $event->setRecurDay();
708 // the $RecurExceptions var is actually the text/calendar field, the select box array is $ExceptSelect
709 $event->setRecurExceptions( isset( $ExceptSelect ) ? $ExceptSelect : false );
710
711 // now we check to see if the RecurType is month
712 if ($event->RecurType == 'month')
713 // it is, so let's set RecurMonthlyType
714 $event->setRecurMonthlyType( $RecurTypeMonth, $datetime );
715 // if not, we set it to blank
716 else
717 $event->setRecurMonthlyType();
718
720 // die("what-is-t00");
721 // die($RepeatOptions);
722
723 // feed repeat options to setFinishTime
724 if ( isset( $RepeatOptions ) && $RepeatOptions=='numTimes') {
725 $event->setFinishDateNot($NumberOfTimes, $RecurFreq, $RecurType, $datetime);
726 // die("what-is-t1");
727 } elseif ( isset( $RepeatOptions ) && $RepeatOptions=='untilDate') {
728 //die("what-is: $UntilDate");
729 $event->setFinishDateUntil($UntilDate);
730 //die("what-is: $UntilDate");
731 //die("what-is-42");
732 } else {// must be forever
733 //die("what-is-t12");
734 $event->SetFinishDateForever();
735 }
736
738 //die("what-is-t2");
739 /*
740 $duration = new eZTime( $stopTime->hour() - $startTime->hour(),
741 $stopTime->minute() - $startTime->minute() );
742 */
743 // formant hour, minute, second : the 1.0 release had a major bug related to the above code mssing the ,0 in duration time span
744 // $duration = new eZTime( $pStopTimeHour - $pStartTimeHour,
745 // $pStopTimeMinute - $pStartTimeMinute, 0 );
746 // This is working today, sorry for the fishing trips
747
748 $duration = new eZTime( $pStopTimeHour,
749 $pStopTimeMinute, 0 );
750
751 $event->setDuration( $duration );
752 $adur = $duration->mysqlTime();
753
754 $aa = $pStopTimeMinute - $pStartTimeMinute;
755
756 /*
757 print( "dir m: $pStopTimeHour - $pStartTimeHour | $pStopTimeMinute - $pStartTimeMinute | $aa" );
758
759 print( "dir t: " . $adur );
760 print("<br />Set Start: ". $pStartTimeHour ." : ". $pStartTimeMinute);
761 print("<br />Set Stop: ". $pStopTimeHour ." : ". $pStopTimeMinute);
762
763 die();
764 */
765 // : check to see if this is a recurring event
766 }
767
768 // die("here!");
769
770 if ( !isset( $TitleError) || isset( $TitleError ) && $TitleError == false && $GroupInsertError == false && $StartTimeError == false && $StopTimeError == false )
771 {
772 $resultz = $event->store();
773 //exec("secure_clearcache.sh");
774 /*
775 $year = addZero( $datetime->year() );
776 $month = addZero( $datetime->month() );
777 $day = addZero( $datetime->day() );
778 */
779 deleteCache( "default", $Language, $Year, $Month, $Day, $groupID );
780
781 // redirect switch
782 if ( $FileUploadFlag ){
783 eZHTTPTool::header( "Location: /groupeventcalendar/eventedit/filelist/$event->ID/" );
784 } else {
785 // eZHTTPTool::header( "Location: /groupeventcalendar/eventedit/edit/$event->ID/" );
786 eZHTTPTool::header( "Location: /groupeventcalendar/dayview/$Year/$Month/$Day/" );;
787 }
788 }
789 else
790 {
791 // : js gui calendar regeneraion
792 if (isset($dateCal))
793 $t->set_var( "date_calendar", $dateCal);
794 else
795 {
796 $today = new eZDateTime();
797
798 $tyear = $today->year();
799 $tmonth = $today->month();
800 $tday = $today->day();
801 $t->set_var( "date_calendar", $tyear.'-'.$tmonth.'-'.$tday );
802 }
803 // recurring events regeneration
804 $t->set_var( "is_recurring", '');
805 $t->set_var( "recur_freq", "1" );
806 $t->set_var( "recur_weekly_mon", "" );
807 $t->set_var( "rtselect_day", "" );
808 $t->set_var( "rtselect_week", "" );
809 $t->set_var( "rtselect_month", "" );
810 $t->set_var( "rtselect_year", "" );
811 $t->set_var( "start_daily", "" );
812 $t->set_var( "start_strdayname", "" );
813 $t->set_var( "start_numdayname", "" );
814 $t->set_var( "recur_weekly_mon", "" );
815 $t->set_var( "recur_weekly_tue", "" );
816 $t->set_var( "recur_weekly_wed", "" );
817 $t->set_var( "recur_weekly_thu", "" );
818 $t->set_var( "recur_weekly_fri", "" );
819 $t->set_var( "recur_weekly_sat", "" );
820 $t->set_var( "recur_weekly_sun", "" );
821 $t->set_var( "recur_weekly_sun", "" );
822 $t->set_var( "until_date", "" );
823 $t->set_var( "num_times", "" );
824 $t->set_var( "repeat_until", "");
825 $t->set_var( "repeat_times", "");
826 $t->set_var( "repeat_forever", "");
827 if (isset($IsRecurring))
828 {
829 $t->set_var( "is_recurring", 'checked');
830 $t->set_var( "recur_freq", $RecurFreq);
831 // recur type stuff...
832 if ('day' == $RecurType)
833 $t->set_var( "rtselect_day", "selected" );
834 elseif ('week' == $RecurType)
835 $t->set_var( "rtselect_week", "selected" );
836 elseif ('month' == $RecurType)
837 $t->set_var( "rtselect_month", "selected" );
838 else
839 $t->set_var( "rtselect_year", "" );
840 if ('daily' == $RecurTypeMonth)
841 $t->set_var( "start_daily", "checked" );
842 elseif ('strdayname' == $RecurTypeMonth)
843 $t->set_var( "start_strdayname", "checked" );
844 else
845 $t->set_var( "start_numdayname", "checked" );
846 if (is_array($RecurWeekly))
847 {
848 foreach ($RecurWeekly as $rwd)
849 {
850 $t->set_var( "recur_weekly_".$rwd , "checked");
851 }
852 }
853
854 if (isset($UntilDate))
855 $t->set_var( "until_date", $UntilDate );
856 if (isset($NumberOfTimes))
857 $t->set_var( "num_times", $NumberOfTimes );
858 if ('forever' == $RepeatOptions)
859 $t->set_var( "repeat_forever", "checked");
860 elseif ('untilDate' == $RepeatOptions)
861 $t->set_var( "repeat_until", 'checked');
862 else
863 $t->set_var( "repeat_times", 'checked');
864
865 if (is_array($ExceptSelect))
866 foreach ($ExceptSelect as $ex)
867 {
868 echo 'adding<br>';
869 $t->set_var('recur_exception', "<option>$ex</option>");
870 $t->parse( "recur_exceptions", "recur_exceptions_tpl", true );
871 }
872 else {
873 $t->set_var('recur_exception', '');
874 $t->set_var('recur_exceptions', '');
875 }
876 } // end of recurring events
877
878 $t->set_var( "name_value", stripslashes($event->name()) );
879 $t->set_var( "description_value", stripslashes($event->description()) );
880
881 $t->set_var( "location_value", $event->location() );
882 $t->set_var( "url_value", $event->url() );
883
884 $t->set_var( "group_name_new", "" );
885
886 if ( $user )
887 {
888 // include_once( "ezuser/classes/ezusergroup.php" );
889 $t->set_var( "group_item", "" );
890
891 // build the group drop down list
892 foreach( $groupsList as $groups )
893 {
894
895 // Add entry for event to be in all groups
896 $t->set_var( "group_member_name", "All Groups" );
897 $t->set_var( "group_member_id", 0 );
898
899 // if ( $groups->id() == $StoreByGroupID )
900 if ( $event->groupID() == 0 )
901 $t->set_var( "group_is_selected", "selected" );
902 else
903 $t->set_var( "group_is_selected", "" );
904
905 $t->parse( "group_item", "group_item_tpl", true );
906
907
908 if( $noShowGroup->groupEntry( $groups->id() ) == false )
909 {
910 $t->set_var( "group_member_name", $groups->name() );
911 $t->set_var( "group_member_id", $groups->id() );
912
913 if ( $groups->id() == $StoreByGroupID )
914 $t->set_var( "group_is_selected", "selected" );
915 else
916 $t->set_var( "group_is_selected", "" );
917
918 $t->parse( "group_item", "group_item_tpl", true );
919 }
920 }
921
922 $t->parse( "group_name_new", "group_name_new_tpl", true );
923 }
924
925 $t->parse( "new_history", "new_history_tpl", true );
926
927 if ( $event->isPrivate() )
928 $t->set_var( "is_private", "checked" );
929 else
930 $t->set_var( "is_private", "" );
931
932 if ( $event->isEventAlarmNotice() )
933 $t->set_var( "is_event_alarm_notice", "checked" );
934 else
935 $t->set_var( "is_event_alarm_notice", "" );
936
937 /* what we need to store this date. timestamp */
938
939 $eventStartTime =& $event->startTime();
940 $startHour = ( addZero( $eventStartTime->hour() ) );
941 $startMinute = ( addZero( $eventStartTime->minute() ) );
942
943 $eventStopTime =& $event->stopTime();
944 $stopHour = ( addZero( $eventStopTime->hour() ) );
945 $stopMinute = ( addZero( $eventStopTime->minute() ) );
946
947 if ( preg_match( "#(^([0-9]{1,2})[^0-9]{0,1}([0-9]{0,2})$)#", $StartTimeStr, $dayStartArray ) )
948 {
949 $dayStarthour = $dayStartArray[2];
950 $dayStartMin = $dayStartArray[3];
951 }
952
953 if ( preg_match( "#(^([0-9]{1,2})[^0-9]{0,1}([0-9]{0,2})$)#", $StopTimeStr, $dayStopArray ) )
954 {
955 $dayStopHour = $dayStopArray[2];
956 $dayStopMin = $dayStopArray[3];
957 }
958
959 $t->set_var( "is_all_day", "" );
960 if( $startHour = $dayStarthour && $startMinute == $dayStartMin && $stopHour == $dayStopHour && $stopMinute == $dayStopMin )
961 $t->set_var( "is_all_day", "checked" );
962
963 $minuteInterval = $ini->variable( "eZGroupEventCalendarMain", "MinutesSelectInterval" );
964 $minute_array = array();
965
966 for( $i=0; $i<60; $i = $i + $minuteInterval )
967 {
968 $i = addZero( $i );
969 array_push ($minute_array, "$i");
970 }
971
972 if( $timeSelect == "enabled" )
973 {
974 $hour_array = array('01','02','03','04','05','06','07','08','09','10','11','12');
975
976 if( $startHour >= 12 )
977 {
978 $t->set_var( "start_am", "unchecked" );
979 $t->set_var( "start_pm", "checked" );
980 }
981 else
982 {
983 $t->set_var( "start_pm", "unchecked" );
984 $t->set_var( "start_am", "checked" );
985 }
986
987 if( $stopHour >= 12 )
988 {
989 $t->set_var( "stop_am", "unchecked" );
990 $t->set_var( "stop_pm", "checked" );
991 }
992 else
993 {
994 $t->set_var( "stop_pm", "unchecked" );
995 $t->set_var( "stop_am", "checked" );
996 }
997
998 $startHour = convertToTwelve( $startHour );
999 $stopHour = convertToTwelve( $stopHour );
1000
1001 $t->parse( "start_ampm_radio", "start_ampm_radio_tpl" );
1002 $t->parse( "stop_ampm_radio", "stop_ampm_radio_tpl" );
1003 }
1004 else
1005 {
1006 $t->set_var( "start_ampm_radio", "" );
1007 $t->set_var( "stop_ampm_radio", "" );
1008 $hour_array = array('00','01','02','03','04','05','06','07','08','09','10','11','12','13','14','15','16','17','18','19','20','21','22','23');
1009 }
1010
1011
1012 foreach( $hour_array as $hour )
1013 {
1014 $t->set_var( "is_start_hour_selected", $hour == $startHour ? "selected" : "" );
1015 $t->set_var( "start_hour", $hour );
1016 $t->parse( "start_hour_item", "start_hour_item_tpl", true );
1017
1018 $t->set_var( "is_stop_hour_selected", $hour == $stopHour ? "selected" : "" );
1019 $t->set_var( "stop_hour", $hour );
1020 $t->parse( "stop_hour_item", "stop_hour_item_tpl", true );
1021 }
1022 foreach( $minute_array as $minute )
1023 {
1024 $t->set_var( "is_start_minute_selected", $minute == $startMinute ? "selected" : "" );
1025 $t->set_var( "start_minute", $minute );
1026 $t->parse( "start_minute_item", "start_minute_item_tpl", true );
1027
1028 $t->set_var( "is_stop_minute_selected", $minute == $stopMinute ? "selected" : "" );
1029 $t->set_var( "stop_minute", $minute );
1030 $t->parse( "stop_minute_item", "stop_minute_item_tpl", true );
1031 }
1032 }
1033 }
1034
1035
1036 $t->set_var( "user_error", "" );
1037
1038 if ( ( isset( $Action ) && $Action == "Insert" || isset( $Action ) && $Action == "Update") && $groupError == true )
1039 {
1040 $t->set_var( "no_error", "" );
1041 $t->set_var( "no_user_error", "" );
1042
1043 $t->parse( "wrong_user_error", "wrong_user_error_tpl" );
1044 $t->parse( "user_error", "user_error_tpl" );
1045 $t->pparse( "output", "event_edit_tpl" );
1046
1047 }
1048
1049 if ( isset( $Action ) && $Action == "Update" && $groupError == false )
1050 {
1051 $t->set_var( "name_value", stripslashes($Name) );
1052 $t->set_var( "description_value", stripslashes($Description) );
1053
1054 $t->set_var( "location_value", $Location );
1055 $t->set_var( "url_value", $Url );
1056
1057 $t->set_var( "start_value", $Start );
1058 $t->set_var( "stop_value", $Stop );
1059
1060 $typeID = $TypeID;
1061 $categoryID = $CategoryID;
1062
1063 $t->set_var( "0_selected", "" );
1064 $t->set_var( "1_selected", "" );
1065 $t->set_var( "2_selected", "" );
1066
1067 if ( isset( $Priority ) && is_numeric( $Priority ) )
1068 {
1069 if ( $Priority == 0 )
1070 $t->set_var( "0_selected", "selected" );
1071 else if ( $Priority == 1 )
1072 $t->set_var( "1_selected", "selected" );
1073 else if ( $Priority == 2 )
1074 $t->set_var( "2_selected", "selected" );
1075 else if ( $Priority == 3 )
1076 $t->set_var( "3_selected", "selected" );
1077 else if ( $Priority == 4 )
1078 $t->set_var( "4_selected", "selected" );
1079 else if ( $Priority == 5 )
1080 $t->set_var( "5_selected", "selected" );
1081 else if ( $Priority == 6 )
1082 $t->set_var( "6_selected", "selected" );
1083 }
1084 else
1085 {
1086 $Priority = 0;
1087 }
1088
1089
1090 $t->set_var( "0_status_selected", "" );
1091 $t->set_var( "1_status_selected", "" );
1092 $t->set_var( "2_status_selected", "" );
1093
1094 if ( $Status == 0 )
1095 $t->set_var( "0_status_selected", "selected" );
1096 else if ( $Status == 1 )
1097 $t->set_var( "1_status_selected", "selected" );
1098 else if ( $Status == 2 )
1099 $t->set_var( "2_status_selected", "selected" );
1100 else
1101 $t->set_var( "1_status_selected", "selected" );
1102
1103 if ( $IsPrivate == "on" )
1104 $t->set_var( "is_private", "checked" );
1105 else
1106 $t->set_var( "is_private", "" );
1107
1108 if ( $EventAlarmNotice == "on" )
1109 $t->set_var( "is_event_alarm_notice", "checked" );
1110 else
1111 $t->set_var( "is_event_alarm_notice", "" );
1112
1113 $t->set_var( "action_value", $Action );
1114 $t->set_var( "appointment_id", $EventID );
1115 }
1116
1117
1118 $today = new eZDate();
1119 if( !isset( $year ) || !isset( $month ) || !isset( $day ) )
1120 {
1121 $Year = $today->year();
1122 $Month = $today->month();
1123 $Day = $today->day();
1124 }
1125 $tmpdate = new eZDate( $Year, $Month, $Day );
1126
1127 $t->set_var( "edit", "" );
1128
1129 if ( isset( $Action ) && $Action == "Edit" && $groupError == false )
1130 {
1131
1132 $t->parse( "add_file_list", "add_file_list_tpl" );
1133
1134 $event = new eZGroupEvent( $EventID );
1135 $t->set_var( "name_value", stripslashes($event->name()) );
1136
1137 $t->set_var( "url_value", $event->url() );
1138 $t->set_var( "location_value", $event->location() );
1139
1140 $t->set_var( "event_id", $event->id() );
1141 $t->set_var( "description_value", stripslashes($event->description()) );
1142
1143 // : adding recurring event template vars
1144 $t->set_var( "is_recurring", '');
1145 $t->set_var( "recur_freq", "1" );
1146 $t->set_var( "recur_weekly_mon", "" );
1147 $t->set_var( "rtselect_day", "" );
1148 $t->set_var( "rtselect_week", "" );
1149 $t->set_var( "rtselect_month", "" );
1150 $t->set_var( "rtselect_year", "" );
1151 $t->set_var( "start_daily", "" );
1152 $t->set_var( "start_strdayname", "" );
1153 $t->set_var( "start_numdayname", "" );
1154 $t->set_var( "recur_weekly_mon", "" );
1155 $t->set_var( "recur_weekly_tue", "" );
1156 $t->set_var( "recur_weekly_wed", "" );
1157 $t->set_var( "recur_weekly_thu", "" );
1158 $t->set_var( "recur_weekly_fri", "" );
1159 $t->set_var( "recur_weekly_sat", "" );
1160 $t->set_var( "recur_weekly_sun", "" );
1161 $t->set_var( "recur_weekly_sun", "" );
1162 $t->set_var( "until_date", "" );
1163 $t->set_var( "num_times", "" );
1164 $t->set_var( "repeat_until", "");
1165 $t->set_var( "repeat_times", "");
1166 $t->set_var( "repeat_forever", "");
1167 if ($event->isRecurring()) {
1168 $t->set_var( "is_recurring", 'checked' );
1169 $t->set_var( "recur_freq", $event->recurFreq() );
1170 $t->set_var( "rtselect_".$event->recurType(), 'selected' );
1171 if ('week' == $event->recurType()) {
1172 foreach ($event->recurDay() as $keyDay)
1173 {
1174 $t->set_var( "recur_weekly_".$keyDay, 'checked' );
1175 }
1176 }
1177 if ('month' == $event->recurType())
1178 {
1179 $t->set_var( "start_".$event->recurMonthlyType(), 'checked');
1180 }
1181
1182 if ($event->repeatTimes())
1183 {
1184 $t->set_var( "repeat_times", 'checked' );
1185 $t->set_var( "num_times", $event->repeatTimes());
1186 }
1187 elseif ($event->repeatUntilDate())
1188 {
1189 $t->set_var( "repeat_until", 'checked' );
1190 $t->set_var( "until_date", $event->repeatUntilDate());
1191 }
1192 else
1193 {
1194 $t->set_var( "repeat_forever", 'checked' );
1195 }
1196 // $repEx is just a holder for the array returned by repeatExceptions
1197 // if there are no exceptions, it will judged false
1198 $repEx = $event->recurExceptions();
1199 if (is_array($repEx))
1200 {
1201 foreach ($repEx as $ex)
1202 {
1203 $t->set_var("recur_exception", "<option>$ex</option>");
1204 $t->parse( "recur_exceptions", "recur_exceptions_tpl", true );
1205 }
1206 }
1207 else
1208 {
1209 $t->set_var('recur_exception', '');
1210 $t->set_var('recur_exceptions', '');
1211 }
1212 // still need to add exception handling, once it's all ready
1213 }
1214
1215 // include_once("ezuser/classes/ezusergroup.php" );
1216 $group = new eZUserGroup( $groupID );
1217
1218 //$t->set_var( "group_name", $group->name() );
1219 //$t->set_var( "group_id", $group->id() );
1220 //$t->parse( "group_name_edit", "group_name_edit_tpl", true );
1221
1222
1223 // build the group drop down list
1224 $noshow_array = $noShowGroup->getAll();
1225 $t->set_var( "group_item", "" );
1226
1227 // Add entry for event to be in all groups
1228 $t->set_var( "group_member_name", "All Groups" );
1229 $t->set_var( "group_member_id", 0 );
1230
1231 // if ( $groups->id() == $StoreByGroupID )
1232 if ( $event->groupID() == 0 )
1233 $t->set_var( "group_is_selected", "selected" );
1234 else
1235 $t->set_var( "group_is_selected", "" );
1236
1237 $t->parse( "group_item", "group_item_tpl", true );
1238
1239 foreach( $groupsList as $groups )
1240 {
1241 if( $noShowGroup->groupEntry( $groups->id() ) == false )
1242 {
1243 $t->set_var( "group_member_id", $groups->id() );
1244 $t->set_var( "group_member_name", $groups->name() );
1245
1246 if ( $groups->id() == $group->id() )
1247 $t->set_var( "group_is_selected", "selected" );
1248 else
1249 $t->set_var( "group_is_selected", "" );
1250
1251 $t->parse( "group_item", "group_item_tpl", true );
1252 }
1253 }
1254
1255 $t->parse( "group_name_new", "group_name_new_tpl", true );
1256
1257 $t->set_var( "group_print_id", $group->id() );
1258 $t->set_var( "group_print_name", $group->name() );
1259 $t->set_var( "event_title", stripslashes($event->name()) );
1260
1261 //set the history bar data
1262 $t->parse( "edit_history", "edit_history_tpl", true );
1263
1264 $type =& $event->type();
1265 $typeID = $type->id();
1266
1267 $category =& $event->category();
1268 $categoryID = $category->id();
1269
1270 $date = $event->dateTime();
1271 $year = $date->year();
1272 $month = $date->month();
1273 $day = $date->day();
1274
1275 //var_dump( $day, $month, $year, $date );
1276 // echo "<hr>";
1277 $tmpdate = new eZDate( $year, $month, $day );
1278
1279 $startTime = $event->dateTime();
1280 $startHour = addZero( $startTime->hour() );
1281 $startMinute = ( addZero( $startTime->minute() ) );
1282
1283 $stopTime = $event->duration();
1284 $stopHour = ( addZero( $stopTime->hour() ) );
1285 $stopMinute = ( addZero( $stopTime->minute() ) );
1286
1287 // $stopMinute = $stopMinute +1 ;
1288 print ( "Echo DT:" . $startHour ." / ". $startMinute );
1289 print ( "<br />Echo DT:" . $stopHour ." / ". $stopMinute );
1290 echo "<hr>";
1291
1292
1293
1294 if ( preg_match( "#(^([0-9]{1,2})[^0-9]{0,1}([0-9]{0,2})$)#", $StartTimeStr, $dayStartArray ) )
1295 {
1296 $dayStarthour = $dayStartArray[2];
1297 $dayStartMin = $dayStartArray[3];
1298 }
1299
1300 if ( preg_match( "#(^([0-9]{1,2})[^0-9]{0,1}([0-9]{0,2})$)#", $StopTimeStr, $dayStopArray ) )
1301 {
1302 $dayStopHour = $dayStopArray[2];
1303 $dayStopMin = $dayStopArray[3];
1304 }
1305
1306 $t->set_var( "is_all_day", "" );
1307 $t->set_var( "is_start_hour_selected", "" );
1308 $t->set_var( "is_start_minute_selected", "" );
1309 $t->set_var( "is_stop_hour_selected", "" );
1310 $t->set_var( "is_stop_minute_selected", "" );
1311 $t->set_var( "start_ampm_radio", "" );
1312 $t->set_var( "stop_ampm_radio", "" );
1313 $allDay = false;
1314
1315 var_dump( $dayStarthour, $dayStartMin, $dayStopHour, $dayStopMin );
1316 echo "<hr> Some: ";
1317 var_dump( $startHour, $startMinute );
1318 echo "<hr>";
1319 var_dump( $stopHour, $stopMinute );
1320 echo "<hr>";
1321 //die('hitters');
1322 if( $startHour == $dayStarthour && $startMinute == $dayStartMin && $stopHour == ($dayStopHour -1) && $stopMinute == $dayStopMin )
1323 {
1324 $allDay = true;
1325 $t->set_var( "is_all_day", "checked" );
1326 }
1327
1328 $minuteInterval = $ini->variable( "eZGroupEventCalendarMain", "MinutesSelectInterval" );
1329
1330 $minute_array = array();
1331 for( $i=0; $i<60; $i = $i + $minuteInterval )
1332 {
1333 $i = addZero( $i );
1334 array_push ($minute_array, "$i");
1335 }
1336
1337 if( $timeSelect == "enabled" )
1338 {
1339 $hour_array = array('01','02','03','04','05','06','07','08','09','10','11','12');
1340 if( $startHour >= 12 )
1341 {
1342 // die( "<hr>");
1343 $t->set_var( "start_am", "unchecked" );
1344 $t->set_var( "start_pm", "checked" );
1345 }
1346 else
1347 {
1348 $t->set_var( "start_pm", "unchecked" );
1349 $t->set_var( "start_am", "checked" );
1350 }
1351
1352 if( $stopHour >= 12 )
1353 {
1354 $t->set_var( "stop_am", "unchecked" );
1355 $t->set_var( "stop_pm", "checked" );
1356 }
1357 else
1358 {
1359 $t->set_var( "stop_pm", "unchecked" );
1360 $t->set_var( "stop_am", "checked" );
1361 }
1362
1363 var_dump( $startHour, $stopHour, $allDay, $timeSelect );
1364 echo "<hr>";
1365 $startHour = convertToTwelve( $startHour );
1366 $stopHour = convertToTwelve( $stopHour );
1367
1368 var_dump( $startHour, $stopHour, $allDay, $timeSelect );
1369 //die( "timeSelect is enabled" );
1370 $t->parse( "start_ampm_radio", "start_ampm_radio_tpl" );
1371 $t->parse( "stop_ampm_radio", "stop_ampm_radio_tpl" );
1372 }
1373 else
1374 {
1375 $t->set_var( "start_ampm_radio", "" );
1376 $t->set_var( "stop_ampm_radio", "" );
1377 $hour_array = array('00','01','02','03','04','05','06','07','08','09','10','11','12','13','14','15','16','17','18','19','20','21','22','23');
1378 }
1379
1380 foreach( $hour_array as $hour )
1381 {
1382 if( $allDay == false && $hour == $startHour )
1383 $t->set_var( "is_start_hour_selected", "selected" );
1384 else
1385 $t->set_var( "is_start_hour_selected", "" );
1386
1387 $t->set_var( "start_hour", $hour );
1388 $t->parse( "start_hour_item", "start_hour_item_tpl", true );
1389
1390
1391 if( $allDay == false && $hour == $stopHour )
1392 $t->set_var( "is_stop_hour_selected", "selected" );
1393 else
1394 $t->set_var( "is_stop_hour_selected", "" );
1395
1396 $t->set_var( "stop_hour", $hour );
1397 $t->parse( "stop_hour_item", "stop_hour_item_tpl", true );
1398 }
1399
1400 var_dump($startMinute, $stopMinute);
1401 foreach( $minute_array as $minute )
1402 {
1403 if( $allDay == false && $minute == $startMinute )
1404 $t->set_var( "is_start_minute_selected", "selected" );
1405 else
1406 $t->set_var( "is_start_minute_selected", "" );
1407
1408 $t->set_var( "start_minute", $minute );
1409 $t->parse( "start_minute_item", "start_minute_item_tpl", true );
1410
1411 if( $allDay == false && $minute == $stopMinute )
1412 $t->set_var( "is_stop_minute_selected", "selected" );
1413 else
1414 $t->set_var( "is_stop_minute_selected", "" );
1415
1416 $t->set_var( "stop_minute", $minute );
1417 $t->parse( "stop_minute_item", "stop_minute_item_tpl", true );
1418 }
1419
1420 $t->set_var( "0_selected", "" );
1421 $t->set_var( "1_selected", "" );
1422 $t->set_var( "2_selected", "" );
1423 $t->set_var( "3_selected", "" );
1424 $t->set_var( "4_selected", "" );
1425 $t->set_var( "5_selected", "" );
1426 $t->set_var( "6_selected", "" );
1427
1428 if ( $event->priority() == 0 )
1429 $t->set_var( "0_selected", "selected" );
1430 else if ( $event->priority() == 1 )
1431 $t->set_var( "1_selected", "selected" );
1432 else if ( $event->priority() == 2 )
1433 $t->set_var( "2_selected", "selected" );
1434 else if ( $event->priority() == 3 )
1435 $t->set_var( "3_selected", "selected" );
1436 else if ( $event->priority() == 4 )
1437 $t->set_var( "4_selected", "selected" );
1438 else if ( $event->priority() == 5 )
1439 $t->set_var( "5_selected", "selected" );
1440 else if ( $event->priority() == 6 )
1441 $t->set_var( "6_selected", "selected" );
1442
1443 $t->set_var( "0_status_selected", "" );
1444 $t->set_var( "1_status_selected", "" );
1445 $t->set_var( "2_status_selected", "" );
1446
1447 if ( $event->status() == 0 )
1448 $t->set_var( "0_status_selected", "selected" );
1449 else if ( $event->status() == 1 )
1450 $t->set_var( "1_status_selected", "selected" );
1451 else if ( $event->status() == 2 )
1452 $t->set_var( "2_status_selected", "selected" );
1453
1454
1455 $dt =& $event->dateTime();
1456 $today = new eZDate();
1457
1458 $tempYear = addZero( $today->year() );
1459 //$tempYear = $tmpdate->year();
1460 $yearsPrint = $ini->variable( "eZGroupEventCalendarMain", "YearsPrint" );
1461
1462 // : setting new day time in template
1463 $t->set_var( "date_calendar", "$year-$month-$day");
1464
1465 /*
1466 for( $i=1; $i<=$yearsPrint; $i++ )
1467 {
1468 if( $dt->year() == $tempYear )
1469 {
1470 $t->set_var( "year_value", $tempYear );
1471 $t->set_var( "is_year_selected", "selected" );
1472 $i--;
1473 }
1474 else
1475 {
1476 $t->set_var( "year_value", $tempYear );
1477 $t->set_var( "is_year_selected", "" );
1478 }
1479
1480 $tempYear++;
1481 $t->parse( "year", "year_tpl", true );
1482 }
1483 */
1484
1485 if ( $event->isPrivate() )
1486 $t->set_var( "is_private", "checked" );
1487 else
1488 $t->set_var( "is_private", "" );
1489
1490 if ( $event->isEventAlarmNotice() )
1491 $t->set_var( "is_event_alarm_notice", "checked" );
1492 else
1493 $t->set_var( "is_event_alarm_notice", "" );
1494
1495 $t->set_var( "action_value", "update" );
1496 }
1497
1498 // print out error messages
1499 if ( isset( $TitleError ) && $TitleError == true )
1500 {
1501 $t->parse( "title_error", "title_error_tpl" );
1502 $t->set_var( "action_value", "insert" );
1503 }
1504 else
1505 $t->set_var( "title_error", "" );
1506
1507 if ( isset( $GroupInsertError ) && $GroupInsertError == true )
1508 {
1509 $t->parse( "group_error", "group_error_tpl" );
1510 $t->set_var( "action_value", "insert" );
1511 }
1512 else
1513 $t->set_var( "group_error", "" );
1514
1515 if ( isset( $StartTimeError ) && $StartTimeError == true )
1516 {
1517 $t->parse( "start_time_error", "start_time_error_tpl" );
1518 $t->set_var( "action_value", "insert" );
1519 }
1520 else
1521 $t->set_var( "start_time_error", "" );
1522
1523 if ( isset( $StopTimeError ) && $StopTimeError == true )
1524 {
1525 $t->parse( "stop_time_error", "stop_time_error_tpl" );
1526 $t->set_var( "action_value", "insert" );
1527 }
1528 else
1529 $t->set_var( "stop_time_error", "" );
1530
1531
1532
1533
1534 if ( isset( $Action ) && $Action == "New" && $groupError == false )
1535 {
1536 $user = eZUser::currentUser();
1537
1538 $t->set_var( "group_name_new", "" );
1539 if ( $user )
1540 {
1541 //include_once( "ezuser/classes/ezusergroup.php" );
1542
1543 $t->set_var( "group_item", "" );
1544
1545 // build the group drop down list
1546
1547 $noshow_array = $noShowGroup->getAll();
1548
1549 // Add entry for event to be in all groups
1550 $t->set_var( "group_member_name", "All Groups" );
1551 $t->set_var( "group_member_id", 0 );
1552
1553 // if ( $groups->id() == $StoreByGroupID )
1554 if ( $event->groupID() == 0 )
1555 $t->set_var( "group_is_selected", "selected" );
1556 else
1557 $t->set_var( "group_is_selected", "" );
1558
1559 $t->parse( "group_item", "group_item_tpl", true );
1560
1561
1562 foreach( $groupsList as $groups )
1563 {
1564 if( $noShowGroup->groupEntry( $groups->id() ) == false )
1565 {
1566 $t->set_var( "group_member_id", $groups->id() );
1567 $t->set_var( "group_member_name", $groups->name() );
1568
1569 if ( $groups->id() == $masterGroupID )
1570 $t->set_var( "group_is_selected", "selected" );
1571 else
1572 $t->set_var( "group_is_selected", "" );
1573
1574 $t->parse( "group_item", "group_item_tpl", true );
1575 }
1576 }
1577
1578 $t->parse( "group_name_new", "group_name_new_tpl", true );
1579 }
1580
1581 $t->parse( "new_history", "new_history_tpl", true );
1582
1583 $t->set_var( "add_file_list", "" );
1584
1585 $t->set_var( "action_value", "insert" );
1586 $t->set_var( "appointment_id", "new" );
1587 $t->set_var( "name_value", "" );
1588 $t->set_var( "location_value", "" );
1589 $t->set_var( "url_value", "" );
1590 $t->set_var( "event_id", "" );
1591
1592 $t->set_var( "recur_freq", "1" );
1593 $t->set_var( "is_recurring", "" );
1594 $t->set_var( "recur_weekly_mon", "" );
1595 $t->set_var( "rtselect_day", "" );
1596 $t->set_var( "rtselect_week", "" );
1597 $t->set_var( "rtselect_month", "" );
1598 $t->set_var( "rtselect_year", "" );
1599 $t->set_var( "start_daily", "" );
1600 $t->set_var( "start_strdayname", "" );
1601 $t->set_var( "start_numdayname", "" );
1602 $t->set_var( "recur_weekly_mon", "" );
1603 $t->set_var( "recur_weekly_tue", "" );
1604 $t->set_var( "recur_weekly_wed", "" );
1605 $t->set_var( "recur_weekly_thu", "" );
1606 $t->set_var( "recur_weekly_fri", "" );
1607 $t->set_var( "recur_weekly_sat", "" );
1608 $t->set_var( "recur_weekly_sun", "" );
1609 $t->set_var( "recur_weekly_sun", "" );
1610 $t->set_var( "until_date", "" );
1611 $t->set_var( "num_times", "" );
1612 $t->set_var( "repeat_until", "");
1613 $t->set_var( "repeat_times", "");
1614 $t->set_var( "repeat_forever", "");
1615
1616 $t->set_var( "description_value", "" );
1617 $t->set_var( "is_private", "" );
1618 $t->set_var( "is_event_alarm_notice", "" );
1619
1620 $t->set_var( "start_value", "" );
1621 $t->set_var( "stop_value", "" );
1622
1623 $t->set_var( "is_all_day", "" );
1624
1625 $t->set_var( "0_selected", "" );
1626 $t->set_var( "1_selected", "" );
1627 $t->set_var( "2_selected", "" );
1628 $t->set_var( "3_selected", "" );
1629 $t->set_var( "4_selected", "" );
1630 $t->set_var( "5_selected", "" );
1631 $t->set_var( "6_selected", "" );
1632
1633 $priority = $ini->variable( "eZGroupEventCalendarMain", "Priority" );
1634
1635 if ( $priority== 0 )
1636 $t->set_var( "0_selected", "selected" );
1637 else if ( $priority == 1 )
1638 $t->set_var( "1_selected", "selected" );
1639 else if ( $priority == 2 )
1640 $t->set_var( "2_selected", "selected" );
1641 else if ( $priority == 3 )
1642 $t->set_var( "3_selected", "selected" );
1643 else if ( $priority == 4 )
1644 $t->set_var( "4_selected", "selected" );
1645 else if ( $priority == 5 )
1646 $t->set_var( "5_selected", "selected" );
1647 else if ( $priority == 6 )
1648 $t->set_var( "6_selected", "selected" );
1649
1650
1651 $t->set_var( "0_status_selected", "" );
1652 $t->set_var( "1_status_selected", "" );
1653 $t->set_var( "2_status_selected", "" );
1654
1655 $status = $ini->variable( "eZGroupEventCalendarMain", "Status" );
1656
1657 if ( $status == 0 )
1658 $t->set_var( "0_status_selected", "selected" );
1659 else if ( $status == 1 )
1660 $t->set_var( "1_status_selected", "selected" );
1661 else if ( $status == 2 )
1662 $t->set_var( "2_status_selected", "selected" );
1663
1664 if ( $Year != 0 )
1665 $year = $Year;
1666 else
1667 $year = $today->year();
1668
1669 if ( $Month != 0 )
1670 $month = $Month;
1671 else
1672 $month = $today->month();
1673
1674 if ( $Day != 0 )
1675 $day = $Day;
1676 else
1677 $day = $today->day();
1678
1679 $t->set_var( "date_calendar", "$year-$month-$day" );
1680
1681 $tmpdate = new eZDate( $year, $month, $day );
1682
1683 $minuteInterval = $ini->variable( "eZGroupEventCalendarMain", "MinutesSelectInterval" );
1684
1685 $minute_array = array();
1686 for( $i=0; $i<60; $i = $i + $minuteInterval )
1687 {
1688 $i = addZero( $i );
1689 array_push ($minute_array, "$i");
1690 }
1691
1692 if ( $StartTime != 0 )
1693 {
1694 $startHour = substr( $StartTime, 0, 2);
1695 $startMinute = substr( $StartTime, 2, 3);
1696 }
1697 else
1698 {
1699 $startHour = '';
1700 $startMinute = '';
1701 }
1702
1703 if( $timeSelect == "enabled" )
1704 {
1705 $hour_array = array('01','02','03','04','05','06','07','08','09','10','11','12');
1706
1707 if( isset( $startHour ) && $startHour >= 12 )
1708 {
1709 $t->set_var( "start_am", "unchecked" );
1710 $t->set_var( "start_pm", "checked" );
1711 }
1712 else
1713 {
1714 $t->set_var( "start_pm", "unchecked" );
1715 $t->set_var( "start_am", "checked" );
1716 }
1717
1718 if( isset( $stopHour ) && $stopHour >= 12 )
1719 {
1720 $t->set_var( "stop_am", "unchecked" );
1721 $t->set_var( "stop_pm", "checked" );
1722 }
1723 else
1724 {
1725 $t->set_var( "stop_pm", "unchecked" );
1726 $t->set_var( "stop_am", "checked" );
1727 }
1728
1729 $startHour = convertToTwelve( $startHour );
1730
1731 $t->parse( "start_ampm_radio", "start_ampm_radio_tpl" );
1732 $t->parse( "stop_ampm_radio", "stop_ampm_radio_tpl" );
1733 }
1734 else
1735 {
1736 $t->set_var( "start_ampm_radio", "" );
1737 $t->set_var( "stop_ampm_radio", "" );
1738 $hour_array = array('00','01','02','03','04','05','06','07','08','09','10','11','12','13','14','15','16','17','18','19','20','21','22','23');
1739 }
1740
1741 $t->set_var( "is_start_hour_selected", "" );
1742 $t->set_var( "is_start_minute_selected", "" );
1743 $t->set_var( "is_stop_hour_selected", "" );
1744 $t->set_var( "is_stop_minute_selected", "" );
1745
1746 foreach( $hour_array as $hour )
1747 {
1748 if ( $StartTime != 0 )
1749 $t->set_var( "is_start_hour_selected", $hour == $startHour ? "selected" : "" );
1750 $t->set_var( "start_hour", $hour );
1751 $t->parse( "start_hour_item", "start_hour_item_tpl", true );
1752
1753 $t->set_var( "stop_hour", $hour );
1754 $t->parse( "stop_hour_item", "stop_hour_item_tpl", true );
1755 }
1756
1757 foreach( $minute_array as $minute )
1758 {
1759 if ( $StartTime != 0 )
1760 $t->set_var( "is_start_minute_selected", $minute == $startMinute ? "selected" : "" );
1761 $t->set_var( "start_minute", $minute );
1762 $t->parse( "start_minute_item", "start_minute_item_tpl", true );
1763
1764 $t->set_var( "stop_minute", $minute );
1765 $t->parse( "stop_minute_item", "stop_minute_item_tpl", true );
1766 }
1767 }
1768 elseif(isset( $Action ) && $Action == "New" && $groupError == true && $errorPrint == false )
1769 {
1770 $t->set_var( "no_error", "" );
1771 $t->set_var( "no_user_error", "" );
1772
1773 $t->parse( "wrong_user_error", "wrong_user_error_tpl" );
1774 $t->parse( "user_error", "user_error_tpl" );
1775 $t->pparse( "output", "event_edit_tpl" );
1776
1777 }
1778
1779 // print the event types
1780 $type = new eZGroupEventType();
1781 $typeList =& $type->getTree();
1782
1783 foreach ( $typeList as $type )
1784 {
1785 if ( $type[1] > 1 )
1786 $t->set_var( "option_level", str_repeat( "&nbsp;&nbsp;", $type[1] - 1 ) );
1787 else
1788 $t->set_var( "option_level", "" );
1789
1790 if ( isset( $typeID ) && $typeID )
1791 {
1792 if ( $typeID == $type[0]->id() )
1793 {
1794 $t->set_var( "type_is_selected", "selected" );
1795 }
1796 else
1797 {
1798 $t->set_var( "type_is_selected", "" );
1799 }
1800 }
1801 else
1802 {
1803 $t->set_var( "type_is_selected", "" );
1804 }
1805
1806 $t->set_var( "option_name", $type[0]->name() );
1807 $t->set_var( "option_value", $type[0]->id() );
1808
1809 $t->parse( "value", "value_tpl", true );
1810 }
1811
1812 // print the event categorys
1813 $category = new eZGroupEventCategory();
1814 $categoryList =& $category->getTree();
1815
1816 foreach ( $categoryList as $category )
1817 {
1818 if ( $category[1] > 1 )
1819 $t->set_var( "option_category_level", str_repeat( "&nbsp;&nbsp;", $category[1] - 1 ) );
1820 else
1821 $t->set_var( "option_category_level", "" );
1822
1823 if ( isset( $categoryID ) && $categoryID )
1824 {
1825 if ( $categoryID == $category[0]->id() )
1826 {
1827 $t->set_var( "category_is_selected", "selected" );
1828 }
1829 else
1830 {
1831 $t->set_var( "category_is_selected", "" );
1832 }
1833 }
1834 else
1835 {
1836 $t->set_var( "category_is_selected", "" );
1837 }
1838
1839 $t->set_var( "category_name", $category[0]->name() );
1840 $t->set_var( "option_category_value", $category[0]->id() );
1841
1842 $t->parse( "category_value", "category_value_tpl", true );
1843 }
1844
1845 // set day combobox
1846 /*-- removed by
1847 $daysInMonth = $tmpdate->daysInMonth();
1848 //for ( $i=1; $i<=$daysInMonth; $i++ )
1849 for ( $i=1; $i<=31; $i++ )
1850 {
1851 if ( $tmpdate->day() == $i )
1852 {
1853 $t->set_var( "day_value", $i );
1854 $t->set_var( "selected", "selected" );
1855 }
1856 else
1857 $t->set_var( "selected", "" );
1858
1859 if ( $Action == "Edit" && $groupError == false )
1860 {
1861 if ( $dt->day() == $i )
1862 {
1863 $t->set_var( "selected", "selected" );
1864 }
1865 else
1866 {
1867 $t->set_var( "selected", "" );
1868 }
1869 }
1870
1871 $t->set_var( "day_id", $i );
1872 $t->set_var( "day_name", $i );
1873
1874 $t->parse( "day", "day_tpl", true );
1875 }
1876 /*
1877 // set month combobox /
1878 /*-- removed code
1879 $month = $tmpdate->month();
1880 for ( $i=1; $i<13; $i++ )
1881 {
1882 if ( $month == $i ) // don't use $tmpdate->month() since it gets changed
1883 {
1884 $t->set_var( "month_value", $i );
1885 $t->set_var( "selected", "selected" );
1886 }
1887 else
1888 $t->set_var( "selected", "" );
1889
1890 if ( $Action == "Edit" && $groupError == false )
1891 {
1892 if ( $dt->month() == $i )
1893 {
1894 $t->set_var( "selected", "selected" );
1895 }
1896 else
1897 {
1898 $t->set_var( "selected", "" );
1899 }
1900 }
1901
1902 $tmpdate->setMonth( $i );
1903 $t->set_var( "month_id", $i );
1904 $t->set_var( "month_name", $Locale->monthName( $tmpdate->monthName() ) );
1905
1906 $t->parse( "month", "month_tpl", true );
1907 }
1908 */
1909 if ( isset( $Action ) && $Action != "Edit" )
1910 {
1911 $t->set_var( "year_value", $tmpdate->year() );
1912 $t->set_var( "is_year_selected", "selected" );
1913 $t->parse( "year", "year_tpl", true );
1914 $yearsPrint = $ini->variable( "eZGroupEventCalendarMain", "YearsPrint" );
1915 for( $i=1; $i<=$yearsPrint; $i++ )
1916 {
1917 $t->set_var( "year_value", $tmpdate->year() + $i );
1918 $t->set_var( "is_year_selected", "" );
1919 $t->parse( "year", "year_tpl", true );
1920 }
1921 }
1922
1923 if ( $groupError == false )
1924 {
1925 $t->parse( "no_error", "no_error_tpl" );
1926 $t->pparse( "output", "event_edit_tpl" );
1927 }
1928
1929
1930 // deletes the dayview cache file for a given day
1931 function deleteCache( $siteStyle, $language, $year, $month, $day, $groupID )
1932 {
1933 if (file_exists("ezgroupeventcalendar/user/cache/dayview.tpl-$siteStyle-$language-$year-$month-$day-$groupID.cache"))
1934 unlink( "ezgroupeventcalendar/user/cache/dayview.tpl-$siteStyle-$language-$year-$month-$day-$groupID.cache" );
1935 if (file_exists("ezgroupeventcalendar/user/cache/monthview.tpl-$siteStyle-$language-$year-$month-$groupID.cache"))
1936 unlink( "ezgroupeventcalendar/user/cache/monthview.tpl-$siteStyle-$language-$year-$month-$groupID.cache" );
1937 if (file_exists("ezgroupeventcalendar/user/cache/dayview.tpl-$siteStyle-$language-$year-$month-$day-$groupID-private.cache"))
1938 unlink( "ezgroupeventcalendar/user/cache/dayview.tpl-$siteStyle-$language-$year-$month-$day-$groupID-private.cache" );
1939 if (file_exists("ezgroupeventcalendar/user/cache/monthview.tpl-$siteStyle-$language-$year-$month-$groupID-private.cache"))
1940 unlink( "ezgroupeventcalendar/user/cache/monthview.tpl-$siteStyle-$language-$year-$month-$groupID-private.cache" );
1941 }
1942
1943 //Adds a "0" in front of the value if it's below 10.
1944 function addZero( $value )
1945 {
1946 settype( $value, "integer" );
1947 $ret = $value;
1948 if ( $ret < 10 )
1949 {
1950 $ret = "0". $ret;
1951 }
1952 return $ret;
1953 }
1954
1955 function convertToTwelve( $value )
1956 {
1957 switch( $value )
1958 {
1959 case "13" :
1960 {
1961 $ret = 1;
1962 }
1963 break;
1964
1965 case "14" :
1966 {
1967 $ret = 2;
1968 }
1969 break;
1970
1971 case "15" :
1972 {
1973 $ret = 3;
1974 }
1975 break;
1976
1977 case "16" :
1978 {
1979 $ret = 4;
1980 }
1981 break;
1982
1983 case "17" :
1984 {
1985 $ret = 5;
1986 }
1987 break;
1988
1989 case "18" :
1990 {
1991 $ret = 6;
1992 }
1993 break;
1994
1995 case "19" :
1996 {
1997 $ret = 7;
1998 }
1999 break;
2000
2001 case "20" :
2002 {
2003 $ret = 8;
2004 }
2005 break;
2006
2007 case "21" :
2008 {
2009 $ret = 9;
2010 }
2011 break;
2012
2013 case "22" :
2014 {
2015 $ret = 10;
2016 }
2017 break;
2018
2019 case "23" :
2020 {
2021 $ret = 11;
2022 }
2023 break;
2024
2025 case "00" :
2026 {
2027 $ret = 12;
2028 }
2029 break;
2030
2031 default :
2032 {
2033 $ret = $value;
2034 }
2035 break;
2036 }
2037
2038 $ret = addZero( $ret );
2039
2040 return $ret;
2041 }
2042
2043 function convertToTwentyFour( $value, $period )
2044 {
2045 switch( $value )
2046 {
2047 case "01" :
2048 {
2049 if( $period == "pm" )
2050 $ret = 13;
2051 else
2052 $ret = $value;
2053 }
2054 break;
2055
2056 case "02" :
2057 {
2058 if( $period == "pm" )
2059 $ret = 14;
2060 else
2061 $ret = $value;
2062 }
2063 break;
2064
2065 case "03" :
2066 {
2067 if( $period == "pm" )
2068 $ret = 15;
2069 else
2070 $ret = $value;
2071 }
2072 break;
2073
2074 case "04" :
2075 {
2076 if( $period == "pm" )
2077 $ret = 16;
2078 else
2079 $ret = $value;
2080 }
2081 break;
2082
2083 case "05" :
2084 {
2085 if( $period == "pm" )
2086 $ret = 17;
2087 else
2088 $ret = $value;
2089 }
2090 break;
2091
2092 case "06" :
2093 {
2094 if( $period == "pm" )
2095 $ret = 18;
2096 else
2097 $ret = $value;
2098 }
2099 break;
2100
2101 case "07" :
2102 {
2103 if( $period == "pm" )
2104 $ret = 19;
2105 else
2106 $ret = $value;
2107 }
2108 break;
2109
2110 case "08" :
2111 {
2112 if( $period == "pm" )
2113 $ret = 20;
2114 else
2115 $ret = $value;
2116 }
2117 break;
2118
2119 case "09" :
2120 {
2121 if( $period == "pm" )
2122 $ret = 21;
2123 else
2124 $ret = $value;
2125 }
2126 break;
2127
2128 case "10" :
2129 {
2130 if( $period == "pm" )
2131 $ret = 22;
2132 else
2133 $ret = $value;
2134 }
2135 break;
2136
2137 case "11" :
2138 {
2139 if( $period == "pm" )
2140 $ret = 23;
2141 else
2142 $ret = $value;
2143 }
2144 break;
2145
2146 case "12" :
2147 {
2148 if( $period == "pm" )
2149 {
2150 $ret = 12;
2151 }
2152 else
2153 {
2154 $ret = 0;
2155 }
2156 }
2157 break;
2158
2159 default :
2160 {
2161 $ret = $value;
2162 }
2163 break;
2164 }
2165
2166 $ret = addZero( $ret );
2167
2168 return $ret;
2169 }
2170
2171 ?>
$i
$i
Definition: admin/adlist.php:91
$CategoryID
$CategoryID
Definition: admin/articleedit.php:53
$group
$group
Definition: admin/articleedit.php:799
$session
$session
Definition: admin/articlelist.php:44
$day
else $day
Definition: appointmentedit.php:665
$StartTimeError
$StartTimeError
Definition: appointmentedit.php:104
$year
else $year
Definition: appointmentedit.php:655
$StopTimeError
$StopTimeError
Definition: appointmentedit.php:105
$TitleError
$TitleError
Definition: appointmentedit.php:103
$month
else $month
Definition: appointmentedit.php:660
$datetime
$datetime
Definition: appointmentview.php:108
$Description
$Description
Definition: articlelistrss.php:38
$priority
$priority
Definition: bugedit.php:472
$status
$status
Definition: bugedit.php:473
$date
$date
Definition: bugpreview.php:66
eZDateTime
Definition: ezdatetime.php:55
eZDate
Definition: ezdate.php:46
eZGroupEditor
Definition: ezgroupeditor.php:33
eZGroupEventCategory
Definition: ezgroupeventcategory.php:39
eZGroupEventType
Definition: ezgroupeventtype.php:37
eZGroupEvent
Definition: ezgroupevent.php:85
eZGroupNoShow
Definition: ezgroupnoshow.php:34
eZHTTPTool\header
static header( $string)
Definition: ezhttptool.php:96
eZLocale
Definition: ezlocale.php:119
eZPermission\checkPermission
static checkPermission( $user, $moduleName, $permissionName)
Definition: ezpermission.php:430
eZSession\globalSession
static & globalSession( $id="", $fetch=true)
Definition: kernel/ezsession/classes/ezsession.php:614
eZTemplate
Definition: eztemplate.php:107
eZTime
Definition: eztime.php:38
eZUserGroup
Definition: ezusergroup.php:66
eZUser\currentUser
static & currentUser()
Definition: ezuser.php:896
$Action
$Action
Definition: companysearch.php:80
file_exists
static file_exists( $inifilename)
Definition: eZPBINIFile.php:195
$event
if(isset( $Action) && $Action=="New") else $event
Definition: eventedit.php:189
convertToTwelve
convertToTwelve( $value)
Definition: eventedit.php:1955
deleteCache
foreach( $categoryList as $category) if(isset( $Action) && $Action !="Edit") if( $groupError==false) deleteCache( $siteStyle, $language, $year, $month, $day, $groupID)
Definition: eventedit.php:1931
$today
if((isset( $Action) && $Action=="Insert"||isset( $Action) && $Action=="Update") && $groupError==true) if(isset( $Action) && $Action=="Update" && $groupError==false) $today
Definition: eventedit.php:1118
$timeSelect
$timeSelect
Definition: eventedit.php:156
convertToTwentyFour
convertToTwentyFour( $value, $period)
Definition: eventedit.php:2043
$t
$t
Definition: eventedit.php:194
$noShowGroup
$noShowGroup
Definition: eventedit.php:312
$typeList
$typeList
Definition: eventedit.php:1781
$user
$user
Definition: eventedit.php:160
$URL
$URL
Definition: eventedit.php:29
$type
if(isset( $Action) && $Action=="New" && $groupError==false) elseif(isset( $Action) && $Action=="New" && $groupError==true && $errorPrint==false) $type
Definition: eventedit.php:1780
$Locale
$Locale
Definition: eventedit.php:158
$masterGroupID
else $masterGroupID
Definition: eventedit.php:34
$StopTimeStr
$StopTimeStr
Definition: eventedit.php:155
$category
foreach( $typeList as $type) $category
Definition: eventedit.php:1813
$Language
$Language
Definition: eventedit.php:153
addZero
addZero( $value)
Definition: eventedit.php:1944
$userID
else $userID
Definition: eventedit.php:182
$permission
$permission
Definition: eventedit.php:315
$categoryList
$categoryList
Definition: eventedit.php:1814
$groupID
if( $userID==false) $groupID
Definition: eventedit.php:309
$ini
if(isset( $DeleteEvents)) if(isset( $GoDay)) else if(isSet( $GoWeek)) else if(isSet( $GoMonth)) else if(isSet( $GoYear)) else if(isSet( $GoToday)) else if(isSet( $GoNew)) if(isSet( $AddFile)) $ini
Definition: eventedit.php:150
$SiteDesign
$SiteDesign
Definition: eventedit.php:152
$tmpdate
if(!isset( $year)||!isset( $month)||!isset( $day)) $tmpdate
Definition: eventedit.php:1125
$editor
$editor
Definition: eventedit.php:316
$StartTimeStr
$StartTimeStr
Definition: eventedit.php:154
$minute
$minute
Definition: export_froogle.php:311
$hour
$hour
Definition: export_froogle.php:310
$error
$error
Definition: ezarticle/admin/categoryedit.php:51
$groups
if( $CategoryID !=0) $groups
Definition: ezbulkmail/admin/categoryedit.php:108
$tmpAppointment
$tmpAppointment
Definition: ezcalendar/user/dayview.php:133
$startTime
$startTime
Definition: ezcalendar/user/dayview.php:139
$Month
$Month
Definition: ezcalendar/user/dayview.php:78
$stopTime
$stopTime
Definition: ezcalendar/user/dayview.php:140
$Day
$Day
Definition: ezcalendar/user/dayview.php:79
$groupsList
$groupsList
Definition: ezgroupeventcalendar/user/dayview.php:185
$curDate
$curDate
Definition: ezgroupeventcalendar/user/dayview.php:59
$ret
$ret
Definition: ezsitemanager/admin/filelist.php:88
exit
exit
Definition: folder.php:81
$language
$language
Definition: messageform.php:32
$Name
$Name
Definition: polledit.php:250
$categoryID
else $categoryID
Definition: productview.php:66
Copyright © 1998 – 2026 7x. All rights reserved. Licensed under the GNU GPLv2+.