@@ -74,8 +74,8 @@ discard block |
||
74 | 74 | static private $recur_egw2ical_2_0 = array( |
75 | 75 | self::DAILY => 'DAILY', |
76 | 76 | self::WEEKLY => 'WEEKLY', |
77 | - self::MONTHLY_WDAY => 'MONTHLY', // BYDAY={1..7, -1}{MO..SO, last workday} |
|
78 | - self::MONTHLY_MDAY => 'MONTHLY', // BYMONHTDAY={1..31, -1 for last day of month} |
|
77 | + self::MONTHLY_WDAY => 'MONTHLY', // BYDAY={1..7, -1}{MO..SO, last workday} |
|
78 | + self::MONTHLY_MDAY => 'MONTHLY', // BYMONHTDAY={1..31, -1 for last day of month} |
|
79 | 79 | self::YEARLY => 'YEARLY', |
80 | 80 | ); |
81 | 81 | |
@@ -85,8 +85,8 @@ discard block |
||
85 | 85 | static private $recur_egw2ical_1_0 = array( |
86 | 86 | self::DAILY => 'D', |
87 | 87 | self::WEEKLY => 'W', |
88 | - self::MONTHLY_WDAY => 'MP', // BYDAY={1..7,-1}{MO..SO, last workday} |
|
89 | - self::MONTHLY_MDAY => 'MD', // BYMONHTDAY={1..31,-1} |
|
88 | + self::MONTHLY_WDAY => 'MP', // BYDAY={1..7,-1}{MO..SO, last workday} |
|
89 | + self::MONTHLY_MDAY => 'MD', // BYMONHTDAY={1..31,-1} |
|
90 | 90 | self::YEARLY => 'YM', |
91 | 91 | ); |
92 | 92 | |
@@ -142,7 +142,7 @@ discard block |
||
142 | 142 | const THURSDAY = 16; |
143 | 143 | const FRIDAY = 32; |
144 | 144 | const SATURDAY = 64; |
145 | - const WORKDAYS = 62; // Mo, ..., Fr |
|
145 | + const WORKDAYS = 62; // Mo, ..., Fr |
|
146 | 146 | const ALLDAYS = 127; |
147 | 147 | /** |
148 | 148 | * Translate weekday bitmasks to labels |
@@ -170,14 +170,14 @@ discard block |
||
170 | 170 | * |
171 | 171 | * @var array |
172 | 172 | */ |
173 | - public $exceptions=array(); |
|
173 | + public $exceptions = array(); |
|
174 | 174 | |
175 | 175 | /** |
176 | 176 | * Array of exceptions as DateTime/egw_time objects |
177 | 177 | * |
178 | 178 | * @var array |
179 | 179 | */ |
180 | - public $exceptions_objs=array(); |
|
180 | + public $exceptions_objs = array(); |
|
181 | 181 | |
182 | 182 | /** |
183 | 183 | * Starttime of series |
@@ -220,9 +220,9 @@ discard block |
||
220 | 220 | * @param int $weekdays =0 self::SUNDAY=1|self::MONDAY=2|...|self::SATURDAY=64 |
221 | 221 | * @param array $exceptions =null DateTime objects with exceptions |
222 | 222 | */ |
223 | - public function __construct(DateTime $time,$type,$interval=1,DateTime $enddate=null,$weekdays=0,array $exceptions=null) |
|
223 | + public function __construct(DateTime $time, $type, $interval = 1, DateTime $enddate = null, $weekdays = 0, array $exceptions = null) |
|
224 | 224 | { |
225 | - switch($GLOBALS['egw_info']['user']['preferences']['calendar']['weekdaystarts']) |
|
225 | + switch ($GLOBALS['egw_info']['user']['preferences']['calendar']['weekdaystarts']) |
|
226 | 226 | { |
227 | 227 | case 'Sunday': |
228 | 228 | $this->lastdayofweek = self::SATURDAY; |
@@ -236,7 +236,7 @@ discard block |
||
236 | 236 | |
237 | 237 | $this->time = $time instanceof egw_time ? $time : new egw_time($time); |
238 | 238 | |
239 | - if (!in_array($type,array(self::NONE, self::DAILY, self::WEEKLY, self::MONTHLY_MDAY, self::MONTHLY_WDAY, self::YEARLY))) |
|
239 | + if (!in_array($type, array(self::NONE, self::DAILY, self::WEEKLY, self::MONTHLY_MDAY, self::MONTHLY_WDAY, self::YEARLY))) |
|
240 | 240 | { |
241 | 241 | throw new egw_exception_wrong_parameter(__METHOD__."($time,$type,$interval,$enddate,$weekdays,...) type $type is NOT valid!"); |
242 | 242 | } |
@@ -246,16 +246,16 @@ discard block |
||
246 | 246 | if ($type == self::MONTHLY_WDAY) |
247 | 247 | { |
248 | 248 | // check for last week of month |
249 | - if (($day = $this->time->format('d')) >= 21 && $day > self::daysInMonth($this->time)-7) |
|
249 | + if (($day = $this->time->format('d')) >= 21 && $day > self::daysInMonth($this->time) - 7) |
|
250 | 250 | { |
251 | 251 | $this->monthly_byday_num = -1; |
252 | 252 | } |
253 | 253 | else |
254 | 254 | { |
255 | - $this->monthly_byday_num = 1 + floor(($this->time->format('d')-1) / 7); |
|
255 | + $this->monthly_byday_num = 1 + floor(($this->time->format('d') - 1) / 7); |
|
256 | 256 | } |
257 | 257 | } |
258 | - elseif($type == self::MONTHLY_MDAY) |
|
258 | + elseif ($type == self::MONTHLY_MDAY) |
|
259 | 259 | { |
260 | 260 | $this->monthly_bymonthday = (int)$this->time->format('d'); |
261 | 261 | // check for last day of month |
@@ -272,7 +272,7 @@ discard block |
||
272 | 272 | |
273 | 273 | if ((int)$interval < 1) |
274 | 274 | { |
275 | - $interval = 1; // calendar stores no (extra) interval as null, so using default 1 here |
|
275 | + $interval = 1; // calendar stores no (extra) interval as null, so using default 1 here |
|
276 | 276 | } |
277 | 277 | $this->interval = (int)$interval; |
278 | 278 | |
@@ -302,7 +302,7 @@ discard block |
||
302 | 302 | } |
303 | 303 | if ($exceptions) |
304 | 304 | { |
305 | - foreach($exceptions as $exception) |
|
305 | + foreach ($exceptions as $exception) |
|
306 | 306 | { |
307 | 307 | $exception->setTimezone($this->time->getTimezone()); |
308 | 308 | $this->exceptions[] = $exception->format('Ymd'); |
@@ -318,22 +318,22 @@ discard block |
||
318 | 318 | * @param int $interval =1 |
319 | 319 | * @return int |
320 | 320 | */ |
321 | - public static function recurrence_interval($type, $interval=1) |
|
321 | + public static function recurrence_interval($type, $interval = 1) |
|
322 | 322 | { |
323 | - switch($type) |
|
323 | + switch ($type) |
|
324 | 324 | { |
325 | 325 | case self::DAILY: |
326 | - $duration = 24*3600; |
|
326 | + $duration = 24 * 3600; |
|
327 | 327 | break; |
328 | 328 | case self::WEEKLY: |
329 | - $duration = 7*24*3600; |
|
329 | + $duration = 7 * 24 * 3600; |
|
330 | 330 | break; |
331 | 331 | case self::MONTHLY_MDAY: |
332 | 332 | case self::MONTHLY_WDAY: |
333 | - $duration = 31*24*3600; |
|
333 | + $duration = 31 * 24 * 3600; |
|
334 | 334 | break; |
335 | 335 | case self::YEARLY: |
336 | - $duration = 366*24*3600; |
|
336 | + $duration = 366 * 24 * 3600; |
|
337 | 337 | break; |
338 | 338 | } |
339 | 339 | if ($interval > 1) $duration *= $interval; |
@@ -349,9 +349,9 @@ discard block |
||
349 | 349 | */ |
350 | 350 | private static function daysInMonth(DateTime $time) |
351 | 351 | { |
352 | - list($year,$month) = explode('-',$time->format('Y-m')); |
|
352 | + list($year, $month) = explode('-', $time->format('Y-m')); |
|
353 | 353 | $last_day = new egw_time(); |
354 | - $last_day->setDate($year,$month+1,0); |
|
354 | + $last_day->setDate($year, $month + 1, 0); |
|
355 | 355 | |
356 | 356 | return (int)$last_day->format('d'); |
357 | 357 | } |
@@ -381,7 +381,7 @@ discard block |
||
381 | 381 | */ |
382 | 382 | public function next_no_exception() |
383 | 383 | { |
384 | - switch($this->type) |
|
384 | + switch ($this->type) |
|
385 | 385 | { |
386 | 386 | case self::NONE: // need to add at least one day, to end "series", as enddate == current date |
387 | 387 | case self::DAILY: |
@@ -396,28 +396,28 @@ discard block |
||
396 | 396 | // --> on the last day of the week we have to additionally advance interval-1 weeks |
397 | 397 | if ($this->interval > 1 && self::getWeekday($this->current) == $this->lastdayofweek) |
398 | 398 | { |
399 | - $this->current->modify(($this->interval-1).' week'); |
|
399 | + $this->current->modify(($this->interval - 1).' week'); |
|
400 | 400 | } |
401 | 401 | $this->current->modify('1 day'); |
402 | 402 | //echo __METHOD__.'() '.$this->current->format('l').', '.$this->current.": $this->weekdays & ".self::getWeekday($this->current)."<br />\n"; |
403 | 403 | } |
404 | - while(!($this->weekdays & self::getWeekday($this->current))); |
|
404 | + while (!($this->weekdays&self::getWeekday($this->current))); |
|
405 | 405 | break; |
406 | 406 | |
407 | 407 | case self::MONTHLY_WDAY: // iCal: BYDAY={1, ..., 5, -1}{MO..SO} |
408 | 408 | // advance to start of next month |
409 | - list($year,$month) = explode('-',$this->current->format('Y-m')); |
|
410 | - $month += $this->interval+($this->monthly_byday_num < 0 ? 1 : 0); |
|
411 | - $this->current->setDate($year,$month,$this->monthly_byday_num < 0 ? 0 : 1); |
|
409 | + list($year, $month) = explode('-', $this->current->format('Y-m')); |
|
410 | + $month += $this->interval + ($this->monthly_byday_num < 0 ? 1 : 0); |
|
411 | + $this->current->setDate($year, $month, $this->monthly_byday_num < 0 ? 0 : 1); |
|
412 | 412 | //echo __METHOD__."() $this->monthly_byday_num".substr(self::$days[$this->monthly_byday_wday],0,2).": setDate($year,$month,1): ".$this->current->format('l').', '.$this->current."<br />\n"; |
413 | 413 | // now advance to n-th week |
414 | 414 | if ($this->monthly_byday_num > 1) |
415 | 415 | { |
416 | - $this->current->modify(($this->monthly_byday_num-1).' week'); |
|
416 | + $this->current->modify(($this->monthly_byday_num - 1).' week'); |
|
417 | 417 | //echo __METHOD__."() $this->monthly_byday_num".substr(self::$days[$this->monthly_byday_wday],0,2).': modify('.($this->monthly_byday_num-1).' week): '.$this->current->format('l').', '.$this->current."<br />\n"; |
418 | 418 | } |
419 | 419 | // advance to given weekday |
420 | - while(!($this->weekdays & self::getWeekday($this->current))) |
|
420 | + while (!($this->weekdays&self::getWeekday($this->current))) |
|
421 | 421 | { |
422 | 422 | $this->current->modify(($this->monthly_byday_num < 0 ? -1 : 1).' day'); |
423 | 423 | //echo __METHOD__."() $this->monthly_byday_num".substr(self::$days[$this->monthly_byday_wday],0,2).': modify(1 day): '.$this->current->format('l').', '.$this->current."<br />\n"; |
@@ -425,10 +425,10 @@ discard block |
||
425 | 425 | break; |
426 | 426 | |
427 | 427 | case self::MONTHLY_MDAY: // iCal: monthly_bymonthday={1, ..., 31, -1} |
428 | - list($year,$month) = explode('-',$this->current->format('Y-m')); |
|
429 | - $day = $this->monthly_bymonthday+($this->monthly_bymonthday < 0 ? 1 : 0); |
|
430 | - $month += $this->interval+($this->monthly_bymonthday < 0 ? 1 : 0); |
|
431 | - $this->current->setDate($year,$month,$day); |
|
428 | + list($year, $month) = explode('-', $this->current->format('Y-m')); |
|
429 | + $day = $this->monthly_bymonthday + ($this->monthly_bymonthday < 0 ? 1 : 0); |
|
430 | + $month += $this->interval + ($this->monthly_bymonthday < 0 ? 1 : 0); |
|
431 | + $this->current->setDate($year, $month, $day); |
|
432 | 432 | //echo __METHOD__."() setDate($year,$month,$day): ".$this->current->format('l').', '.$this->current."<br />\n"; |
433 | 433 | break; |
434 | 434 | |
@@ -450,7 +450,7 @@ discard block |
||
450 | 450 | { |
451 | 451 | $this->next_no_exception(); |
452 | 452 | } |
453 | - while($this->exceptions && in_array($this->current->format('Ymd'),$this->exceptions)); |
|
453 | + while ($this->exceptions && in_array($this->current->format('Ymd'), $this->exceptions)); |
|
454 | 454 | } |
455 | 455 | |
456 | 456 | /** |
@@ -482,7 +482,7 @@ discard block |
||
482 | 482 | if (isset($this->current)) $backup = $this->current; |
483 | 483 | $this->rewind(); |
484 | 484 | |
485 | - while(--$count > 0) |
|
485 | + while (--$count > 0) |
|
486 | 486 | { |
487 | 487 | $this->next_no_exception(); |
488 | 488 | } |
@@ -507,7 +507,7 @@ discard block |
||
507 | 507 | // if enddate is now before next acurrence, but not on same day, we use previous recurrence |
508 | 508 | // this can happen if client gives an enddate which is NOT a recurrence date |
509 | 509 | // eg. for a on Monday recurring weekly event a Tuesday as enddate |
510 | - if ($this->enddate < $this->current && $this->current->format('Ymd') != $this->enddate->format('Ymd')) |
|
510 | + if ($this->enddate < $this->current && $this->current->format('Ymd') != $this->enddate->format('Ymd')) |
|
511 | 511 | { |
512 | 512 | $last = $previous; |
513 | 513 | } |
@@ -526,7 +526,7 @@ discard block |
||
526 | 526 | $this->current = clone $this->time; |
527 | 527 | while ($this->valid() && |
528 | 528 | $this->exceptions && |
529 | - in_array($this->current->format('Ymd'),$this->exceptions)) |
|
529 | + in_array($this->current->format('Ymd'), $this->exceptions)) |
|
530 | 530 | { |
531 | 531 | $this->next_no_exception(); |
532 | 532 | } |
@@ -537,7 +537,7 @@ discard block |
||
537 | 537 | * |
538 | 538 | * @return boolean |
539 | 539 | */ |
540 | - public function valid () |
|
540 | + public function valid() |
|
541 | 541 | { |
542 | 542 | return $this->current->format('Ymd') <= $this->enddate_ymd; |
543 | 543 | } |
@@ -551,9 +551,9 @@ discard block |
||
551 | 551 | { |
552 | 552 | $str = ''; |
553 | 553 | // Repeated Events |
554 | - if($this->type != self::NONE) |
|
554 | + if ($this->type != self::NONE) |
|
555 | 555 | { |
556 | - list($str) = explode(' (',lang(self::$types[$this->type])); // remove (by day/date) from Monthly |
|
556 | + list($str) = explode(' (', lang(self::$types[$this->type])); // remove (by day/date) from Monthly |
|
557 | 557 | |
558 | 558 | $str_extra = array(); |
559 | 559 | switch ($this->type) |
@@ -569,7 +569,7 @@ discard block |
||
569 | 569 | { |
570 | 570 | $repeat_days[] = $this->type == self::WEEKLY ? lang('all') : lang('day'); |
571 | 571 | } |
572 | - elseif($this->weekdays == self::WORKDAYS) |
|
572 | + elseif ($this->weekdays == self::WORKDAYS) |
|
573 | 573 | { |
574 | 574 | $repeat_days[] = $this->type == self::WEEKLY ? lang('workdays') : lang('workday'); |
575 | 575 | } |
@@ -577,24 +577,24 @@ discard block |
||
577 | 577 | { |
578 | 578 | foreach (self::$days as $mask => $label) |
579 | 579 | { |
580 | - if ($this->weekdays & $mask) |
|
580 | + if ($this->weekdays&$mask) |
|
581 | 581 | { |
582 | 582 | $repeat_days[] = lang($label); |
583 | 583 | } |
584 | 584 | } |
585 | 585 | } |
586 | - if($this->type == self::WEEKLY && count($repeat_days)) |
|
586 | + if ($this->type == self::WEEKLY && count($repeat_days)) |
|
587 | 587 | { |
588 | - $str_extra[] = lang('days repeated').': '.implode(', ',$repeat_days); |
|
588 | + $str_extra[] = lang('days repeated').': '.implode(', ', $repeat_days); |
|
589 | 589 | } |
590 | - elseif($this->type == self::MONTHLY_WDAY) |
|
590 | + elseif ($this->type == self::MONTHLY_WDAY) |
|
591 | 591 | { |
592 | - $str_extra[] = ($this->monthly_byday_num == -1 ? lang('last') : $this->monthly_byday_num.'.').' '.implode(', ',$repeat_days); |
|
592 | + $str_extra[] = ($this->monthly_byday_num == -1 ? lang('last') : $this->monthly_byday_num.'.').' '.implode(', ', $repeat_days); |
|
593 | 593 | } |
594 | 594 | break; |
595 | 595 | |
596 | 596 | } |
597 | - if($this->interval > 1) |
|
597 | + if ($this->interval > 1) |
|
598 | 598 | { |
599 | 599 | $str_extra[] = lang('Interval').': '.$this->interval; |
600 | 600 | } |
@@ -610,9 +610,9 @@ discard block |
||
610 | 610 | { |
611 | 611 | $str_extra[] = $this->time->getTimezone()->getName(); |
612 | 612 | } |
613 | - if(count($str_extra)) |
|
613 | + if (count($str_extra)) |
|
614 | 614 | { |
615 | - $str .= ' ('.implode(', ',$str_extra).')'; |
|
615 | + $str .= ' ('.implode(', ', $str_extra).')'; |
|
616 | 616 | } |
617 | 617 | } |
618 | 618 | return $str; |
@@ -624,24 +624,24 @@ discard block |
||
624 | 624 | * |
625 | 625 | * $return array vCalendar RRULE |
626 | 626 | */ |
627 | - public function generate_rrule($version='2.0') |
|
627 | + public function generate_rrule($version = '2.0') |
|
628 | 628 | { |
629 | 629 | $repeat_days = array(); |
630 | 630 | $rrule = array(); |
631 | 631 | |
632 | - if ($this->type == self::NONE) return false; // no recuring event |
|
632 | + if ($this->type == self::NONE) return false; // no recuring event |
|
633 | 633 | |
634 | 634 | if ($version == '1.0') |
635 | 635 | { |
636 | - $rrule['FREQ'] = self::$recur_egw2ical_1_0[$this->type] . $this->interval; |
|
636 | + $rrule['FREQ'] = self::$recur_egw2ical_1_0[$this->type].$this->interval; |
|
637 | 637 | switch ($this->type) |
638 | 638 | { |
639 | 639 | case self::WEEKLY: |
640 | 640 | foreach (self::$days as $mask => $label) |
641 | 641 | { |
642 | - if ($this->weekdays & $mask) |
|
642 | + if ($this->weekdays&$mask) |
|
643 | 643 | { |
644 | - $repeat_days[] = strtoupper(substr($label,0,2)); |
|
644 | + $repeat_days[] = strtoupper(substr($label, 0, 2)); |
|
645 | 645 | } |
646 | 646 | } |
647 | 647 | $rrule['BYDAY'] = implode(' ', $repeat_days); |
@@ -654,7 +654,7 @@ discard block |
||
654 | 654 | case self::MONTHLY_WDAY: // weekday of the month: BDAY={1..5}+ {MO..SO} |
655 | 655 | $rrule['BYDAY'] = abs($this->monthly_byday_num); |
656 | 656 | $rrule['BYDAY'] .= ($this->monthly_byday_num < 0) ? '- ' : '+ '; |
657 | - $rrule['BYDAY'] .= strtoupper(substr($this->time->format('l'),0,2)); |
|
657 | + $rrule['BYDAY'] .= strtoupper(substr($this->time->format('l'), 0, 2)); |
|
658 | 658 | $rrule['FREQ'] = $rrule['FREQ'].' '.$rrule['BYDAY']; |
659 | 659 | break; |
660 | 660 | } |
@@ -672,9 +672,9 @@ discard block |
||
672 | 672 | case self::WEEKLY: |
673 | 673 | foreach (self::$days as $mask => $label) |
674 | 674 | { |
675 | - if ($this->weekdays & $mask) |
|
675 | + if ($this->weekdays&$mask) |
|
676 | 676 | { |
677 | - $repeat_days[] = strtoupper(substr($label,0,2)); |
|
677 | + $repeat_days[] = strtoupper(substr($label, 0, 2)); |
|
678 | 678 | } |
679 | 679 | } |
680 | 680 | $rrule['BYDAY'] = implode(',', $repeat_days); |
@@ -685,8 +685,8 @@ discard block |
||
685 | 685 | break; |
686 | 686 | |
687 | 687 | case self::MONTHLY_WDAY: // weekday of the month: BDAY={1..5}{MO..SO} |
688 | - $rrule['BYDAY'] = $this->monthly_byday_num . |
|
689 | - strtoupper(substr($this->time->format('l'),0,2)); |
|
688 | + $rrule['BYDAY'] = $this->monthly_byday_num. |
|
689 | + strtoupper(substr($this->time->format('l'), 0, 2)); |
|
690 | 690 | break; |
691 | 691 | } |
692 | 692 | if ($this->interval > 1) |
@@ -721,12 +721,12 @@ discard block |
||
721 | 721 | * |
722 | 722 | * @return calendar_rrule false on error |
723 | 723 | */ |
724 | - public static function event2rrule(array $event,$usertime=true,$to_tz=null) |
|
724 | + public static function event2rrule(array $event, $usertime = true, $to_tz = null) |
|
725 | 725 | { |
726 | - if (!is_array($event) || !isset($event['tzid'])) return false; |
|
726 | + if (!is_array($event) || !isset($event['tzid'])) return false; |
|
727 | 727 | if (!$to_tz) $to_tz = $event['tzid']; |
728 | 728 | $timestamp_tz = $usertime ? egw_time::$user_timezone : egw_time::$server_timezone; |
729 | - $time = is_a($event['start'],'DateTime') ? $event['start'] : new egw_time($event['start'],$timestamp_tz); |
|
729 | + $time = is_a($event['start'], 'DateTime') ? $event['start'] : new egw_time($event['start'], $timestamp_tz); |
|
730 | 730 | |
731 | 731 | if (!isset(self::$tz_cache[$to_tz])) |
732 | 732 | { |
@@ -739,16 +739,16 @@ discard block |
||
739 | 739 | |
740 | 740 | if ($event['recur_enddate']) |
741 | 741 | { |
742 | - $enddate = is_a($event['recur_enddate'],'DateTime') ? $event['recur_enddate'] : new egw_time($event['recur_enddate'],$timestamp_tz); |
|
742 | + $enddate = is_a($event['recur_enddate'], 'DateTime') ? $event['recur_enddate'] : new egw_time($event['recur_enddate'], $timestamp_tz); |
|
743 | 743 | } |
744 | 744 | if (is_array($event['recur_exception'])) |
745 | 745 | { |
746 | - foreach($event['recur_exception'] as $exception) |
|
746 | + foreach ($event['recur_exception'] as $exception) |
|
747 | 747 | { |
748 | - $exceptions[] = is_a($exception,'DateTime') ? $exception : new egw_time($exception,$timestamp_tz); |
|
748 | + $exceptions[] = is_a($exception, 'DateTime') ? $exception : new egw_time($exception, $timestamp_tz); |
|
749 | 749 | } |
750 | 750 | } |
751 | - return new calendar_rrule($time,$event['recur_type'],$event['recur_interval'],$enddate,$event['recur_data'],$exceptions); |
|
751 | + return new calendar_rrule($time, $event['recur_type'], $event['recur_interval'], $enddate, $event['recur_data'], $exceptions); |
|
752 | 752 | } |
753 | 753 | |
754 | 754 | /** |
@@ -774,7 +774,7 @@ discard block |
||
774 | 774 | * @param DateTime/string starttime of the event (in servertime) |
775 | 775 | * @param string $to_tz new timezone |
776 | 776 | */ |
777 | - public static function rrule2tz(array &$event,$starttime,$to_tz) |
|
777 | + public static function rrule2tz(array &$event, $starttime, $to_tz) |
|
778 | 778 | { |
779 | 779 | // We assume that the difference between timezones can result |
780 | 780 | // in a maximum of one day |
@@ -795,7 +795,7 @@ discard block |
||
795 | 795 | self::$tz_cache[$to_tz] = calendar_timezones::DateTimeZone($to_tz); |
796 | 796 | } |
797 | 797 | |
798 | - $time = is_a($starttime,'DateTime') ? |
|
798 | + $time = is_a($starttime, 'DateTime') ? |
|
799 | 799 | $starttime : new egw_time($starttime, egw_time::$server_timezone); |
800 | 800 | $time->setTimezone(self::$tz_cache[$event['tzid']]); |
801 | 801 | $remote = clone $time; |
@@ -813,11 +813,11 @@ discard block |
||
813 | 813 | if ($delta == 1 || $delta == -6) |
814 | 814 | { |
815 | 815 | $mask = $mask << 1; |
816 | - if ($mask & 128) $mask = $mask - 127; // overflow |
|
816 | + if ($mask&128) $mask = $mask - 127; // overflow |
|
817 | 817 | } |
818 | 818 | else |
819 | 819 | { |
820 | - if ($mask & 1) $mask = $mask + 128; // underflow |
|
820 | + if ($mask&1) $mask = $mask + 128; // underflow |
|
821 | 821 | $mask = $mask >> 1; |
822 | 822 | } |
823 | 823 | $event['recur_data'] = $mask; |
@@ -828,8 +828,8 @@ discard block |
||
828 | 828 | |
829 | 829 | if (isset($_SERVER['SCRIPT_FILENAME']) && $_SERVER['SCRIPT_FILENAME'] == __FILE__) // some tests |
830 | 830 | { |
831 | - ini_set('display_errors',1); |
|
832 | - error_reporting(E_ALL & ~E_NOTICE); |
|
831 | + ini_set('display_errors', 1); |
|
832 | + error_reporting(E_ALL&~E_NOTICE); |
|
833 | 833 | function lang($str) { return $str; } |
834 | 834 | $GLOBALS['egw_info']['user']['preferences']['common']['tz'] = $_REQUEST['user-tz'] ? $_REQUEST['user-tz'] : 'Europe/Berlin'; |
835 | 835 | require_once('../../phpgwapi/inc/class.egw_time.inc.php'); |
@@ -838,7 +838,7 @@ discard block |
||
838 | 838 | |
839 | 839 | if (!isset($_REQUEST['time'])) |
840 | 840 | { |
841 | - $now = new egw_time('now',new DateTimeZone($_REQUEST['tz'] = 'UTC')); |
|
841 | + $now = new egw_time('now', new DateTimeZone($_REQUEST['tz'] = 'UTC')); |
|
842 | 842 | $_REQUEST['time'] = $now->format(); |
843 | 843 | $_REQUEST['type'] = calendar_rrule::WEEKLY; |
844 | 844 | $_REQUEST['interval'] = 2; |
@@ -847,29 +847,29 @@ discard block |
||
847 | 847 | $_REQUEST['user-tz'] = 'Europe/Berlin'; |
848 | 848 | } |
849 | 849 | echo "<html>\n<head>\n\t<title>Test calendar_rrule class</title>\n</head>\n<body>\n<form method='GET'>\n"; |
850 | - echo "<p>Date+Time: ".html::input('time',$_REQUEST['time']). |
|
851 | - html::select('tz',$_REQUEST['tz'],egw_time::getTimezones())."</p>\n"; |
|
852 | - echo "<p>Type: ".html::select('type',$_REQUEST['type'],calendar_rrule::$types)."\n". |
|
853 | - "Interval: ".html::input('interval',$_REQUEST['interval'])."</p>\n"; |
|
850 | + echo "<p>Date+Time: ".html::input('time', $_REQUEST['time']). |
|
851 | + html::select('tz', $_REQUEST['tz'], egw_time::getTimezones())."</p>\n"; |
|
852 | + echo "<p>Type: ".html::select('type', $_REQUEST['type'], calendar_rrule::$types)."\n". |
|
853 | + "Interval: ".html::input('interval', $_REQUEST['interval'])."</p>\n"; |
|
854 | 854 | echo "<table><tr><td>\n"; |
855 | - echo "Weekdays:<br />".html::checkbox_multiselect('weekdays',$_REQUEST['weekdays'],calendar_rrule::$days,false,'','7',false,'height: 150px;')."\n"; |
|
855 | + echo "Weekdays:<br />".html::checkbox_multiselect('weekdays', $_REQUEST['weekdays'], calendar_rrule::$days, false, '', '7', false, 'height: 150px;')."\n"; |
|
856 | 856 | echo "</td><td>\n"; |
857 | - echo "<p>Exceptions:<br />".html::textarea('exceptions',$_REQUEST['exceptions'],'style="height: 150px;"')."\n"; |
|
857 | + echo "<p>Exceptions:<br />".html::textarea('exceptions', $_REQUEST['exceptions'], 'style="height: 150px;"')."\n"; |
|
858 | 858 | echo "</td></tr></table>\n"; |
859 | - echo "<p>Enddate: ".html::input('enddate',$_REQUEST['enddate'])."</p>\n"; |
|
860 | - echo "<p>Display recurances in ".html::select('user-tz',$_REQUEST['user-tz'],egw_time::getTimezones())."</p>\n"; |
|
861 | - echo "<p>".html::submit_button('calc','Calculate')."</p>\n"; |
|
859 | + echo "<p>Enddate: ".html::input('enddate', $_REQUEST['enddate'])."</p>\n"; |
|
860 | + echo "<p>Display recurances in ".html::select('user-tz', $_REQUEST['user-tz'], egw_time::getTimezones())."</p>\n"; |
|
861 | + echo "<p>".html::submit_button('calc', 'Calculate')."</p>\n"; |
|
862 | 862 | echo "</form>\n"; |
863 | 863 | |
864 | 864 | $tz = new DateTimeZone($_REQUEST['tz']); |
865 | - $time = new egw_time($_REQUEST['time'],$tz); |
|
866 | - if ($_REQUEST['enddate']) $enddate = new egw_time($_REQUEST['enddate'],$tz); |
|
867 | - $weekdays = 0; foreach((array)$_REQUEST['weekdays'] as $mask) { $weekdays |= $mask; } |
|
868 | - if ($_REQUEST['exceptions']) foreach(preg_split("/[,\r\n]+ ?/",$_REQUEST['exceptions']) as $exception) { $exceptions[] = new egw_time($exception); } |
|
865 | + $time = new egw_time($_REQUEST['time'], $tz); |
|
866 | + if ($_REQUEST['enddate']) $enddate = new egw_time($_REQUEST['enddate'], $tz); |
|
867 | + $weekdays = 0; foreach ((array)$_REQUEST['weekdays'] as $mask) { $weekdays |= $mask; } |
|
868 | + if ($_REQUEST['exceptions']) foreach (preg_split("/[,\r\n]+ ?/", $_REQUEST['exceptions']) as $exception) { $exceptions[] = new egw_time($exception); } |
|
869 | 869 | |
870 | - $rrule = new calendar_rrule($time,$_REQUEST['type'],$_REQUEST['interval'],$enddate,$weekdays,$exceptions); |
|
870 | + $rrule = new calendar_rrule($time, $_REQUEST['type'], $_REQUEST['interval'], $enddate, $weekdays, $exceptions); |
|
871 | 871 | echo "<h3>".$time->format('l').', '.$time.' ('.$tz->getName().') '.$rrule."</h3>\n"; |
872 | - foreach($rrule as $rtime) |
|
872 | + foreach ($rrule as $rtime) |
|
873 | 873 | { |
874 | 874 | $rtime->setTimezone(egw_time::$user_timezone); |
875 | 875 | echo ++$n.': '.$rtime->format('l').', '.$rtime."<br />\n"; |
@@ -42,7 +42,7 @@ discard block |
||
42 | 42 | * |
43 | 43 | * @var mixed |
44 | 44 | */ |
45 | - var $debug=false; |
|
45 | + var $debug = false; |
|
46 | 46 | |
47 | 47 | /** |
48 | 48 | * minimum width for an event |
@@ -100,21 +100,21 @@ discard block |
||
100 | 100 | * |
101 | 101 | * @var boolean |
102 | 102 | */ |
103 | - var $use_time_grid=true; |
|
103 | + var $use_time_grid = true; |
|
104 | 104 | |
105 | 105 | /** |
106 | 106 | * Can we display the whole day in a timeGrid of the size of the workday and just scroll to workday start |
107 | 107 | * |
108 | 108 | * @var boolean |
109 | 109 | */ |
110 | - var $scroll_to_wdstart=false; |
|
110 | + var $scroll_to_wdstart = false; |
|
111 | 111 | |
112 | 112 | /** |
113 | 113 | * counter for the current whole day event of a single day |
114 | 114 | * |
115 | 115 | * @var int |
116 | 116 | */ |
117 | - var $wholeDayPosCounter=1; |
|
117 | + var $wholeDayPosCounter = 1; |
|
118 | 118 | |
119 | 119 | /** |
120 | 120 | * Switch to disable private data and possibility to view and edit events |
@@ -137,9 +137,9 @@ discard block |
||
137 | 137 | * |
138 | 138 | * @param array $set_states = null to manualy set / change one of the states, default NULL = use $_REQUEST |
139 | 139 | */ |
140 | - function __construct($set_states=null) |
|
140 | + function __construct($set_states = null) |
|
141 | 141 | { |
142 | - parent::__construct(false,$set_states); // call the parent's constructor |
|
142 | + parent::__construct(false, $set_states); // call the parent's constructor |
|
143 | 143 | $this->extraRowsOriginal = $this->extraRows; //save original extraRows value |
144 | 144 | |
145 | 145 | $GLOBALS['egw_info']['flags']['nonavbar'] = False; |
@@ -154,14 +154,14 @@ discard block |
||
154 | 154 | $GLOBALS['egw_info']['flags']['app_header'] = $GLOBALS['egw_info']['apps']['calendar']['title']. |
155 | 155 | (isset($app_header[$this->view]) ? ' - '.$app_header[$this->view] : ''). |
156 | 156 | // for a single owner we add it's name to the app-header |
157 | - (count(explode(',',$this->owner)) == 1 ? ': '.$this->bo->participant_name($this->owner) : ''); |
|
157 | + (count(explode(',', $this->owner)) == 1 ? ': '.$this->bo->participant_name($this->owner) : ''); |
|
158 | 158 | |
159 | 159 | // standard params for calling bocal::search for all views |
160 | - $this->owner = str_replace('%2C',',',$this->owner); |
|
160 | + $this->owner = str_replace('%2C', ',', $this->owner); |
|
161 | 161 | $this->search_params = array( |
162 | 162 | 'start' => $this->date, |
163 | - 'cat_id' => $this->cat_id ? (is_array($this->cat_id)?$this->cat_id:explode(',',$this->cat_id)) : 0, |
|
164 | - 'users' => explode(',',$this->owner), |
|
163 | + 'cat_id' => $this->cat_id ? (is_array($this->cat_id) ? $this->cat_id : explode(',', $this->cat_id)) : 0, |
|
164 | + 'users' => explode(',', $this->owner), |
|
165 | 165 | 'filter' => $this->filter, |
166 | 166 | 'daywise' => True, |
167 | 167 | 'use_so_events' => $this->test === 'true', |
@@ -183,7 +183,7 @@ discard block |
||
183 | 183 | */ |
184 | 184 | public function week_number($time) |
185 | 185 | { |
186 | - if (!is_a($time,'DateTime')) $time = new egw_time($time); |
|
186 | + if (!is_a($time, 'DateTime')) $time = new egw_time($time); |
|
187 | 187 | |
188 | 188 | // if week does not start Monday and $time is Sunday --> add one day |
189 | 189 | if ($this->cal_prefs['weekdaystarts'] != 'Monday' && !($wday = $time->format('w'))) |
@@ -208,7 +208,7 @@ discard block |
||
208 | 208 | // handle views in other files |
209 | 209 | if (!isset($this->public_functions[$this->view])) |
210 | 210 | { |
211 | - $GLOBALS['egw']->redirect_link('/index.php',array('menuaction'=>$this->view_menuaction,'ajax'=>'true'),'calendar'); |
|
211 | + $GLOBALS['egw']->redirect_link('/index.php', array('menuaction'=>$this->view_menuaction, 'ajax'=>'true'), 'calendar'); |
|
212 | 212 | } |
213 | 213 | // get manual to load the right page |
214 | 214 | $GLOBALS['egw_info']['flags']['params']['manual'] = array('page' => 'ManualCalendar'.ucfirst($this->view)); |
@@ -228,7 +228,7 @@ discard block |
||
228 | 228 | 'date' => $this->bo->date2string($this->bo->now_su), |
229 | 229 | 'cat_id' => 0, |
230 | 230 | 'filter' => 'default', |
231 | - 'owner' => substr($this->cal_prefs['mainscreen_showevents'],0,7) == 'planner' && $this->cal_prefs['planner_start_with_group'] ? |
|
231 | + 'owner' => substr($this->cal_prefs['mainscreen_showevents'], 0, 7) == 'planner' && $this->cal_prefs['planner_start_with_group'] ? |
|
232 | 232 | $this->cal_prefs['planner_start_with_group'] : $this->user, |
233 | 233 | 'multiple' => 0, |
234 | 234 | 'view' => $this->bo->cal_prefs['mainscreen_showevents'], |
@@ -242,7 +242,7 @@ discard block |
||
242 | 242 | { |
243 | 243 | $group_warning = '<p class="message" align="center">'.$this->group_warning."</p>\n"; |
244 | 244 | } |
245 | - switch($this->cal_prefs['mainscreen_showevents']) |
|
245 | + switch ($this->cal_prefs['mainscreen_showevents']) |
|
246 | 246 | { |
247 | 247 | case 'planner_user': |
248 | 248 | case 'planner_cat': |
@@ -253,20 +253,20 @@ discard block |
||
253 | 253 | return $group_warning.$this->year(true); |
254 | 254 | |
255 | 255 | case 'month': |
256 | - return $group_warning.$this->month(0,true); |
|
256 | + return $group_warning.$this->month(0, true); |
|
257 | 257 | |
258 | 258 | case 'weekN': |
259 | 259 | return $group_warning.$this->weekN(true); |
260 | 260 | |
261 | 261 | default: |
262 | 262 | case 'week': |
263 | - return $group_warning.$this->week(0,true); |
|
263 | + return $group_warning.$this->week(0, true); |
|
264 | 264 | |
265 | 265 | case 'day': |
266 | 266 | return $group_warning.$this->day(true); |
267 | 267 | |
268 | 268 | case 'day4': |
269 | - return $group_warning.$this->week(4,true); |
|
269 | + return $group_warning.$this->week(4, true); |
|
270 | 270 | } |
271 | 271 | } |
272 | 272 | |
@@ -275,7 +275,7 @@ discard block |
||
275 | 275 | * |
276 | 276 | * @param boolean $home = false if true return content suitable for home-page |
277 | 277 | */ |
278 | - function &planner($home=false) |
|
278 | + function &planner($home = false) |
|
279 | 279 | { |
280 | 280 | if ($this->sortby == 'month') // yearly planner with month rows |
281 | 281 | { |
@@ -284,50 +284,50 @@ discard block |
||
284 | 284 | unset($this->first['raw']); |
285 | 285 | $this->last = $this->first; |
286 | 286 | $this->last['year']++; |
287 | - $this->last = $this->bo->date2ts($this->last)-1; |
|
287 | + $this->last = $this->bo->date2ts($this->last) - 1; |
|
288 | 288 | $GLOBALS['egw_info']['flags']['app_header'] .= ': '.lang('yearly planner').' '. |
289 | - lang(egw_time::to($this->first,'F')).' '.egw_time::to($this->first,'Y').' - '. |
|
290 | - lang(egw_time::to($this->last,'F')).' '.egw_time::to($this->last,'Y'); |
|
289 | + lang(egw_time::to($this->first, 'F')).' '.egw_time::to($this->first, 'Y').' - '. |
|
290 | + lang(egw_time::to($this->last, 'F')).' '.egw_time::to($this->last, 'Y'); |
|
291 | 291 | } |
292 | 292 | elseif (!$this->planner_days) // planner monthview |
293 | 293 | { |
294 | 294 | if ($this->day < 15) // show one complete month |
295 | 295 | { |
296 | - $this->_week_align_month($this->first,$this->last); |
|
297 | - $GLOBALS['egw_info']['flags']['app_header'] .= ': '.lang(adodb_date('F',$this->bo->date2ts($this->date))).' '.$this->year; |
|
296 | + $this->_week_align_month($this->first, $this->last); |
|
297 | + $GLOBALS['egw_info']['flags']['app_header'] .= ': '.lang(adodb_date('F', $this->bo->date2ts($this->date))).' '.$this->year; |
|
298 | 298 | } |
299 | 299 | else // show 2 half month |
300 | 300 | { |
301 | - $this->_week_align_month($this->first,$this->last,15); |
|
302 | - $GLOBALS['egw_info']['flags']['app_header'] .= ': '.lang(adodb_date('F',$this->first)).' / '.lang(adodb_date('F',$this->last)).' '.$this->year; |
|
301 | + $this->_week_align_month($this->first, $this->last, 15); |
|
302 | + $GLOBALS['egw_info']['flags']['app_header'] .= ': '.lang(adodb_date('F', $this->first)).' / '.lang(adodb_date('F', $this->last)).' '.$this->year; |
|
303 | 303 | } |
304 | 304 | } |
305 | 305 | elseif ($this->planner_days >= 5) // weeekview |
306 | 306 | { |
307 | - $this->first = $this->datetime->get_weekday_start($this->year,$this->month,$this->day); |
|
307 | + $this->first = $this->datetime->get_weekday_start($this->year, $this->month, $this->day); |
|
308 | 308 | $this->last = $this->bo->date2array($this->first); |
309 | - $this->last['day'] += (int) $this->planner_days - 1; |
|
309 | + $this->last['day'] += (int)$this->planner_days - 1; |
|
310 | 310 | $this->last['hour'] = 23; $this->last['minute'] = $this->last['sec'] = 59; |
311 | 311 | unset($this->last['raw']); |
312 | 312 | $this->last = $this->bo->date2ts($this->last); |
313 | - $GLOBALS['egw_info']['flags']['app_header'] .= ': '.lang('Week').' '.$this->week_number($this->first).': '.$this->bo->long_date($this->first,$this->last); |
|
313 | + $GLOBALS['egw_info']['flags']['app_header'] .= ': '.lang('Week').' '.$this->week_number($this->first).': '.$this->bo->long_date($this->first, $this->last); |
|
314 | 314 | } |
315 | 315 | else // dayview |
316 | 316 | { |
317 | 317 | $this->first = $this->bo->date2ts($this->date); |
318 | 318 | $this->last = $this->bo->date2array($this->first); |
319 | - $this->last['day'] += (int) $this->planner_days - 1; |
|
319 | + $this->last['day'] += (int)$this->planner_days - 1; |
|
320 | 320 | $this->last['hour'] = 23; $this->last['minute'] = $this->last['sec'] = 59; |
321 | 321 | unset($this->last['raw']); |
322 | 322 | $this->last = $this->bo->date2ts($this->last); |
323 | - $GLOBALS['egw_info']['flags']['app_header'] .= ': '.($this->planner_days == 1 ? lang(date('l',$this->first)).', ' : ''). |
|
324 | - $this->bo->long_date($this->first,$this->planner_days > 1 ? $this->last : 0); |
|
323 | + $GLOBALS['egw_info']['flags']['app_header'] .= ': '.($this->planner_days == 1 ? lang(date('l', $this->first)).', ' : ''). |
|
324 | + $this->bo->long_date($this->first, $this->planner_days > 1 ? $this->last : 0); |
|
325 | 325 | } |
326 | 326 | |
327 | 327 | $merge = $this->merge(); |
328 | - if($merge) |
|
328 | + if ($merge) |
|
329 | 329 | { |
330 | - egw::redirect_link('/index.php',array( |
|
330 | + egw::redirect_link('/index.php', array( |
|
331 | 331 | 'menuaction' => 'calendar.calendar_uiviews.index', |
332 | 332 | 'msg' => $merge, |
333 | 333 | )); |
@@ -338,11 +338,11 @@ discard block |
||
338 | 338 | $search_params['start'] = $this->first; |
339 | 339 | $search_params['end'] = $this->last; |
340 | 340 | $search_params['enum_groups'] = $this->sortby == 'user'; |
341 | - $events =& $this->bo->search($search_params); |
|
341 | + $events = & $this->bo->search($search_params); |
|
342 | 342 | |
343 | - if ($this->debug > 0) $this->bo->debug_message('uiviews::planner() date=%1: first=%2, last=%3',False,$this->date,$this->bo->date2string($this->first),$this->bo->date2string($this->last)); |
|
343 | + if ($this->debug > 0) $this->bo->debug_message('uiviews::planner() date=%1: first=%2, last=%3', False, $this->date, $this->bo->date2string($this->first), $this->bo->date2string($this->last)); |
|
344 | 344 | |
345 | - $content =& $this->plannerWidget($events,$this->first,$this->last,$this->sortby != 'category' ? $this->sortby : (int) $this->cat_id); |
|
345 | + $content = & $this->plannerWidget($events, $this->first, $this->last, $this->sortby != 'category' ? $this->sortby : (int)$this->cat_id); |
|
346 | 346 | |
347 | 347 | |
348 | 348 | if (!$home) |
@@ -359,11 +359,11 @@ discard block |
||
359 | 359 | * |
360 | 360 | * @param boolean $home = false if true return content suitable for home-page |
361 | 361 | */ |
362 | - function &weekN($home=false) |
|
362 | + function &weekN($home = false) |
|
363 | 363 | { |
364 | - if (($num = (int)$this->cal_prefs['multiple_weeks']) < 2) $num = 3; // default 3 weeks |
|
364 | + if (($num = (int)$this->cal_prefs['multiple_weeks']) < 2) $num = 3; // default 3 weeks |
|
365 | 365 | |
366 | - return $this->month($num,$home); |
|
366 | + return $this->month($num, $home); |
|
367 | 367 | } |
368 | 368 | |
369 | 369 | /** Month column width (usually 3 or 4) in year view */ |
@@ -374,25 +374,25 @@ discard block |
||
374 | 374 | * |
375 | 375 | * @param boolean $home = false if true return content suitable for home-page |
376 | 376 | */ |
377 | - function &year($home=false) |
|
377 | + function &year($home = false) |
|
378 | 378 | { |
379 | - if ($this->debug > 0) $this->bo->debug_message('uiviews::year date=%2',True,$this->date); |
|
379 | + if ($this->debug > 0) $this->bo->debug_message('uiviews::year date=%2', True, $this->date); |
|
380 | 380 | |
381 | 381 | |
382 | - $this->_month_align_year($this->first,$this->last); |
|
382 | + $this->_month_align_year($this->first, $this->last); |
|
383 | 383 | |
384 | 384 | $GLOBALS['egw_info']['flags']['app_header'] .= ': '.$this->year; |
385 | 385 | |
386 | 386 | $merge = $this->merge(); |
387 | - if($merge) |
|
387 | + if ($merge) |
|
388 | 388 | { |
389 | - egw::redirect_link('/index.php',array( |
|
389 | + egw::redirect_link('/index.php', array( |
|
390 | 390 | 'menuaction' => 'calendar.calendar_uiviews.index', |
391 | 391 | 'msg' => $merge, |
392 | 392 | )); |
393 | 393 | } |
394 | 394 | |
395 | - $days =& $this->bo->search(array( |
|
395 | + $days = & $this->bo->search(array( |
|
396 | 396 | 'start' => $this->first, |
397 | 397 | 'end' => $this->last, |
398 | 398 | ) + $this->search_params); |
@@ -407,14 +407,14 @@ discard block |
||
407 | 407 | $content .= "\t".'<div class="calDayColsNoGrip">'."\n"; |
408 | 408 | } |
409 | 409 | |
410 | - $month_start = $this->datetime->get_weekday_start($this->year,$month,1); |
|
410 | + $month_start = $this->datetime->get_weekday_start($this->year, $month, 1); |
|
411 | 411 | // Beginning of the last week in the month |
412 | 412 | $month_end = $this->datetime->get_weekday_start( |
413 | 413 | $this->year, |
414 | 414 | $month, |
415 | - $this->datetime->days_in_month($month,$this->year)); |
|
415 | + $this->datetime->days_in_month($month, $this->year)); |
|
416 | 416 | // End of the last week in month |
417 | - $month_end = strtotime("+6 days",$month_end); |
|
417 | + $month_end = strtotime("+6 days", $month_end); |
|
418 | 418 | |
419 | 419 | $content .= "\t\t".'<div class="calendar_calDayCol" style="left: '. |
420 | 420 | ((($month - 1) % self::YEARVIEW_COLS) * (100 / self::YEARVIEW_COLS)).'%; width: '. |
@@ -422,26 +422,26 @@ discard block |
||
422 | 422 | |
423 | 423 | // Year Header |
424 | 424 | $content .= "\t\t\t".'<div class="calendar_calDayColHeader '.($month % 2 == 0 ? "th" : "row_on").'"'. |
425 | - ' style="height: 20px; line-height: 20px; z-index: 0;" title="'.lang(adodb_date('F',strtotime("+1 week",$month_start))).' '.adodb_date('Y',strtotime("+1 week",$month_start)).'">'."\n"; |
|
425 | + ' style="height: 20px; line-height: 20px; z-index: 0;" title="'.lang(adodb_date('F', strtotime("+1 week", $month_start))).' '.adodb_date('Y', strtotime("+1 week", $month_start)).'">'."\n"; |
|
426 | 426 | if (($month) == 1) |
427 | 427 | { |
428 | 428 | $content .= '<span style="position: absolute; left: 0px;">'; |
429 | - $content .= html::a_href(html::image('phpgwapi','first',lang('previous'),$options=' alt="<<"'),array( |
|
429 | + $content .= html::a_href(html::image('phpgwapi', 'first', lang('previous'), $options = ' alt="<<"'), array( |
|
430 | 430 | 'menuaction' => $this->view_menuaction, |
431 | - 'date' => date('Ymd',strtotime('-1 year',strtotime($this->date))), |
|
431 | + 'date' => date('Ymd', strtotime('-1 year', strtotime($this->date))), |
|
432 | 432 | )); |
433 | 433 | $content .= '</span>'."\n"; |
434 | 434 | } |
435 | 435 | $content .= "\t\t\t\t".'<a href="'.$GLOBALS['egw']->link('/index.php', |
436 | 436 | array('menuaction'=>'calendar.calendar_uiviews.month', |
437 | 437 | 'date'=>$this->year.($month < 10 ? '0' : '').$month.'01')). |
438 | - '" title="'.lang('Monthview').'">'.lang(adodb_date('F',strtotime("+1 week",$month_start))).'</a>'."\n"; |
|
438 | + '" title="'.lang('Monthview').'">'.lang(adodb_date('F', strtotime("+1 week", $month_start))).'</a>'."\n"; |
|
439 | 439 | if ($month == self::YEARVIEW_COLS) |
440 | 440 | { |
441 | 441 | $content .= '<span style="position: absolute; right: 0px;">'; |
442 | - $content .= html::a_href(html::image('phpgwapi','last',lang('next'),$options=' alt=">>"'),array( |
|
442 | + $content .= html::a_href(html::image('phpgwapi', 'last', lang('next'), $options = ' alt=">>"'), array( |
|
443 | 443 | 'menuaction' => $this->view_menuaction, |
444 | - 'date' => date('Ymd',strtotime('+1 year',strtotime($this->date))), |
|
444 | + 'date' => date('Ymd', strtotime('+1 year', strtotime($this->date))), |
|
445 | 445 | )); |
446 | 446 | $content .= '</span>'."\n"; |
447 | 447 | } |
@@ -455,8 +455,8 @@ discard block |
||
455 | 455 | // Day Columns, Legend |
456 | 456 | for ($i = 0; $i <= 6; $i++) |
457 | 457 | { |
458 | - $day_date = ($i ? strtotime("+$i days",$month_start) : $month_start); |
|
459 | - if (adodb_date('w',$day_date) % 6 == 0) |
|
458 | + $day_date = ($i ? strtotime("+$i days", $month_start) : $month_start); |
|
459 | + if (adodb_date('w', $day_date) % 6 == 0) |
|
460 | 460 | { |
461 | 461 | $style = 'calendar_cal_year_legend_weekend'; |
462 | 462 | } |
@@ -467,13 +467,13 @@ discard block |
||
467 | 467 | |
468 | 468 | $content .= "\t\t\t\t".'<div class="'.$style.'"'. |
469 | 469 | ' style="text-align: center; position: absolute; width: 11.5%; height: 16px; left: '.((($i + 1) * 12.5) + 0.5).'%;">'. |
470 | - lang(adodb_date('D',$day_date)).'</div>'."\n"; |
|
470 | + lang(adodb_date('D', $day_date)).'</div>'."\n"; |
|
471 | 471 | } |
472 | 472 | $content .= "\t\t\t".'</div>'."\n"; |
473 | 473 | |
474 | 474 | // Week rows in month |
475 | 475 | $week_start = $month_start; |
476 | - for ($week_in_month = 1; $week_in_month <= 6; $week_in_month ++) |
|
476 | + for ($week_in_month = 1; $week_in_month <= 6; $week_in_month++) |
|
477 | 477 | { |
478 | 478 | $content .= "\t\t\t".'<div'. |
479 | 479 | ' style="position: absolute; width: 100%; height: 16px;'. |
@@ -481,7 +481,7 @@ discard block |
||
481 | 481 | |
482 | 482 | $content .= "\t\t\t\t".'<div class="calendar_cal_year_legend"'. |
483 | 483 | ' style="text-align: center;position: absolute; width: 11.5%; height: 16px; left: 0.5%;" '. |
484 | - 'title="'.lang('Wk').' '.$this->week_number($week_start).'/'.adodb_date('Y',$week_start).'">'."\n"; |
|
484 | + 'title="'.lang('Wk').' '.$this->week_number($week_start).'/'.adodb_date('Y', $week_start).'">'."\n"; |
|
485 | 485 | $content .= "\t\t\t\t\t". |
486 | 486 | '<a href="'.$GLOBALS['egw']->link('/index.php', |
487 | 487 | array('menuaction'=>'calendar.calendar_uiviews.week', |
@@ -491,13 +491,13 @@ discard block |
||
491 | 491 | // Day columns in week row |
492 | 492 | for ($i = 0; $i <= 6; $i++) |
493 | 493 | { |
494 | - $day_date = $i ? strtotime("+$i days",$week_start) : $week_start; |
|
494 | + $day_date = $i ? strtotime("+$i days", $week_start) : $week_start; |
|
495 | 495 | $day_ymd = $this->bo->date2string($day_date); |
496 | 496 | $eventcount = count($days[$day_ymd]); |
497 | 497 | $in_month = true; |
498 | 498 | $css_class = ""; |
499 | - $this->_day_class_holiday($day_ymd,$class,$holidays,false,false); |
|
500 | - if (adodb_date('n',$day_date) != $month) |
|
499 | + $this->_day_class_holiday($day_ymd, $class, $holidays, false, false); |
|
500 | + if (adodb_date('n', $day_date) != $month) |
|
501 | 501 | { |
502 | 502 | $css_class .= 'calendar_cal_year_legend'; |
503 | 503 | $in_month = false; |
@@ -505,7 +505,7 @@ discard block |
||
505 | 505 | else |
506 | 506 | { |
507 | 507 | $css_class .= 'calendar_calEvent calendar_calEventAllAccepted'; |
508 | - if (adodb_date('w',$day_date) % 6 == 0) |
|
508 | + if (adodb_date('w', $day_date) % 6 == 0) |
|
509 | 509 | { |
510 | 510 | $css_class .= ' calendar_cal_year_weekend'; |
511 | 511 | } |
@@ -535,12 +535,12 @@ discard block |
||
535 | 535 | { |
536 | 536 | $content .= ' title="'.$holidays.'"'; |
537 | 537 | } |
538 | - $content .= '>'.adodb_date('d',$day_date).'</div>'."\n"; |
|
538 | + $content .= '>'.adodb_date('d', $day_date).'</div>'."\n"; |
|
539 | 539 | |
540 | 540 | |
541 | 541 | if (($in_month) && (count($days[$day_ymd]))) |
542 | 542 | { |
543 | - $eventCols = $this->getEventCols($day_ymd,$days[$day_ymd]); |
|
543 | + $eventCols = $this->getEventCols($day_ymd, $days[$day_ymd]); |
|
544 | 544 | // displaying all event columns of the day |
545 | 545 | $row_height = 100 / count($eventCols); |
546 | 546 | $space_left = 4; //% |
@@ -549,19 +549,19 @@ discard block |
||
549 | 549 | // settings for time2pos |
550 | 550 | $this->scroll_to_wdstart = false; |
551 | 551 | $this->wd_start = 0; |
552 | - $this->wd_end = 24*60; |
|
552 | + $this->wd_end = 24 * 60; |
|
553 | 553 | $this->granularity_m = 24 * 60; |
554 | 554 | $this->extraRows = -1; |
555 | 555 | $this->remBotExtraRows = 0; |
556 | 556 | $this->rowHeight = $row_width; |
557 | - foreach($eventCols as $n => $eventCol) |
|
557 | + foreach ($eventCols as $n => $eventCol) |
|
558 | 558 | { |
559 | 559 | foreach ($eventCol as $event) |
560 | 560 | { |
561 | 561 | $indent = "\t\t\t\t"; |
562 | 562 | // some fields set by the dayColWidget for the other views |
563 | 563 | unset($event['whole_day_on_top']); |
564 | - $data = $this->eventWidget($event,25,$indent,$this->owner,true,'planner_event'); |
|
564 | + $data = $this->eventWidget($event, 25, $indent, $this->owner, true, 'planner_event'); |
|
565 | 565 | |
566 | 566 | $left = ((($i + 1) * 12.5) + 0.5 + $space_left + $this->time2pos($event['start_m'])); |
567 | 567 | $width = $this->time2pos($event['end_m'] - $event['start_m']); |
@@ -569,7 +569,7 @@ discard block |
||
569 | 569 | |
570 | 570 | $tooltip = html::htmlspecialchars($data['tooltip']); |
571 | 571 | $content .= $indent.'<div class="calendar_plannerEvent'.($data['private'] ? 'Private' : ''). |
572 | - '" data-tooltip ="'.$tooltip . |
|
572 | + '" data-tooltip ="'.$tooltip. |
|
573 | 573 | '" style="position: absolute; left: '.$left.'%; width: '.$width.'%; height: '. |
574 | 574 | $row_height.'%; top: '.($n * $row_height).'%;'. |
575 | 575 | 'background-color: '.$color.';" '.'" data-date ="'.$this->bo->date2string($event['start']).'|'.$data['popup'].'" '. |
@@ -578,7 +578,7 @@ discard block |
||
578 | 578 | } |
579 | 579 | } |
580 | 580 | } |
581 | - $week_start = strtotime("+1 week",$week_start); |
|
581 | + $week_start = strtotime("+1 week", $week_start); |
|
582 | 582 | $content .= "\t\t\t".'</div>'."\n"; |
583 | 583 | } |
584 | 584 | $content .= "\t\t".'</div>'."\n"; |
@@ -606,35 +606,35 @@ discard block |
||
606 | 606 | * @param int $weeks = 0 number of weeks to show, if 0 (default) all weeks of one month are shown |
607 | 607 | * @param boolean $home = false if true return content suitable for home-page |
608 | 608 | */ |
609 | - function &month($weeks=0,$home=false) |
|
609 | + function &month($weeks = 0, $home = false) |
|
610 | 610 | { |
611 | - if ($this->debug > 0) $this->bo->debug_message('uiviews::month(weeks=%1) date=%2',True,$weeks,$this->date); |
|
611 | + if ($this->debug > 0) $this->bo->debug_message('uiviews::month(weeks=%1) date=%2', True, $weeks, $this->date); |
|
612 | 612 | |
613 | - $this->use_time_grid = !$this->cal_prefs['use_time_grid'] || $this->cal_prefs['use_time_grid'] == 'all'; // all views |
|
613 | + $this->use_time_grid = !$this->cal_prefs['use_time_grid'] || $this->cal_prefs['use_time_grid'] == 'all'; // all views |
|
614 | 614 | |
615 | 615 | // Merge print |
616 | - if($weeks) |
|
616 | + if ($weeks) |
|
617 | 617 | { |
618 | 618 | // Split up span into multiple weeks |
619 | 619 | $timespan = array(); |
620 | - $this->first = $this->datetime->get_weekday_start($this->year,$this->month,$this->day); |
|
621 | - for($i = 0; $i < $weeks; $i++) |
|
620 | + $this->first = $this->datetime->get_weekday_start($this->year, $this->month, $this->day); |
|
621 | + for ($i = 0; $i < $weeks; $i++) |
|
622 | 622 | { |
623 | 623 | $timespan[] = array( |
624 | 624 | 'start' => strtotime("+$i weeks", $this->first), |
625 | - 'end' => strtotime('+' . ($i+1).' weeks', $this->first) -1 |
|
625 | + 'end' => strtotime('+'.($i + 1).' weeks', $this->first) - 1 |
|
626 | 626 | ); |
627 | 627 | } |
628 | 628 | } else { |
629 | 629 | $timespan[] = array( |
630 | - 'start' => mktime(0,0,0,$this->month,1,$this->year), |
|
631 | - 'end' => mktime(0,0,0,$this->month+1,1,$this->year)-1 |
|
630 | + 'start' => mktime(0, 0, 0, $this->month, 1, $this->year), |
|
631 | + 'end' => mktime(0, 0, 0, $this->month + 1, 1, $this->year) - 1 |
|
632 | 632 | ); |
633 | 633 | } |
634 | 634 | $merge = $this->merge($timespan); |
635 | - if($merge) |
|
635 | + if ($merge) |
|
636 | 636 | { |
637 | - egw::redirect_link('/index.php',array( |
|
637 | + egw::redirect_link('/index.php', array( |
|
638 | 638 | 'menuaction' => 'calendar.calendar_uiviews.index', |
639 | 639 | 'msg' => $merge, |
640 | 640 | )); |
@@ -642,34 +642,34 @@ discard block |
||
642 | 642 | |
643 | 643 | if ($weeks) |
644 | 644 | { |
645 | - $this->first = $this->datetime->get_weekday_start($this->year,$this->month,$this->day); |
|
646 | - $this->last = strtotime("+$weeks weeks",$this->first) - 1; |
|
645 | + $this->first = $this->datetime->get_weekday_start($this->year, $this->month, $this->day); |
|
646 | + $this->last = strtotime("+$weeks weeks", $this->first) - 1; |
|
647 | 647 | $weekNavH = "$weeks weeks"; |
648 | 648 | $navHeader = lang('Week').' '.$this->week_number($this->first).' - '.$this->week_number($this->last).': '. |
649 | - $this->bo->long_date($this->first,$this->last); |
|
649 | + $this->bo->long_date($this->first, $this->last); |
|
650 | 650 | } |
651 | 651 | else |
652 | 652 | { |
653 | - $this->_week_align_month($this->first,$this->last); |
|
653 | + $this->_week_align_month($this->first, $this->last); |
|
654 | 654 | $weekNavH = "1 month"; |
655 | - $navHeader = lang(adodb_date('F',$this->bo->date2ts($this->date))).' '.$this->year; |
|
655 | + $navHeader = lang(adodb_date('F', $this->bo->date2ts($this->date))).' '.$this->year; |
|
656 | 656 | } |
657 | - if ($this->debug > 0) $this->bo->debug_message('uiviews::month(%1) date=%2: first=%3, last=%4',False,$weeks,$this->date,$this->bo->date2string($this->first),$this->bo->date2string($this->last)); |
|
657 | + if ($this->debug > 0) $this->bo->debug_message('uiviews::month(%1) date=%2: first=%3, last=%4', False, $weeks, $this->date, $this->bo->date2string($this->first), $this->bo->date2string($this->last)); |
|
658 | 658 | |
659 | 659 | $GLOBALS['egw_info']['flags']['app_header'] .= ': '.$navHeader; |
660 | 660 | |
661 | - $days =& $this->bo->search(array( |
|
661 | + $days = & $this->bo->search(array( |
|
662 | 662 | 'start' => $this->first, |
663 | 663 | 'end' => $this->last, |
664 | - )+$this->search_params); |
|
664 | + ) + $this->search_params); |
|
665 | 665 | |
666 | 666 | // we add DAY_s/2 to $this->first (using 12h), to deal with daylight saving changes |
667 | - for ($week_start = $this->first; $week_start < $this->last; $week_start = strtotime("+1 week",$week_start)) |
|
667 | + for ($week_start = $this->first; $week_start < $this->last; $week_start = strtotime("+1 week", $week_start)) |
|
668 | 668 | { |
669 | 669 | $week = array(); |
670 | 670 | for ($i = 0; $i < 7; ++$i) |
671 | 671 | { |
672 | - $day_ymd = $this->bo->date2string($i ? strtotime("+$i days",$week_start) : $week_start); |
|
672 | + $day_ymd = $this->bo->date2string($i ? strtotime("+$i days", $week_start) : $week_start); |
|
673 | 673 | $week[$day_ymd] = array_shift($days); |
674 | 674 | } |
675 | 675 | $week_view = array( |
@@ -679,21 +679,21 @@ discard block |
||
679 | 679 | $title = lang('Wk').' '.$this->week_number($week_start); |
680 | 680 | if ($this->allowEdit) |
681 | 681 | { |
682 | - $title = html::a_href($title,$week_view,'',' title="'.lang('Weekview').'"'); |
|
682 | + $title = html::a_href($title, $week_view, '', ' title="'.lang('Weekview').'"'); |
|
683 | 683 | } |
684 | 684 | |
685 | - $content .= $this->timeGridWidget($this->tagWholeDayOnTop($week),$weeks == 2 ? 30 : 60,200,'',$title,0,$week_start+WEEK_s >= $this->last); |
|
685 | + $content .= $this->timeGridWidget($this->tagWholeDayOnTop($week), $weeks == 2 ? 30 : 60, 200, '', $title, 0, $week_start + WEEK_s >= $this->last); |
|
686 | 686 | } |
687 | 687 | |
688 | 688 | $navHeader = '<div class="calendar_calMonthNavHeader calendar_calMonth">' |
689 | - .html::a_href(html::image('phpgwapi','left',lang('previous'),$options=' alt="<<"'),array( |
|
689 | + .html::a_href(html::image('phpgwapi', 'left', lang('previous'), $options = ' alt="<<"'), array( |
|
690 | 690 | 'menuaction' => $this->view_menuaction, |
691 | - 'date' => date('Ymd',strtotime("-".$weekNavH, $weeks? $this->first: $this->bo->date2ts($this->date))), |
|
692 | - )). ' <span>'.$navHeader; |
|
691 | + 'date' => date('Ymd', strtotime("-".$weekNavH, $weeks ? $this->first : $this->bo->date2ts($this->date))), |
|
692 | + )).' <span>'.$navHeader; |
|
693 | 693 | |
694 | - $navHeader = $navHeader.'</span> '.html::a_href(html::image('phpgwapi','right',lang('next'),$options=' alt=">>"'),array( |
|
694 | + $navHeader = $navHeader.'</span> '.html::a_href(html::image('phpgwapi', 'right', lang('next'), $options = ' alt=">>"'), array( |
|
695 | 695 | 'menuaction' => $this->view_menuaction, |
696 | - 'date' => date('Ymd',strtotime("+".$weekNavH, $weeks? $this->first: $this->bo->date2ts($this->date))), |
|
696 | + 'date' => date('Ymd', strtotime("+".$weekNavH, $weeks ? $this->first : $this->bo->date2ts($this->date))), |
|
697 | 697 | )).'</div>'; |
698 | 698 | $content = $navHeader.$content; |
699 | 699 | if (!$home) |
@@ -714,17 +714,17 @@ discard block |
||
714 | 714 | * @param int &$last timestamp 23:59:59 of last day of week containg the last day of the current month |
715 | 715 | * @param int $day = 1 should the alignment be based on the 1. of the month or an other date, eg. the 15. |
716 | 716 | */ |
717 | - function _week_align_month(&$first,&$last,$day=1) |
|
717 | + function _week_align_month(&$first, &$last, $day = 1) |
|
718 | 718 | { |
719 | - $first = $this->datetime->get_weekday_start($this->year,$this->month,$this->day=$day); |
|
719 | + $first = $this->datetime->get_weekday_start($this->year, $this->month, $this->day = $day); |
|
720 | 720 | if ($day == 1) |
721 | 721 | { |
722 | - $last = $this->datetime->get_weekday_start($this->year,$this->month, |
|
723 | - $this->datetime->days_in_month($this->month,$this->year)); |
|
722 | + $last = $this->datetime->get_weekday_start($this->year, $this->month, |
|
723 | + $this->datetime->days_in_month($this->month, $this->year)); |
|
724 | 724 | } |
725 | 725 | else |
726 | 726 | { |
727 | - $last = $this->datetime->get_weekday_start($this->year,$this->month+1,$day); |
|
727 | + $last = $this->datetime->get_weekday_start($this->year, $this->month + 1, $day); |
|
728 | 728 | } |
729 | 729 | // now we need to calculate the end of the last day of that week |
730 | 730 | // as simple $last += WEEK_s - 1; does NOT work, if daylight saving changes in that week!!! |
@@ -732,7 +732,7 @@ discard block |
||
732 | 732 | $last['day'] += 6; |
733 | 733 | $last['hour'] = 23; |
734 | 734 | $last['min'] = $last['sec'] = 59; |
735 | - unset($last['raw']); // otherwise date2ts does not calc raw new, but uses it |
|
735 | + unset($last['raw']); // otherwise date2ts does not calc raw new, but uses it |
|
736 | 736 | $last = $this->bo->date2ts($last); |
737 | 737 | } |
738 | 738 | |
@@ -742,18 +742,18 @@ discard block |
||
742 | 742 | * @param int &$first timestamp 0h of first day of week containing the first of the current year |
743 | 743 | * @param int &$last timestamp 23:59:59 of last day of week containg the last day of the current year |
744 | 744 | */ |
745 | - function _month_align_year(&$first,&$last) |
|
745 | + function _month_align_year(&$first, &$last) |
|
746 | 746 | { |
747 | - $first = $this->datetime->get_weekday_start($this->year,$this->month=1,$this->day=1); |
|
748 | - $last = $this->datetime->get_weekday_start($this->year,$this->month+12, |
|
749 | - $this->datetime->days_in_month($this->month+12,$this->year)); |
|
747 | + $first = $this->datetime->get_weekday_start($this->year, $this->month = 1, $this->day = 1); |
|
748 | + $last = $this->datetime->get_weekday_start($this->year, $this->month + 12, |
|
749 | + $this->datetime->days_in_month($this->month + 12, $this->year)); |
|
750 | 750 | // now we need to calculate the end of the last day of that week |
751 | 751 | // as simple $last += WEEK_s - 1; does NOT work, if daylight saving changes in that week!!! |
752 | 752 | $last = $this->bo->date2array($last); |
753 | 753 | $last['day'] += 6; |
754 | 754 | $last['hour'] = 23; |
755 | 755 | $last['min'] = $last['sec'] = 59; |
756 | - unset($last['raw']); // otherwise date2ts does not calc raw new, but uses it |
|
756 | + unset($last['raw']); // otherwise date2ts does not calc raw new, but uses it |
|
757 | 757 | $last = $this->bo->date2ts($last); |
758 | 758 | } |
759 | 759 | |
@@ -763,9 +763,9 @@ discard block |
||
763 | 763 | * @param boolean $home = false if true return content suitable for home-page |
764 | 764 | * @return string |
765 | 765 | */ |
766 | - function day4($home=false) |
|
766 | + function day4($home = false) |
|
767 | 767 | { |
768 | - return $this->week(4,$home); |
|
768 | + return $this->week(4, $home); |
|
769 | 769 | } |
770 | 770 | |
771 | 771 | /** |
@@ -777,7 +777,7 @@ discard block |
||
777 | 777 | */ |
778 | 778 | private function close_button($uid) |
779 | 779 | { |
780 | - return html::a_href(html::image('phpgwapi', 'close.button', 'Close','style="width: 12px; padding-top: 1px;"'), array( |
|
780 | + return html::a_href(html::image('phpgwapi', 'close.button', 'Close', 'style="width: 12px; padding-top: 1px;"'), array( |
|
781 | 781 | 'menuaction' => 'calendar.calendar_uiviews.index', |
782 | 782 | 'close' => $uid, |
783 | 783 | )); |
@@ -789,9 +789,9 @@ discard block |
||
789 | 789 | * @param int $days = 0 number of days to show, if 0 (default) the value from the URL or the prefs is used |
790 | 790 | * @param boolean $home = false if true return content suitable for home-page |
791 | 791 | */ |
792 | - function week($days=0,$home=false) |
|
792 | + function week($days = 0, $home = false) |
|
793 | 793 | { |
794 | - $this->use_time_grid = $days != 4 && !in_array($this->cal_prefs['use_time_grid'],array('day','day4')) || |
|
794 | + $this->use_time_grid = $days != 4 && !in_array($this->cal_prefs['use_time_grid'], array('day', 'day4')) || |
|
795 | 795 | $days == 4 && $this->cal_prefs['use_time_grid'] != 'day'; |
796 | 796 | |
797 | 797 | if (!$days) |
@@ -800,55 +800,55 @@ discard block |
||
800 | 800 | if ($days != 5) $days = 7; |
801 | 801 | if ($days != $this->cal_prefs['days_in_weekview']) // save the preference |
802 | 802 | { |
803 | - $GLOBALS['egw']->preferences->add('calendar','days_in_weekview',$days); |
|
803 | + $GLOBALS['egw']->preferences->add('calendar', 'days_in_weekview', $days); |
|
804 | 804 | $GLOBALS['egw']->preferences->save_repository(); |
805 | 805 | $this->cal_prefs['days_in_weekview'] = $days; |
806 | 806 | } |
807 | 807 | } |
808 | - if ($this->debug > 0) $this->bo->debug_message('uiviews::week(days=%1) date=%2',True,$days,$this->date); |
|
808 | + if ($this->debug > 0) $this->bo->debug_message('uiviews::week(days=%1) date=%2', True, $days, $this->date); |
|
809 | 809 | |
810 | 810 | if ($days == 4) // next 4 days view |
811 | 811 | { |
812 | 812 | $wd_start = $this->first = $this->bo->date2ts($this->date); |
813 | - $this->last = strtotime("+$days days",$this->first) - 1; |
|
814 | - $GLOBALS['egw_info']['flags']['app_header'] .= ': '.lang('Four days view').' '.$this->bo->long_date($this->first,$this->last); |
|
815 | - $navHeader =lang('Four days view').' '.$this->bo->long_date($this->first,$this->last); |
|
813 | + $this->last = strtotime("+$days days", $this->first) - 1; |
|
814 | + $GLOBALS['egw_info']['flags']['app_header'] .= ': '.lang('Four days view').' '.$this->bo->long_date($this->first, $this->last); |
|
815 | + $navHeader = lang('Four days view').' '.$this->bo->long_date($this->first, $this->last); |
|
816 | 816 | } |
817 | 817 | else |
818 | 818 | { |
819 | - $wd_start = $this->first = $this->datetime->get_weekday_start($this->year,$this->month,$this->day); |
|
819 | + $wd_start = $this->first = $this->datetime->get_weekday_start($this->year, $this->month, $this->day); |
|
820 | 820 | if ($days == 5) // no weekend-days |
821 | 821 | { |
822 | - switch($this->cal_prefs['weekdaystarts']) |
|
822 | + switch ($this->cal_prefs['weekdaystarts']) |
|
823 | 823 | { |
824 | 824 | case 'Saturday': |
825 | - $this->first = strtotime("+2 days",$this->first); |
|
825 | + $this->first = strtotime("+2 days", $this->first); |
|
826 | 826 | break; |
827 | 827 | case 'Sunday': |
828 | - $this->first = strtotime("+1 day",$this->first); |
|
828 | + $this->first = strtotime("+1 day", $this->first); |
|
829 | 829 | break; |
830 | 830 | } |
831 | 831 | } |
832 | - $this->last = strtotime("+$days days",$this->first) - 1; |
|
833 | - $GLOBALS['egw_info']['flags']['app_header'] .=': ' .lang('Week').' '.$this->week_number($this->first).': '.$this->bo->long_date($this->first,$this->last); |
|
834 | - $navHeader = lang('Week').' '.$this->week_number($this->first).': '.$this->bo->long_date($this->first,$this->last); |
|
832 | + $this->last = strtotime("+$days days", $this->first) - 1; |
|
833 | + $GLOBALS['egw_info']['flags']['app_header'] .= ': '.lang('Week').' '.$this->week_number($this->first).': '.$this->bo->long_date($this->first, $this->last); |
|
834 | + $navHeader = lang('Week').' '.$this->week_number($this->first).': '.$this->bo->long_date($this->first, $this->last); |
|
835 | 835 | } |
836 | 836 | |
837 | 837 | $navHeader = '<div class="calendar_calWeek calendar_calWeekNavHeader">' |
838 | - .html::a_href(html::image('phpgwapi','left',lang('previous'),$options=' alt="<<"'),array( |
|
838 | + .html::a_href(html::image('phpgwapi', 'left', lang('previous'), $options = ' alt="<<"'), array( |
|
839 | 839 | 'menuaction' => $this->view_menuaction, |
840 | - 'date' => date('Ymd', strtotime("-$days days",$this->first)), |
|
841 | - )). '<span>'.$navHeader; |
|
840 | + 'date' => date('Ymd', strtotime("-$days days", $this->first)), |
|
841 | + )).'<span>'.$navHeader; |
|
842 | 842 | |
843 | - $navHeader = $navHeader.'</span>'.html::a_href(html::image('phpgwapi','right',lang('next'),$options=' alt=">>"'),array( |
|
843 | + $navHeader = $navHeader.'</span>'.html::a_href(html::image('phpgwapi', 'right', lang('next'), $options = ' alt=">>"'), array( |
|
844 | 844 | 'menuaction' => $this->view_menuaction, |
845 | - 'date' => date('Ymd', strtotime("+$days days",$this->last)), |
|
845 | + 'date' => date('Ymd', strtotime("+$days days", $this->last)), |
|
846 | 846 | )).'</div>'; |
847 | 847 | |
848 | 848 | $merge = $this->merge(); |
849 | - if($merge) |
|
849 | + if ($merge) |
|
850 | 850 | { |
851 | - egw::redirect_link('/index.php',array( |
|
851 | + egw::redirect_link('/index.php', array( |
|
852 | 852 | 'menuaction' => 'calendar.calendar_uiviews.index', |
853 | 853 | 'msg' => $merge, |
854 | 854 | )); |
@@ -864,13 +864,13 @@ discard block |
||
864 | 864 | |
865 | 865 | if (count($users) == 1 || count($users) > $this->bo->calview_no_consolidate) // for more then X users, show all in one row |
866 | 866 | { |
867 | - $content = $this->timeGridWidget($this->tagWholeDayOnTop($this->bo->search($search_params)),$this->cal_prefs['interval']); |
|
867 | + $content = $this->timeGridWidget($this->tagWholeDayOnTop($this->bo->search($search_params)), $this->cal_prefs['interval']); |
|
868 | 868 | } |
869 | 869 | else |
870 | 870 | { |
871 | 871 | $content = ''; |
872 | 872 | $headerCounter = 0; |
873 | - foreach(explode(',',$this->owner) as $uid) |
|
873 | + foreach (explode(',', $this->owner) as $uid) |
|
874 | 874 | { |
875 | 875 | $label = $this->bo->participant_name($uid); |
876 | 876 | $content .= '<div data-sortable-id="'.$uid.'">'; |
@@ -878,7 +878,7 @@ discard block |
||
878 | 878 | $content .= '<b>'.$label."</b>\n"; |
879 | 879 | $content .= $this->close_button($uid); |
880 | 880 | $content .= $this->timeGridWidget($this->tagWholeDayOnTop($this->bo->search($search_params)), |
881 | - count($users) * $this->cal_prefs['interval'],400 / count($users),'','',$uid); |
|
881 | + count($users) * $this->cal_prefs['interval'], 400 / count($users), '', '', $uid); |
|
882 | 882 | ++$headerCounter; |
883 | 883 | if (count($users) > $headerCounter) |
884 | 884 | { |
@@ -907,21 +907,21 @@ discard block |
||
907 | 907 | * |
908 | 908 | * @param boolean $home = false if true return content suitable for home-page |
909 | 909 | */ |
910 | - function &day($home=false) |
|
910 | + function &day($home = false) |
|
911 | 911 | { |
912 | - if ($this->debug > 0) $this->bo->debug_message('uiviews::day() date=%1',True,$this->date); |
|
912 | + if ($this->debug > 0) $this->bo->debug_message('uiviews::day() date=%1', True, $this->date); |
|
913 | 913 | |
914 | 914 | $this->last = $this->first = $this->bo->date2ts((string)$this->date); |
915 | - $GLOBALS['egw_info']['flags']['app_header'] .= ': '.$this->bo->long_date($this->first,0,false,true); |
|
915 | + $GLOBALS['egw_info']['flags']['app_header'] .= ': '.$this->bo->long_date($this->first, 0, false, true); |
|
916 | 916 | |
917 | - $this->use_time_grid = true; // day-view always uses a time-grid, independent what's set in the prefs! |
|
917 | + $this->use_time_grid = true; // day-view always uses a time-grid, independent what's set in the prefs! |
|
918 | 918 | |
919 | - $this->search_params['end'] = $this->last = $this->first+DAY_s-1; |
|
919 | + $this->search_params['end'] = $this->last = $this->first + DAY_s - 1; |
|
920 | 920 | |
921 | 921 | $merge = $this->merge(); |
922 | - if($merge) |
|
922 | + if ($merge) |
|
923 | 923 | { |
924 | - egw::redirect_link('/index.php',array( |
|
924 | + egw::redirect_link('/index.php', array( |
|
925 | 925 | 'menuaction' => 'calendar.calendar_uiviews.index', |
926 | 926 | 'msg' => $merge, |
927 | 927 | )); |
@@ -937,14 +937,14 @@ discard block |
||
937 | 937 | // for more then X users, show all in one row |
938 | 938 | if (count($users) == 1 || count($users) > $this->bo->calview_no_consolidate) |
939 | 939 | { |
940 | - $dayEvents =& $this->bo->search($this->search_params); |
|
940 | + $dayEvents = & $this->bo->search($this->search_params); |
|
941 | 941 | $owner = 0; |
942 | 942 | } |
943 | 943 | else |
944 | 944 | { |
945 | 945 | $dayEvents = $owner = array(); |
946 | 946 | $search_params = $this->search_params; |
947 | - foreach($this->_get_planner_users(false) as $uid => $label) |
|
947 | + foreach ($this->_get_planner_users(false) as $uid => $label) |
|
948 | 948 | { |
949 | 949 | $search_params['users'] = $uid; |
950 | 950 | list(,$dayEvents['<b>'.$label.'</b>'.$this->close_button($uid)]) = each($this->bo->search($search_params)); |
@@ -957,32 +957,32 @@ discard block |
||
957 | 957 | //types mask accordingly. |
958 | 958 | $display_holidays_event = $GLOBALS['egw_info']['user']['preferences']['calendar']['display_holidays_event']; |
959 | 959 | $this->display_holiday_event_types = array( |
960 | - 'bdays' => ((int)$display_holidays_event & 1) != 0, |
|
961 | - 'hdays' => ((int)$display_holidays_event & 2) != 0 |
|
960 | + 'bdays' => ((int)$display_holidays_event&1) != 0, |
|
961 | + 'hdays' => ((int)$display_holidays_event&2) != 0 |
|
962 | 962 | ); |
963 | 963 | |
964 | 964 | //Add the holiday events |
965 | 965 | $holidays = $this->_get_holiday_events($this->date, $this->display_holiday_event_types); |
966 | - foreach($dayEvents as &$events) |
|
966 | + foreach ($dayEvents as &$events) |
|
967 | 967 | { |
968 | - $events = array_merge($events,$holidays); |
|
968 | + $events = array_merge($events, $holidays); |
|
969 | 969 | } |
970 | 970 | unset($events); |
971 | 971 | unset($holidays); |
972 | 972 | |
973 | - $cols[0] =& $this->timeGridWidget($this->tagWholeDayOnTop($dayEvents),$this->cal_prefs['interval'],450,'','',$owner); |
|
973 | + $cols[0] = & $this->timeGridWidget($this->tagWholeDayOnTop($dayEvents), $this->cal_prefs['interval'], 450, '', '', $owner); |
|
974 | 974 | |
975 | 975 | if (count($users) > 1) |
976 | 976 | { |
977 | 977 | $navHeader = '<div class="calendar_calWeek calendar_calWeekNavHeader">' |
978 | - .html::a_href(html::image('phpgwapi','left',lang('previous'),$options=' alt="<<"'),array( |
|
978 | + .html::a_href(html::image('phpgwapi', 'left', lang('previous'), $options = ' alt="<<"'), array( |
|
979 | 979 | 'menuaction' => $this->view_menuaction, |
980 | - 'date' => date('Ymd',$this->first-1), |
|
981 | - )). '<span>'.$this->bo->long_date($this->first,0,false,true); |
|
980 | + 'date' => date('Ymd', $this->first - 1), |
|
981 | + )).'<span>'.$this->bo->long_date($this->first, 0, false, true); |
|
982 | 982 | |
983 | - $navHeader = $navHeader.'</span>'.html::a_href(html::image('phpgwapi','right',lang('next'),$options=' alt=">>"'),array( |
|
983 | + $navHeader = $navHeader.'</span>'.html::a_href(html::image('phpgwapi', 'right', lang('next'), $options = ' alt=">>"'), array( |
|
984 | 984 | 'menuaction' => $this->view_menuaction, |
985 | - 'date' => date('Ymd',$this->last+1), |
|
985 | + 'date' => date('Ymd', $this->last + 1), |
|
986 | 986 | )).'</div>'; |
987 | 987 | } |
988 | 988 | |
@@ -991,33 +991,33 @@ discard block |
||
991 | 991 | { |
992 | 992 | if ($GLOBALS['egw_info']['user']['apps']['infolog']) |
993 | 993 | { |
994 | - foreach(array('task','phone','note') as $type) |
|
994 | + foreach (array('task', 'phone', 'note') as $type) |
|
995 | 995 | { |
996 | - $todo_label .= ' '.html::a_href( html::image('infolog',$type,lang('Add')),'infolog.infolog_ui.edit',array( |
|
996 | + $todo_label .= ' '.html::a_href(html::image('infolog', $type, lang('Add')), 'infolog.infolog_ui.edit', array( |
|
997 | 997 | 'type' => $type, |
998 | 998 | 'start_time' => $ts, |
999 | - ),' data-todo="app|750x590"'); |
|
999 | + ), ' data-todo="app|750x590"'); |
|
1000 | 1000 | } |
1001 | 1001 | } |
1002 | 1002 | $cols[1] = html::div( |
1003 | - html::div($todo_label,'','calendar_calDayTodosHeader th')."\n". |
|
1004 | - html::div($todos,'','calendar_calDayTodosTable'),'','calendar_calDayTodos'); |
|
1003 | + html::div($todo_label, '', 'calendar_calDayTodosHeader th')."\n". |
|
1004 | + html::div($todos, '', 'calendar_calDayTodosTable'), '', 'calendar_calDayTodos'); |
|
1005 | 1005 | $cols['.1'] = 'width=30%'; |
1006 | 1006 | echo html::table(array( |
1007 | 1007 | 0 => $cols, |
1008 | 1008 | '.0' => 'valign="top"' |
1009 | - ),'class="calendar_calDayView"'); |
|
1009 | + ), 'class="calendar_calDayView"'); |
|
1010 | 1010 | } |
1011 | 1011 | else |
1012 | 1012 | { |
1013 | - $cols[0] = $navHeader . $cols[0]; |
|
1013 | + $cols[0] = $navHeader.$cols[0]; |
|
1014 | 1014 | echo $cols[0]; |
1015 | 1015 | } |
1016 | 1016 | |
1017 | 1017 | } |
1018 | 1018 | else |
1019 | 1019 | { |
1020 | - $content = $this->timeGridWidget($this->bo->search($this->search_params),$this->cal_prefs['interval'],300); |
|
1020 | + $content = $this->timeGridWidget($this->bo->search($this->search_params), $this->cal_prefs['interval'], 300); |
|
1021 | 1021 | |
1022 | 1022 | |
1023 | 1023 | return $content; |
@@ -1041,56 +1041,55 @@ discard block |
||
1041 | 1041 | 'owner' => $this->owner == 0 ? $this->user : $this->owner // num. id of the user, not necessary current user |
1042 | 1042 | )); |
1043 | 1043 | |
1044 | - if(is_array($todo_label)) |
|
1044 | + if (is_array($todo_label)) |
|
1045 | 1045 | { |
1046 | - list($label,$showall)=$todo_label; |
|
1046 | + list($label, $showall) = $todo_label; |
|
1047 | 1047 | } |
1048 | 1048 | else |
1049 | 1049 | { |
1050 | - $label=$todo_label; |
|
1051 | - $showall=true; |
|
1050 | + $label = $todo_label; |
|
1051 | + $showall = true; |
|
1052 | 1052 | } |
1053 | 1053 | $maxshow = (int)$GLOBALS['egw_info']['user']['preferences']['infolog']['mainscreen_maxshow']; |
1054 | - if($maxshow <= 0) |
|
1054 | + if ($maxshow <= 0) |
|
1055 | 1055 | { |
1056 | - $maxshow=10; |
|
1056 | + $maxshow = 10; |
|
1057 | 1057 | } |
1058 | 1058 | //print_debug("get_todos(): label=$label; showall=$showall; max=$maxshow"); |
1059 | 1059 | |
1060 | 1060 | $content = $todo_label = ''; |
1061 | 1061 | if (is_array($todos_from_hook) && count($todos_from_hook)) |
1062 | 1062 | { |
1063 | - foreach($todos_from_hook as $todos) |
|
1063 | + foreach ($todos_from_hook as $todos) |
|
1064 | 1064 | { |
1065 | 1065 | $i = 0; |
1066 | 1066 | if (is_array($todos)) |
1067 | 1067 | { |
1068 | 1068 | $todo_label = !empty($label) ? $label : lang("open ToDo's:"); |
1069 | 1069 | |
1070 | - foreach($todos as $todo) |
|
1070 | + foreach ($todos as $todo) |
|
1071 | 1071 | { |
1072 | - if(!$showall && ($i++ > $maxshow)) |
|
1072 | + if (!$showall && ($i++ > $maxshow)) |
|
1073 | 1073 | { |
1074 | 1074 | break; |
1075 | 1075 | } |
1076 | 1076 | $icons = ''; |
1077 | - foreach($todo['icons'] as $name => $app) |
|
1077 | + foreach ($todo['icons'] as $name => $app) |
|
1078 | 1078 | { |
1079 | - $icons .= ($icons?' ':'').$GLOBALS['egw']->html->image($app,$name,lang($name),'border="0" width="15" height="15"'); |
|
1079 | + $icons .= ($icons ? ' ' : '').$GLOBALS['egw']->html->image($app, $name, lang($name), 'border="0" width="15" height="15"'); |
|
1080 | 1080 | } |
1081 | 1081 | $class = $class == 'row_on' ? 'row_off' : 'row_on'; |
1082 | - if($todo['edit']) { |
|
1082 | + if ($todo['edit']) { |
|
1083 | 1083 | list($width, $height) = explode('x', $todo['edit']['size']); |
1084 | 1084 | unset($todo['edit']['size']); |
1085 | - $edit_icon_href = html::a_href( $icons, $todo['edit'],'',' data-todo="app|'.$width.'x'.$height.'" '); |
|
1086 | - $edit_href = html::a_href( $todo['title'], $todo['edit'],'',' data-todo="app|750x590" '); |
|
1085 | + $edit_icon_href = html::a_href($icons, $todo['edit'], '', ' data-todo="app|'.$width.'x'.$height.'" '); |
|
1086 | + $edit_href = html::a_href($todo['title'], $todo['edit'], '', ' data-todo="app|750x590" '); |
|
1087 | 1087 | } |
1088 | - $icon_href = html::a_href($icons,$todo['view']); |
|
1088 | + $icon_href = html::a_href($icons, $todo['view']); |
|
1089 | 1089 | $href = html::a_href($todo['title'], $todo['view']); |
1090 | 1090 | $content .= " <tr class=\"$class\">\n <td valign=\"top\" width=\"15%\" nowrap>". |
1091 | - ($this->bo->printer_friendly?$icons:($edit_icon_href ? $edit_icon_href : $icon_href)). |
|
1092 | - "</td>\n <td>".($this->printer_friendly?$todo['title']: |
|
1093 | - $edit_href)."</td>\n </tr>\n"; |
|
1091 | + ($this->bo->printer_friendly ? $icons : ($edit_icon_href ? $edit_icon_href : $icon_href)). |
|
1092 | + "</td>\n <td>".($this->printer_friendly ? $todo['title'] : $edit_href)."</td>\n </tr>\n"; |
|
1094 | 1093 | /** |
1095 | 1094 | * ToDo: add delete and closing action |
1096 | 1095 | */ |
@@ -1117,7 +1116,7 @@ discard block |
||
1117 | 1116 | { |
1118 | 1117 | if ($this->scroll_to_wdstart) // we display the complete day - thought only workday is visible without scrolling |
1119 | 1118 | { |
1120 | - return $this->rowHeight * (1 + $this->extraRows + $time/$this->granularity_m); |
|
1119 | + return $this->rowHeight * (1 + $this->extraRows + $time / $this->granularity_m); |
|
1121 | 1120 | } |
1122 | 1121 | // time before workday => condensed in the first $this->extraRows rows |
1123 | 1122 | if ($this->wd_start > 0 && $time < $this->wd_start) |
@@ -1125,18 +1124,18 @@ discard block |
||
1125 | 1124 | $pos = (($this->extraRows - $this->extraRowsOriginal + 1) + ($time / $this->wd_start * ($this->extraRowsOriginal - 1))) * $this->rowHeight; |
1126 | 1125 | } |
1127 | 1126 | // time after workday => condensed in the last row |
1128 | - elseif ($this->wd_end < 24*60 && $time > $this->wd_end+1*$this->granularity_m) |
|
1127 | + elseif ($this->wd_end < 24 * 60 && $time > $this->wd_end + 1 * $this->granularity_m) |
|
1129 | 1128 | { |
1130 | - $pos = 100 - (($this->extraRows - $this->remBotExtraRows) * $this->rowHeight * (1 - ($time - $this->wd_end) / (24*60 - $this->wd_end))); |
|
1129 | + $pos = 100 - (($this->extraRows - $this->remBotExtraRows) * $this->rowHeight * (1 - ($time - $this->wd_end) / (24 * 60 - $this->wd_end))); |
|
1131 | 1130 | } |
1132 | 1131 | // time during the workday => 2. row on (= + granularity) |
1133 | 1132 | else |
1134 | 1133 | { |
1135 | - $pos = $this->rowHeight * (1+$this->extraRows+($time-$this->wd_start)/$this->granularity_m); |
|
1134 | + $pos = $this->rowHeight * (1 + $this->extraRows + ($time - $this->wd_start) / $this->granularity_m); |
|
1136 | 1135 | } |
1137 | - $pos = round($pos,1); |
|
1136 | + $pos = round($pos, 1); |
|
1138 | 1137 | |
1139 | - if ($this->debug > 3) $this->bo->debug_message('uiviews::time2pos(%1)=%2',False,$time,$pos); |
|
1138 | + if ($this->debug > 3) $this->bo->debug_message('uiviews::time2pos(%1)=%2', False, $time, $pos); |
|
1140 | 1139 | |
1141 | 1140 | return $pos; |
1142 | 1141 | } |
@@ -1151,12 +1150,12 @@ discard block |
||
1151 | 1150 | * @param int $minimum = 0 minimum height |
1152 | 1151 | * @return float height in percent |
1153 | 1152 | */ |
1154 | - function times2height($start,$end,$minimum=0) |
|
1153 | + function times2height($start, $end, $minimum = 0) |
|
1155 | 1154 | { |
1156 | 1155 | $minimum = $this->rowHeight; |
1157 | 1156 | $height = $this->time2pos($end) - $this->time2pos($start); |
1158 | 1157 | |
1159 | - if ($this->debug > 3) $this->bo->debug_message('uiviews::times2height(%1,%2,min=%3)=%4',False,$start,$end,$minimum,$height); |
|
1158 | + if ($this->debug > 3) $this->bo->debug_message('uiviews::times2height(%1,%2,min=%3)=%4', False, $start, $end, $minimum, $height); |
|
1160 | 1159 | |
1161 | 1160 | return $height >= $minimum ? $height : $minimum; |
1162 | 1161 | } |
@@ -1174,36 +1173,36 @@ discard block |
||
1174 | 1173 | * @param int/array $owner = 0 owner of the calendar (default 0 = $this->owner) or array with owner for each column |
1175 | 1174 | * @param boolean $last = true last timeGrid displayed, default true |
1176 | 1175 | */ |
1177 | - function &timeGridWidget($daysEvents,$granularity_m=30,$height=400,$indent='',$title='',$owner=0,$last=true) |
|
1176 | + function &timeGridWidget($daysEvents, $granularity_m = 30, $height = 400, $indent = '', $title = '', $owner = 0, $last = true) |
|
1178 | 1177 | { |
1179 | - if ($this->debug > 1 || $this->debug==='timeGridWidget') $this->bo->debug_message('uiviews::timeGridWidget(events=%1,granularity_m=%2,height=%3,,title=%4)',True,$daysEvents,$granularity_m,$height,$title); |
|
1178 | + if ($this->debug > 1 || $this->debug === 'timeGridWidget') $this->bo->debug_message('uiviews::timeGridWidget(events=%1,granularity_m=%2,height=%3,,title=%4)', True, $daysEvents, $granularity_m, $height, $title); |
|
1180 | 1179 | |
1181 | 1180 | // determine if the browser supports scrollIntoView: IE4+, firefox1.0+ and safari2.0+ does |
1182 | 1181 | // then show all hours in a div of the size of the workday and scroll to the workday start |
1183 | 1182 | // still disabled, as things need to be re-aranged first, to that the column headers are not scrolled |
1184 | - $this->scroll_to_wdstart = false;/*$this->use_time_grid && (html::$user_agent == 'msie' || |
|
1183 | + $this->scroll_to_wdstart = false; /*$this->use_time_grid && (html::$user_agent == 'msie' || |
|
1185 | 1184 | html::$user_agent == 'mozilla' && html::ua_version >= 5.0 || |
1186 | 1185 | html::$user_agent == 'safari' && html::ua_version >= 2.0);*/ |
1187 | 1186 | |
1188 | 1187 | if ($this->scroll_to_wdstart) |
1189 | 1188 | { |
1190 | - $this->extraRows = 0; // no extra rows necessary |
|
1189 | + $this->extraRows = 0; // no extra rows necessary |
|
1191 | 1190 | $this->remBotExtraRows = 0; |
1192 | 1191 | $overflow = 'overflow: scroll;'; |
1193 | 1192 | } |
1194 | 1193 | $this->granularity_m = $granularity_m; |
1195 | 1194 | $this->display_start = $this->wd_start - ($this->extraRows * $this->granularity_m); |
1196 | - $this->display_end = $this->wd_end + (($this->extraRows - $this->remBotExtraRows) * $this->granularity_m); |
|
1195 | + $this->display_end = $this->wd_end + (($this->extraRows - $this->remBotExtraRows) * $this->granularity_m); |
|
1197 | 1196 | |
1198 | 1197 | if (!$this->wd_end) $this->wd_end = 1440; |
1199 | 1198 | $totalDisplayMinutes = $this->wd_end - $this->wd_start; |
1200 | - $this->rowsToDisplay = ($totalDisplayMinutes/$granularity_m)+2+2*$this->extraRows - $this->remBotExtraRows; |
|
1201 | - $this->rowHeight = round(100/$this->rowsToDisplay,1); |
|
1199 | + $this->rowsToDisplay = ($totalDisplayMinutes / $granularity_m) + 2 + 2 * $this->extraRows - $this->remBotExtraRows; |
|
1200 | + $this->rowHeight = round(100 / $this->rowsToDisplay, 1); |
|
1202 | 1201 | |
1203 | 1202 | // ensure a minimum height of each row |
1204 | - if ($height < ($this->rowsToDisplay+1) * 12) |
|
1203 | + if ($height < ($this->rowsToDisplay + 1) * 12) |
|
1205 | 1204 | { |
1206 | - $height = ($this->rowsToDisplay+1) * 12; |
|
1205 | + $height = ($this->rowsToDisplay + 1) * 12; |
|
1207 | 1206 | } |
1208 | 1207 | $html = $indent.'<div class="calendar_calTimeGrid" style="height: '.$height.'px;'.$overflow.'">'."\n"; |
1209 | 1208 | |
@@ -1212,13 +1211,13 @@ discard block |
||
1212 | 1211 | |
1213 | 1212 | if ($this->use_time_grid) |
1214 | 1213 | { |
1215 | - $off = false; // Off-row means a different bgcolor |
|
1214 | + $off = false; // Off-row means a different bgcolor |
|
1216 | 1215 | $add_links = count($daysEvents) == 1; |
1217 | 1216 | |
1218 | 1217 | // the hour rows |
1219 | - for($t = $this->scroll_to_wdstart ? 0 : $this->wd_start,$i = 1+$this->extraRows; |
|
1220 | - $t <= $this->wd_end || $this->scroll_to_wdstart && $t < 24*60; |
|
1221 | - $t += $this->granularity_m,++$i) |
|
1218 | + for ($t = $this->scroll_to_wdstart ? 0 : $this->wd_start, $i = 1 + $this->extraRows; |
|
1219 | + $t <= $this->wd_end || $this->scroll_to_wdstart && $t < 24 * 60; |
|
1220 | + $t += $this->granularity_m, ++$i) |
|
1222 | 1221 | { |
1223 | 1222 | $set_id = ''; |
1224 | 1223 | if ($t == $this->wd_start) |
@@ -1231,29 +1230,29 @@ discard block |
||
1231 | 1230 | } |
1232 | 1231 | } |
1233 | 1232 | $html .= $indent."\t".'<div'.$set_id.' class="calendar_calTimeRow'.($off ? 'Off row_off' : ' row_on'). |
1234 | - '" style="height: '.$this->rowHeight.'%; top:'. $i*$this->rowHeight .'%;">'."\n"; |
|
1233 | + '" style="height: '.$this->rowHeight.'%; top:'.$i * $this->rowHeight.'%;">'."\n"; |
|
1235 | 1234 | // show time for full hours, allways for 45min interval and at least on every 3 row |
1236 | 1235 | $time = ''; |
1237 | 1236 | static $show = array( |
1238 | - 5 => array(0,15,30,45), |
|
1239 | - 10 => array(0,30), |
|
1240 | - 15 => array(0,30), |
|
1241 | - 45 => array(0,15,30,45), |
|
1237 | + 5 => array(0, 15, 30, 45), |
|
1238 | + 10 => array(0, 30), |
|
1239 | + 15 => array(0, 30), |
|
1240 | + 45 => array(0, 15, 30, 45), |
|
1242 | 1241 | ); |
1243 | - if (!isset($show[$this->granularity_m]) ? $t % 60 == 0 : in_array($t % 60,$show[$this->granularity_m])) |
|
1242 | + if (!isset($show[$this->granularity_m]) ? $t % 60 == 0 : in_array($t % 60, $show[$this->granularity_m])) |
|
1244 | 1243 | { |
1245 | - $time = $GLOBALS['egw']->common->formattime(sprintf('%02d',$t/60),sprintf('%02d',$t%60)); |
|
1244 | + $time = $GLOBALS['egw']->common->formattime(sprintf('%02d', $t / 60), sprintf('%02d', $t % 60)); |
|
1246 | 1245 | } |
1247 | - if ($add_links) $time = $this->add_link($time,$this->date,(int) ($t/60),$t%60); |
|
1246 | + if ($add_links) $time = $this->add_link($time, $this->date, (int)($t / 60), $t % 60); |
|
1248 | 1247 | $html .= $indent."\t\t".'<div class="calendar_calTimeRowTime">'.$time."</div>\n"; |
1249 | - $html .= $indent."\t</div>\n"; // calendar_calTimeRow |
|
1248 | + $html .= $indent."\t</div>\n"; // calendar_calTimeRow |
|
1250 | 1249 | $off = !$off; |
1251 | 1250 | } |
1252 | 1251 | } |
1253 | 1252 | if (is_array($daysEvents) && count($daysEvents)) |
1254 | 1253 | { |
1255 | - $numberOfDays = count($daysEvents); |
|
1256 | - $dayColWidth = 100/$numberOfDays; |
|
1254 | + $numberOfDays = count($daysEvents); |
|
1255 | + $dayColWidth = 100 / $numberOfDays; |
|
1257 | 1256 | |
1258 | 1257 | $dayCols_width = $width - $this->timeRow_width - 1; |
1259 | 1258 | |
@@ -1275,9 +1274,9 @@ discard block |
||
1275 | 1274 | } |
1276 | 1275 | $dayCol_width = $dayCols_width / count($daysEvents); |
1277 | 1276 | $n = 0; |
1278 | - foreach($daysEvents as $day => $events) |
|
1277 | + foreach ($daysEvents as $day => $events) |
|
1279 | 1278 | { |
1280 | - $this->wholeDayPosCounter=1; |
|
1279 | + $this->wholeDayPosCounter = 1; |
|
1281 | 1280 | $short_title = count($daysEvents) > 1; |
1282 | 1281 | $col_owner = $owner; |
1283 | 1282 | if (!is_numeric($day)) |
@@ -1286,15 +1285,15 @@ discard block |
||
1286 | 1285 | $day = $this->date; |
1287 | 1286 | $col_owner = $owner[$n]; |
1288 | 1287 | } |
1289 | - $html .= $this->dayColWidget($day,$events,$n*$dayColWidth, |
|
1290 | - $dayColWidth,$indent."\t\t",$short_title,++$on_off & 1,$col_owner); |
|
1288 | + $html .= $this->dayColWidget($day, $events, $n * $dayColWidth, |
|
1289 | + $dayColWidth, $indent."\t\t", $short_title, ++$on_off&1, $col_owner); |
|
1291 | 1290 | ++$n; |
1292 | 1291 | } |
1293 | 1292 | if (html::$user_agent == 'msie') $html .= "</div>\n"; |
1294 | 1293 | |
1295 | - $html .= $indent."\t</div>\n"; // calendar_calDayCols |
|
1294 | + $html .= $indent."\t</div>\n"; // calendar_calDayCols |
|
1296 | 1295 | } |
1297 | - $html .= $indent."</div>\n"; // calendar_calTimeGrid |
|
1296 | + $html .= $indent."</div>\n"; // calendar_calTimeGrid |
|
1298 | 1297 | |
1299 | 1298 | if ($this->scroll_to_wdstart) |
1300 | 1299 | { |
@@ -1322,13 +1321,13 @@ discard block |
||
1322 | 1321 | |
1323 | 1322 | // if daylight saving is switched on or off, correct $day_start |
1324 | 1323 | // gives correct times after 2am, times between 0am and 2am are wrong |
1325 | - if(($daylight_diff = $day_start + 12*HOUR_s - ($this->bo->date2ts($day_ymd."T120000")))) |
|
1324 | + if (($daylight_diff = $day_start + 12 * HOUR_s - ($this->bo->date2ts($day_ymd."T120000")))) |
|
1326 | 1325 | { |
1327 | 1326 | $day_start -= $daylight_diff; |
1328 | 1327 | } |
1329 | 1328 | |
1330 | 1329 | $eventCols = $col_ends = array(); |
1331 | - foreach($events as $event) |
|
1330 | + foreach ($events as $event) |
|
1332 | 1331 | { |
1333 | 1332 | $event['multiday'] = False; |
1334 | 1333 | $event['start_m'] = ($event['start'] - $day_start) / 60; |
@@ -1338,19 +1337,19 @@ discard block |
||
1338 | 1337 | $event['multiday'] = True; |
1339 | 1338 | } |
1340 | 1339 | $event['end_m'] = ($event['end'] - $day_start) / 60; |
1341 | - if ($event['end_m'] >= 24*60) |
|
1340 | + if ($event['end_m'] >= 24 * 60) |
|
1342 | 1341 | { |
1343 | - $event['end_m'] = 24*60-1; |
|
1342 | + $event['end_m'] = 24 * 60 - 1; |
|
1344 | 1343 | $event['multiday'] = True; |
1345 | 1344 | } |
1346 | 1345 | if ($this->use_time_grid && !$event['whole_day_on_top']) |
1347 | 1346 | { |
1348 | - for($c = 0; $event['start_m'] < $col_ends[$c]; ++$c); |
|
1347 | + for ($c = 0; $event['start_m'] < $col_ends[$c]; ++$c); |
|
1349 | 1348 | $col_ends[$c] = $event['end_m']; |
1350 | 1349 | } |
1351 | 1350 | else |
1352 | 1351 | { |
1353 | - $c = 0; // without grid we only use one column |
|
1352 | + $c = 0; // without grid we only use one column |
|
1354 | 1353 | } |
1355 | 1354 | $eventCols[$c][] = $event; |
1356 | 1355 | } |
@@ -1371,23 +1370,22 @@ discard block |
||
1371 | 1370 | * @param boolean $on_off = false start with row_on or row_off, default false=row_off |
1372 | 1371 | * @param int $owner = 0 if != 0 owner to add to the add-event link |
1373 | 1372 | */ |
1374 | - function dayColWidget($day_ymd,$events,$pleft,$pwidth,$indent,$short_title=True,$on_off=False,$owner=0) |
|
1373 | + function dayColWidget($day_ymd, $events, $pleft, $pwidth, $indent, $short_title = True, $on_off = False, $owner = 0) |
|
1375 | 1374 | { |
1376 | - if ($this->debug > 1 || $this->debug==='dayColWidget') $this->bo->debug_message('uiviews::dayColWidget(%1,%2,left=%3,width=%4,)',False,$day_ymd,$events,$pleft,$pwidth); |
|
1375 | + if ($this->debug > 1 || $this->debug === 'dayColWidget') $this->bo->debug_message('uiviews::dayColWidget(%1,%2,left=%3,width=%4,)', False, $day_ymd, $events, $pleft, $pwidth); |
|
1377 | 1376 | |
1378 | 1377 | $html = $indent.'<div id="calColumn'.$this->calColumnCounter++.'" class="calendar_calDayCol" '.'data-sortable-id="'.$owner.'" style="left: '.$pleft. |
1379 | 1378 | '%;width: '.$pwidth.'%;">'."\n"; |
1380 | 1379 | |
1381 | 1380 | // Creation of the header-column with date, evtl. holiday-names and a matching background-color |
1382 | 1381 | $ts = $this->bo->date2ts((string)$day_ymd); |
1383 | - $title = !is_bool($short_title) ? $short_title : |
|
1384 | - ($short_title ? lang(adodb_date('l',$ts)).' '.adodb_date('d.',$ts) : $this->bo->long_date($ts,0,false,true)); |
|
1382 | + $title = !is_bool($short_title) ? $short_title : ($short_title ? lang(adodb_date('l', $ts)).' '.adodb_date('d.', $ts) : $this->bo->long_date($ts, 0, false, true)); |
|
1385 | 1383 | |
1386 | 1384 | $day_view = array( |
1387 | 1385 | 'menuaction' => 'calendar.calendar_uiviews.day', |
1388 | 1386 | 'date' => $day_ymd, |
1389 | 1387 | ); |
1390 | - $this->_day_class_holiday($day_ymd,$class,$holidays); |
|
1388 | + $this->_day_class_holiday($day_ymd, $class, $holidays); |
|
1391 | 1389 | // the weekday and date |
1392 | 1390 | if (!$short_title && $holidays) $title .= html::htmlspecialchars(': '.$holidays); |
1393 | 1391 | |
@@ -1395,26 +1393,26 @@ discard block |
||
1395 | 1393 | { |
1396 | 1394 | if ($this->allowEdit) |
1397 | 1395 | { |
1398 | - $title = html::a_href($title,$day_view,'', |
|
1399 | - !isset($this->holidays[$day_ymd])?' title="'.$this->bo->long_date($ts,0,false,true).'"':''); |
|
1396 | + $title = html::a_href($title, $day_view, '', |
|
1397 | + !isset($this->holidays[$day_ymd]) ? ' title="'.$this->bo->long_date($ts, 0, false, true).'"' : ''); |
|
1400 | 1398 | } |
1401 | 1399 | } |
1402 | 1400 | elseif ($short_title === false) |
1403 | 1401 | { |
1404 | 1402 | // add arrows to go to the previous and next day (dayview only) |
1405 | - $day_view['date'] = $this->bo->date2string($ts -= 12*HOUR_s); |
|
1403 | + $day_view['date'] = $this->bo->date2string($ts -= 12 * HOUR_s); |
|
1406 | 1404 | if ($this->allowEdit) |
1407 | 1405 | { |
1408 | - $title = html::a_href(html::image('phpgwapi','left',$this->bo->long_date($ts)),$day_view).' <span> '.$title; |
|
1406 | + $title = html::a_href(html::image('phpgwapi', 'left', $this->bo->long_date($ts)), $day_view).' <span> '.$title; |
|
1409 | 1407 | } |
1410 | 1408 | else |
1411 | 1409 | { |
1412 | 1410 | $title = $day_view.' <span> '.$title; |
1413 | 1411 | } |
1414 | - $day_view['date'] = $this->bo->date2string($ts += 48*HOUR_s); |
|
1412 | + $day_view['date'] = $this->bo->date2string($ts += 48 * HOUR_s); |
|
1415 | 1413 | if ($this->allowEdit) |
1416 | 1414 | { |
1417 | - $title .= ' </span> '.html::a_href(html::image('phpgwapi','right',$this->bo->long_date($ts)),$day_view); |
|
1415 | + $title .= ' </span> '.html::a_href(html::image('phpgwapi', 'right', $this->bo->long_date($ts)), $day_view); |
|
1418 | 1416 | } |
1419 | 1417 | else |
1420 | 1418 | { |
@@ -1422,16 +1420,16 @@ discard block |
||
1422 | 1420 | } |
1423 | 1421 | } |
1424 | 1422 | if (is_bool($short_title) || ($short_title != "")) { |
1425 | - $html .= $indent."\t".'<div style="height: '. $this->rowHeight .'%;" class="calendar_calDayColHeader '.$class.'"'. |
|
1426 | - ($holidays ? ' title="'.html::htmlspecialchars($holidays).'"':'').'>'.$title."</div>\n"; |
|
1423 | + $html .= $indent."\t".'<div style="height: '.$this->rowHeight.'%;" class="calendar_calDayColHeader '.$class.'"'. |
|
1424 | + ($holidays ? ' title="'.html::htmlspecialchars($holidays).'"' : '').'>'.$title."</div>\n"; |
|
1427 | 1425 | } |
1428 | 1426 | |
1429 | 1427 | if ($this->use_time_grid) |
1430 | 1428 | { |
1431 | 1429 | // drag and drop: check if the current user has EDIT permissions on the grid |
1432 | - if($owner) |
|
1430 | + if ($owner) |
|
1433 | 1431 | { |
1434 | - $dropPermission = $this->bo->check_perms(EGW_ACL_EDIT,0,$owner); |
|
1432 | + $dropPermission = $this->bo->check_perms(EGW_ACL_EDIT, 0, $owner); |
|
1435 | 1433 | } |
1436 | 1434 | else |
1437 | 1435 | { |
@@ -1439,28 +1437,28 @@ discard block |
||
1439 | 1437 | } |
1440 | 1438 | |
1441 | 1439 | // adding divs to click on for each row / time-span |
1442 | - for($t = $this->scroll_to_wdstart ? 0 : $this->wd_start,$i = 1 + $this->extraRows; |
|
1443 | - $t <= $this->wd_end || $this->scroll_to_wdstart && $t < 24*60; |
|
1444 | - $t += $this->granularity_m,++$i) |
|
1440 | + for ($t = $this->scroll_to_wdstart ? 0 : $this->wd_start, $i = 1 + $this->extraRows; |
|
1441 | + $t <= $this->wd_end || $this->scroll_to_wdstart && $t < 24 * 60; |
|
1442 | + $t += $this->granularity_m, ++$i) |
|
1445 | 1443 | { |
1446 | 1444 | $linkData = array( |
1447 | 1445 | 'menuaction' =>'calendar.calendar_uiforms.edit', |
1448 | 1446 | 'date' => $day_ymd, |
1449 | - 'hour' => sprintf("%02d",floor($t / 60)), |
|
1450 | - 'minute' => sprintf("%02d",floor($t % 60)), |
|
1447 | + 'hour' => sprintf("%02d", floor($t / 60)), |
|
1448 | + 'minute' => sprintf("%02d", floor($t % 60)), |
|
1451 | 1449 | ); |
1452 | 1450 | if ($owner) $linkData['owner'] = $owner; |
1453 | 1451 | |
1454 | - $droppableDateTime = $linkData['date'] . "T" . $linkData['hour'] . $linkData['minute']; |
|
1455 | - $droppableID='drop_'.$droppableDateTime.'_O'.($owner<0?str_replace('-','group',$owner):$owner); |
|
1452 | + $droppableDateTime = $linkData['date']."T".$linkData['hour'].$linkData['minute']; |
|
1453 | + $droppableID = 'drop_'.$droppableDateTime.'_O'.($owner < 0 ? str_replace('-', 'group', $owner) : $owner); |
|
1456 | 1454 | |
1457 | - $html .= $indent."\t".'<div id="' . $droppableID . '" style="height:'. $this->rowHeight .'%; top: '. $i*$this->rowHeight . |
|
1455 | + $html .= $indent."\t".'<div id="'.$droppableID.'" style="height:'.$this->rowHeight.'%; top: '.$i * $this->rowHeight. |
|
1458 | 1456 | '%;" class="calendar_calAddEvent"'; |
1459 | 1457 | if ($this->allowEdit) |
1460 | 1458 | { |
1461 | - $html .= ' data-date=' .$linkData['date'].'|'.$linkData['hour'].'|'.$linkData['minute']; |
|
1459 | + $html .= ' data-date='.$linkData['date'].'|'.$linkData['hour'].'|'.$linkData['minute']; |
|
1462 | 1460 | } |
1463 | - if($dropPermission && $owner) |
|
1461 | + if ($dropPermission && $owner) |
|
1464 | 1462 | { |
1465 | 1463 | $html .= ' data-owner ='.$owner; |
1466 | 1464 | |
@@ -1470,9 +1468,9 @@ discard block |
||
1470 | 1468 | } |
1471 | 1469 | } |
1472 | 1470 | |
1473 | - $eventCols = $this->getEventCols($day_ymd,$events); |
|
1471 | + $eventCols = $this->getEventCols($day_ymd, $events); |
|
1474 | 1472 | // displaying all event columns of the day |
1475 | - foreach($eventCols as $n => $eventCol) |
|
1473 | + foreach ($eventCols as $n => $eventCol) |
|
1476 | 1474 | { |
1477 | 1475 | // equal sized columns |
1478 | 1476 | //$width = 95.0 / count($eventCols); |
@@ -1486,14 +1484,14 @@ discard block |
||
1486 | 1484 | else |
1487 | 1485 | { |
1488 | 1486 | $width = !$n ? 70 : 50; |
1489 | - $left += $n * (100.0-$left) / count($eventCols); |
|
1487 | + $left += $n * (100.0 - $left) / count($eventCols); |
|
1490 | 1488 | } |
1491 | 1489 | if ($left + $width > 100.0) $width = 100.0 - $left; |
1492 | 1490 | //echo "<p>count(\$eventCols)=".count($eventCols).", n=$n, pWidth=$pwidth, pLeft=$pleft, width=$width, left=$left</p>\n"; |
1493 | - $html .= $this->eventColWidget($eventCol,$left,$width,$indent."\t", |
|
1494 | - $owner ? $owner : $this->user, 20+10*$n); |
|
1491 | + $html .= $this->eventColWidget($eventCol, $left, $width, $indent."\t", |
|
1492 | + $owner ? $owner : $this->user, 20 + 10 * $n); |
|
1495 | 1493 | } |
1496 | - $html .= $indent."</div>\n"; // calendar_calDayCol |
|
1494 | + $html .= $indent."</div>\n"; // calendar_calDayCol |
|
1497 | 1495 | |
1498 | 1496 | return $html; |
1499 | 1497 | } |
@@ -1510,14 +1508,14 @@ discard block |
||
1510 | 1508 | * If the preferences allow birthdays to be displayed, they are cached within the holidays structure. |
1511 | 1509 | * This setting just suppressing the available data in the view. |
1512 | 1510 | */ |
1513 | - function _day_class_holiday($day_ymd,&$class,&$holidays,$only_weekend=false,$show_bdays=true) |
|
1511 | + function _day_class_holiday($day_ymd, &$class, &$holidays, $only_weekend = false, $show_bdays = true) |
|
1514 | 1512 | { |
1515 | 1513 | $class = $holidays = ''; |
1516 | 1514 | $bday = false; |
1517 | 1515 | if (isset($this->holidays[$day_ymd])) |
1518 | 1516 | { |
1519 | 1517 | $h = array(); |
1520 | - foreach($this->holidays[$day_ymd] as $holiday) |
|
1518 | + foreach ($this->holidays[$day_ymd] as $holiday) |
|
1521 | 1519 | { |
1522 | 1520 | if (isset($holiday['birthyear'])) |
1523 | 1521 | { |
@@ -1545,7 +1543,7 @@ discard block |
||
1545 | 1543 | } |
1546 | 1544 | } |
1547 | 1545 | } |
1548 | - $holidays = implode(', ',$h); |
|
1546 | + $holidays = implode(', ', $h); |
|
1549 | 1547 | } |
1550 | 1548 | if (!$class) |
1551 | 1549 | { |
@@ -1555,7 +1553,7 @@ discard block |
||
1555 | 1553 | } |
1556 | 1554 | else |
1557 | 1555 | { |
1558 | - $day = (int) date('w',$this->bo->date2ts((string) $day_ymd)); |
|
1556 | + $day = (int)date('w', $this->bo->date2ts((string)$day_ymd)); |
|
1559 | 1557 | |
1560 | 1558 | if ($only_weekend) |
1561 | 1559 | { |
@@ -1563,7 +1561,7 @@ discard block |
||
1563 | 1561 | } |
1564 | 1562 | else |
1565 | 1563 | { |
1566 | - $class = $day & 1 ? 'row_on' : 'th'; |
|
1564 | + $class = $day&1 ? 'row_on' : 'th'; |
|
1567 | 1565 | } |
1568 | 1566 | } |
1569 | 1567 | } |
@@ -1581,9 +1579,9 @@ discard block |
||
1581 | 1579 | * @param string $indent string for correct indention |
1582 | 1580 | * @param int $owner owner of the eventCol |
1583 | 1581 | */ |
1584 | - function eventColWidget($events,$left,$width,$indent,$owner,$z_index=null) |
|
1582 | + function eventColWidget($events, $left, $width, $indent, $owner, $z_index = null) |
|
1585 | 1583 | { |
1586 | - if ($this->debug > 1 || $this->debug==='eventColWidget') $this->bo->debug_message('uiviews::eventColWidget(%1,left=%2,width=%3,)',False,$events,$left,$width); |
|
1584 | + if ($this->debug > 1 || $this->debug === 'eventColWidget') $this->bo->debug_message('uiviews::eventColWidget(%1,left=%2,width=%3,)', False, $events, $left, $width); |
|
1587 | 1585 | |
1588 | 1586 | $html = $indent.'<div class="calendar_calEventCol" style="left: '.$left.'%; width:'.$width.'%;'. |
1589 | 1587 | // the "calendar_calEventCol" spans across a whole column (as the name suggests) - setting the |
@@ -1592,9 +1590,9 @@ discard block |
||
1592 | 1590 | // function. |
1593 | 1591 | //(!is_null($z_index) ? ' z-index:'.$z_index.';' : ''). |
1594 | 1592 | (!$this->use_time_grid ? ' top: '.$this->rowHeight.'%;height: '.(100 - $this->rowHeight).'%;overflow-y:auto;' : '').'">'."\n"; |
1595 | - foreach($events as $event) |
|
1593 | + foreach ($events as $event) |
|
1596 | 1594 | { |
1597 | - $html .= $this->eventWidget($event,$width,$indent."\t",$owner,false,'event_widget',$z_index); |
|
1595 | + $html .= $this->eventWidget($event, $width, $indent."\t", $owner, false, 'event_widget', $z_index); |
|
1598 | 1596 | } |
1599 | 1597 | $html .= $indent."</div>\n"; |
1600 | 1598 | |
@@ -1615,28 +1613,28 @@ discard block |
||
1615 | 1613 | * @param int $z_index is the z-index of the drag-drobable outer box of the event. |
1616 | 1614 | * @return string/array |
1617 | 1615 | */ |
1618 | - function eventWidget($event,$width,$indent,$owner,$return_array=false,$block='event_widget',$z_index=null) |
|
1616 | + function eventWidget($event, $width, $indent, $owner, $return_array = false, $block = 'event_widget', $z_index = null) |
|
1619 | 1617 | { |
1620 | - if ($this->debug > 1 || $this->debug==='eventWidget') $this->bo->debug_message('uiviews::eventWidget(%1,width=%2)',False,$event,$width); |
|
1618 | + if ($this->debug > 1 || $this->debug === 'eventWidget') $this->bo->debug_message('uiviews::eventWidget(%1,width=%2)', False, $event, $width); |
|
1621 | 1619 | |
1622 | - if($this->use_time_grid && $event['whole_day_on_top']) $block = 'event_widget_wholeday_on_top'; |
|
1620 | + if ($this->use_time_grid && $event['whole_day_on_top']) $block = 'event_widget_wholeday_on_top'; |
|
1623 | 1621 | |
1624 | 1622 | static $tpl = False; |
1625 | 1623 | if (!$tpl) |
1626 | 1624 | { |
1627 | 1625 | $tpl = new Template(common::get_tpl_dir('calendar')); |
1628 | 1626 | |
1629 | - $tpl->set_file('event_widget_t','event_widget.tpl'); |
|
1630 | - $tpl->set_block('event_widget_t','event_widget'); |
|
1631 | - $tpl->set_block('event_widget_t','event_widget_wholeday_on_top'); |
|
1632 | - $tpl->set_block('event_widget_t','event_tooltip'); |
|
1633 | - $tpl->set_block('event_widget_t','planner_event'); |
|
1627 | + $tpl->set_file('event_widget_t', 'event_widget.tpl'); |
|
1628 | + $tpl->set_block('event_widget_t', 'event_widget'); |
|
1629 | + $tpl->set_block('event_widget_t', 'event_widget_wholeday_on_top'); |
|
1630 | + $tpl->set_block('event_widget_t', 'event_tooltip'); |
|
1631 | + $tpl->set_block('event_widget_t', 'planner_event'); |
|
1634 | 1632 | } |
1635 | - if (($return_array || $event['start_m'] == 0) && $event['end_m'] >= 24*60-1) |
|
1633 | + if (($return_array || $event['start_m'] == 0) && $event['end_m'] >= 24 * 60 - 1) |
|
1636 | 1634 | { |
1637 | - if ($return_array && $event['end_m'] > 24*60) |
|
1635 | + if ($return_array && $event['end_m'] > 24 * 60) |
|
1638 | 1636 | { |
1639 | - $timespan = $this->bo->format_date($event['start'],false).' - '.$this->bo->format_date($event['end']); |
|
1637 | + $timespan = $this->bo->format_date($event['start'], false).' - '.$this->bo->format_date($event['end']); |
|
1640 | 1638 | } |
1641 | 1639 | else |
1642 | 1640 | { |
@@ -1645,49 +1643,49 @@ discard block |
||
1645 | 1643 | } |
1646 | 1644 | else |
1647 | 1645 | { |
1648 | - $timespan = $this->bo->timespan($event['start_m'],$event['end_m']); |
|
1646 | + $timespan = $this->bo->timespan($event['start_m'], $event['end_m']); |
|
1649 | 1647 | } |
1650 | 1648 | $icons = array(); |
1651 | - if(!(int)$event['id'] && preg_match('/^([a-z_-]+)([0-9]+)$/i',$event['id'],$matches)) |
|
1649 | + if (!(int)$event['id'] && preg_match('/^([a-z_-]+)([0-9]+)$/i', $event['id'], $matches)) |
|
1652 | 1650 | { |
1653 | 1651 | $app = $matches[1]; |
1654 | 1652 | $app_id = $matches[2]; |
1655 | - if (($is_private = calendar_bo::integration_get_private($app,$app_id,$event))) |
|
1653 | + if (($is_private = calendar_bo::integration_get_private($app, $app_id, $event))) |
|
1656 | 1654 | { |
1657 | - $icons[] = html::image('calendar','private'); |
|
1655 | + $icons[] = html::image('calendar', 'private'); |
|
1658 | 1656 | } |
1659 | 1657 | else |
1660 | 1658 | { |
1661 | - $icons = self::integration_get_icons($app,$app_id,$event); |
|
1659 | + $icons = self::integration_get_icons($app, $app_id, $event); |
|
1662 | 1660 | } |
1663 | 1661 | } |
1664 | - elseif($event['id']) |
|
1662 | + elseif ($event['id']) |
|
1665 | 1663 | { |
1666 | - if (($is_private = !$this->bo->check_perms(EGW_ACL_READ,$event))) |
|
1664 | + if (($is_private = !$this->bo->check_perms(EGW_ACL_READ, $event))) |
|
1667 | 1665 | { |
1668 | - $icons = array(html::image('calendar','private')); |
|
1666 | + $icons = array(html::image('calendar', 'private')); |
|
1669 | 1667 | } |
1670 | 1668 | else |
1671 | 1669 | { |
1672 | 1670 | $icons = $this->event_icons($event); |
1673 | 1671 | } |
1674 | 1672 | } |
1675 | - $cats = $this->bo->categories($this->categories->check_list(EGW_ACL_READ, $event['category']),$color); |
|
1673 | + $cats = $this->bo->categories($this->categories->check_list(EGW_ACL_READ, $event['category']), $color); |
|
1676 | 1674 | // these values control varius aspects of the geometry of the eventWidget |
1677 | - $small_trigger_width = 120 + 20*count($icons); |
|
1678 | - $corner_radius=$width > $small_trigger_width ? 10 : 5; |
|
1679 | - $header_height=$width > $small_trigger_width ? 19 : 12; // multi_3 icon has a height of 19=16+2*1padding+1border ! |
|
1675 | + $small_trigger_width = 120 + 20 * count($icons); |
|
1676 | + $corner_radius = $width > $small_trigger_width ? 10 : 5; |
|
1677 | + $header_height = $width > $small_trigger_width ? 19 : 12; // multi_3 icon has a height of 19=16+2*1padding+1border ! |
|
1680 | 1678 | if (!$return_array) |
1681 | 1679 | { |
1682 | - $height = $this->times2height($event['start_m'],$event['end_m'],$header_height); |
|
1680 | + $height = $this->times2height($event['start_m'], $event['end_m'], $header_height); |
|
1683 | 1681 | } |
1684 | 1682 | //$body_height = max(0,$height - $header_height - $corner_radius); |
1685 | - $border=1; |
|
1683 | + $border = 1; |
|
1686 | 1684 | $headerbgcolor = $color ? $color : '#808080'; |
1687 | 1685 | $headercolor = self::brightness($headerbgcolor) > 128 ? 'black' : 'white'; |
1688 | 1686 | // the body-colors (gradient) are calculated from the headercolor, which depends on the cat of an event |
1689 | - $bodybgcolor1 = $this->brighter($headerbgcolor,$headerbgcolor == '#808080' ? 100 : 170); |
|
1690 | - $bodybgcolor2 = $this->brighter($headerbgcolor,220); |
|
1687 | + $bodybgcolor1 = $this->brighter($headerbgcolor, $headerbgcolor == '#808080' ? 100 : 170); |
|
1688 | + $bodybgcolor2 = $this->brighter($headerbgcolor, 220); |
|
1691 | 1689 | |
1692 | 1690 | // mark event as invitation, by NOT using category based background color, but plain white |
1693 | 1691 | if ($event['participants'][$this->user][0] == 'U') |
@@ -1697,11 +1695,11 @@ discard block |
||
1697 | 1695 | |
1698 | 1696 | // get status class of event: calendar_calEventAllAccepted, calendar_calEventAllAnswered or calendar_calEventSomeUnknown |
1699 | 1697 | $status_class = 'calendar_calEventAllAccepted'; |
1700 | - foreach($event['participants'] as $id => $status) |
|
1698 | + foreach ($event['participants'] as $id => $status) |
|
1701 | 1699 | { |
1702 | - if ($id < 0) continue; // as we cant accept/reject groups, we dont care about them here |
|
1700 | + if ($id < 0) continue; // as we cant accept/reject groups, we dont care about them here |
|
1703 | 1701 | |
1704 | - calendar_so::split_status($status,$quantity,$role); |
|
1702 | + calendar_so::split_status($status, $quantity, $role); |
|
1705 | 1703 | |
1706 | 1704 | switch ($status) |
1707 | 1705 | { |
@@ -1710,7 +1708,7 @@ discard block |
||
1710 | 1708 | break; |
1711 | 1709 | case 'U': |
1712 | 1710 | $status_class = 'calendar_calEventSomeUnknown'; |
1713 | - break 2; // break foreach |
|
1711 | + break 2; // break foreach |
|
1714 | 1712 | default: |
1715 | 1713 | $status_class = 'calendar_calEventAllAnswered'; |
1716 | 1714 | break; |
@@ -1720,48 +1718,46 @@ discard block |
||
1720 | 1718 | $part_array = array(); |
1721 | 1719 | if ($this->allowEdit) |
1722 | 1720 | { |
1723 | - foreach($this->bo->participants($event) as $part_key => $participant) |
|
1721 | + foreach ($this->bo->participants($event) as $part_key => $participant) |
|
1724 | 1722 | { |
1725 | - if(is_numeric($part_key)) |
|
1723 | + if (is_numeric($part_key)) |
|
1726 | 1724 | { |
1727 | 1725 | $part_array[lang('Participants')][$part_key] = $participant; |
1728 | 1726 | } |
1729 | - elseif(isset($this->bo->resources[$part_key[0]])) |
|
1727 | + elseif (isset($this->bo->resources[$part_key[0]])) |
|
1730 | 1728 | { |
1731 | 1729 | $part_array[((isset($this->bo->resources[$part_key[0]]['participants_header'])) ? $this->bo->resources[$part_key[0]]['participants_header'] : lang($this->bo->resources[$part_key[0]]['app']))][$part_key] = $participant; |
1732 | 1730 | } |
1733 | 1731 | } |
1734 | - foreach($part_array as $part_group => $participant) |
|
1732 | + foreach ($part_array as $part_group => $participant) |
|
1735 | 1733 | { |
1736 | - $participants .= $this->add_nonempty($participant,$part_group,True,False,false); |
|
1734 | + $participants .= $this->add_nonempty($participant, $part_group, True, False, false); |
|
1737 | 1735 | } |
1738 | 1736 | } |
1739 | 1737 | // as we only deal with percentual widht, we consider only the full dayview (1 colum) as NOT small |
1740 | 1738 | $small = $this->view != 'day' || $width < 50; |
1741 | 1739 | // $small = $width <= $small_trigger_width |
1742 | 1740 | |
1743 | - $small_height = $this->use_time_grid && ( $event['end_m']-$event['start_m'] < 2*$this->granularity_m || |
|
1741 | + $small_height = $this->use_time_grid && ($event['end_m'] - $event['start_m'] < 2 * $this->granularity_m || |
|
1744 | 1742 | $event['end_m'] <= $this->wd_start || $event['start_m'] >= $this->wd_end); |
1745 | 1743 | |
1746 | 1744 | $tpl->set_var(array( |
1747 | 1745 | // event-content, some of it displays only if it really has content or is needed |
1748 | 1746 | 'owner' => $GLOBALS['egw']->common->grab_owner_name($event['owner']), |
1749 | - 'header_icons' => $small ? '' : implode("",$icons), |
|
1750 | - 'body_icons' => $small ? implode("\n",$icons) : '', |
|
1751 | - 'icons' => implode('',$icons), |
|
1747 | + 'header_icons' => $small ? '' : implode("", $icons), |
|
1748 | + 'body_icons' => $small ? implode("\n", $icons) : '', |
|
1749 | + 'icons' => implode('', $icons), |
|
1752 | 1750 | 'timespan' => $timespan, |
1753 | 1751 | 'title' => ($title = !$is_private ? html::htmlspecialchars($event['title']) : lang('private')), |
1754 | 1752 | 'header' => $small_height ? $title : $timespan, |
1755 | 1753 | 'description' => !$is_private ? nl2br(html::htmlspecialchars($event['description'])) : '', |
1756 | - 'location' => !$is_private ? $this->add_nonempty($event['location'],lang('Location')) : '', |
|
1754 | + 'location' => !$is_private ? $this->add_nonempty($event['location'], lang('Location')) : '', |
|
1757 | 1755 | 'participants' => $participants, |
1758 | - 'times' => !$event['multiday'] ? $this->add_nonempty($this->bo->timespan($event['start_m'],$event['end_m'],true),lang('Time')) : |
|
1759 | - $this->add_nonempty($this->bo->format_date($event['start']),lang('Start')). |
|
1760 | - $this->add_nonempty($this->bo->format_date($event['end']),lang('End')), |
|
1761 | - 'multidaytimes' => !$event['multiday'] ? '' : |
|
1762 | - $this->add_nonempty($this->bo->format_date($event['start']),lang('Start')). |
|
1763 | - $this->add_nonempty($this->bo->format_date($event['end']),lang('End')), |
|
1764 | - 'category' => !$is_private ? $this->add_nonempty($cats,lang('Category')) : '', |
|
1756 | + 'times' => !$event['multiday'] ? $this->add_nonempty($this->bo->timespan($event['start_m'], $event['end_m'], true), lang('Time')) : $this->add_nonempty($this->bo->format_date($event['start']), lang('Start')). |
|
1757 | + $this->add_nonempty($this->bo->format_date($event['end']), lang('End')), |
|
1758 | + 'multidaytimes' => !$event['multiday'] ? '' : $this->add_nonempty($this->bo->format_date($event['start']), lang('Start')). |
|
1759 | + $this->add_nonempty($this->bo->format_date($event['end']), lang('End')), |
|
1760 | + 'category' => !$is_private ? $this->add_nonempty($cats, lang('Category')) : '', |
|
1765 | 1761 | // the tooltip is based on the content of the actual widget, this way it takes no extra bandwidth/volum |
1766 | 1762 | // 'tooltip' => html::tooltip(False,False,array('BorderWidth'=>0,'Padding'=>0)), |
1767 | 1763 | // various aspects of the geometry or style |
@@ -1769,7 +1765,7 @@ discard block |
||
1769 | 1765 | 'header_height' => $header_height.'px', |
1770 | 1766 | //'body_height' => $body_height.'px', |
1771 | 1767 | 'height' => $height, |
1772 | - 'width' => ($width-20).'px', |
|
1768 | + 'width' => ($width - 20).'px', |
|
1773 | 1769 | 'border' => $border, |
1774 | 1770 | 'bordercolor' => $headerbgcolor, |
1775 | 1771 | 'headerbgcolor' => $headerbgcolor, |
@@ -1777,7 +1773,7 @@ discard block |
||
1777 | 1773 | 'bodybackground' => ($background = 'url('.$GLOBALS['egw_info']['server']['webserver_url']. |
1778 | 1774 | '/calendar/inc/gradient.php?color1='.urlencode($bodybgcolor1).'&color2='.urlencode($bodybgcolor2). |
1779 | 1775 | '&width='.$width.') repeat-y '.$bodybgcolor2), |
1780 | - 'Small' => $small ? 'Small' : '', // to use in css class-names |
|
1776 | + 'Small' => $small ? 'Small' : '', // to use in css class-names |
|
1781 | 1777 | 'indent' => $indent."\t", |
1782 | 1778 | 'status_class' => $status_class, |
1783 | 1779 | )); |
@@ -1808,16 +1804,16 @@ discard block |
||
1808 | 1804 | $tpl->set_var('bodydescription', ''); |
1809 | 1805 | } |
1810 | 1806 | |
1811 | - $tooltip = $tpl->fp('tooltip','event_tooltip'); |
|
1812 | - $html = $tpl->fp('out',$block); |
|
1807 | + $tooltip = $tpl->fp('tooltip', 'event_tooltip'); |
|
1808 | + $html = $tpl->fp('out', $block); |
|
1813 | 1809 | |
1814 | 1810 | if ($is_private || !$this->allowEdit) |
1815 | 1811 | { |
1816 | 1812 | $popup = ''; |
1817 | 1813 | } |
1818 | - elseif($app && $app_id) |
|
1814 | + elseif ($app && $app_id) |
|
1819 | 1815 | { |
1820 | - $popup = $this->integration_get_popup($app,$app_id); |
|
1816 | + $popup = $this->integration_get_popup($app, $app_id); |
|
1821 | 1817 | } |
1822 | 1818 | else |
1823 | 1819 | { |
@@ -1830,7 +1826,7 @@ discard block |
||
1830 | 1826 | $popup = $event['id']."|n"; |
1831 | 1827 | } |
1832 | 1828 | } |
1833 | - $tooltip = html::htmlspecialchars($tooltip, true); // true=need double-encoding, as it is transported as attribute! |
|
1829 | + $tooltip = html::htmlspecialchars($tooltip, true); // true=need double-encoding, as it is transported as attribute! |
|
1834 | 1830 | //_debug_array($event); |
1835 | 1831 | |
1836 | 1832 | if ($return_array) |
@@ -1845,17 +1841,17 @@ discard block |
||
1845 | 1841 | } |
1846 | 1842 | |
1847 | 1843 | $draggableID = $event['id'].($event['recur_type'] ? ':'.$event['start'] : ''). |
1848 | - '_O'.$event['owner'].'_C'.($owner<0?str_replace('-','group',$owner):$owner); |
|
1844 | + '_O'.$event['owner'].'_C'.($owner < 0 ? str_replace('-', 'group', $owner) : $owner); |
|
1849 | 1845 | |
1850 | 1846 | if ($this->use_time_grid) |
1851 | 1847 | { |
1852 | - if($event['whole_day_on_top']) |
|
1848 | + if ($event['whole_day_on_top']) |
|
1853 | 1849 | { |
1854 | - $style = 'top: '.($this->rowHeight*$this->wholeDayPosCounter).'%; height: '.$this->rowHeight.'%;'; |
|
1850 | + $style = 'top: '.($this->rowHeight * $this->wholeDayPosCounter).'%; height: '.$this->rowHeight.'%;'; |
|
1855 | 1851 | $this->wholeDayPosCounter++; |
1856 | 1852 | } |
1857 | 1853 | else |
1858 | - { $view_link = $GLOBALS['egw']->link('/index.php',array('menuaction'=>'calendar.calendar_uiforms.edit','cal_id'=>$event['id'],'date'=>$this->bo->date2string($event['start']))); |
|
1854 | + { $view_link = $GLOBALS['egw']->link('/index.php', array('menuaction'=>'calendar.calendar_uiforms.edit', 'cal_id'=>$event['id'], 'date'=>$this->bo->date2string($event['start']))); |
|
1859 | 1855 | |
1860 | 1856 | $style = 'top: '.$this->time2pos($event['start_m']).'%; height: '.$height.'%;'; |
1861 | 1857 | } |
@@ -1870,17 +1866,17 @@ discard block |
||
1870 | 1866 | $z_index = is_null($z_index) ? 20 : (int)$z_index; |
1871 | 1867 | |
1872 | 1868 | if ($this->use_time_grid && |
1873 | - ((int)$event['id'] || substr($event['id'],0,7) == 'infolog') && $this->bo->check_perms(EGW_ACL_EDIT,$event)) |
|
1869 | + ((int)$event['id'] || substr($event['id'], 0, 7) == 'infolog') && $this->bo->check_perms(EGW_ACL_EDIT, $event)) |
|
1874 | 1870 | { |
1875 | 1871 | if (!$event['whole_day_on_top'] && |
1876 | 1872 | !$event['whole_day'] && |
1877 | 1873 | !$event['recur_type']) |
1878 | 1874 | { |
1879 | - $draggableID = 'drag_'.$event['id'].($event['recur_type'] ? ':'.$event['start'] : '').'_O'.$event['owner'].'_C'.($owner<0?str_replace('-','group',$owner):$owner); |
|
1875 | + $draggableID = 'drag_'.$event['id'].($event['recur_type'] ? ':'.$event['start'] : '').'_O'.$event['owner'].'_C'.($owner < 0 ? str_replace('-', 'group', $owner) : $owner); |
|
1880 | 1876 | } |
1881 | 1877 | else |
1882 | 1878 | { |
1883 | - $draggableID = 'drag_'.$event['id'].($event['recur_type'] ? ':'.$event['start'] : '').'_O'.$event['owner'].'_C'.($owner<0?str_replace('-','group',$owner):$owner); |
|
1879 | + $draggableID = 'drag_'.$event['id'].($event['recur_type'] ? ':'.$event['start'] : '').'_O'.$event['owner'].'_C'.($owner < 0 ? str_replace('-', 'group', $owner) : $owner); |
|
1884 | 1880 | |
1885 | 1881 | } |
1886 | 1882 | } |
@@ -1889,7 +1885,7 @@ discard block |
||
1889 | 1885 | { |
1890 | 1886 | // S represents Series |
1891 | 1887 | // '' represents Single |
1892 | - $eventTypeTag = $event['recur_type']?'S':''; |
|
1888 | + $eventTypeTag = $event['recur_type'] ? 'S' : ''; |
|
1893 | 1889 | } |
1894 | 1890 | else if (!$event['recur_type']) |
1895 | 1891 | { |
@@ -1902,9 +1898,9 @@ discard block |
||
1902 | 1898 | $eventTypeTag = 'WDS'; |
1903 | 1899 | } |
1904 | 1900 | // Helps client-side to bind handler to events with specific types tag |
1905 | - $resizableHelper = $this->bo->date2string($event['start']). '|' .$this->bo->format_date($event['start'],false) . '|' . $this->cal_prefs['interval'].'|'.$eventTypeTag; |
|
1901 | + $resizableHelper = $this->bo->date2string($event['start']).'|'.$this->bo->format_date($event['start'], false).'|'.$this->cal_prefs['interval'].'|'.$eventTypeTag; |
|
1906 | 1902 | |
1907 | - $html = $indent.'<div id="'.$draggableID.'" data-tooltip ="'.$tooltip .'" data-resize="'.$resizableHelper.'" class="calendar_calEvent'.($is_private ? 'Private' : '').' '.$status_class. |
|
1903 | + $html = $indent.'<div id="'.$draggableID.'" data-tooltip ="'.$tooltip.'" data-resize="'.$resizableHelper.'" class="calendar_calEvent'.($is_private ? 'Private' : '').' '.$status_class. |
|
1908 | 1904 | '" style="'.$style.' border-color: '.$headerbgcolor.'; background: '.$background.'; z-index: '.$z_index.';"'. |
1909 | 1905 | '>'.$prefix_icon."\n".$html."\n". |
1910 | 1906 | $indent."</div>"."\n"; |
@@ -1924,9 +1920,9 @@ discard block |
||
1924 | 1920 | * @param int|string $id |
1925 | 1921 | * @return string |
1926 | 1922 | */ |
1927 | - function integration_get_popup($app,$id) |
|
1923 | + function integration_get_popup($app, $id) |
|
1928 | 1924 | { |
1929 | - $app_data = calendar_bo::integration_get_data($app,'edit_link'); |
|
1925 | + $app_data = calendar_bo::integration_get_data($app, 'edit_link'); |
|
1930 | 1926 | |
1931 | 1927 | if (is_array($app_data) && isset($app_data['edit'])) |
1932 | 1928 | { |
@@ -1936,11 +1932,11 @@ discard block |
||
1936 | 1932 | } |
1937 | 1933 | else |
1938 | 1934 | { |
1939 | - $edit = egw_link::edit($app,$id,$popup_size); |
|
1935 | + $edit = egw_link::edit($app, $id, $popup_size); |
|
1940 | 1936 | } |
1941 | 1937 | if ($edit) |
1942 | 1938 | { |
1943 | - $view_link = egw::link('/index.php',$edit); |
|
1939 | + $view_link = egw::link('/index.php', $edit); |
|
1944 | 1940 | |
1945 | 1941 | if ($popup_size) |
1946 | 1942 | { |
@@ -1967,50 +1963,50 @@ discard block |
||
1967 | 1963 | * @param array $event |
1968 | 1964 | * @return array |
1969 | 1965 | */ |
1970 | - static function integration_get_icons($app,$id,$event) |
|
1966 | + static function integration_get_icons($app, $id, $event) |
|
1971 | 1967 | { |
1972 | 1968 | $icons = array(); |
1973 | 1969 | if ($event['icons']) |
1974 | 1970 | { |
1975 | - foreach(explode(',',$event['icons']) as $icon) |
|
1971 | + foreach (explode(',', $event['icons']) as $icon) |
|
1976 | 1972 | { |
1977 | - list($icon_app,$icon) = explode(':',$icon); |
|
1978 | - if (common::find_image($icon_app,$icon)) |
|
1973 | + list($icon_app, $icon) = explode(':', $icon); |
|
1974 | + if (common::find_image($icon_app, $icon)) |
|
1979 | 1975 | { |
1980 | - $icons[] = html::image($icon_app,$icon); |
|
1976 | + $icons[] = html::image($icon_app, $icon); |
|
1981 | 1977 | } |
1982 | 1978 | } |
1983 | 1979 | } |
1984 | - $app_data = calendar_bo::integration_get_data($app,'icons'); |
|
1980 | + $app_data = calendar_bo::integration_get_data($app, 'icons'); |
|
1985 | 1981 | if (is_null($app_data)) |
1986 | 1982 | { |
1987 | - $icons[] = html::image($app,'navbar'); // use navbar icon |
|
1983 | + $icons[] = html::image($app, 'navbar'); // use navbar icon |
|
1988 | 1984 | } |
1989 | 1985 | elseif ($app_data) |
1990 | 1986 | { |
1991 | - $icons += (array)ExecMethod2($app_data,$id,$event); |
|
1987 | + $icons += (array)ExecMethod2($app_data, $id, $event); |
|
1992 | 1988 | } |
1993 | 1989 | return $icons; |
1994 | 1990 | } |
1995 | 1991 | |
1996 | - function add_nonempty($content,$label,$one_per_line=False,$space = True,$htmlspecialchars=true) |
|
1992 | + function add_nonempty($content, $label, $one_per_line = False, $space = True, $htmlspecialchars = true) |
|
1997 | 1993 | { |
1998 | 1994 | if (is_array($content)) |
1999 | 1995 | { |
2000 | - if($space) |
|
1996 | + if ($space) |
|
2001 | 1997 | { |
2002 | - $content = implode($one_per_line ? ",\n" : ', ',$content); |
|
1998 | + $content = implode($one_per_line ? ",\n" : ', ', $content); |
|
2003 | 1999 | } |
2004 | 2000 | else |
2005 | 2001 | { |
2006 | - $content = implode($one_per_line ? "\n" : ', ',$content); |
|
2002 | + $content = implode($one_per_line ? "\n" : ', ', $content); |
|
2007 | 2003 | } |
2008 | 2004 | } |
2009 | 2005 | if (!empty($content)) |
2010 | 2006 | { |
2011 | 2007 | return '<span class="calendar_calEventLabel">'.$label.'</span>:'. |
2012 | 2008 | ($one_per_line ? '<br>' : ' '). |
2013 | - nl2br($htmlspecialchars?html::htmlspecialchars($content):$content).'<br>'; |
|
2009 | + nl2br($htmlspecialchars ? html::htmlspecialchars($content) : $content).'<br>'; |
|
2014 | 2010 | } |
2015 | 2011 | return ''; |
2016 | 2012 | } |
@@ -2022,18 +2018,18 @@ discard block |
||
2022 | 2018 | * @param $decr int value to add to each component, default 64 |
2023 | 2019 | * @return string the brighter color |
2024 | 2020 | */ |
2025 | - static function brighter($rgb,$decr=64) |
|
2021 | + static function brighter($rgb, $decr = 64) |
|
2026 | 2022 | { |
2027 | - if (!preg_match('/^#?([0-9A-Fa-f]{2})([0-9A-Fa-f]{2})([0-9A-Fa-f]{2})$/',$rgb,$components)) |
|
2023 | + if (!preg_match('/^#?([0-9A-Fa-f]{2})([0-9A-Fa-f]{2})([0-9A-Fa-f]{2})$/', $rgb, $components)) |
|
2028 | 2024 | { |
2029 | 2025 | return '#ffffff'; |
2030 | 2026 | } |
2031 | 2027 | $brighter = '#'; |
2032 | - for ($i = 1; $i <=3; ++$i) |
|
2028 | + for ($i = 1; $i <= 3; ++$i) |
|
2033 | 2029 | { |
2034 | 2030 | $val = hexdec($components[$i]) + $decr; |
2035 | 2031 | if ($val > 255) $val = 255; |
2036 | - $brighter .= sprintf('%02x',$val); |
|
2032 | + $brighter .= sprintf('%02x', $val); |
|
2037 | 2033 | } |
2038 | 2034 | //echo "brighter($rgb=".print_r($components,True).")=$brighter</p>\n"; |
2039 | 2035 | return $brighter; |
@@ -2049,12 +2045,12 @@ discard block |
||
2049 | 2045 | { |
2050 | 2046 | if ($rgb[0] != '#' || strlen($rgb) != 7) |
2051 | 2047 | { |
2052 | - return 128; // no rgb color, return some default |
|
2048 | + return 128; // no rgb color, return some default |
|
2053 | 2049 | } |
2054 | - $dec = hexdec(substr($rgb,1)); |
|
2055 | - for($i = 0; $i < 24; $i += 8) |
|
2050 | + $dec = hexdec(substr($rgb, 1)); |
|
2051 | + for ($i = 0; $i < 24; $i += 8) |
|
2056 | 2052 | { |
2057 | - $sum += ($dec >> $i) & 255; |
|
2053 | + $sum += ($dec >> $i)&255; |
|
2058 | 2054 | } |
2059 | 2055 | return (int)round($sum / 3.0, 0); |
2060 | 2056 | } |
@@ -2076,7 +2072,7 @@ discard block |
||
2076 | 2072 | * @param string $indent = '' string for correct indention |
2077 | 2073 | * @return string with widget |
2078 | 2074 | */ |
2079 | - function &plannerWidget(&$events,$start,$end,$by_cat=0,$indent='') |
|
2075 | + function &plannerWidget(&$events, $start, $end, $by_cat = 0, $indent = '') |
|
2080 | 2076 | { |
2081 | 2077 | $content = $indent.'<div class="calendar_plannerWidget">'."\n"; |
2082 | 2078 | |
@@ -2084,7 +2080,7 @@ discard block |
||
2084 | 2080 | $content .= $indent."\t".'<div class="calendar_plannerHeader">'."\n"; |
2085 | 2081 | |
2086 | 2082 | // display the headerTitle, and get sort2labels |
2087 | - switch($by_cat) |
|
2083 | + switch ($by_cat) |
|
2088 | 2084 | { |
2089 | 2085 | case 'user': |
2090 | 2086 | $title = lang('User'); |
@@ -2094,7 +2090,7 @@ discard block |
||
2094 | 2090 | $title = lang('Month'); |
2095 | 2091 | $sort2label = array(); |
2096 | 2092 | $time = new egw_time($start); |
2097 | - for($n = 0; $n < self::YEARLY_PLANNER_NUM_MONTH; ++$n) |
|
2093 | + for ($n = 0; $n < self::YEARLY_PLANNER_NUM_MONTH; ++$n) |
|
2098 | 2094 | { |
2099 | 2095 | $sort2label[$time->format('Y-m')] = lang($time->format('F')).' '.$time->format('Y'); |
2100 | 2096 | $time->modify('+1 month'); |
@@ -2110,7 +2106,7 @@ discard block |
||
2110 | 2106 | // display the headerRows with the scales |
2111 | 2107 | $content .= $indent."\t\t".'<div class="calendar_plannerHeaderRows">'."\n"; |
2112 | 2108 | // set start & end to timestamp and first & last to timestamp of 12h midday, to avoid trouble with daylight saving |
2113 | - foreach(array('start' => 'first','end' => 'last') as $t => $v) |
|
2109 | + foreach (array('start' => 'first', 'end' => 'last') as $t => $v) |
|
2114 | 2110 | { |
2115 | 2111 | $$t = $this->bo->date2ts($$t); |
2116 | 2112 | $$v = $this->bo->date2array($$t); |
@@ -2125,23 +2121,23 @@ discard block |
||
2125 | 2121 | } |
2126 | 2122 | else |
2127 | 2123 | { |
2128 | - $days = 1 + (int) round(($last - $first) / DAY_s); // we have to use round to get the right number if daylight saving changes |
|
2124 | + $days = 1 + (int)round(($last - $first) / DAY_s); // we have to use round to get the right number if daylight saving changes |
|
2129 | 2125 | if ($days >= 28) // display the month scale |
2130 | 2126 | { |
2131 | - $content .= $this->plannerMonthScale($first,$days,$indent."\t\t\t"); |
|
2127 | + $content .= $this->plannerMonthScale($first, $days, $indent."\t\t\t"); |
|
2132 | 2128 | } |
2133 | 2129 | if ($days >= 5) // display the week scale |
2134 | 2130 | { |
2135 | - $content .= $this->plannerWeekScale($first,$days,$indent."\t\t\t"); |
|
2131 | + $content .= $this->plannerWeekScale($first, $days, $indent."\t\t\t"); |
|
2136 | 2132 | } |
2137 | - $content .= $this->plannerDayScale($first,$days,$indent."\t\t\t"); // day-scale, always displayed |
|
2133 | + $content .= $this->plannerDayScale($first, $days, $indent."\t\t\t"); // day-scale, always displayed |
|
2138 | 2134 | if ($days <= 7) // display the hour scale |
2139 | 2135 | { |
2140 | - $content .= $this->plannerHourScale($start,$days,$indent."\t\t\t"); |
|
2136 | + $content .= $this->plannerHourScale($start, $days, $indent."\t\t\t"); |
|
2141 | 2137 | } |
2142 | 2138 | } |
2143 | - $content .= $indent."\t\t</div>\n"; // end of the plannerHeaderRows |
|
2144 | - $content .= $indent."\t</div>\n"; // end of the plannerHeader |
|
2139 | + $content .= $indent."\t\t</div>\n"; // end of the plannerHeaderRows |
|
2140 | + $content .= $indent."\t</div>\n"; // end of the plannerHeader |
|
2145 | 2141 | |
2146 | 2142 | // sort the events after user or category |
2147 | 2143 | $rows = array(); |
@@ -2150,10 +2146,10 @@ discard block |
||
2150 | 2146 | if ($by_cat === 'user') // planner by user |
2151 | 2147 | { |
2152 | 2148 | // convert filter to allowed status |
2153 | - switch($this->filter) |
|
2149 | + switch ($this->filter) |
|
2154 | 2150 | { |
2155 | 2151 | case 'unknown': |
2156 | - $status_to_show = array('U','G'); break; |
|
2152 | + $status_to_show = array('U', 'G'); break; |
|
2157 | 2153 | case 'accepted': |
2158 | 2154 | $status_to_show = array('A'); break; |
2159 | 2155 | case 'tentative': |
@@ -2163,65 +2159,65 @@ discard block |
||
2163 | 2159 | case 'delegated': |
2164 | 2160 | $status_to_show = array('D'); break; |
2165 | 2161 | case 'all': |
2166 | - $status_to_show = array('U','A','T','D','G','R'); break; |
|
2162 | + $status_to_show = array('U', 'A', 'T', 'D', 'G', 'R'); break; |
|
2167 | 2163 | default: |
2168 | - $status_to_show = array('U','A','T','D','G'); break; |
|
2164 | + $status_to_show = array('U', 'A', 'T', 'D', 'G'); break; |
|
2169 | 2165 | } |
2170 | 2166 | } |
2171 | - foreach($events as $key => $event) |
|
2167 | + foreach ($events as $key => $event) |
|
2172 | 2168 | { |
2173 | 2169 | if ($by_cat === 'user') // planner by user |
2174 | 2170 | { |
2175 | - foreach($event['participants'] as $sort => $status) |
|
2171 | + foreach ($event['participants'] as $sort => $status) |
|
2176 | 2172 | { |
2177 | - calendar_so::split_status($status,$nul,$nul); |
|
2173 | + calendar_so::split_status($status, $nul, $nul); |
|
2178 | 2174 | // only show if participant with status visible with current filter |
2179 | - if (isset($sort2label[$sort]) && (in_array($status,$status_to_show) || |
|
2175 | + if (isset($sort2label[$sort]) && (in_array($status, $status_to_show) || |
|
2180 | 2176 | $this->filter == 'owner' && $event['owner'] == $sort)) // owner too additionally uses owner |
2181 | 2177 | { |
2182 | - $rows[$sort][] =& $events[$key]; |
|
2178 | + $rows[$sort][] = & $events[$key]; |
|
2183 | 2179 | } |
2184 | 2180 | } |
2185 | 2181 | } |
2186 | 2182 | elseif ($by_cat === 'month') // planner by month / yearly planner |
2187 | 2183 | { |
2188 | - $sort = date('Y-m',$event['start']); |
|
2189 | - $rows[$sort][] =& $events[$key]; |
|
2184 | + $sort = date('Y-m', $event['start']); |
|
2185 | + $rows[$sort][] = & $events[$key]; |
|
2190 | 2186 | // end in a different month? |
2191 | - if ($sort != ($end_sort = date('Y-m',$event['end']))) |
|
2187 | + if ($sort != ($end_sort = date('Y-m', $event['end']))) |
|
2192 | 2188 | { |
2193 | - while($sort != $end_sort) |
|
2189 | + while ($sort != $end_sort) |
|
2194 | 2190 | { |
2195 | - list($y,$m) = explode('-',$sort); |
|
2191 | + list($y, $m) = explode('-', $sort); |
|
2196 | 2192 | if (++$m > 12) |
2197 | 2193 | { |
2198 | 2194 | ++$y; |
2199 | 2195 | $m = 1; |
2200 | 2196 | } |
2201 | - $sort = sprintf('%04d-%02d',$y,$m); |
|
2202 | - $rows[$sort][] =& $events[$key]; |
|
2197 | + $sort = sprintf('%04d-%02d', $y, $m); |
|
2198 | + $rows[$sort][] = & $events[$key]; |
|
2203 | 2199 | } |
2204 | 2200 | } |
2205 | 2201 | } |
2206 | 2202 | else // planner by cat |
2207 | 2203 | { |
2208 | - foreach($this->_get_planner_cats($event['category'],$sort2label,$sort2color) as $sort) |
|
2204 | + foreach ($this->_get_planner_cats($event['category'], $sort2label, $sort2color) as $sort) |
|
2209 | 2205 | { |
2210 | 2206 | if (!is_array($rows[$sort])) $rows[$sort] = array(); |
2211 | 2207 | |
2212 | - $rows[$sort][] =& $events[$key]; |
|
2208 | + $rows[$sort][] = & $events[$key]; |
|
2213 | 2209 | } |
2214 | 2210 | } |
2215 | 2211 | } |
2216 | - $owners = explode(',',$this->owner); |
|
2212 | + $owners = explode(',', $this->owner); |
|
2217 | 2213 | // display a plannerRowWidget for each row (user or category) |
2218 | - foreach($sort2label as $sort => $label) |
|
2214 | + foreach ($sort2label as $sort => $label) |
|
2219 | 2215 | { |
2220 | 2216 | if (!isset($rows[$sort]) && (!$this->cal_prefs['planner_show_empty_rows'] || |
2221 | 2217 | $by_cat === 'user' && $this->cal_prefs['planner_show_empty_rows'] == 'cat' || |
2222 | 2218 | is_int($by_cat) && $this->cal_prefs['planner_show_empty_rows'] == 'user')) |
2223 | 2219 | { |
2224 | - continue; // dont show empty categories or user rows |
|
2220 | + continue; // dont show empty categories or user rows |
|
2225 | 2221 | } |
2226 | 2222 | $class = $class == 'row_on' ? 'row_off' : 'row_on'; |
2227 | 2223 | if ($by_cat === 'month') |
@@ -2236,9 +2232,9 @@ discard block |
||
2236 | 2232 | { |
2237 | 2233 | $label .= $this->close_button($sort); |
2238 | 2234 | } |
2239 | - $content .= $this->plannerRowWidget(isset($rows[$sort]) ? $rows[$sort] : array(),$start,$end,$label,$class,$indent."\t"); |
|
2235 | + $content .= $this->plannerRowWidget(isset($rows[$sort]) ? $rows[$sort] : array(), $start, $end, $label, $class, $indent."\t"); |
|
2240 | 2236 | } |
2241 | - $content .= $indent."</div>\n"; // end of the plannerWidget |
|
2237 | + $content .= $indent."</div>\n"; // end of the plannerWidget |
|
2242 | 2238 | |
2243 | 2239 | return $content; |
2244 | 2240 | } |
@@ -2249,12 +2245,12 @@ discard block |
||
2249 | 2245 | * @param boolean $enum_groups = true should groups be returned as there members (eg. planner) or not (day & week) |
2250 | 2246 | * @return array with uid => label pairs, first all users alphabetically sorted, then all resources |
2251 | 2247 | */ |
2252 | - function _get_planner_users($enum_groups=true) |
|
2248 | + function _get_planner_users($enum_groups = true) |
|
2253 | 2249 | { |
2254 | 2250 | $users = $resources = array(); |
2255 | - foreach(explode(',',$this->owner) as $user) |
|
2251 | + foreach (explode(',', $this->owner) as $user) |
|
2256 | 2252 | { |
2257 | - if($user === '0') |
|
2253 | + if ($user === '0') |
|
2258 | 2254 | { |
2259 | 2255 | // 0 means current user |
2260 | 2256 | $user = $this->user; |
@@ -2265,10 +2261,10 @@ discard block |
||
2265 | 2261 | } |
2266 | 2262 | elseif ($enum_groups && $GLOBALS['egw']->accounts->get_type($user) == 'g') // groups |
2267 | 2263 | { |
2268 | - foreach((array) $GLOBALS['egw']->accounts->member($user) as $data) |
|
2264 | + foreach ((array)$GLOBALS['egw']->accounts->member($user) as $data) |
|
2269 | 2265 | { |
2270 | 2266 | $user = $data['account_id']; |
2271 | - if ($this->bo->check_perms(EGW_ACL_READ | EGW_ACL_FREEBUSY,0,$user)) |
|
2267 | + if ($this->bo->check_perms(EGW_ACL_READ|EGW_ACL_FREEBUSY, 0, $user)) |
|
2272 | 2268 | { |
2273 | 2269 | $users[$user] = $this->bo->participant_name($user); |
2274 | 2270 | } |
@@ -2286,7 +2282,7 @@ discard block |
||
2286 | 2282 | asort($resources); |
2287 | 2283 | } |
2288 | 2284 | |
2289 | - return $users+$resources; |
|
2285 | + return $users + $resources; |
|
2290 | 2286 | } |
2291 | 2287 | |
2292 | 2288 | /** |
@@ -2298,7 +2294,7 @@ discard block |
||
2298 | 2294 | * @param array &$sort2label labels for the returned cats |
2299 | 2295 | * @return array with cat_id's |
2300 | 2296 | */ |
2301 | - function _get_planner_cats($cats,&$sort2label) |
|
2297 | + function _get_planner_cats($cats, &$sort2label) |
|
2302 | 2298 | { |
2303 | 2299 | static $cat2sort; |
2304 | 2300 | |
@@ -2306,7 +2302,7 @@ discard block |
||
2306 | 2302 | { |
2307 | 2303 | $cat2sort = array(); |
2308 | 2304 | $cat_filter = $this->cat_id ? (array)$this->cat_id : array(); |
2309 | - foreach((array)$this->categories->return_sorted_array(0,false,'','','',true) as $data) |
|
2305 | + foreach ((array)$this->categories->return_sorted_array(0, false, '', '', '', true) as $data) |
|
2310 | 2306 | { |
2311 | 2307 | if (in_array($data['parent'], $cat_filter) || in_array($data['id'], $cat_filter) || |
2312 | 2308 | !$data['parent'] && !$cat_filter) // cat is a direct sub of $this->cat_id |
@@ -2314,16 +2310,16 @@ discard block |
||
2314 | 2310 | $cat2sort[$data['id']] = $data['id']; |
2315 | 2311 | $sort2label[$data['id']] = stripslashes($data['name']); |
2316 | 2312 | } |
2317 | - elseif(isset($cat2sort[$data['parent']])) // parent is already in the array => add us with same target |
|
2313 | + elseif (isset($cat2sort[$data['parent']])) // parent is already in the array => add us with same target |
|
2318 | 2314 | { |
2319 | 2315 | $cat2sort[$data['id']] = $cat2sort[$data['parent']]; |
2320 | 2316 | } |
2321 | 2317 | } |
2322 | 2318 | } |
2323 | 2319 | $ret = array(); |
2324 | - foreach(!is_array($cats) ? explode(',',$cats) : $cats as $cat) |
|
2320 | + foreach (!is_array($cats) ? explode(',', $cats) : $cats as $cat) |
|
2325 | 2321 | { |
2326 | - if (isset($cat2sort[$cat]) && !in_array($cat2sort[$cat],$ret)) |
|
2322 | + if (isset($cat2sort[$cat]) && !in_array($cat2sort[$cat], $ret)) |
|
2327 | 2323 | { |
2328 | 2324 | $ret[] = $cat2sort[$cat]; |
2329 | 2325 | } |
@@ -2345,24 +2341,24 @@ discard block |
||
2345 | 2341 | * @param string $indent = '' string for correct indention |
2346 | 2342 | * @return string with scale |
2347 | 2343 | */ |
2348 | - function plannerMonthScale($start,$days,$indent) |
|
2344 | + function plannerMonthScale($start, $days, $indent) |
|
2349 | 2345 | { |
2350 | - $day_width = round(100 / $days,2); |
|
2346 | + $day_width = round(100 / $days, 2); |
|
2351 | 2347 | |
2352 | 2348 | $content .= $indent.'<div class="calendar_plannerScale">'."\n"; |
2353 | - for($t = $start,$left = 0,$i = 0; $i < $days; $t += $days_in_month*DAY_s,$left += $days_in_month*$day_width,$i += $days_in_month) |
|
2349 | + for ($t = $start, $left = 0, $i = 0; $i < $days; $t += $days_in_month * DAY_s, $left += $days_in_month * $day_width, $i += $days_in_month) |
|
2354 | 2350 | { |
2355 | 2351 | $t_arr = $this->bo->date2array($t); |
2356 | - unset($t_arr['raw']); // force recalculation |
|
2352 | + unset($t_arr['raw']); // force recalculation |
|
2357 | 2353 | unset($t_arr['full']); |
2358 | - $days_in_month = $this->datetime->days_in_month($t_arr['month'],$t_arr['year']) - ($t_arr['day']-1); |
|
2354 | + $days_in_month = $this->datetime->days_in_month($t_arr['month'], $t_arr['year']) - ($t_arr['day'] - 1); |
|
2359 | 2355 | if ($i + $days_in_month > $days) |
2360 | 2356 | { |
2361 | 2357 | $days_in_month = $days - $i; |
2362 | 2358 | } |
2363 | 2359 | if ($days_in_month > 10) |
2364 | 2360 | { |
2365 | - $title = lang(date('F',$t)).' '.$t_arr['year']; |
|
2361 | + $title = lang(date('F', $t)).' '.$t_arr['year']; |
|
2366 | 2362 | // previous links |
2367 | 2363 | $prev = $t_arr; |
2368 | 2364 | $prev['day'] = 1; |
@@ -2371,21 +2367,21 @@ discard block |
||
2371 | 2367 | $prev['month'] = 12; |
2372 | 2368 | $prev['year']--; |
2373 | 2369 | } |
2374 | - if ($this->bo->date2ts($prev) < $start-20*DAY_s) |
|
2370 | + if ($this->bo->date2ts($prev) < $start - 20 * DAY_s) |
|
2375 | 2371 | { |
2376 | 2372 | $prev['day'] = $this->day; |
2377 | 2373 | $full = $this->bo->date2string($prev); |
2378 | - if ($this->day >= 15) $prev = $t_arr; // we stay in the same month |
|
2374 | + if ($this->day >= 15) $prev = $t_arr; // we stay in the same month |
|
2379 | 2375 | $prev['day'] = $this->day < 15 ? 15 : 1; |
2380 | 2376 | $half = $this->bo->date2string($prev); |
2381 | - $title = html::a_href(html::image('phpgwapi','first',lang('back one month'),$options=' alt="<<"'),array( |
|
2377 | + $title = html::a_href(html::image('phpgwapi', 'first', lang('back one month'), $options = ' alt="<<"'), array( |
|
2382 | 2378 | 'menuaction' => $this->view_menuaction, |
2383 | 2379 | 'date' => $full, |
2384 | - )) . ' '. |
|
2385 | - html::a_href(html::image('phpgwapi','left',lang('back half a month'),$options=' alt="<"'),array( |
|
2380 | + )).' '. |
|
2381 | + html::a_href(html::image('phpgwapi', 'left', lang('back half a month'), $options = ' alt="<"'), array( |
|
2386 | 2382 | 'menuaction' => $this->view_menuaction, |
2387 | 2383 | 'date' => $half, |
2388 | - )) . ' '.$title; |
|
2384 | + )).' '.$title; |
|
2389 | 2385 | } |
2390 | 2386 | // next links |
2391 | 2387 | $next = $t_arr; |
@@ -2395,20 +2391,20 @@ discard block |
||
2395 | 2391 | $next['year']++; |
2396 | 2392 | } |
2397 | 2393 | // dont show next scales, if there are more then 10 days in the next month or there is no next month |
2398 | - $days_in_next_month = (int) date('d',$end = $start+$days*DAY_s); |
|
2399 | - if ($days_in_next_month <= 10 || date('m',$end) == date('m',$t)) |
|
2394 | + $days_in_next_month = (int)date('d', $end = $start + $days * DAY_s); |
|
2395 | + if ($days_in_next_month <= 10 || date('m', $end) == date('m', $t)) |
|
2400 | 2396 | { |
2401 | - if ($this->day >= 15) $next = $t_arr; // we stay in the same month |
|
2397 | + if ($this->day >= 15) $next = $t_arr; // we stay in the same month |
|
2402 | 2398 | $next['day'] = $this->day; |
2403 | 2399 | $full = $this->bo->date2string($next); |
2404 | - if ($this->day < 15) $next = $t_arr; // we stay in the same month |
|
2400 | + if ($this->day < 15) $next = $t_arr; // we stay in the same month |
|
2405 | 2401 | $next['day'] = $this->day < 15 ? 15 : 1; |
2406 | 2402 | $half = $this->bo->date2string($next); |
2407 | - $title .= ' '.html::a_href(html::image('phpgwapi','right',lang('forward half a month'),$options=' alt=">>"'),array( |
|
2403 | + $title .= ' '.html::a_href(html::image('phpgwapi', 'right', lang('forward half a month'), $options = ' alt=">>"'), array( |
|
2408 | 2404 | 'menuaction' => $this->view_menuaction, |
2409 | 2405 | 'date' => $half, |
2410 | - )). ' '. |
|
2411 | - html::a_href(html::image('phpgwapi','last',lang('forward one month'),$options=' alt=">>"'),array( |
|
2406 | + )).' '. |
|
2407 | + html::a_href(html::image('phpgwapi', 'last', lang('forward one month'), $options = ' alt=">>"'), array( |
|
2412 | 2408 | 'menuaction' => $this->view_menuaction, |
2413 | 2409 | 'date' => $full, |
2414 | 2410 | )); |
@@ -2419,10 +2415,10 @@ discard block |
||
2419 | 2415 | $title = ' '; |
2420 | 2416 | } |
2421 | 2417 | $class = $class == 'row_on' ? 'th' : 'row_on'; |
2422 | - $content .= $indent."\t".'<div class="calendar_plannerMonthScale '.$class.'" style="left: '.$left.'%; width: '.($day_width*$days_in_month).'%;">'. |
|
2418 | + $content .= $indent."\t".'<div class="calendar_plannerMonthScale '.$class.'" style="left: '.$left.'%; width: '.($day_width * $days_in_month).'%;">'. |
|
2423 | 2419 | $title."</div>\n"; |
2424 | 2420 | } |
2425 | - $content .= $indent."</div>\n"; // end of plannerScale |
|
2421 | + $content .= $indent."</div>\n"; // end of plannerScale |
|
2426 | 2422 | |
2427 | 2423 | return $content; |
2428 | 2424 | } |
@@ -2435,39 +2431,39 @@ discard block |
||
2435 | 2431 | * @param string $indent = '' string for correct indention |
2436 | 2432 | * @return string with scale |
2437 | 2433 | */ |
2438 | - function plannerWeekScale($start,$days,$indent) |
|
2434 | + function plannerWeekScale($start, $days, $indent) |
|
2439 | 2435 | { |
2440 | - $week_width = round(100 / $days * ($days <= 7 ? $days : 7),2); |
|
2436 | + $week_width = round(100 / $days * ($days <= 7 ? $days : 7), 2); |
|
2441 | 2437 | |
2442 | 2438 | $content .= $indent.'<div class="calendar_plannerScale">'."\n"; |
2443 | - for($t = $start,$left = 0,$i = 0; $i < $days; $t += 7*DAY_s,$left += $week_width,$i += 7) |
|
2439 | + for ($t = $start, $left = 0, $i = 0; $i < $days; $t += 7 * DAY_s, $left += $week_width, $i += 7) |
|
2444 | 2440 | { |
2445 | 2441 | $title = lang('Week').' '.$this->week_number($t); |
2446 | 2442 | if ($days > 7) |
2447 | 2443 | { |
2448 | - $title = html::a_href($title,array( |
|
2444 | + $title = html::a_href($title, array( |
|
2449 | 2445 | 'menuaction' => 'calendar.calendar_uiviews.planner', |
2450 | 2446 | 'planner_days' => 7, |
2451 | - 'date' => date('Ymd',$t), |
|
2452 | - ),false,' title="'.html::htmlspecialchars(lang('Weekview')).'"'); |
|
2447 | + 'date' => date('Ymd', $t), |
|
2448 | + ), false, ' title="'.html::htmlspecialchars(lang('Weekview')).'"'); |
|
2453 | 2449 | } |
2454 | 2450 | else |
2455 | 2451 | { |
2456 | 2452 | // prev. week |
2457 | - $title = html::a_href(html::image('phpgwapi','first',lang('previous'),$options=' alt="<<"'),array( |
|
2453 | + $title = html::a_href(html::image('phpgwapi', 'first', lang('previous'), $options = ' alt="<<"'), array( |
|
2458 | 2454 | 'menuaction' => $this->view_menuaction, |
2459 | - 'date' => date('Ymd',$t-7*DAY_s), |
|
2460 | - )) . ' <b>'.$title; |
|
2455 | + 'date' => date('Ymd', $t - 7 * DAY_s), |
|
2456 | + )).' <b>'.$title; |
|
2461 | 2457 | // next week |
2462 | - $title .= '</b> '.html::a_href(html::image('phpgwapi','last',lang('next'),$options=' alt=">>"'),array( |
|
2458 | + $title .= '</b> '.html::a_href(html::image('phpgwapi', 'last', lang('next'), $options = ' alt=">>"'), array( |
|
2463 | 2459 | 'menuaction' => $this->view_menuaction, |
2464 | - 'date' => date('Ymd',$t+7*DAY_s), |
|
2460 | + 'date' => date('Ymd', $t + 7 * DAY_s), |
|
2465 | 2461 | )); |
2466 | 2462 | } |
2467 | 2463 | $class = $class == 'row_on' ? 'th' : 'row_on'; |
2468 | 2464 | $content .= $indent."\t".'<div class="calendar_plannerWeekScale '.$class.'" style="left: '.$left.'%; width: '.$week_width.'%;">'.$title."</div>\n"; |
2469 | 2465 | } |
2470 | - $content .= $indent."</div>\n"; // end of plannerScale |
|
2466 | + $content .= $indent."</div>\n"; // end of plannerScale |
|
2471 | 2467 | |
2472 | 2468 | return $content; |
2473 | 2469 | } |
@@ -2480,56 +2476,56 @@ discard block |
||
2480 | 2476 | * @param string $indent = '' string for correct indention |
2481 | 2477 | * @return string with scale |
2482 | 2478 | */ |
2483 | - function plannerDayScale($start,$days,$indent) |
|
2479 | + function plannerDayScale($start, $days, $indent) |
|
2484 | 2480 | { |
2485 | - $day_width = round(100 / $days,2); |
|
2481 | + $day_width = round(100 / $days, 2); |
|
2486 | 2482 | |
2487 | 2483 | $content .= $indent.'<div class="calendar_plannerScale'.($days > 3 ? 'Day' : '').'">'."\n"; |
2488 | - for($t = $start,$left = 0,$i = 0; $i < $days; $t += DAY_s,$left += $day_width,++$i) |
|
2484 | + for ($t = $start, $left = 0, $i = 0; $i < $days; $t += DAY_s, $left += $day_width, ++$i) |
|
2489 | 2485 | { |
2490 | - $this->_day_class_holiday($this->bo->date2string($t),$class,$holidays,$days > 7); |
|
2486 | + $this->_day_class_holiday($this->bo->date2string($t), $class, $holidays, $days > 7); |
|
2491 | 2487 | |
2492 | 2488 | if ($days <= 3) |
2493 | 2489 | { |
2494 | - $title = '<b>'.lang(date('l',$t)).', '.date('j',$t).'. '.lang(date('F',$t)).'</b>'; |
|
2490 | + $title = '<b>'.lang(date('l', $t)).', '.date('j', $t).'. '.lang(date('F', $t)).'</b>'; |
|
2495 | 2491 | } |
2496 | 2492 | elseif ($days <= 7) |
2497 | 2493 | { |
2498 | - $title = lang(date('l',$t)).'<br />'.date('j',$t).'. '.lang(date('F',$t)); |
|
2494 | + $title = lang(date('l', $t)).'<br />'.date('j', $t).'. '.lang(date('F', $t)); |
|
2499 | 2495 | } |
2500 | 2496 | else |
2501 | 2497 | { |
2502 | - $title = substr(lang(date('D',$t)),0,2).'<br />'.date('j',$t); |
|
2498 | + $title = substr(lang(date('D', $t)), 0, 2).'<br />'.date('j', $t); |
|
2503 | 2499 | } |
2504 | 2500 | if ($days > 1) |
2505 | 2501 | { |
2506 | - $title = html::a_href($title,array( |
|
2502 | + $title = html::a_href($title, array( |
|
2507 | 2503 | 'menuaction' => 'calendar.calendar_uiviews.planner', |
2508 | 2504 | 'planner_days' => 1, |
2509 | - 'date' => date('Ymd',$t), |
|
2510 | - ),false,strpos($class,'calendar_calHoliday') !== false || strpos($class,'calendar_calBirthday') !== false ? '' : ' title="'.html::htmlspecialchars(lang('Dayview')).'"'); |
|
2505 | + 'date' => date('Ymd', $t), |
|
2506 | + ), false, strpos($class, 'calendar_calHoliday') !== false || strpos($class, 'calendar_calBirthday') !== false ? '' : ' title="'.html::htmlspecialchars(lang('Dayview')).'"'); |
|
2511 | 2507 | } |
2512 | 2508 | if ($days < 5) |
2513 | 2509 | { |
2514 | 2510 | if (!$i) // prev. day only for the first day |
2515 | 2511 | { |
2516 | - $title = html::a_href(html::image('phpgwapi','first',lang('previous'),$options=' alt="<<"'),array( |
|
2512 | + $title = html::a_href(html::image('phpgwapi', 'first', lang('previous'), $options = ' alt="<<"'), array( |
|
2517 | 2513 | 'menuaction' => $this->view_menuaction, |
2518 | - 'date' => date('Ymd',$start-DAY_s), |
|
2519 | - )) . ' '.$title; |
|
2514 | + 'date' => date('Ymd', $start - DAY_s), |
|
2515 | + )).' '.$title; |
|
2520 | 2516 | } |
2521 | - if ($i == $days-1) // next day only for the last day |
|
2517 | + if ($i == $days - 1) // next day only for the last day |
|
2522 | 2518 | { |
2523 | - $title .= ' '.html::a_href(html::image('phpgwapi','last',lang('next'),$options=' alt=">>"'),array( |
|
2519 | + $title .= ' '.html::a_href(html::image('phpgwapi', 'last', lang('next'), $options = ' alt=">>"'), array( |
|
2524 | 2520 | 'menuaction' => $this->view_menuaction, |
2525 | - 'date' => date('Ymd',$start+DAY_s), |
|
2521 | + 'date' => date('Ymd', $start + DAY_s), |
|
2526 | 2522 | )); |
2527 | 2523 | } |
2528 | 2524 | } |
2529 | 2525 | $content .= $indent."\t".'<div class="calendar_plannerDayScale '.$class.'" style="left: '.$left.'%; width: '.$day_width.'%;"'. |
2530 | 2526 | ($holidays ? ' title="'.html::htmlspecialchars($holidays).'"' : '').'>'.$title."</div>\n"; |
2531 | 2527 | } |
2532 | - $content .= $indent."</div>\n"; // end of plannerScale |
|
2528 | + $content .= $indent."</div>\n"; // end of plannerScale |
|
2533 | 2529 | |
2534 | 2530 | return $content; |
2535 | 2531 | } |
@@ -2542,13 +2538,13 @@ discard block |
||
2542 | 2538 | */ |
2543 | 2539 | function plannerDayOfMonthScale($indent) |
2544 | 2540 | { |
2545 | - $day_width = round(100 / 31,2); |
|
2541 | + $day_width = round(100 / 31, 2); |
|
2546 | 2542 | |
2547 | 2543 | // month scale with navigation |
2548 | 2544 | $content .= $indent.'<div class="calendar_plannerScale">'."\n"; |
2549 | 2545 | |
2550 | - $title = lang(egw_time::to($this->first,'F')).' '.egw_time::to($this->first,'Y').' - '. |
|
2551 | - lang(egw_time::to($this->last,'F')).' '.egw_time::to($this->last,'Y'); |
|
2546 | + $title = lang(egw_time::to($this->first, 'F')).' '.egw_time::to($this->first, 'Y').' - '. |
|
2547 | + lang(egw_time::to($this->last, 'F')).' '.egw_time::to($this->last, 'Y'); |
|
2552 | 2548 | |
2553 | 2549 | // calculate date for navigation links |
2554 | 2550 | $time = new egw_time($this->first); |
@@ -2561,37 +2557,37 @@ discard block |
||
2561 | 2557 | $time->modify('+11month'); |
2562 | 2558 | $next_year = $time->format('Ymd'); |
2563 | 2559 | |
2564 | - $title = html::a_href(html::image('phpgwapi','first',lang('back one year'),$options=' alt="<<"'),array( |
|
2560 | + $title = html::a_href(html::image('phpgwapi', 'first', lang('back one year'), $options = ' alt="<<"'), array( |
|
2565 | 2561 | 'menuaction' => $this->view_menuaction, |
2566 | 2562 | 'date' => $last_year, |
2567 | - )) . ' '. |
|
2568 | - html::a_href(html::image('phpgwapi','left',lang('back one month'),$options=' alt="<"'),array( |
|
2563 | + )).' '. |
|
2564 | + html::a_href(html::image('phpgwapi', 'left', lang('back one month'), $options = ' alt="<"'), array( |
|
2569 | 2565 | 'menuaction' => $this->view_menuaction, |
2570 | 2566 | 'date' => $last_month, |
2571 | - )) . ' '.$title; |
|
2572 | - $title .= ' '.html::a_href(html::image('phpgwapi','right',lang('forward one month'),$options=' alt=">>"'),array( |
|
2567 | + )).' '.$title; |
|
2568 | + $title .= ' '.html::a_href(html::image('phpgwapi', 'right', lang('forward one month'), $options = ' alt=">>"'), array( |
|
2573 | 2569 | 'menuaction' => $this->view_menuaction, |
2574 | 2570 | 'date' => $next_month, |
2575 | - )). ' '. |
|
2576 | - html::a_href(html::image('phpgwapi','last',lang('forward one year'),$options=' alt=">>"'),array( |
|
2571 | + )).' '. |
|
2572 | + html::a_href(html::image('phpgwapi', 'last', lang('forward one year'), $options = ' alt=">>"'), array( |
|
2577 | 2573 | 'menuaction' => $this->view_menuaction, |
2578 | 2574 | 'date' => $next_year, |
2579 | 2575 | )); |
2580 | 2576 | |
2581 | 2577 | $content .= $indent."\t".'<div class="calendar_plannerMonthScale th" style="left: 0; width: 100%;">'. |
2582 | 2578 | $title."</div>\n"; |
2583 | - $content .= $indent."</div>\n"; // end of plannerScale |
|
2579 | + $content .= $indent."</div>\n"; // end of plannerScale |
|
2584 | 2580 | |
2585 | 2581 | // day of month scale |
2586 | 2582 | $content .= $indent.'<div class="calendar_plannerScale">'."\n"; |
2587 | - $today = egw_time::to('now','d'); |
|
2588 | - for($left = 0,$i = 0; $i < 31; $left += $day_width,++$i) |
|
2583 | + $today = egw_time::to('now', 'd'); |
|
2584 | + for ($left = 0, $i = 0; $i < 31; $left += $day_width, ++$i) |
|
2589 | 2585 | { |
2590 | - $class = $i & 1 ? 'row_on' : 'row_off'; |
|
2586 | + $class = $i&1 ? 'row_on' : 'row_off'; |
|
2591 | 2587 | $content .= $indent."\t".'<div class="calendar_plannerDayOfMonthScale '.$class.'" style="left: '.$left.'%; width: '.$day_width.'%;">'. |
2592 | - (1+$i)."</div>\n"; |
|
2588 | + (1 + $i)."</div>\n"; |
|
2593 | 2589 | } |
2594 | - $content .= $indent."</div>\n"; // end of plannerScale |
|
2590 | + $content .= $indent."</div>\n"; // end of plannerScale |
|
2595 | 2591 | |
2596 | 2592 | return $content; |
2597 | 2593 | } |
@@ -2604,9 +2600,9 @@ discard block |
||
2604 | 2600 | * @param string $indent = '' string for correct indention |
2605 | 2601 | * @return string with scale |
2606 | 2602 | */ |
2607 | - function plannerHourScale($start,$days,$indent) |
|
2603 | + function plannerHourScale($start, $days, $indent) |
|
2608 | 2604 | { |
2609 | - foreach(array(1,2,3,4,6,8,12) as $d) // numbers dividing 24 without rest |
|
2605 | + foreach (array(1, 2, 3, 4, 6, 8, 12) as $d) // numbers dividing 24 without rest |
|
2610 | 2606 | { |
2611 | 2607 | if ($d > $days) break; |
2612 | 2608 | $decr = $d; |
@@ -2621,17 +2617,17 @@ discard block |
||
2621 | 2617 | $t_arr['hour'] = 23; $t_arr['minute'] = $t_arr['second'] = 59; |
2622 | 2618 | $hours = ($this->bo->date2ts($t_arr) - $s) / HOUR_s; |
2623 | 2619 | } |
2624 | - $cell_width = round(100 / $hours * $decr,2); |
|
2620 | + $cell_width = round(100 / $hours * $decr, 2); |
|
2625 | 2621 | |
2626 | 2622 | $content .= $indent.'<div class="calendar_plannerScale">'."\n"; |
2627 | - for($t = $start,$left = 0,$i = 0; $i < $hours; $t += $decr*HOUR_s,$left += $cell_width,$i += $decr) |
|
2623 | + for ($t = $start, $left = 0, $i = 0; $i < $hours; $t += $decr * HOUR_s, $left += $cell_width, $i += $decr) |
|
2628 | 2624 | { |
2629 | - $title = date($this->cal_prefs['timeformat'] == 12 ? 'ha' : 'H',$t); |
|
2625 | + $title = date($this->cal_prefs['timeformat'] == 12 ? 'ha' : 'H', $t); |
|
2630 | 2626 | |
2631 | 2627 | $class = $class == 'row_on' ? 'th' : 'row_on'; |
2632 | 2628 | $content .= $indent."\t".'<div class="calendar_plannerHourScale '.$class.'" style="left: '.$left.'%; width: '.($cell_width).'%;">'.$title."</div>\n"; |
2633 | 2629 | } |
2634 | - $content .= $indent."</div>\n"; // end of plannerScale |
|
2630 | + $content .= $indent."</div>\n"; // end of plannerScale |
|
2635 | 2631 | |
2636 | 2632 | return $content; |
2637 | 2633 | } |
@@ -2649,7 +2645,7 @@ discard block |
||
2649 | 2645 | * @param string $indent = '' string for correct indention |
2650 | 2646 | * @return string with widget |
2651 | 2647 | */ |
2652 | - function plannerRowWidget($events,$start,$end,$header,$class,$indent='') |
|
2648 | + function plannerRowWidget($events, $start, $end, $header, $class, $indent = '') |
|
2653 | 2649 | { |
2654 | 2650 | $content = $indent.'<div class="calendar_plannerRowWidget '.$class.'">'."\n"; |
2655 | 2651 | |
@@ -2659,19 +2655,19 @@ discard block |
||
2659 | 2655 | // sorting the events in non-overlapping rows |
2660 | 2656 | $rows = array(array()); |
2661 | 2657 | $row_end = array(); |
2662 | - foreach($events as $n => $event) |
|
2658 | + foreach ($events as $n => $event) |
|
2663 | 2659 | { |
2664 | - for($row = 0; (int) $row_end[$row] > $event['start']; ++$row); // find a "free" row (no other event) |
|
2665 | - $rows[$row][] =& $events[$n]; |
|
2660 | + for ($row = 0; (int)$row_end[$row] > $event['start']; ++$row); // find a "free" row (no other event) |
|
2661 | + $rows[$row][] = & $events[$n]; |
|
2666 | 2662 | $row_end[$row] = $event['end']; |
2667 | 2663 | } |
2668 | 2664 | //echo $header; _debug_array($rows); |
2669 | 2665 | // display the rows |
2670 | 2666 | $content .= $indent."\t".'<div class="calendar_eventRows"'; |
2671 | 2667 | |
2672 | - if ($this->sortby == 'month' && ($days = date('j',$end)) < 31) |
|
2668 | + if ($this->sortby == 'month' && ($days = date('j', $end)) < 31) |
|
2673 | 2669 | { |
2674 | - $width = round(85*$days/31,2); |
|
2670 | + $width = round(85 * $days / 31, 2); |
|
2675 | 2671 | $content .= ' style="width: '.$width.'%;"'; |
2676 | 2672 | } |
2677 | 2673 | $content .= ">\n"; |
@@ -2679,21 +2675,21 @@ discard block |
||
2679 | 2675 | // mark weekends and other special days in yearly planner |
2680 | 2676 | if ($this->sortby == 'month') |
2681 | 2677 | { |
2682 | - $content .= $this->yearlyPlannerMarkDays($start,$days,$indent."\t\t"); |
|
2678 | + $content .= $this->yearlyPlannerMarkDays($start, $days, $indent."\t\t"); |
|
2683 | 2679 | } |
2684 | - foreach($rows as $row) |
|
2680 | + foreach ($rows as $row) |
|
2685 | 2681 | { |
2686 | - $content .= $this->eventRowWidget($row,$start,$end,$indent."\t\t"); |
|
2682 | + $content .= $this->eventRowWidget($row, $start, $end, $indent."\t\t"); |
|
2687 | 2683 | } |
2688 | - $content .= $indent."\t</div>\n"; // end of the eventRows |
|
2684 | + $content .= $indent."\t</div>\n"; // end of the eventRows |
|
2689 | 2685 | |
2690 | 2686 | if ($this->sortby == 'month' && $days < 31) |
2691 | 2687 | { |
2692 | 2688 | // add a filler for non existing days in that month |
2693 | 2689 | $content .= $indent."\t".'<div class="calendar_eventRowsFiller"'. |
2694 | - ' style="left:'.(15+$width).'%; width:'.(85-$width).'%;" ></div>'."\n"; |
|
2690 | + ' style="left:'.(15 + $width).'%; width:'.(85 - $width).'%;" ></div>'."\n"; |
|
2695 | 2691 | } |
2696 | - $content .= $indent."</div>\n"; // end of the plannerRowWidget |
|
2692 | + $content .= $indent."</div>\n"; // end of the plannerRowWidget |
|
2697 | 2693 | |
2698 | 2694 | return $content; |
2699 | 2695 | } |
@@ -2706,14 +2702,14 @@ discard block |
||
2706 | 2702 | * @param string $indent = '' |
2707 | 2703 | * @return string |
2708 | 2704 | */ |
2709 | - function yearlyPlannerMarkDays($start,$days,$indent='') |
|
2705 | + function yearlyPlannerMarkDays($start, $days, $indent = '') |
|
2710 | 2706 | { |
2711 | - $day_width = round(100/$days,2); |
|
2712 | - for($t = $start,$left = 0,$i = 0; $i < $days; $t += DAY_s,$left += $day_width,++$i) |
|
2707 | + $day_width = round(100 / $days, 2); |
|
2708 | + for ($t = $start, $left = 0, $i = 0; $i < $days; $t += DAY_s, $left += $day_width, ++$i) |
|
2713 | 2709 | { |
2714 | - $this->_day_class_holiday($this->bo->date2string($t),$class,$holidays,true); |
|
2710 | + $this->_day_class_holiday($this->bo->date2string($t), $class, $holidays, true); |
|
2715 | 2711 | |
2716 | - $class = trim(str_replace(array('row_on','row_off'),'',$class)); |
|
2712 | + $class = trim(str_replace(array('row_on', 'row_off'), '', $class)); |
|
2717 | 2713 | if ($class) // no regular weekday |
2718 | 2714 | { |
2719 | 2715 | $content .= $indent.'<div class="calendar_eventRowsMarkedDay '.$class. |
@@ -2736,13 +2732,13 @@ discard block |
||
2736 | 2732 | * @param string $indent = '' string for correct indention |
2737 | 2733 | * @return string with widget |
2738 | 2734 | */ |
2739 | - function eventRowWidget($events,$start,$end,$indent='') |
|
2735 | + function eventRowWidget($events, $start, $end, $indent = '') |
|
2740 | 2736 | { |
2741 | 2737 | $content = $indent.'<div class="calendar_eventRowWidget">'."\n"; |
2742 | 2738 | |
2743 | - foreach($events as $event) |
|
2739 | + foreach ($events as $event) |
|
2744 | 2740 | { |
2745 | - $content .= $this->plannerEventWidget($event,$start,$end,$indent."\t"); |
|
2741 | + $content .= $this->plannerEventWidget($event, $start, $end, $indent."\t"); |
|
2746 | 2742 | } |
2747 | 2743 | $content .= $indent."</div>\n"; |
2748 | 2744 | |
@@ -2760,10 +2756,10 @@ discard block |
||
2760 | 2756 | * @param int $end end-time of the planner |
2761 | 2757 | * @return float percentage position between 0-100 |
2762 | 2758 | */ |
2763 | - function _planner_pos($time,$start,$end) |
|
2759 | + function _planner_pos($time, $start, $end) |
|
2764 | 2760 | { |
2765 | - if ($time <= $start) return 0; // we are left of our scale |
|
2766 | - if ($time >= $end) return 100; // we are right of our scale |
|
2761 | + if ($time <= $start) return 0; // we are left of our scale |
|
2762 | + if ($time >= $end) return 100; // we are right of our scale |
|
2767 | 2763 | |
2768 | 2764 | if ($this->planner_days || $this->sortby == 'month') |
2769 | 2765 | { |
@@ -2785,14 +2781,14 @@ discard block |
||
2785 | 2781 | else |
2786 | 2782 | { |
2787 | 2783 | $wd_lenght = $this->wd_end - $this->wd_start; |
2788 | - if ($wd_lenght <= 0) $wd_lenght = 24*60; |
|
2789 | - $day_percentage = ($time_of_day-$this->wd_start) / $wd_lenght; // between 0 and 1 |
|
2784 | + if ($wd_lenght <= 0) $wd_lenght = 24 * 60; |
|
2785 | + $day_percentage = ($time_of_day - $this->wd_start) / $wd_lenght; // between 0 and 1 |
|
2790 | 2786 | } |
2791 | 2787 | $days = ($end - $start) / DAY_s; |
2792 | 2788 | $percent += $day_percentage / $days; |
2793 | 2789 | } |
2794 | 2790 | } |
2795 | - $percent = round(100 * $percent,2); |
|
2791 | + $percent = round(100 * $percent, 2); |
|
2796 | 2792 | |
2797 | 2793 | //echo "<p>_planner_pos(".date('Y-m-d H:i',$time).', '.date('Y-m-d H:i',$start).', '.date('Y-m-d H:i',$end).") = $percent</p>\n"; |
2798 | 2794 | return $percent; |
@@ -2806,7 +2802,7 @@ discard block |
||
2806 | 2802 | * @param int $end end-time of the planner |
2807 | 2803 | * @return string with widget |
2808 | 2804 | */ |
2809 | - function plannerEventWidget($event,$start,$end,$indent='') |
|
2805 | + function plannerEventWidget($event, $start, $end, $indent = '') |
|
2810 | 2806 | { |
2811 | 2807 | // some fields set by the dayColWidget for the other views |
2812 | 2808 | $day_start = $this->bo->date2ts((string)$this->bo->date2string($event['start'])); |
@@ -2815,15 +2811,15 @@ discard block |
||
2815 | 2811 | $event['multiday'] = true; |
2816 | 2812 | unset($event['whole_day_on_top']); |
2817 | 2813 | |
2818 | - $data = $this->eventWidget($event,200,$indent,$this->owner,true,'planner_event'); |
|
2814 | + $data = $this->eventWidget($event, 200, $indent, $this->owner, true, 'planner_event'); |
|
2819 | 2815 | |
2820 | - $left = $this->_planner_pos($event['start'],$start,$end); |
|
2821 | - $width = $this->_planner_pos($event['end'],$start,$end) - $left; |
|
2816 | + $left = $this->_planner_pos($event['start'], $start, $end); |
|
2817 | + $width = $this->_planner_pos($event['end'], $start, $end) - $left; |
|
2822 | 2818 | $color = $data['color'] ? $data['color'] : 'gray'; |
2823 | 2819 | |
2824 | - $tooltip = html::htmlspecialchars(str_replace(array("\n","\r","'",'"'),array('','',"\\'",'"'),$data['tooltip'])); |
|
2820 | + $tooltip = html::htmlspecialchars(str_replace(array("\n", "\r", "'", '"'), array('', '', "\\'", '"'), $data['tooltip'])); |
|
2825 | 2821 | return $indent.'<div class="calendar_plannerEvent'.($data['private'] ? 'Private' : '').'" style="left: '.$left. |
2826 | - '%; width: '.$width.'%; background-color: '.$color.';"'.'data-tooltip="'. $tooltip.'" '. |
|
2822 | + '%; width: '.$width.'%; background-color: '.$color.';"'.'data-tooltip="'.$tooltip.'" '. |
|
2827 | 2823 | '" data-date ="'.$this->bo->date2string($event['start']).'|'.$data['popup'].'">'."\n".$data['html'].$indent."</div>\n"; |
2828 | 2824 | } |
2829 | 2825 | |
@@ -2847,25 +2843,25 @@ discard block |
||
2847 | 2843 | { |
2848 | 2844 | $start = $this->bo->date2array($event['start']); |
2849 | 2845 | $end = $this->bo->date2array($event['end']); |
2850 | - if(!$start['hour'] && !$start['minute'] && $end['hour'] == 23 && $end['minute'] == 59) |
|
2846 | + if (!$start['hour'] && !$start['minute'] && $end['hour'] == 23 && $end['minute'] == 59) |
|
2851 | 2847 | { |
2852 | - if($event['non_blocking']) |
|
2848 | + if ($event['non_blocking']) |
|
2853 | 2849 | { |
2854 | - $dayEvents[$day][$num]['whole_day_on_top']=true; |
|
2855 | - $this->whole_day_positions[$num]=($this->rowHeight*($num+2)); |
|
2850 | + $dayEvents[$day][$num]['whole_day_on_top'] = true; |
|
2851 | + $this->whole_day_positions[$num] = ($this->rowHeight * ($num + 2)); |
|
2856 | 2852 | $extraRowsToAdd++; |
2857 | 2853 | } |
2858 | 2854 | else |
2859 | 2855 | { |
2860 | - $dayEvents[$day][$num]['whole_day']=true; |
|
2856 | + $dayEvents[$day][$num]['whole_day'] = true; |
|
2861 | 2857 | } |
2862 | 2858 | } |
2863 | 2859 | } |
2864 | 2860 | // check after every day if we have to increase $this->extraRows |
2865 | - if(($this->extraRowsOriginal+$extraRowsToAdd) > $this->extraRows) |
|
2861 | + if (($this->extraRowsOriginal + $extraRowsToAdd) > $this->extraRows) |
|
2866 | 2862 | { |
2867 | 2863 | $this->remBotExtraRows = $extraRowsToAdd; |
2868 | - $this->extraRows = ($this->extraRowsOriginal+$extraRowsToAdd); |
|
2864 | + $this->extraRows = ($this->extraRowsOriginal + $extraRowsToAdd); |
|
2869 | 2865 | } |
2870 | 2866 | } |
2871 | 2867 | } |
@@ -2942,7 +2938,7 @@ discard block |
||
2942 | 2938 | $day_start = $this->bo->date2ts((string)$day_ymd); |
2943 | 2939 | |
2944 | 2940 | //Iterate over the holidays array and add those the the events list |
2945 | - foreach($this->holidays[$day_ymd] as $holiday) |
|
2941 | + foreach ($this->holidays[$day_ymd] as $holiday) |
|
2946 | 2942 | { |
2947 | 2943 | if (isset($holiday['birthyear'])) |
2948 | 2944 | { |
@@ -44,14 +44,14 @@ discard block |
||
44 | 44 | |
45 | 45 | if (!is_array($data_id)) |
46 | 46 | { |
47 | - if (!(int) $data_id || !($data = $cal->read((int) $data_id))) |
|
47 | + if (!(int)$data_id || !($data = $cal->read((int)$data_id))) |
|
48 | 48 | { |
49 | 49 | return false; |
50 | 50 | } |
51 | 51 | } |
52 | 52 | else |
53 | 53 | { |
54 | - $data =& $data_id; |
|
54 | + $data = & $data_id; |
|
55 | 55 | } |
56 | 56 | $ds = array( |
57 | 57 | 'pe_title' => $cal->link_title($data), |
@@ -61,7 +61,7 @@ discard block |
||
61 | 61 | 'pe_details' => $data['description'] ? nl2br($data['description']) : '', |
62 | 62 | ); |
63 | 63 | // return first global category, as PM only supports one |
64 | - foreach($data['category'] ? explode(',', $data['category']) : array() as $cat_id) |
|
64 | + foreach ($data['category'] ? explode(',', $data['category']) : array() as $cat_id) |
|
65 | 65 | { |
66 | 66 | if (categories::is_global($cat_id)) |
67 | 67 | { |
@@ -70,12 +70,12 @@ discard block |
||
70 | 70 | } |
71 | 71 | } |
72 | 72 | // calculation of the time |
73 | - $ds['pe_planned_time'] = (int) (($ds['pe_planned_end'] - $ds['pe_planned_start'])/60); // time is in minutes |
|
73 | + $ds['pe_planned_time'] = (int)(($ds['pe_planned_end'] - $ds['pe_planned_start']) / 60); // time is in minutes |
|
74 | 74 | |
75 | 75 | // if the event spans multiple days, we have to substract the nights (24h - daily working time specified in PM) |
76 | - if (($ds['pe_planned_time']/ 60 > 24) && date('Y-m-d',$ds['pe_planned_end']) != date('Y-m-d',$ds['pe_planned_start'])) |
|
76 | + if (($ds['pe_planned_time'] / 60 > 24) && date('Y-m-d', $ds['pe_planned_end']) != date('Y-m-d', $ds['pe_planned_start'])) |
|
77 | 77 | { |
78 | - foreach(array('start','end') as $name) |
|
78 | + foreach (array('start', 'end') as $name) |
|
79 | 79 | { |
80 | 80 | $$name = $cal->date2array($ds['pe_planned_'.$name]); |
81 | 81 | ${$name}['hour'] = 12; |
@@ -87,7 +87,7 @@ discard block |
||
87 | 87 | |
88 | 88 | if (!is_array($this->pm_config)) |
89 | 89 | { |
90 | - $c =& CreateObject('phpgwapi.config','projectmanager'); |
|
90 | + $c = & CreateObject('phpgwapi.config', 'projectmanager'); |
|
91 | 91 | $c->read_repository(); |
92 | 92 | $this->pm_config = $c->config_data; |
93 | 93 | unset($c); |
@@ -95,7 +95,7 @@ discard block |
||
95 | 95 | } |
96 | 96 | $ds['pe_planned_time'] -= $nights * 60 * (24 - $this->pm_config['hours_per_workday']); |
97 | 97 | } |
98 | - foreach($data['participants'] as $uid => $status) |
|
98 | + foreach ($data['participants'] as $uid => $status) |
|
99 | 99 | { |
100 | 100 | if ($status != 'R' && is_numeric($uid)) // only users for now |
101 | 101 | { |
@@ -12,15 +12,15 @@ discard block |
||
12 | 12 | */ |
13 | 13 | |
14 | 14 | // types of messsages send by calendar_boupdate::send_update |
15 | -define('MSG_DELETED',0); |
|
16 | -define('MSG_MODIFIED',1); |
|
17 | -define('MSG_ADDED',2); |
|
18 | -define('MSG_REJECTED',3); |
|
19 | -define('MSG_TENTATIVE',4); |
|
20 | -define('MSG_ACCEPTED',5); |
|
21 | -define('MSG_ALARM',6); |
|
22 | -define('MSG_DISINVITE',7); |
|
23 | -define('MSG_DELEGATED',8); |
|
15 | +define('MSG_DELETED', 0); |
|
16 | +define('MSG_MODIFIED', 1); |
|
17 | +define('MSG_ADDED', 2); |
|
18 | +define('MSG_REJECTED', 3); |
|
19 | +define('MSG_TENTATIVE', 4); |
|
20 | +define('MSG_ACCEPTED', 5); |
|
21 | +define('MSG_ALARM', 6); |
|
22 | +define('MSG_DISINVITE', 7); |
|
23 | +define('MSG_DELEGATED', 8); |
|
24 | 24 | |
25 | 25 | /** |
26 | 26 | * Class to access AND manipulate all calendar data (business object) |
@@ -81,11 +81,11 @@ discard block |
||
81 | 81 | */ |
82 | 82 | function __construct() |
83 | 83 | { |
84 | - if ($this->debug > 0) $this->debug_message('calendar_boupdate::__construct() started',True); |
|
84 | + if ($this->debug > 0) $this->debug_message('calendar_boupdate::__construct() started', True); |
|
85 | 85 | |
86 | - parent::__construct(); // calling the parent constructor |
|
86 | + parent::__construct(); // calling the parent constructor |
|
87 | 87 | |
88 | - if ($this->debug > 0) $this->debug_message('calendar_boupdate::__construct() finished',True); |
|
88 | + if ($this->debug > 0) $this->debug_message('calendar_boupdate::__construct() finished', True); |
|
89 | 89 | } |
90 | 90 | |
91 | 91 | /** |
@@ -112,7 +112,7 @@ discard block |
||
112 | 112 | * + + + C + which is clearly wrong for everything with a maximum quantity > 1 |
113 | 113 | * ++++++++ ++++++++ |
114 | 114 | */ |
115 | - function update(&$event,$ignore_conflicts=false,$touch_modified=true,$ignore_acl=false,$updateTS=true,&$messages=null, $skip_notification=false) |
|
115 | + function update(&$event, $ignore_conflicts = false, $touch_modified = true, $ignore_acl = false, $updateTS = true, &$messages = null, $skip_notification = false) |
|
116 | 116 | { |
117 | 117 | //error_log(__METHOD__."(".array2string($event).",$ignore_conflicts,$touch_modified,$ignore_acl)"); |
118 | 118 | if (!is_array($messages)) $messages = $messages ? (array)$messages : array(); |
@@ -120,7 +120,7 @@ discard block |
||
120 | 120 | if ($this->debug > 1 || $this->debug == 'update') |
121 | 121 | { |
122 | 122 | $this->debug_message('calendar_boupdate::update(%1,ignore_conflict=%2,touch_modified=%3,ignore_acl=%4)', |
123 | - false,$event,$ignore_conflicts,$touch_modified,$ignore_acl); |
|
123 | + false, $event, $ignore_conflicts, $touch_modified, $ignore_acl); |
|
124 | 124 | } |
125 | 125 | // check some minimum requirements: |
126 | 126 | // - new events need start, end and title |
@@ -148,11 +148,11 @@ discard block |
||
148 | 148 | } |
149 | 149 | |
150 | 150 | // check if user has the permission to update / create the event |
151 | - if (!$ignore_acl && (!$new_event && !$this->check_perms(EGW_ACL_EDIT,$event['id']) || |
|
152 | - $new_event && !$this->check_perms(EGW_ACL_EDIT,0,$event['owner'])) && |
|
153 | - !$this->check_perms(EGW_ACL_ADD,0,$event['owner'])) |
|
151 | + if (!$ignore_acl && (!$new_event && !$this->check_perms(EGW_ACL_EDIT, $event['id']) || |
|
152 | + $new_event && !$this->check_perms(EGW_ACL_EDIT, 0, $event['owner'])) && |
|
153 | + !$this->check_perms(EGW_ACL_ADD, 0, $event['owner'])) |
|
154 | 154 | { |
155 | - $messages[] = lang('Access to calendar of %1 denied!',common::grab_owner_name($event['owner'])); |
|
155 | + $messages[] = lang('Access to calendar of %1 denied!', common::grab_owner_name($event['owner'])); |
|
156 | 156 | return false; |
157 | 157 | } |
158 | 158 | if ($new_event) |
@@ -161,24 +161,24 @@ discard block |
||
161 | 161 | } |
162 | 162 | else |
163 | 163 | { |
164 | - $old_event = $this->read((int)$event['id'],null,$ignore_acl); |
|
164 | + $old_event = $this->read((int)$event['id'], null, $ignore_acl); |
|
165 | 165 | } |
166 | 166 | |
167 | 167 | // do we need to check, if user is allowed to invite the invited participants |
168 | - if ($this->require_acl_invite && ($removed = $this->remove_no_acl_invite($event,$old_event))) |
|
168 | + if ($this->require_acl_invite && ($removed = $this->remove_no_acl_invite($event, $old_event))) |
|
169 | 169 | { |
170 | 170 | // report removed participants back to user |
171 | - foreach($removed as $key => $account_id) |
|
171 | + foreach ($removed as $key => $account_id) |
|
172 | 172 | { |
173 | 173 | $removed[$key] = $this->participant_name($account_id); |
174 | 174 | } |
175 | - $messages[] = lang('%1 participants removed because of missing invite grants',count($removed)). |
|
176 | - ': '.implode(', ',$removed); |
|
175 | + $messages[] = lang('%1 participants removed because of missing invite grants', count($removed)). |
|
176 | + ': '.implode(', ', $removed); |
|
177 | 177 | } |
178 | 178 | // check category based ACL |
179 | 179 | if ($event['category']) |
180 | 180 | { |
181 | - if (!is_array($event['category'])) $event['category'] = explode(',',$event['category']); |
|
181 | + if (!is_array($event['category'])) $event['category'] = explode(',', $event['category']); |
|
182 | 182 | if (!$old_event || !isset($old_event['category'])) |
183 | 183 | { |
184 | 184 | $old_event['category'] = array(); |
@@ -187,38 +187,38 @@ discard block |
||
187 | 187 | { |
188 | 188 | $old_event['category'] = explode(',', $old_event['category']); |
189 | 189 | } |
190 | - foreach($event['category'] as $key => $cat_id) |
|
190 | + foreach ($event['category'] as $key => $cat_id) |
|
191 | 191 | { |
192 | 192 | // check if user is allowed to update event categories |
193 | - if ((!$old_event || !in_array($cat_id,$old_event['category'])) && |
|
194 | - self::has_cat_right(self::CAT_ACL_ADD,$cat_id,$this->user) === false) |
|
193 | + if ((!$old_event || !in_array($cat_id, $old_event['category'])) && |
|
194 | + self::has_cat_right(self::CAT_ACL_ADD, $cat_id, $this->user) === false) |
|
195 | 195 | { |
196 | 196 | unset($event['category'][$key]); |
197 | 197 | // report removed category to user |
198 | 198 | $removed_cats[$cat_id] = $this->categories->id2name($cat_id); |
199 | - continue; // no further check, as cat was removed |
|
199 | + continue; // no further check, as cat was removed |
|
200 | 200 | } |
201 | 201 | // for new or moved events check status of participants, if no category status right --> set all status to 'U' = unknown |
202 | 202 | if (!$status_reset_to_unknown && |
203 | - self::has_cat_right(self::CAT_ACL_STATUS,$cat_id,$this->user) === false && |
|
203 | + self::has_cat_right(self::CAT_ACL_STATUS, $cat_id, $this->user) === false && |
|
204 | 204 | (!$old_event || $old_event['start'] != $event['start'] || $old_event['end'] != $event['end'])) |
205 | 205 | { |
206 | - foreach((array)$event['participants'] as $uid => $status) |
|
206 | + foreach ((array)$event['participants'] as $uid => $status) |
|
207 | 207 | { |
208 | 208 | $q = $r = null; |
209 | - calendar_so::split_status($status,$q,$r); |
|
209 | + calendar_so::split_status($status, $q, $r); |
|
210 | 210 | if ($status != 'U') |
211 | 211 | { |
212 | - $event['participants'][$uid] = calendar_so::combine_status('U',$q,$r); |
|
212 | + $event['participants'][$uid] = calendar_so::combine_status('U', $q, $r); |
|
213 | 213 | // todo: report reset status to user |
214 | 214 | } |
215 | 215 | } |
216 | - $status_reset_to_unknown = true; // once is enough |
|
216 | + $status_reset_to_unknown = true; // once is enough |
|
217 | 217 | } |
218 | 218 | } |
219 | 219 | if ($removed_cats) |
220 | 220 | { |
221 | - $messages[] = lang('Category %1 removed because of missing rights',implode(', ',$removed_cats)); |
|
221 | + $messages[] = lang('Category %1 removed because of missing rights', implode(', ', $removed_cats)); |
|
222 | 222 | } |
223 | 223 | if ($status_reset_to_unknown) |
224 | 224 | { |
@@ -229,61 +229,61 @@ discard block |
||
229 | 229 | if (!$ignore_conflicts && !$event['non_blocking'] && isset($event['start']) && isset($event['end'])) |
230 | 230 | { |
231 | 231 | $types_with_quantity = array(); |
232 | - foreach($this->resources as $type => $data) |
|
232 | + foreach ($this->resources as $type => $data) |
|
233 | 233 | { |
234 | 234 | if ($data['max_quantity']) $types_with_quantity[] = $type; |
235 | 235 | } |
236 | 236 | // get all NOT rejected participants and evtl. their quantity |
237 | 237 | $quantity = $users = array(); |
238 | - foreach($event['participants'] as $uid => $status) |
|
238 | + foreach ($event['participants'] as $uid => $status) |
|
239 | 239 | { |
240 | - calendar_so::split_status($status,$q,$r); |
|
241 | - if ($status[0] == 'R') continue; // ignore rejected participants |
|
240 | + calendar_so::split_status($status, $q, $r); |
|
241 | + if ($status[0] == 'R') continue; // ignore rejected participants |
|
242 | 242 | |
243 | 243 | if ($uid < 0) // group, check it's members too |
244 | 244 | { |
245 | - $users += (array)$GLOBALS['egw']->accounts->members($uid,true); |
|
245 | + $users += (array)$GLOBALS['egw']->accounts->members($uid, true); |
|
246 | 246 | $users = array_unique($users); |
247 | 247 | } |
248 | 248 | $users[] = $uid; |
249 | - if (in_array($uid[0],$types_with_quantity)) |
|
249 | + if (in_array($uid[0], $types_with_quantity)) |
|
250 | 250 | { |
251 | 251 | $quantity[$uid] = $q; |
252 | 252 | } |
253 | 253 | } |
254 | 254 | //$start = microtime(true); |
255 | - $overlapping_events =& $this->search(array( |
|
255 | + $overlapping_events = & $this->search(array( |
|
256 | 256 | 'start' => $event['start'], |
257 | 257 | 'end' => $event['end'], |
258 | 258 | 'users' => $users, |
259 | - 'ignore_acl' => true, // otherwise we get only events readable by the user |
|
260 | - 'enum_groups' => true, // otherwise group-events would not block time |
|
259 | + 'ignore_acl' => true, // otherwise we get only events readable by the user |
|
260 | + 'enum_groups' => true, // otherwise group-events would not block time |
|
261 | 261 | 'query' => array( |
262 | 262 | 'cal_non_blocking' => 0, |
263 | 263 | ), |
264 | - 'no_integration' => true, // do NOT use integration of other apps |
|
264 | + 'no_integration' => true, // do NOT use integration of other apps |
|
265 | 265 | )); |
266 | 266 | //error_log(__METHOD__."() conflict check took ".number_format(microtime(true)-$start, 3).'s'); |
267 | 267 | if ($this->debug > 2 || $this->debug == 'update') |
268 | 268 | { |
269 | - $this->debug_message('calendar_boupdate::update() checking for potential overlapping events for users %1 from %2 to %3',false,$users,$event['start'],$event['end']); |
|
269 | + $this->debug_message('calendar_boupdate::update() checking for potential overlapping events for users %1 from %2 to %3', false, $users, $event['start'], $event['end']); |
|
270 | 270 | } |
271 | 271 | $max_quantity = $possible_quantity_conflicts = $conflicts = array(); |
272 | - foreach((array) $overlapping_events as $k => $overlap) |
|
272 | + foreach ((array)$overlapping_events as $k => $overlap) |
|
273 | 273 | { |
274 | - if ($overlap['id'] == $event['id'] || // that's the event itself |
|
275 | - $overlap['id'] == $event['reference'] || // event is an exception of overlap |
|
274 | + if ($overlap['id'] == $event['id'] || // that's the event itself |
|
275 | + $overlap['id'] == $event['reference'] || // event is an exception of overlap |
|
276 | 276 | $overlap['non_blocking']) // that's a non_blocking event |
277 | 277 | { |
278 | 278 | continue; |
279 | 279 | } |
280 | 280 | if ($this->debug > 3 || $this->debug == 'update') |
281 | 281 | { |
282 | - $this->debug_message('calendar_boupdate::update() checking overlapping event %1',false,$overlap); |
|
282 | + $this->debug_message('calendar_boupdate::update() checking overlapping event %1', false, $overlap); |
|
283 | 283 | } |
284 | 284 | // check if the overlap is with a rejected participant or within the allowed quantity |
285 | - $common_parts = array_intersect($users,array_keys($overlap['participants'])); |
|
286 | - foreach($common_parts as $n => $uid) |
|
285 | + $common_parts = array_intersect($users, array_keys($overlap['participants'])); |
|
286 | + foreach ($common_parts as $n => $uid) |
|
287 | 287 | { |
288 | 288 | $status = $overlap['participants'][$uid]; |
289 | 289 | calendar_so::split_status($status, $q, $r); |
@@ -292,9 +292,9 @@ discard block |
||
292 | 292 | unset($common_parts[$n]); |
293 | 293 | continue; |
294 | 294 | } |
295 | - if (is_numeric($uid) || !in_array($uid[0],$types_with_quantity)) |
|
295 | + if (is_numeric($uid) || !in_array($uid[0], $types_with_quantity)) |
|
296 | 296 | { |
297 | - continue; // no quantity check: quantity allways 1 ==> conflict |
|
297 | + continue; // no quantity check: quantity allways 1 ==> conflict |
|
298 | 298 | } |
299 | 299 | if (!isset($max_quantity[$uid])) |
300 | 300 | { |
@@ -304,7 +304,7 @@ discard block |
||
304 | 304 | $quantity[$uid] += $q; |
305 | 305 | if ($quantity[$uid] <= $max_quantity[$uid]) |
306 | 306 | { |
307 | - $possible_quantity_conflicts[$uid][] =& $overlapping_events[$k]; // an other event can give the conflict |
|
307 | + $possible_quantity_conflicts[$uid][] = & $overlapping_events[$k]; // an other event can give the conflict |
|
308 | 308 | unset($common_parts[$n]); |
309 | 309 | continue; |
310 | 310 | } |
@@ -314,20 +314,20 @@ discard block |
||
314 | 314 | { |
315 | 315 | if ($this->debug > 3 || $this->debug == 'update') |
316 | 316 | { |
317 | - $this->debug_message('calendar_boupdate::update() conflicts with the following participants found %1',false,$common_parts); |
|
317 | + $this->debug_message('calendar_boupdate::update() conflicts with the following participants found %1', false, $common_parts); |
|
318 | 318 | } |
319 | - $conflicts[$overlap['id'].'-'.$this->date2ts($overlap['start'])] =& $overlapping_events[$k]; |
|
319 | + $conflicts[$overlap['id'].'-'.$this->date2ts($overlap['start'])] = & $overlapping_events[$k]; |
|
320 | 320 | } |
321 | 321 | } |
322 | 322 | // check if we are withing the allowed quantity and if not add all events using that resource |
323 | 323 | // seems this function is doing very strange things, it gives empty conflicts |
324 | - foreach($max_quantity as $uid => $max) |
|
324 | + foreach ($max_quantity as $uid => $max) |
|
325 | 325 | { |
326 | 326 | if ($quantity[$uid] > $max) |
327 | 327 | { |
328 | - foreach((array)$possible_quantity_conflicts[$uid] as $conflict) |
|
328 | + foreach ((array)$possible_quantity_conflicts[$uid] as $conflict) |
|
329 | 329 | { |
330 | - $conflicts[$conflict['id'].'-'.$this->date2ts($conflict['start'])] =& $possible_quantity_conflicts[$k]; |
|
330 | + $conflicts[$conflict['id'].'-'.$this->date2ts($conflict['start'])] = & $possible_quantity_conflicts[$k]; |
|
331 | 331 | } |
332 | 332 | } |
333 | 333 | } |
@@ -335,10 +335,10 @@ discard block |
||
335 | 335 | |
336 | 336 | if (count($conflicts)) |
337 | 337 | { |
338 | - foreach($conflicts as $key => $conflict) |
|
338 | + foreach ($conflicts as $key => $conflict) |
|
339 | 339 | { |
340 | - $conflict['participants'] = array_intersect_key((array)$conflict['participants'],$event['participants']); |
|
341 | - if (!$this->check_perms(EGW_ACL_READ,$conflict)) |
|
340 | + $conflict['participants'] = array_intersect_key((array)$conflict['participants'], $event['participants']); |
|
341 | + if (!$this->check_perms(EGW_ACL_READ, $conflict)) |
|
342 | 342 | { |
343 | 343 | $conflicts[$key] = array( |
344 | 344 | 'id' => $conflict['id'], |
@@ -351,7 +351,7 @@ discard block |
||
351 | 351 | } |
352 | 352 | if ($this->debug > 2 || $this->debug == 'update') |
353 | 353 | { |
354 | - $this->debug_message('calendar_boupdate::update() %1 conflicts found %2',false,count($conflicts),$conflicts); |
|
354 | + $this->debug_message('calendar_boupdate::update() %1 conflicts found %2', false, count($conflicts), $conflicts); |
|
355 | 355 | } |
356 | 356 | return $conflicts; |
357 | 357 | } |
@@ -365,33 +365,33 @@ discard block |
||
365 | 365 | return $cal_id; |
366 | 366 | } |
367 | 367 | |
368 | - $event = $this->read($cal_id); // we re-read the event, in case only partial information was update and we need the full info for the notifies |
|
368 | + $event = $this->read($cal_id); // we re-read the event, in case only partial information was update and we need the full info for the notifies |
|
369 | 369 | //echo "new $cal_id="; _debug_array($event); |
370 | 370 | |
371 | - if($old_event['deleted'] && $event['deleted'] == null) |
|
371 | + if ($old_event['deleted'] && $event['deleted'] == null) |
|
372 | 372 | { |
373 | 373 | // Restored, bring back links |
374 | 374 | egw_link::restore('calendar', $cal_id); |
375 | 375 | } |
376 | 376 | if ($this->log_file) |
377 | 377 | { |
378 | - $this->log2file($event2save,$event,$old_event); |
|
378 | + $this->log2file($event2save, $event, $old_event); |
|
379 | 379 | } |
380 | 380 | // send notifications |
381 | - if(!$skip_notification) |
|
381 | + if (!$skip_notification) |
|
382 | 382 | { |
383 | 383 | if ($new_event) |
384 | 384 | { |
385 | - $this->send_update(MSG_ADDED,$event['participants'],'',$event); |
|
385 | + $this->send_update(MSG_ADDED, $event['participants'], '', $event); |
|
386 | 386 | } |
387 | 387 | else // update existing event |
388 | 388 | { |
389 | - $this->check4update($event,$old_event); |
|
389 | + $this->check4update($event, $old_event); |
|
390 | 390 | } |
391 | 391 | } |
392 | 392 | |
393 | 393 | // notify the link-class about the update, as other apps may be subscribt to it |
394 | - egw_link::notify_update('calendar',$cal_id,$event); |
|
394 | + egw_link::notify_update('calendar', $cal_id, $event); |
|
395 | 395 | |
396 | 396 | return $cal_id; |
397 | 397 | } |
@@ -403,22 +403,22 @@ discard block |
||
403 | 403 | * @param array $old_event =null old event with already invited participants |
404 | 404 | * @return array removed participants because of missing invite grants |
405 | 405 | */ |
406 | - public function remove_no_acl_invite(array &$event,array $old_event=null) |
|
406 | + public function remove_no_acl_invite(array &$event, array $old_event = null) |
|
407 | 407 | { |
408 | 408 | if (!$this->require_acl_invite) |
409 | 409 | { |
410 | - return array(); // nothing to check, everyone can invite everyone else |
|
410 | + return array(); // nothing to check, everyone can invite everyone else |
|
411 | 411 | } |
412 | 412 | if ($event['id'] && is_null($old_event)) |
413 | 413 | { |
414 | 414 | $old_event = $this->read($event['id']); |
415 | 415 | } |
416 | 416 | $removed = array(); |
417 | - foreach(array_keys((array)$event['participants']) as $uid) |
|
417 | + foreach (array_keys((array)$event['participants']) as $uid) |
|
418 | 418 | { |
419 | 419 | if ((is_null($old_event) || !isset($old_event['participants'][$uid])) && !$this->check_acl_invite($uid)) |
420 | 420 | { |
421 | - unset($event['participants'][$uid]); // remove participant |
|
421 | + unset($event['participants'][$uid]); // remove participant |
|
422 | 422 | $removed[] = $uid; |
423 | 423 | } |
424 | 424 | } |
@@ -434,19 +434,19 @@ discard block |
||
434 | 434 | */ |
435 | 435 | public function check_acl_invite($uid) |
436 | 436 | { |
437 | - if (!is_numeric($uid)) return true; // nothing implemented for resources so far |
|
437 | + if (!is_numeric($uid)) return true; // nothing implemented for resources so far |
|
438 | 438 | |
439 | 439 | if (!$this->require_acl_invite) |
440 | 440 | { |
441 | - $ret = true; // no grant required |
|
441 | + $ret = true; // no grant required |
|
442 | 442 | } |
443 | 443 | elseif ($this->require_acl_invite == 'groups' && $GLOBALS['egw']->accounts->get_type($uid) != 'g') |
444 | 444 | { |
445 | - $ret = true; // grant only required for groups |
|
445 | + $ret = true; // grant only required for groups |
|
446 | 446 | } |
447 | 447 | else |
448 | 448 | { |
449 | - $ret = $this->check_perms(EGW_ACL_INVITE,0,$uid); |
|
449 | + $ret = $this->check_perms(EGW_ACL_INVITE, 0, $uid); |
|
450 | 450 | } |
451 | 451 | //error_log(__METHOD__."($uid) = ".array2string($ret)); |
452 | 452 | //echo "<p>".__METHOD__."($uid) require_acl_invite=$this->require_acl_invite returning ".array2string($ret)."</p>\n"; |
@@ -460,7 +460,7 @@ discard block |
||
460 | 460 | * @param array $old_event the event before the update |
461 | 461 | * @todo check if there is a real change, not assume every save is a change |
462 | 462 | */ |
463 | - function check4update($new_event,$old_event) |
|
463 | + function check4update($new_event, $old_event) |
|
464 | 464 | { |
465 | 465 | //error_log(__METHOD__."($new_event[title])"); |
466 | 466 | $modified = $added = $deleted = array(); |
@@ -468,9 +468,9 @@ discard block |
||
468 | 468 | //echo "<p>calendar_boupdate::check4update() new participants = ".print_r($new_event['participants'],true).", old participants =".print_r($old_event['participants'],true)."</p>\n"; |
469 | 469 | |
470 | 470 | // Find modified and deleted participants ... |
471 | - foreach($old_event['participants'] as $old_userid => $old_status) |
|
471 | + foreach ($old_event['participants'] as $old_userid => $old_status) |
|
472 | 472 | { |
473 | - if(isset($new_event['participants'][$old_userid])) |
|
473 | + if (isset($new_event['participants'][$old_userid])) |
|
474 | 474 | { |
475 | 475 | $modified[$old_userid] = $new_event['participants'][$old_userid]; |
476 | 476 | } |
@@ -480,27 +480,27 @@ discard block |
||
480 | 480 | } |
481 | 481 | } |
482 | 482 | // Find new participants ... |
483 | - foreach(array_keys((array)$new_event['participants']) as $new_userid) |
|
483 | + foreach (array_keys((array)$new_event['participants']) as $new_userid) |
|
484 | 484 | { |
485 | - if(!isset($old_event['participants'][$new_userid])) |
|
485 | + if (!isset($old_event['participants'][$new_userid])) |
|
486 | 486 | { |
487 | 487 | $added[$new_userid] = 'U'; |
488 | 488 | } |
489 | 489 | } |
490 | 490 | //echo "<p>calendar_boupdate::check4update() added=".print_r($added,true).", modified=".print_r($modified,true).", deleted=".print_r($deleted,true)."</p>\n"; |
491 | - if(count($added) || count($modified) || count($deleted)) |
|
491 | + if (count($added) || count($modified) || count($deleted)) |
|
492 | 492 | { |
493 | - if(count($added)) |
|
493 | + if (count($added)) |
|
494 | 494 | { |
495 | - $this->send_update(MSG_ADDED,$added,$old_event,$new_event); |
|
495 | + $this->send_update(MSG_ADDED, $added, $old_event, $new_event); |
|
496 | 496 | } |
497 | - if(count($modified)) |
|
497 | + if (count($modified)) |
|
498 | 498 | { |
499 | - $this->send_update(MSG_MODIFIED,$modified,$old_event,$new_event); |
|
499 | + $this->send_update(MSG_MODIFIED, $modified, $old_event, $new_event); |
|
500 | 500 | } |
501 | - if(count($deleted)) |
|
501 | + if (count($deleted)) |
|
502 | 502 | { |
503 | - $this->send_update(MSG_DISINVITE,$deleted,$new_event); |
|
503 | + $this->send_update(MSG_DISINVITE, $deleted, $new_event); |
|
504 | 504 | } |
505 | 505 | } |
506 | 506 | } |
@@ -517,11 +517,11 @@ discard block |
||
517 | 517 | * @param string $status of current user |
518 | 518 | * @return boolean true = update requested, false otherwise |
519 | 519 | */ |
520 | - public static function update_requested($userid, $part_prefs, &$msg_type, $old_event ,$new_event, $role, $status=null) |
|
520 | + public static function update_requested($userid, $part_prefs, &$msg_type, $old_event, $new_event, $role, $status = null) |
|
521 | 521 | { |
522 | 522 | if ($msg_type == MSG_ALARM) |
523 | 523 | { |
524 | - return True; // always True for now |
|
524 | + return True; // always True for now |
|
525 | 525 | } |
526 | 526 | $want_update = 0; |
527 | 527 | |
@@ -529,7 +529,7 @@ discard block |
||
529 | 529 | // |
530 | 530 | $msg_is_response = $msg_type == MSG_REJECTED || $msg_type == MSG_ACCEPTED || $msg_type == MSG_TENTATIVE || $msg_type == MSG_DELEGATED; |
531 | 531 | |
532 | - switch($ru = $part_prefs['calendar']['receive_updates']) |
|
532 | + switch ($ru = $part_prefs['calendar']['receive_updates']) |
|
533 | 533 | { |
534 | 534 | case 'responses': |
535 | 535 | ++$want_update; |
@@ -543,8 +543,8 @@ discard block |
||
543 | 543 | default: |
544 | 544 | if (is_array($new_event) && is_array($old_event)) |
545 | 545 | { |
546 | - $diff = max(abs(self::date2ts($old_event['start'])-self::date2ts($new_event['start'])), |
|
547 | - abs(self::date2ts($old_event['end'])-self::date2ts($new_event['end']))); |
|
546 | + $diff = max(abs(self::date2ts($old_event['start']) - self::date2ts($new_event['start'])), |
|
547 | + abs(self::date2ts($old_event['end']) - self::date2ts($new_event['end']))); |
|
548 | 548 | $check = $ru == 'time_change_4h' ? 4 * 60 * 60 - 1 : 0; |
549 | 549 | if ($msg_type == MSG_MODIFIED && $diff > $check) |
550 | 550 | { |
@@ -564,13 +564,13 @@ discard block |
||
564 | 564 | if (!is_numeric($userid) && $role == 'CHAIR' && |
565 | 565 | ($msg_is_response || in_array($msg_type, array(MSG_ADDED, MSG_DELETED)))) |
566 | 566 | { |
567 | - switch($msg_type) |
|
567 | + switch ($msg_type) |
|
568 | 568 | { |
569 | 569 | case MSG_DELETED: // treat deleting event as rejection to organizer |
570 | 570 | $msg_type = MSG_REJECTED; |
571 | 571 | break; |
572 | 572 | case MSG_ADDED: // new events use added, but organizer needs status |
573 | - switch($status[0]) |
|
573 | + switch ($status[0]) |
|
574 | 574 | { |
575 | 575 | case 'A': $msg_type = MSG_ACCEPTED; break; |
576 | 576 | case 'R': $msg_type = MSG_REJECTED; break; |
@@ -595,7 +595,7 @@ discard block |
||
595 | 595 | * @param string $role ='REQ-PARTICIPANT' |
596 | 596 | * @return boolean true if user requested to be notified, false if not |
597 | 597 | */ |
598 | - static public function email_update_requested($user_or_email, $ical_method='REQUEST', $role='REQ-PARTICIPANT') |
|
598 | + static public function email_update_requested($user_or_email, $ical_method = 'REQUEST', $role = 'REQ-PARTICIPANT') |
|
599 | 599 | { |
600 | 600 | // check if email is from a user |
601 | 601 | if (is_numeric($user_or_email)) |
@@ -619,7 +619,7 @@ discard block |
||
619 | 619 | ) |
620 | 620 | ); |
621 | 621 | } |
622 | - switch($ical_method) |
|
622 | + switch ($ical_method) |
|
623 | 623 | { |
624 | 624 | default: |
625 | 625 | case 'REQUEST': |
@@ -644,9 +644,9 @@ discard block |
||
644 | 644 | * @param string& $action=null on return verbose name |
645 | 645 | * @param string& $msg=null on return notification message |
646 | 646 | */ |
647 | - function msg_type2ical_method($msg_type, &$action=null, &$msg=null) |
|
647 | + function msg_type2ical_method($msg_type, &$action = null, &$msg = null) |
|
648 | 648 | { |
649 | - switch($msg_type) |
|
649 | + switch ($msg_type) |
|
650 | 650 | { |
651 | 651 | case MSG_DELETED: |
652 | 652 | $action = 'Canceled'; |
@@ -698,7 +698,7 @@ discard block |
||
698 | 698 | $msg = $this->cal_prefs['notify'.$pref]; |
699 | 699 | if (empty($msg)) |
700 | 700 | { |
701 | - $msg = $this->cal_prefs['notifyAdded']; // use a default |
|
701 | + $msg = $this->cal_prefs['notifyAdded']; // use a default |
|
702 | 702 | } |
703 | 703 | //error_log(__METHOD__."($msg_type) action='$action', $msg='$msg' returning '$method'"); |
704 | 704 | return $method; |
@@ -714,7 +714,7 @@ discard block |
||
714 | 714 | * @param int $user =0 User who started the notify, default current user |
715 | 715 | * @return bool true/false |
716 | 716 | */ |
717 | - function send_update($msg_type,$to_notify,$old_event,$new_event=null,$user=0) |
|
717 | + function send_update($msg_type, $to_notify, $old_event, $new_event = null, $user = 0) |
|
718 | 718 | { |
719 | 719 | //error_log(__METHOD__."($msg_type,".array2string($to_notify).",...) ".array2string($new_event)); |
720 | 720 | if (!is_array($to_notify)) |
@@ -726,11 +726,11 @@ discard block |
||
726 | 726 | $owner = $old_event ? $old_event['owner'] : $new_event['owner']; |
727 | 727 | if ($owner && !isset($to_notify[$owner]) && $msg_type != MSG_ALARM) |
728 | 728 | { |
729 | - $to_notify[$owner] = 'OCHAIR'; // always include the event-owner |
|
729 | + $to_notify[$owner] = 'OCHAIR'; // always include the event-owner |
|
730 | 730 | } |
731 | 731 | |
732 | 732 | // ignore events in the past (give a tolerance of 10 seconds for the script) |
733 | - if($old_event && $this->date2ts($old_event['start']) < ($this->now_su - 10)) |
|
733 | + if ($old_event && $this->date2ts($old_event['start']) < ($this->now_su - 10)) |
|
734 | 734 | { |
735 | 735 | return False; |
736 | 736 | } |
@@ -740,7 +740,7 @@ discard block |
||
740 | 740 | $restore_tz = $tz; |
741 | 741 | date_default_timezone_set($GLOBALS['egw_info']['server']['server_timezone']); |
742 | 742 | } |
743 | - $temp_user = $GLOBALS['egw_info']['user']; // save user-date of the enviroment to restore it after |
|
743 | + $temp_user = $GLOBALS['egw_info']['user']; // save user-date of the enviroment to restore it after |
|
744 | 744 | |
745 | 745 | if (!$user) |
746 | 746 | { |
@@ -756,17 +756,17 @@ discard block |
||
756 | 756 | $event = $msg_type == MSG_ADDED || $msg_type == MSG_MODIFIED ? $new_event : $old_event; |
757 | 757 | |
758 | 758 | // add all group-members to the notification, unless they are already participants |
759 | - foreach($to_notify as $userid => $statusid) |
|
759 | + foreach ($to_notify as $userid => $statusid) |
|
760 | 760 | { |
761 | 761 | if (is_numeric($userid) && $GLOBALS['egw']->accounts->get_type($userid) == 'g' && |
762 | 762 | ($members = $GLOBALS['egw']->accounts->member($userid))) |
763 | 763 | { |
764 | - foreach($members as $member) |
|
764 | + foreach ($members as $member) |
|
765 | 765 | { |
766 | 766 | $member = $member['account_id']; |
767 | 767 | if (!isset($to_notify[$member])) |
768 | 768 | { |
769 | - $to_notify[$member] = 'G'; // Group-invitation |
|
769 | + $to_notify[$member] = 'G'; // Group-invitation |
|
770 | 770 | } |
771 | 771 | } |
772 | 772 | } |
@@ -778,7 +778,7 @@ discard block |
||
778 | 778 | if ($old_event) $olddate = new egw_time($old_event['start']); |
779 | 779 | //error_log(__METHOD__."() date_default_timezone_get()=".date_default_timezone_get().", user-timezone=".egw_time::$user_timezone->getName().", startdate=".$startdate->format().", enddate=".$enddate->format().", updated=".$modified->format().", olddate=".($olddate ? $olddate->format() : '')); |
780 | 780 | $owner_prefs = $ics = null; |
781 | - foreach($to_notify as $userid => $statusid) |
|
781 | + foreach ($to_notify as $userid => $statusid) |
|
782 | 782 | { |
783 | 783 | $res_info = $quantity = $role = null; |
784 | 784 | calendar_so::split_status($statusid, $quantity, $role); |
@@ -801,14 +801,14 @@ discard block |
||
801 | 801 | |
802 | 802 | if (!isset($userid)) |
803 | 803 | { |
804 | - if (empty($res_info['email'])) continue; // no way to notify |
|
804 | + if (empty($res_info['email'])) continue; // no way to notify |
|
805 | 805 | // check if event-owner wants non-EGroupware users notified |
806 | 806 | if (is_null($owner_prefs)) |
807 | 807 | { |
808 | 808 | $preferences = new preferences($owner); |
809 | 809 | $owner_prefs = $preferences->read_repository(); |
810 | 810 | } |
811 | - if ($role != 'CHAIR' && // always notify externals CHAIRs |
|
811 | + if ($role != 'CHAIR' && // always notify externals CHAIRs |
|
812 | 812 | (empty($owner_prefs['calendar']['notify_externals']) || |
813 | 813 | $owner_prefs['calendar']['notify_externals'] == 'no')) |
814 | 814 | { |
@@ -820,12 +820,12 @@ discard block |
||
820 | 820 | |
821 | 821 | if ($statusid == 'R' || $GLOBALS['egw']->accounts->get_type($userid) == 'g') |
822 | 822 | { |
823 | - continue; // dont notify rejected participants or groups |
|
823 | + continue; // dont notify rejected participants or groups |
|
824 | 824 | } |
825 | 825 | |
826 | - if($userid != $GLOBALS['egw_info']['user']['account_id'] || |
|
826 | + if ($userid != $GLOBALS['egw_info']['user']['account_id'] || |
|
827 | 827 | ($userid == $GLOBALS['egw_info']['user']['account_id'] && |
828 | - $user_prefs['calendar']['receive_own_updates']==1) || |
|
828 | + $user_prefs['calendar']['receive_own_updates'] == 1) || |
|
829 | 829 | $msg_type == MSG_ALARM) |
830 | 830 | { |
831 | 831 | $tfn = $tln = $lid = null; //cleanup of lastname and fullname (in case they are set in a previous loop) |
@@ -833,8 +833,8 @@ discard block |
||
833 | 833 | { |
834 | 834 | $preferences = new preferences($userid); |
835 | 835 | $GLOBALS['egw_info']['user']['preferences'] = $part_prefs = $preferences->read_repository(); |
836 | - $GLOBALS['egw']->accounts->get_account_name($userid,$lid,$tfn,$tln); |
|
837 | - $fullname = common::display_fullname('',$tfn,$tln); |
|
836 | + $GLOBALS['egw']->accounts->get_account_name($userid, $lid, $tfn, $tln); |
|
837 | + $fullname = common::display_fullname('', $tfn, $tln); |
|
838 | 838 | } |
839 | 839 | else // external email address: use preferences of event-owner, plus some hardcoded settings (eg. ical notification) |
840 | 840 | { |
@@ -845,7 +845,7 @@ discard block |
||
845 | 845 | } |
846 | 846 | $part_prefs = $owner_prefs; |
847 | 847 | $part_prefs['calendar']['receive_updates'] = $owner_prefs['calendar']['notify_externals']; |
848 | - $part_prefs['calendar']['update_format'] = 'ical'; // use ical format |
|
848 | + $part_prefs['calendar']['update_format'] = 'ical'; // use ical format |
|
849 | 849 | $fullname = $res_info && !empty($res_info['name']) ? $res_info['name'] : $userid; |
850 | 850 | } |
851 | 851 | $m_type = $msg_type; |
@@ -873,7 +873,7 @@ discard block |
||
873 | 873 | if (!isset($part_prefs['common']['tz'])) $part_prefs['common']['tz'] = $GLOBALS['egw_info']['server']['server_timezone']; |
874 | 874 | $timezone = new DateTimeZone($part_prefs['common']['tz']); |
875 | 875 | $timeformat = $part_prefs['common']['timeformat']; |
876 | - switch($timeformat) |
|
876 | + switch ($timeformat) |
|
877 | 877 | { |
878 | 878 | case '24': |
879 | 879 | $timeformat = 'H:i'; |
@@ -882,7 +882,7 @@ discard block |
||
882 | 882 | $timeformat = 'h:i a'; |
883 | 883 | break; |
884 | 884 | } |
885 | - $timeformat = $part_prefs['common']['dateformat'] . ', ' . $timeformat; |
|
885 | + $timeformat = $part_prefs['common']['dateformat'].', '.$timeformat; |
|
886 | 886 | |
887 | 887 | $startdate->setTimezone($timezone); |
888 | 888 | $details['startdate'] = $startdate->format($timeformat); |
@@ -891,7 +891,7 @@ discard block |
||
891 | 891 | $details['enddate'] = $enddate->format($timeformat); |
892 | 892 | |
893 | 893 | $modified->setTimezone($timezone); |
894 | - $details['updated'] = $modified->format($timeformat) . ', ' . common::grab_owner_name($event['modifier']); |
|
894 | + $details['updated'] = $modified->format($timeformat).', '.common::grab_owner_name($event['modifier']); |
|
895 | 895 | |
896 | 896 | if ($old_event != False) |
897 | 897 | { |
@@ -900,15 +900,14 @@ discard block |
||
900 | 900 | } |
901 | 901 | //error_log(__METHOD__."() userid=$userid, timezone=".$timezone->getName().", startdate=$details[startdate], enddate=$details[enddate], updated=$details[updated], olddate=$details[olddate]"); |
902 | 902 | |
903 | - list($subject,$notify_body) = explode("\n",$GLOBALS['egw']->preferences->parse_notify($notify_msg,$details),2); |
|
903 | + list($subject, $notify_body) = explode("\n", $GLOBALS['egw']->preferences->parse_notify($notify_msg, $details), 2); |
|
904 | 904 | // alarm is NOT an iCal method, therefore we have to use extened (no iCal) |
905 | - switch($msg_type == MSG_ALARM ? 'extended' : $part_prefs['calendar']['update_format']) |
|
905 | + switch ($msg_type == MSG_ALARM ? 'extended' : $part_prefs['calendar']['update_format']) |
|
906 | 906 | { |
907 | - case 'ical': |
|
908 | - if (is_null($ics) || $m_type != $msg_type) // need different ical for organizer notification |
|
907 | + case 'ical' : if (is_null($ics) || $m_type != $msg_type) // need different ical for organizer notification |
|
909 | 908 | { |
910 | 909 | $calendar_ical = new calendar_ical(); |
911 | - $calendar_ical->setSupportedFields('full'); // full iCal fields+event TZ |
|
910 | + $calendar_ical->setSupportedFields('full'); // full iCal fields+event TZ |
|
912 | 911 | // we need to pass $event[id] so iCal class reads event again, |
913 | 912 | // as event is in user TZ, but iCal class expects server TZ! |
914 | 913 | $ics = $calendar_ical->exportVCal(array(isset($cleared_event) ? $cleared_event : $event['id']), |
@@ -927,11 +926,11 @@ discard block |
||
927 | 926 | case 'extended': |
928 | 927 | |
929 | 928 | $details_body = lang('Event Details follow').":\n"; |
930 | - foreach($event_arr as $key => $val) |
|
929 | + foreach ($event_arr as $key => $val) |
|
931 | 930 | { |
932 | - if(!empty($details[$key])) |
|
931 | + if (!empty($details[$key])) |
|
933 | 932 | { |
934 | - switch($key) |
|
933 | + switch ($key) |
|
935 | 934 | { |
936 | 935 | case 'access': |
937 | 936 | case 'priority': |
@@ -940,7 +939,7 @@ discard block |
||
940 | 939 | case 'title': |
941 | 940 | break; |
942 | 941 | default: |
943 | - $details_body .= sprintf("%-20s %s\n",$val['field'].':',$details[$key]); |
|
942 | + $details_body .= sprintf("%-20s %s\n", $val['field'].':', $details[$key]); |
|
944 | 943 | break; |
945 | 944 | } |
946 | 945 | } |
@@ -948,7 +947,7 @@ discard block |
||
948 | 947 | break; |
949 | 948 | } |
950 | 949 | // send via notification_app |
951 | - if($GLOBALS['egw_info']['apps']['notifications']['enabled']) |
|
950 | + if ($GLOBALS['egw_info']['apps']['notifications']['enabled']) |
|
952 | 951 | { |
953 | 952 | try { |
954 | 953 | //error_log(__METHOD__."() notifying $userid from $senderid: $subject"); |
@@ -972,7 +971,7 @@ discard block |
||
972 | 971 | $notification->set_popupmessage($notify_body."\n\n".$details['description']."\n\n".$details_body); |
973 | 972 | $notification->set_popuplinks(array($details['link_arr'])); |
974 | 973 | |
975 | - if(is_array($attachment)) { $notification->set_attachments(array($attachment)); } |
|
974 | + if (is_array($attachment)) { $notification->set_attachments(array($attachment)); } |
|
976 | 975 | $notification->send(); |
977 | 976 | } |
978 | 977 | catch (Exception $exception) { |
@@ -1004,14 +1003,14 @@ discard block |
||
1004 | 1003 | return true; |
1005 | 1004 | } |
1006 | 1005 | |
1007 | - function get_update_message($event,$added) |
|
1006 | + function get_update_message($event, $added) |
|
1008 | 1007 | { |
1009 | 1008 | $nul = null; |
1010 | - $details = $this->_get_event_details($event,$added ? lang('Added') : lang('Modified'),$nul); |
|
1009 | + $details = $this->_get_event_details($event, $added ? lang('Added') : lang('Modified'), $nul); |
|
1011 | 1010 | |
1012 | 1011 | $notify_msg = $this->cal_prefs[$added || empty($this->cal_prefs['notifyModified']) ? 'notifyAdded' : 'notifyModified']; |
1013 | 1012 | |
1014 | - return explode("\n",$GLOBALS['egw']->preferences->parse_notify($notify_msg,$details),2); |
|
1013 | + return explode("\n", $GLOBALS['egw']->preferences->parse_notify($notify_msg, $details), 2); |
|
1015 | 1014 | } |
1016 | 1015 | |
1017 | 1016 | /** |
@@ -1025,37 +1024,37 @@ discard block |
||
1025 | 1024 | //echo "<p>bocalendar::send_alarm("; print_r($alarm); echo ")</p>\n"; |
1026 | 1025 | $GLOBALS['egw_info']['user']['account_id'] = $this->owner = $alarm['owner']; |
1027 | 1026 | |
1028 | - $event_time_user = egw_time::server2user($alarm['time'] + $alarm['offset']); // alarm[time] is in server-time, read requires user-time |
|
1029 | - if (!$alarm['owner'] || !$alarm['cal_id'] || !($event = $this->read($alarm['cal_id'],$event_time_user))) |
|
1027 | + $event_time_user = egw_time::server2user($alarm['time'] + $alarm['offset']); // alarm[time] is in server-time, read requires user-time |
|
1028 | + if (!$alarm['owner'] || !$alarm['cal_id'] || !($event = $this->read($alarm['cal_id'], $event_time_user))) |
|
1030 | 1029 | { |
1031 | - return False; // event not found |
|
1030 | + return False; // event not found |
|
1032 | 1031 | } |
1033 | 1032 | if ($alarm['all']) |
1034 | 1033 | { |
1035 | 1034 | $to_notify = $event['participants']; |
1036 | 1035 | } |
1037 | - elseif ($this->check_perms(EGW_ACL_READ,$event)) // checks agains $this->owner set to $alarm[owner] |
|
1036 | + elseif ($this->check_perms(EGW_ACL_READ, $event)) // checks agains $this->owner set to $alarm[owner] |
|
1038 | 1037 | { |
1039 | 1038 | $to_notify[$alarm['owner']] = 'A'; |
1040 | 1039 | } |
1041 | 1040 | else |
1042 | 1041 | { |
1043 | - return False; // no rights |
|
1042 | + return False; // no rights |
|
1044 | 1043 | } |
1045 | 1044 | // need to load calendar translations and set currentapp, so calendar can reload a different lang |
1046 | 1045 | translation::add_app('calendar'); |
1047 | 1046 | $GLOBALS['egw_info']['flags']['currentapp'] = 'calendar'; |
1048 | 1047 | |
1049 | - $ret = $this->send_update(MSG_ALARM,$to_notify,$event,False,$alarm['owner']); |
|
1048 | + $ret = $this->send_update(MSG_ALARM, $to_notify, $event, False, $alarm['owner']); |
|
1050 | 1049 | |
1051 | 1050 | // create a new alarm for recuring events for the next event, if one exists |
1052 | - if ($event['recur_type'] != MCAL_RECUR_NONE && ($event = $this->read($alarm['cal_id'],$event_time_user+1))) |
|
1051 | + if ($event['recur_type'] != MCAL_RECUR_NONE && ($event = $this->read($alarm['cal_id'], $event_time_user + 1))) |
|
1053 | 1052 | { |
1054 | 1053 | $alarm['time'] = $this->date2ts($event['start']) - $alarm['offset']; |
1055 | 1054 | unset($alarm['times']); |
1056 | 1055 | unset($alarm['next']); |
1057 | 1056 | //error_log(__METHOD__."() moving alarm to next recurrence ".array2string($alarm)); |
1058 | - $this->save_alarm($alarm['cal_id'], $alarm, false); // false = do NOT update timestamp, as nothing changed for iCal clients |
|
1057 | + $this->save_alarm($alarm['cal_id'], $alarm, false); // false = do NOT update timestamp, as nothing changed for iCal clients |
|
1059 | 1058 | } |
1060 | 1059 | return $ret; |
1061 | 1060 | } |
@@ -1071,15 +1070,15 @@ discard block |
||
1071 | 1070 | * DEPRECATED: we allways (have to) update timestamp, as they are required for sync! |
1072 | 1071 | * @return int|boolean $cal_id > 0 or false on error (eg. permission denied) |
1073 | 1072 | */ |
1074 | - function save($event,$ignore_acl=false,$updateTS=true) |
|
1073 | + function save($event, $ignore_acl = false, $updateTS = true) |
|
1075 | 1074 | { |
1076 | 1075 | unset($updateTS); |
1077 | 1076 | //error_log(__METHOD__.'('.array2string($event).", $ignore_acl, $updateTS)"); |
1078 | 1077 | |
1079 | 1078 | // check if user has the permission to update / create the event |
1080 | - if (!$ignore_acl && ($event['id'] && !$this->check_perms(EGW_ACL_EDIT,$event['id']) || |
|
1081 | - !$event['id'] && !$this->check_perms(EGW_ACL_EDIT,0,$event['owner']) && |
|
1082 | - !$this->check_perms(EGW_ACL_ADD,0,$event['owner']))) |
|
1079 | + if (!$ignore_acl && ($event['id'] && !$this->check_perms(EGW_ACL_EDIT, $event['id']) || |
|
1080 | + !$event['id'] && !$this->check_perms(EGW_ACL_EDIT, 0, $event['owner']) && |
|
1081 | + !$this->check_perms(EGW_ACL_ADD, 0, $event['owner']))) |
|
1083 | 1082 | { |
1084 | 1083 | return false; |
1085 | 1084 | } |
@@ -1124,19 +1123,19 @@ discard block |
||
1124 | 1123 | $time->setUser(); |
1125 | 1124 | $save_event['recur_enddate'] = egw_time::to($time, 'ts'); |
1126 | 1125 | } |
1127 | - $timestamps = array('modified','created'); |
|
1126 | + $timestamps = array('modified', 'created'); |
|
1128 | 1127 | // all-day events are handled in server time |
1129 | 1128 | $event['tzid'] = $save_event['tzid'] = egw_time::$server_timezone->getName(); |
1130 | 1129 | } |
1131 | 1130 | else |
1132 | 1131 | { |
1133 | - $timestamps = array('start','end','modified','created','recur_enddate','recurrence'); |
|
1132 | + $timestamps = array('start', 'end', 'modified', 'created', 'recur_enddate', 'recurrence'); |
|
1134 | 1133 | } |
1135 | 1134 | // we run all dates through date2ts, to adjust to server-time and the possible date-formats |
1136 | - foreach($timestamps as $ts) |
|
1135 | + foreach ($timestamps as $ts) |
|
1137 | 1136 | { |
1138 | 1137 | // we convert here from user-time to timestamps in server-time! |
1139 | - if (isset($event[$ts])) $event[$ts] = $event[$ts] ? $this->date2ts($event[$ts],true) : 0; |
|
1138 | + if (isset($event[$ts])) $event[$ts] = $event[$ts] ? $this->date2ts($event[$ts], true) : 0; |
|
1140 | 1139 | } |
1141 | 1140 | // convert tzid name to integer tz_id, of set user default |
1142 | 1141 | if (empty($event['tzid']) || !($event['tz_id'] = calendar_timezones::tz2id($event['tzid']))) |
@@ -1146,7 +1145,7 @@ discard block |
||
1146 | 1145 | // same with the recur exceptions |
1147 | 1146 | if (isset($event['recur_exception']) && is_array($event['recur_exception'])) |
1148 | 1147 | { |
1149 | - foreach($event['recur_exception'] as &$date) |
|
1148 | + foreach ($event['recur_exception'] as &$date) |
|
1150 | 1149 | { |
1151 | 1150 | if ($event['whole_day']) |
1152 | 1151 | { |
@@ -1155,7 +1154,7 @@ discard block |
||
1155 | 1154 | } |
1156 | 1155 | else |
1157 | 1156 | { |
1158 | - $date = $this->date2ts($date,true); |
|
1157 | + $date = $this->date2ts($date, true); |
|
1159 | 1158 | } |
1160 | 1159 | } |
1161 | 1160 | unset($date); |
@@ -1163,7 +1162,7 @@ discard block |
||
1163 | 1162 | // same with the alarms |
1164 | 1163 | if (isset($event['alarm']) && is_array($event['alarm']) && isset($event['start'])) |
1165 | 1164 | { |
1166 | - foreach($event['alarm'] as $id => &$alarm) |
|
1165 | + foreach ($event['alarm'] as $id => &$alarm) |
|
1167 | 1166 | { |
1168 | 1167 | // remove alarms belonging to not longer existing or rejected participants |
1169 | 1168 | if ($alarm['owner'] && isset($event['participants'])) |
@@ -1181,15 +1180,14 @@ discard block |
||
1181 | 1180 | // update all existing alarm times, in case alarm got moved and alarms are not include in $event |
1182 | 1181 | if ($old_event && is_array($old_event['alarm']) && isset($event['start'])) |
1183 | 1182 | { |
1184 | - foreach($old_event['alarm'] as $id => &$alarm) |
|
1183 | + foreach ($old_event['alarm'] as $id => &$alarm) |
|
1185 | 1184 | { |
1186 | 1185 | if (!isset($event['alarm'][$id])) |
1187 | 1186 | { |
1188 | 1187 | $alarm['time'] = $event['start'] - $alarm['offset']; |
1189 | 1188 | if ($alarm['time'] < time()) calendar_so::shift_alarm($event, $alarm); |
1190 | 1189 | // remove (not store) alarms belonging to not longer existing or rejected participants |
1191 | - $status = isset($event['participants']) ? $event['participants'][$alarm['owner']] : |
|
1192 | - $old_event['participants'][$alarm['owner']]; |
|
1190 | + $status = isset($event['participants']) ? $event['participants'][$alarm['owner']] : $old_event['participants'][$alarm['owner']]; |
|
1193 | 1191 | if (!$alarm['owner'] || isset($status) && calendar_so::split_status($status) !== 'R') |
1194 | 1192 | { |
1195 | 1193 | $this->so->save_alarm($event['id'], $alarm); |
@@ -1215,7 +1213,7 @@ discard block |
||
1215 | 1213 | } |
1216 | 1214 | $set_recurrences = false; |
1217 | 1215 | $set_recurrences_start = 0; |
1218 | - if (($cal_id = $this->so->save($event,$set_recurrences,$set_recurrences_start,0,$event['etag'])) && $set_recurrences && $event['recur_type'] != MCAL_RECUR_NONE) |
|
1216 | + if (($cal_id = $this->so->save($event, $set_recurrences, $set_recurrences_start, 0, $event['etag'])) && $set_recurrences && $event['recur_type'] != MCAL_RECUR_NONE) |
|
1219 | 1217 | { |
1220 | 1218 | $save_event['id'] = $cal_id; |
1221 | 1219 | // unset participants to enforce the default stati for all added recurrences |
@@ -1227,7 +1225,7 @@ discard block |
||
1227 | 1225 | // create links for new participants from addressbook, if configured |
1228 | 1226 | if ($cal_id && $GLOBALS['egw_info']['server']['link_contacts'] && $event['participants']) |
1229 | 1227 | { |
1230 | - foreach($event['participants'] as $uid => $status) |
|
1228 | + foreach ($event['participants'] as $uid => $status) |
|
1231 | 1229 | { |
1232 | 1230 | $user_type = $user_id = null; |
1233 | 1231 | calendar_so::split_user($uid, $user_type, $user_id); |
@@ -1240,7 +1238,7 @@ discard block |
||
1240 | 1238 | |
1241 | 1239 | // Update history |
1242 | 1240 | $tracking = new calendar_tracking($this); |
1243 | - if (empty($event['id']) && !empty($cal_id)) $event['id']=$cal_id; |
|
1241 | + if (empty($event['id']) && !empty($cal_id)) $event['id'] = $cal_id; |
|
1244 | 1242 | $tracking->track($event, $old_event); |
1245 | 1243 | |
1246 | 1244 | return $cal_id; |
@@ -1255,16 +1253,16 @@ discard block |
||
1255 | 1253 | * @param array|int $event event array or id of the event |
1256 | 1254 | * @return boolean |
1257 | 1255 | */ |
1258 | - function check_status_perms($uid,$event) |
|
1256 | + function check_status_perms($uid, $event) |
|
1259 | 1257 | { |
1260 | 1258 | if ($uid[0] == 'c' || $uid[0] == 'e') // for contact we use the owner of the event |
1261 | 1259 | { |
1262 | 1260 | if (!is_array($event) && !($event = $this->read($event))) return false; |
1263 | 1261 | |
1264 | - return $this->check_perms(EGW_ACL_EDIT,0,$event['owner']); |
|
1262 | + return $this->check_perms(EGW_ACL_EDIT, 0, $event['owner']); |
|
1265 | 1263 | } |
1266 | 1264 | // check if we have a category acl for the event or not (null) |
1267 | - $access = $this->check_cat_acl(self::CAT_ACL_STATUS,$event); |
|
1265 | + $access = $this->check_cat_acl(self::CAT_ACL_STATUS, $event); |
|
1268 | 1266 | if (!is_null($access)) |
1269 | 1267 | { |
1270 | 1268 | return $access; |
@@ -1274,17 +1272,17 @@ discard block |
||
1274 | 1272 | { |
1275 | 1273 | $resource = $this->resource_info($uid); |
1276 | 1274 | |
1277 | - return EGW_ACL_EDIT & $resource['rights']; |
|
1275 | + return EGW_ACL_EDIT&$resource['rights']; |
|
1278 | 1276 | } |
1279 | 1277 | if (!is_array($event) && !($event = $this->read($event))) return false; |
1280 | 1278 | |
1281 | 1279 | // regular user and groups (need to check memberships too) |
1282 | 1280 | if (!isset($event['participants'][$uid])) |
1283 | 1281 | { |
1284 | - $memberships = $GLOBALS['egw']->accounts->memberships($uid,true); |
|
1282 | + $memberships = $GLOBALS['egw']->accounts->memberships($uid, true); |
|
1285 | 1283 | } |
1286 | 1284 | $memberships[] = $uid; |
1287 | - return array_intersect($memberships, array_keys($event['participants'])) && $this->check_perms(EGW_ACL_EDIT,0,$uid); |
|
1285 | + return array_intersect($memberships, array_keys($event['participants'])) && $this->check_perms(EGW_ACL_EDIT, 0, $uid); |
|
1288 | 1286 | } |
1289 | 1287 | |
1290 | 1288 | /** |
@@ -1298,16 +1296,16 @@ discard block |
||
1298 | 1296 | * @return boolean false=access denied because of cat acl, true access granted because of cat acl, |
1299 | 1297 | * null = cat has no acl |
1300 | 1298 | */ |
1301 | - function check_cat_acl($right,$event) |
|
1299 | + function check_cat_acl($right, $event) |
|
1302 | 1300 | { |
1303 | 1301 | if (!is_array($event)) $event = $this->read($event); |
1304 | 1302 | |
1305 | 1303 | $ret = null; |
1306 | 1304 | if ($event['category']) |
1307 | 1305 | { |
1308 | - foreach(is_array($event['category']) ? $event['category'] : explode(',',$event['category']) as $cat_id) |
|
1306 | + foreach (is_array($event['category']) ? $event['category'] : explode(',', $event['category']) as $cat_id) |
|
1309 | 1307 | { |
1310 | - $access = self::has_cat_right($right,$cat_id,$this->user); |
|
1308 | + $access = self::has_cat_right($right, $cat_id, $this->user); |
|
1311 | 1309 | if ($access === true) |
1312 | 1310 | { |
1313 | 1311 | $ret = true; |
@@ -1315,7 +1313,7 @@ discard block |
||
1315 | 1313 | } |
1316 | 1314 | if ($access === false) |
1317 | 1315 | { |
1318 | - $ret = false; // cat denies access --> check further cats |
|
1316 | + $ret = false; // cat denies access --> check further cats |
|
1319 | 1317 | } |
1320 | 1318 | } |
1321 | 1319 | } |
@@ -1336,12 +1334,12 @@ discard block |
||
1336 | 1334 | * @param int $cat_id =null null to return array with all cats |
1337 | 1335 | * @return array with account_id => right pairs |
1338 | 1336 | */ |
1339 | - public static function get_cat_rights($cat_id=null) |
|
1337 | + public static function get_cat_rights($cat_id = null) |
|
1340 | 1338 | { |
1341 | 1339 | if (!isset(self::$cat_rights_cache)) |
1342 | 1340 | { |
1343 | - self::$cat_rights_cache = egw_cache::getSession('calendar','cat_rights', |
|
1344 | - array($GLOBALS['egw']->acl,'get_location_grants'),array('L%','calendar')); |
|
1341 | + self::$cat_rights_cache = egw_cache::getSession('calendar', 'cat_rights', |
|
1342 | + array($GLOBALS['egw']->acl, 'get_location_grants'), array('L%', 'calendar')); |
|
1345 | 1343 | } |
1346 | 1344 | //echo "<p>".__METHOD__."($cat_id) = ".array2string($cat_id ? self::$cat_rights_cache['L'.$cat_id] : self::$cat_rights_cache)."</p>\n"; |
1347 | 1345 | return $cat_id ? self::$cat_rights_cache['L'.$cat_id] : self::$cat_rights_cache; |
@@ -1354,7 +1352,7 @@ discard block |
||
1354 | 1352 | * @param int $user |
1355 | 1353 | * @param int $rights self::CAT_ACL_{ADD|STATUS} or'ed together |
1356 | 1354 | */ |
1357 | - public static function set_cat_rights($cat_id,$user,$rights) |
|
1355 | + public static function set_cat_rights($cat_id, $user, $rights) |
|
1358 | 1356 | { |
1359 | 1357 | //echo "<p>".__METHOD__."($cat_id,$user,$rights)</p>\n"; |
1360 | 1358 | if (!isset(self::$cat_rights_cache)) self::get_cat_rights($cat_id); |
@@ -1364,15 +1362,15 @@ discard block |
||
1364 | 1362 | if ($rights) |
1365 | 1363 | { |
1366 | 1364 | self::$cat_rights_cache['L'.$cat_id][$user] = $rights; |
1367 | - $GLOBALS['egw']->acl->add_repository('calendar','L'.$cat_id,$user,$rights); |
|
1365 | + $GLOBALS['egw']->acl->add_repository('calendar', 'L'.$cat_id, $user, $rights); |
|
1368 | 1366 | } |
1369 | 1367 | else |
1370 | 1368 | { |
1371 | 1369 | unset(self::$cat_rights_cache['L'.$cat_id][$user]); |
1372 | 1370 | if (!self::$cat_rights_cache['L'.$cat_id]) unset(self::$cat_rights_cache['L'.$cat_id]); |
1373 | - $GLOBALS['egw']->acl->delete_repository('calendar','L'.$cat_id,$user); |
|
1371 | + $GLOBALS['egw']->acl->delete_repository('calendar', 'L'.$cat_id, $user); |
|
1374 | 1372 | } |
1375 | - egw_cache::setSession('calendar','cat_rights',self::$cat_rights_cache); |
|
1373 | + egw_cache::setSession('calendar', 'cat_rights', self::$cat_rights_cache); |
|
1376 | 1374 | } |
1377 | 1375 | } |
1378 | 1376 | |
@@ -1383,9 +1381,9 @@ discard block |
||
1383 | 1381 | * @return boolean false=access denied because of cat acl, true access granted because of cat acl, |
1384 | 1382 | * null = cat has no acl |
1385 | 1383 | */ |
1386 | - public static function has_cat_right($right,$cat_id,$user) |
|
1384 | + public static function has_cat_right($right, $cat_id, $user) |
|
1387 | 1385 | { |
1388 | - static $cache=null; |
|
1386 | + static $cache = null; |
|
1389 | 1387 | |
1390 | 1388 | if (!isset($cache[$cat_id])) |
1391 | 1389 | { |
@@ -1393,21 +1391,21 @@ discard block |
||
1393 | 1391 | $cat_rights = self::get_cat_rights($cat_id); |
1394 | 1392 | if (!is_null($cat_rights)) |
1395 | 1393 | { |
1396 | - static $memberships=null; |
|
1394 | + static $memberships = null; |
|
1397 | 1395 | if (is_null($memberships)) |
1398 | 1396 | { |
1399 | - $memberships = $GLOBALS['egw']->accounts->memberships($user,true); |
|
1397 | + $memberships = $GLOBALS['egw']->accounts->memberships($user, true); |
|
1400 | 1398 | $memberships[] = $user; |
1401 | 1399 | } |
1402 | - foreach($cat_rights as $uid => $value) |
|
1400 | + foreach ($cat_rights as $uid => $value) |
|
1403 | 1401 | { |
1404 | 1402 | $all |= $value; |
1405 | - if (in_array($uid,$memberships)) $own |= $value; |
|
1403 | + if (in_array($uid, $memberships)) $own |= $value; |
|
1406 | 1404 | } |
1407 | 1405 | } |
1408 | - foreach(array(self::CAT_ACL_ADD,self::CAT_ACL_STATUS) as $mask) |
|
1406 | + foreach (array(self::CAT_ACL_ADD, self::CAT_ACL_STATUS) as $mask) |
|
1409 | 1407 | { |
1410 | - $cache[$cat_id][$mask] = !($all & $mask) ? null : !!($own & $mask); |
|
1408 | + $cache[$cat_id][$mask] = !($all&$mask) ? null : !!($own&$mask); |
|
1411 | 1409 | } |
1412 | 1410 | } |
1413 | 1411 | //echo "<p>".__METHOD__."($right,$cat_id) all=$all, own=$own returning ".array2string($cache[$cat_id][$right])."</p>\n"; |
@@ -1427,13 +1425,13 @@ discard block |
||
1427 | 1425 | * @param boolean $skip_notification =false true: do not send notification messages |
1428 | 1426 | * @return int number of changed recurrences |
1429 | 1427 | */ |
1430 | - function set_status($event,$uid,$status,$recur_date=0,$ignore_acl=false,$updateTS=true,$skip_notification=false) |
|
1428 | + function set_status($event, $uid, $status, $recur_date = 0, $ignore_acl = false, $updateTS = true, $skip_notification = false) |
|
1431 | 1429 | { |
1432 | 1430 | unset($updateTS); |
1433 | 1431 | |
1434 | 1432 | $cal_id = is_array($event) ? $event['id'] : $event; |
1435 | 1433 | //echo "<p>calendar_boupdate::set_status($cal_id,$uid,$status,$recur_date)</p>\n"; |
1436 | - if (!$cal_id || (!$ignore_acl && !$this->check_status_perms($uid,$event))) |
|
1434 | + if (!$cal_id || (!$ignore_acl && !$this->check_status_perms($uid, $event))) |
|
1437 | 1435 | { |
1438 | 1436 | return false; |
1439 | 1437 | } |
@@ -1442,16 +1440,16 @@ discard block |
||
1442 | 1440 | if ($this->log) |
1443 | 1441 | { |
1444 | 1442 | error_log(__FILE__.'['.__LINE__.'] '.__METHOD__. |
1445 | - "($cal_id, $uid, $status, $recur_date)\n",3,$this->logfile); |
|
1443 | + "($cal_id, $uid, $status, $recur_date)\n", 3, $this->logfile); |
|
1446 | 1444 | } |
1447 | 1445 | $old_event = $this->read($cal_id, $recur_date, false, 'server'); |
1448 | - if (($Ok = $this->so->set_status($cal_id,is_numeric($uid)?'u':$uid[0], |
|
1449 | - is_numeric($uid)?$uid:substr($uid,1),$status, |
|
1450 | - $recur_date?$this->date2ts($recur_date,true):0,$role))) |
|
1446 | + if (($Ok = $this->so->set_status($cal_id, is_numeric($uid) ? 'u' : $uid[0], |
|
1447 | + is_numeric($uid) ? $uid : substr($uid, 1), $status, |
|
1448 | + $recur_date ? $this->date2ts($recur_date, true) : 0, $role))) |
|
1451 | 1449 | { |
1452 | 1450 | if ($status == 'R') // remove alarms belonging to rejected participants |
1453 | 1451 | { |
1454 | - foreach(isset($event['alarm']) ? $event['alarm'] : $old_event['alarm'] as $id => $alarm) |
|
1452 | + foreach (isset($event['alarm']) ? $event['alarm'] : $old_event['alarm'] as $id => $alarm) |
|
1455 | 1453 | { |
1456 | 1454 | if ((string)$alarm['owner'] === (string)$uid) |
1457 | 1455 | { |
@@ -1474,8 +1472,8 @@ discard block |
||
1474 | 1472 | if (isset($status2msg[$status]) && !$skip_notification) |
1475 | 1473 | { |
1476 | 1474 | if (!is_array($event)) $event = $this->read($cal_id); |
1477 | - if (isset($recur_date)) $event = $this->read($event['id'],$recur_date); //re-read the actually edited recurring event |
|
1478 | - $this->send_update($status2msg[$status],$event['participants'],$event); |
|
1475 | + if (isset($recur_date)) $event = $this->read($event['id'], $recur_date); //re-read the actually edited recurring event |
|
1476 | + $this->send_update($status2msg[$status], $event['participants'], $event); |
|
1479 | 1477 | } |
1480 | 1478 | |
1481 | 1479 | // Update history |
@@ -1495,14 +1493,14 @@ discard block |
||
1495 | 1493 | * @param int $recur_date =0 date to change, or 0 = all since now |
1496 | 1494 | * @param boolean $skip_notification Do not send notifications. Parameter passed on to set_status(). |
1497 | 1495 | */ |
1498 | - function update_status($new_event, $old_event , $recur_date=0, $skip_notification=false) |
|
1496 | + function update_status($new_event, $old_event, $recur_date = 0, $skip_notification = false) |
|
1499 | 1497 | { |
1500 | 1498 | if (!isset($new_event['participants'])) return; |
1501 | 1499 | |
1502 | 1500 | // check the old list against the new list |
1503 | 1501 | foreach ($old_event['participants'] as $userid => $status) |
1504 | 1502 | { |
1505 | - if (!isset($new_event['participants'][$userid])){ |
|
1503 | + if (!isset($new_event['participants'][$userid])) { |
|
1506 | 1504 | // Attendee will be deleted this way |
1507 | 1505 | $new_event['participants'][$userid] = 'G'; |
1508 | 1506 | } |
@@ -1515,7 +1513,7 @@ discard block |
||
1515 | 1513 | // write the changes |
1516 | 1514 | foreach ($new_event['participants'] as $userid => $status) |
1517 | 1515 | { |
1518 | - $this->set_status($old_event, $userid, $status, $recur_date, true, false,$skip_notification); |
|
1516 | + $this->set_status($old_event, $userid, $status, $recur_date, true, false, $skip_notification); |
|
1519 | 1517 | } |
1520 | 1518 | } |
1521 | 1519 | |
@@ -1530,43 +1528,43 @@ discard block |
||
1530 | 1528 | * @param int &$exceptions_kept=null on return number of kept exceptions |
1531 | 1529 | * @return boolean true on success, false on error (usually permission denied) |
1532 | 1530 | */ |
1533 | - function delete($cal_id, $recur_date=0, $ignore_acl=false, $skip_notification=false, |
|
1534 | - $delete_exceptions=true, &$exceptions_kept=null) |
|
1531 | + function delete($cal_id, $recur_date = 0, $ignore_acl = false, $skip_notification = false, |
|
1532 | + $delete_exceptions = true, &$exceptions_kept = null) |
|
1535 | 1533 | { |
1536 | 1534 | //error_log(__METHOD__."(cal_id=$cal_id, recur_date=$recur_date, ignore_acl=$ignore_acl, skip_notifications=$skip_notification)"); |
1537 | - if (!($event = $this->read($cal_id,$recur_date)) || |
|
1538 | - !$ignore_acl && !$this->check_perms(EGW_ACL_DELETE,$event)) |
|
1535 | + if (!($event = $this->read($cal_id, $recur_date)) || |
|
1536 | + !$ignore_acl && !$this->check_perms(EGW_ACL_DELETE, $event)) |
|
1539 | 1537 | { |
1540 | 1538 | return false; |
1541 | 1539 | } |
1542 | 1540 | |
1543 | 1541 | // Don't send notification if the event has already been deleted |
1544 | - if(!$event['deleted'] && !$skip_notification) |
|
1542 | + if (!$event['deleted'] && !$skip_notification) |
|
1545 | 1543 | { |
1546 | - $this->send_update(MSG_DELETED,$event['participants'],$event); |
|
1544 | + $this->send_update(MSG_DELETED, $event['participants'], $event); |
|
1547 | 1545 | } |
1548 | 1546 | |
1549 | 1547 | if (!$recur_date || $event['recur_type'] == MCAL_RECUR_NONE) |
1550 | 1548 | { |
1551 | 1549 | $config = config::read('phpgwapi'); |
1552 | - if(!$config['calendar_delete_history'] || $event['deleted']) |
|
1550 | + if (!$config['calendar_delete_history'] || $event['deleted']) |
|
1553 | 1551 | { |
1554 | 1552 | $this->so->delete($cal_id); |
1555 | 1553 | |
1556 | 1554 | // delete all links to the event |
1557 | - egw_link::unlink(0,'calendar',$cal_id); |
|
1555 | + egw_link::unlink(0, 'calendar', $cal_id); |
|
1558 | 1556 | } |
1559 | 1557 | elseif ($config['calendar_delete_history']) |
1560 | 1558 | { |
1561 | 1559 | // mark all links to the event as deleted, but keep them |
1562 | - egw_link::unlink(0,'calendar',$cal_id,'','','',true); |
|
1560 | + egw_link::unlink(0, 'calendar', $cal_id, '', '', '', true); |
|
1563 | 1561 | |
1564 | 1562 | $event['deleted'] = $this->now; |
1565 | 1563 | $this->save($event, $ignore_acl); |
1566 | 1564 | // Actually delete alarms |
1567 | 1565 | if (isset($event['alarm']) && is_array($event['alarm'])) |
1568 | 1566 | { |
1569 | - foreach($event['alarm'] as $id => $alarm) |
|
1567 | + foreach ($event['alarm'] as $id => $alarm) |
|
1570 | 1568 | { |
1571 | 1569 | $this->delete_alarm($id); |
1572 | 1570 | } |
@@ -1589,7 +1587,7 @@ discard block |
||
1589 | 1587 | if (!($exception = $this->read($id))) continue; |
1590 | 1588 | $exception['uid'] = common::generate_uid('calendar', $id); |
1591 | 1589 | $exception['reference'] = $exception['recurrence'] = 0; |
1592 | - $this->update($exception, true, true, false, true, $msg=null, true); |
|
1590 | + $this->update($exception, true, true, false, true, $msg = null, true); |
|
1593 | 1591 | ++$exceptions_kept; |
1594 | 1592 | } |
1595 | 1593 | } |
@@ -1601,9 +1599,9 @@ discard block |
||
1601 | 1599 | if ($event['alarm']) |
1602 | 1600 | { |
1603 | 1601 | $next_recurrance = null; |
1604 | - foreach($event['alarm'] as &$alarm) |
|
1602 | + foreach ($event['alarm'] as &$alarm) |
|
1605 | 1603 | { |
1606 | - if (($alarm['time'] == $recur_date) || ($alarm['time']+$alarm['offset'] == $recur_date)) |
|
1604 | + if (($alarm['time'] == $recur_date) || ($alarm['time'] + $alarm['offset'] == $recur_date)) |
|
1607 | 1605 | { |
1608 | 1606 | //error_log(__METHOD__.__LINE__.'->'.array2string($recur_date)); |
1609 | 1607 | //error_log(__METHOD__.__LINE__.array2string($event)); |
@@ -1611,12 +1609,12 @@ discard block |
||
1611 | 1609 | { |
1612 | 1610 | $checkdate = $recur_date; |
1613 | 1611 | //if ($alarm['time']+$alarm['offset'] == $recur_date) $checkdate = $recur_date + $alarm['offset']; |
1614 | - if (($e = $this->read($cal_id,$checkdate+1))) |
|
1612 | + if (($e = $this->read($cal_id, $checkdate + 1))) |
|
1615 | 1613 | { |
1616 | 1614 | $next_recurrance = $this->date2ts($e['start']); |
1617 | 1615 | } |
1618 | 1616 | } |
1619 | - $alarm['time'] = $this->date2ts($next_recurrance, true); // user to server-time |
|
1617 | + $alarm['time'] = $this->date2ts($next_recurrance, true); // user to server-time |
|
1620 | 1618 | $alarm['cal_id'] = $cal_id; |
1621 | 1619 | unset($alarm['times']); |
1622 | 1620 | unset($alarm['next']); |
@@ -1630,7 +1628,7 @@ discard block |
||
1630 | 1628 | $event = $this->read($cal_id); |
1631 | 1629 | //if (isset($alarmbuffer)) $event['alarm'] = $alarmbuffer; |
1632 | 1630 | $event['recur_exception'][] = $recur_date; |
1633 | - $this->save($event);// updates the content-history |
|
1631 | + $this->save($event); // updates the content-history |
|
1634 | 1632 | } |
1635 | 1633 | if ($event['reference']) |
1636 | 1634 | { |
@@ -1648,19 +1646,19 @@ discard block |
||
1648 | 1646 | * @param array $disinvited |
1649 | 1647 | * @return array |
1650 | 1648 | */ |
1651 | - function _get_event_details($event,$action,&$event_arr,$disinvited=array()) |
|
1649 | + function _get_event_details($event, $action, &$event_arr, $disinvited = array()) |
|
1652 | 1650 | { |
1653 | 1651 | $details = array( // event-details for the notify-msg |
1654 | 1652 | 'id' => $event['id'], |
1655 | 1653 | 'action' => lang($action), |
1656 | 1654 | ); |
1657 | 1655 | $event_arr = $this->event2array($event); |
1658 | - foreach($event_arr as $key => $val) |
|
1656 | + foreach ($event_arr as $key => $val) |
|
1659 | 1657 | { |
1660 | 1658 | if ($key == 'recur_type') $key = 'repetition'; |
1661 | 1659 | $details[$key] = $val['data']; |
1662 | 1660 | } |
1663 | - $details['participants'] = $details['participants'] ? implode("\n",$details['participants']) : ''; |
|
1661 | + $details['participants'] = $details['participants'] ? implode("\n", $details['participants']) : ''; |
|
1664 | 1662 | |
1665 | 1663 | $event_arr['link']['field'] = lang('URL'); |
1666 | 1664 | $eventStart_arr = $this->date2array($event['start']); // give this as 'date' to the link to pick the right recurrence for the participants state |
@@ -1681,7 +1679,7 @@ discard block |
||
1681 | 1679 | */ |
1682 | 1680 | $link_arr = array(); |
1683 | 1681 | $link_arr['text'] = $event['title']; |
1684 | - $link_arr['view'] = array( 'menuaction' => 'calendar.calendar_uiforms.edit', |
|
1682 | + $link_arr['view'] = array('menuaction' => 'calendar.calendar_uiforms.edit', |
|
1685 | 1683 | 'cal_id' => $event['id'], |
1686 | 1684 | 'date' => $eventStart_arr['full'], |
1687 | 1685 | ); |
@@ -1689,11 +1687,11 @@ discard block |
||
1689 | 1687 | $details['link_arr'] = $link_arr; |
1690 | 1688 | |
1691 | 1689 | $dis = array(); |
1692 | - foreach($disinvited as $uid) |
|
1690 | + foreach ($disinvited as $uid) |
|
1693 | 1691 | { |
1694 | 1692 | $dis[] = $this->participant_name($uid); |
1695 | 1693 | } |
1696 | - $details['disinvited'] = implode(', ',$dis); |
|
1694 | + $details['disinvited'] = implode(', ', $dis); |
|
1697 | 1695 | return $details; |
1698 | 1696 | } |
1699 | 1697 | |
@@ -1717,14 +1715,14 @@ discard block |
||
1717 | 1715 | 'data' => $event['description'] |
1718 | 1716 | ); |
1719 | 1717 | |
1720 | - foreach(explode(',',$event['category']) as $cat_id) |
|
1718 | + foreach (explode(',', $event['category']) as $cat_id) |
|
1721 | 1719 | { |
1722 | 1720 | list($cat) = $GLOBALS['egw']->categories->return_single($cat_id); |
1723 | 1721 | $cat_string[] = stripslashes($cat['name']); |
1724 | 1722 | } |
1725 | 1723 | $var['category'] = Array( |
1726 | 1724 | 'field' => lang('Category'), |
1727 | - 'data' => implode(', ',$cat_string) |
|
1725 | + 'data' => implode(', ', $cat_string) |
|
1728 | 1726 | ); |
1729 | 1727 | |
1730 | 1728 | $var['location'] = Array( |
@@ -1770,7 +1768,7 @@ discard block |
||
1770 | 1768 | |
1771 | 1769 | if (isset($event['participants']) && is_array($event['participants']) && !empty($event['participants'])) |
1772 | 1770 | { |
1773 | - $participants = $this->participants($event,true); |
|
1771 | + $participants = $this->participants($event, true); |
|
1774 | 1772 | } |
1775 | 1773 | $var['participants'] = Array( |
1776 | 1774 | 'field' => lang('Participants'), |
@@ -1793,26 +1791,26 @@ discard block |
||
1793 | 1791 | * @param array $old_event =null event-data in the DB before calling save |
1794 | 1792 | * @param string $type ='update' |
1795 | 1793 | */ |
1796 | - function log2file($event2save,$event_saved,$old_event=null,$type='update') |
|
1794 | + function log2file($event2save, $event_saved, $old_event = null, $type = 'update') |
|
1797 | 1795 | { |
1798 | - if (!($f = fopen($this->log_file,'a'))) |
|
1796 | + if (!($f = fopen($this->log_file, 'a'))) |
|
1799 | 1797 | { |
1800 | 1798 | echo "<p>error opening '$this->log_file' !!!</p>\n"; |
1801 | 1799 | return false; |
1802 | 1800 | } |
1803 | - fwrite($f,$type.': '.common::grab_owner_name($this->user).': '.date('r')."\n"); |
|
1804 | - fwrite($f,"Time: time to save / saved time read back / old time before save\n"); |
|
1805 | - foreach(array('start','end') as $name) |
|
1801 | + fwrite($f, $type.': '.common::grab_owner_name($this->user).': '.date('r')."\n"); |
|
1802 | + fwrite($f, "Time: time to save / saved time read back / old time before save\n"); |
|
1803 | + foreach (array('start', 'end') as $name) |
|
1806 | 1804 | { |
1807 | - fwrite($f,$name.': '.(isset($event2save[$name]) ? $this->format_date($event2save[$name]) : 'not set').' / '. |
|
1808 | - $this->format_date($event_saved[$name]) .' / '. |
|
1805 | + fwrite($f, $name.': '.(isset($event2save[$name]) ? $this->format_date($event2save[$name]) : 'not set').' / '. |
|
1806 | + $this->format_date($event_saved[$name]).' / '. |
|
1809 | 1807 | (is_null($old_event) ? 'no old event' : $this->format_date($old_event[$name]))."\n"); |
1810 | 1808 | } |
1811 | - foreach(array('event2save','event_saved','old_event') as $name) |
|
1809 | + foreach (array('event2save', 'event_saved', 'old_event') as $name) |
|
1812 | 1810 | { |
1813 | - fwrite($f,$name.' = '.print_r($$name,true)); |
|
1811 | + fwrite($f, $name.' = '.print_r($$name, true)); |
|
1814 | 1812 | } |
1815 | - fwrite($f,"\n"); |
|
1813 | + fwrite($f, "\n"); |
|
1816 | 1814 | fclose($f); |
1817 | 1815 | |
1818 | 1816 | return true; |
@@ -1833,14 +1831,14 @@ discard block |
||
1833 | 1831 | if ($old_event !== null && $event['start'] == $old_event['start']) return; |
1834 | 1832 | |
1835 | 1833 | $time = new egw_time($event['start']); |
1836 | - if(!is_array($event['alarm'])) |
|
1834 | + if (!is_array($event['alarm'])) |
|
1837 | 1835 | { |
1838 | 1836 | $event['alarm'] = $this->so->read_alarms($event['id']); |
1839 | 1837 | } |
1840 | 1838 | |
1841 | - foreach($event['alarm'] as $id => &$alarm) |
|
1839 | + foreach ($event['alarm'] as $id => &$alarm) |
|
1842 | 1840 | { |
1843 | - if($event['recur_type'] != MCAL_RECUR_NONE) |
|
1841 | + if ($event['recur_type'] != MCAL_RECUR_NONE) |
|
1844 | 1842 | { |
1845 | 1843 | calendar_so::shift_alarm($event, $alarm, $instance_date->format('ts')); |
1846 | 1844 | } |
@@ -1860,14 +1858,14 @@ discard block |
||
1860 | 1858 | * @param boolean $update_modified =true call update modified, default true |
1861 | 1859 | * @return string id of the alarm, or false on error (eg. no perms) |
1862 | 1860 | */ |
1863 | - function save_alarm($cal_id, $alarm, $update_modified=true) |
|
1861 | + function save_alarm($cal_id, $alarm, $update_modified = true) |
|
1864 | 1862 | { |
1865 | - if (!$cal_id || !$this->check_perms(EGW_ACL_EDIT,$alarm['all'] ? $cal_id : 0,!$alarm['all'] ? $alarm['owner'] : 0)) |
|
1863 | + if (!$cal_id || !$this->check_perms(EGW_ACL_EDIT, $alarm['all'] ? $cal_id : 0, !$alarm['all'] ? $alarm['owner'] : 0)) |
|
1866 | 1864 | { |
1867 | 1865 | //echo "<p>no rights to save the alarm=".print_r($alarm,true)." to event($cal_id)</p>"; |
1868 | - return false; // no rights to add the alarm |
|
1866 | + return false; // no rights to add the alarm |
|
1869 | 1867 | } |
1870 | - $alarm['time'] = $this->date2ts($alarm['time'],true); // user to server-time |
|
1868 | + $alarm['time'] = $this->date2ts($alarm['time'], true); // user to server-time |
|
1871 | 1869 | |
1872 | 1870 | $GLOBALS['egw']->contenthistory->updateTimeStamp('calendar', $cal_id, 'modify', $this->now); |
1873 | 1871 | |
@@ -1882,11 +1880,11 @@ discard block |
||
1882 | 1880 | */ |
1883 | 1881 | function delete_alarm($id) |
1884 | 1882 | { |
1885 | - list(,$cal_id) = explode(':',$id); |
|
1883 | + list(,$cal_id) = explode(':', $id); |
|
1886 | 1884 | |
1887 | - if (!($alarm = $this->so->read_alarm($id)) || !$cal_id || !$this->check_perms(EGW_ACL_EDIT,$alarm['all'] ? $cal_id : 0,!$alarm['all'] ? $alarm['owner'] : 0)) |
|
1885 | + if (!($alarm = $this->so->read_alarm($id)) || !$cal_id || !$this->check_perms(EGW_ACL_EDIT, $alarm['all'] ? $cal_id : 0, !$alarm['all'] ? $alarm['owner'] : 0)) |
|
1888 | 1886 | { |
1889 | - return false; // no rights to delete the alarm |
|
1887 | + return false; // no rights to delete the alarm |
|
1890 | 1888 | } |
1891 | 1889 | |
1892 | 1890 | $GLOBALS['egw']->contenthistory->updateTimeStamp('calendar', $cal_id, 'modify', $this->now); |
@@ -1903,13 +1901,13 @@ discard block |
||
1903 | 1901 | * by the ones the user normally does not see due to category permissions - used to preserve categories |
1904 | 1902 | * @return array category ids (found, added and preserved categories) |
1905 | 1903 | */ |
1906 | - function find_or_add_categories($catname_list, $old_event=null) |
|
1904 | + function find_or_add_categories($catname_list, $old_event = null) |
|
1907 | 1905 | { |
1908 | 1906 | if (is_array($old_event) || $old_event > 0) |
1909 | 1907 | { |
1910 | 1908 | // preserve categories without users read access |
1911 | 1909 | if (!is_array($old_event)) $old_event = $this->read($old_event); |
1912 | - $old_categories = explode(',',$old_event['category']); |
|
1910 | + $old_categories = explode(',', $old_event['category']); |
|
1913 | 1911 | $old_cats_preserve = array(); |
1914 | 1912 | if (is_array($old_categories) && count($old_categories) > 0) |
1915 | 1913 | { |
@@ -1963,7 +1961,7 @@ discard block |
||
1963 | 1961 | { |
1964 | 1962 | if (!is_array($cat_id_list)) |
1965 | 1963 | { |
1966 | - $cat_id_list = explode(',',$cat_id_list); |
|
1964 | + $cat_id_list = explode(',', $cat_id_list); |
|
1967 | 1965 | } |
1968 | 1966 | $cat_list = array(); |
1969 | 1967 | foreach ($cat_id_list as $cat_id) |
@@ -1988,7 +1986,7 @@ discard block |
||
1988 | 1986 | * master -> try to find a releated series master |
1989 | 1987 | * @return array calendar_ids of matching entries |
1990 | 1988 | */ |
1991 | - function find_event($event, $filter='exact') |
|
1989 | + function find_event($event, $filter = 'exact') |
|
1992 | 1990 | { |
1993 | 1991 | $matchingEvents = array(); |
1994 | 1992 | $query = array(); |
@@ -1996,14 +1994,14 @@ discard block |
||
1996 | 1994 | if ($this->log) |
1997 | 1995 | { |
1998 | 1996 | error_log(__FILE__.'['.__LINE__.'] '.__METHOD__. |
1999 | - "($filter)[EVENT]:" . array2string($event)."\n",3,$this->logfile); |
|
1997 | + "($filter)[EVENT]:".array2string($event)."\n", 3, $this->logfile); |
|
2000 | 1998 | } |
2001 | 1999 | |
2002 | 2000 | if (!isset($event['recurrence'])) $event['recurrence'] = 0; |
2003 | 2001 | |
2004 | 2002 | if ($filter == 'master') |
2005 | 2003 | { |
2006 | - $query[] = 'recur_type!='. MCAL_RECUR_NONE; |
|
2004 | + $query[] = 'recur_type!='.MCAL_RECUR_NONE; |
|
2007 | 2005 | $query['cal_recurrence'] = 0; |
2008 | 2006 | } |
2009 | 2007 | elseif ($filter == 'exact') |
@@ -2024,14 +2022,14 @@ discard block |
||
2024 | 2022 | if ($this->log) |
2025 | 2023 | { |
2026 | 2024 | error_log(__FILE__.'['.__LINE__.'] '.__METHOD__. |
2027 | - '(' . $event['id'] . ")[EventID]\n",3,$this->logfile); |
|
2025 | + '('.$event['id'].")[EventID]\n", 3, $this->logfile); |
|
2028 | 2026 | } |
2029 | 2027 | if (($egwEvent = $this->read($event['id'], 0, false, 'server'))) |
2030 | 2028 | { |
2031 | 2029 | if ($this->log) |
2032 | 2030 | { |
2033 | 2031 | error_log(__FILE__.'['.__LINE__.'] '.__METHOD__. |
2034 | - '()[FOUND]:' . array2string($egwEvent)."\n",3,$this->logfile); |
|
2032 | + '()[FOUND]:'.array2string($egwEvent)."\n", 3, $this->logfile); |
|
2035 | 2033 | } |
2036 | 2034 | if ($egwEvent['recur_type'] != MCAL_RECUR_NONE && |
2037 | 2035 | (empty($event['uid']) || $event['uid'] == $egwEvent['uid'])) |
@@ -2050,7 +2048,7 @@ discard block |
||
2050 | 2048 | $exceptions = $this->so->get_recurrence_exceptions($egwEvent, $event['tzid']); |
2051 | 2049 | if (in_array($event['recurrence'], $exceptions)) |
2052 | 2050 | { |
2053 | - $matchingEvents[] = $egwEvent['id'] . ':' . (int)$event['recurrence']; |
|
2051 | + $matchingEvents[] = $egwEvent['id'].':'.(int)$event['recurrence']; |
|
2054 | 2052 | } |
2055 | 2053 | } |
2056 | 2054 | } elseif ($filter != 'master' && ($filter == 'exact' || |
@@ -2069,19 +2067,19 @@ discard block |
||
2069 | 2067 | |
2070 | 2068 | // only query calendars of users, we have READ-grants from |
2071 | 2069 | $users = array(); |
2072 | - foreach(array_keys($this->grants) as $user) |
|
2070 | + foreach (array_keys($this->grants) as $user) |
|
2073 | 2071 | { |
2074 | 2072 | $user = trim($user); |
2075 | - if ($this->check_perms(EGW_ACL_READ|EGW_ACL_READ_FOR_PARTICIPANTS|EGW_ACL_FREEBUSY,0,$user)) |
|
2073 | + if ($this->check_perms(EGW_ACL_READ|EGW_ACL_READ_FOR_PARTICIPANTS|EGW_ACL_FREEBUSY, 0, $user)) |
|
2076 | 2074 | { |
2077 | - if ($user && !in_array($user,$users)) // already added? |
|
2075 | + if ($user && !in_array($user, $users)) // already added? |
|
2078 | 2076 | { |
2079 | 2077 | $users[] = $user; |
2080 | 2078 | } |
2081 | 2079 | } |
2082 | 2080 | elseif ($GLOBALS['egw']->accounts->get_type($user) != 'g') |
2083 | 2081 | { |
2084 | - continue; // for non-groups (eg. users), we stop here if we have no read-rights |
|
2082 | + continue; // for non-groups (eg. users), we stop here if we have no read-rights |
|
2085 | 2083 | } |
2086 | 2084 | // the further code is only for real users |
2087 | 2085 | if (!is_numeric($user)) continue; |
@@ -2092,11 +2090,11 @@ discard block |
||
2092 | 2090 | $members = $GLOBALS['egw']->accounts->member($user); |
2093 | 2091 | if (is_array($members)) |
2094 | 2092 | { |
2095 | - foreach($members as $member) |
|
2093 | + foreach ($members as $member) |
|
2096 | 2094 | { |
2097 | 2095 | // use only members which gave the user a read-grant |
2098 | - if (!in_array($member['account_id'],$users) && |
|
2099 | - $this->check_perms(EGW_ACL_READ|EGW_ACL_FREEBUSY,0,$member['account_id'])) |
|
2096 | + if (!in_array($member['account_id'], $users) && |
|
2097 | + $this->check_perms(EGW_ACL_READ|EGW_ACL_FREEBUSY, 0, $member['account_id'])) |
|
2100 | 2098 | { |
2101 | 2099 | $users[] = $member['account_id']; |
2102 | 2100 | } |
@@ -2108,9 +2106,9 @@ discard block |
||
2108 | 2106 | $memberships = $GLOBALS['egw']->accounts->membership($user); |
2109 | 2107 | if (is_array($memberships)) |
2110 | 2108 | { |
2111 | - foreach($memberships as $group) |
|
2109 | + foreach ($memberships as $group) |
|
2112 | 2110 | { |
2113 | - if (!in_array($group['account_id'],$users)) |
|
2111 | + if (!in_array($group['account_id'], $users)) |
|
2114 | 2112 | { |
2115 | 2113 | $users[] = $group['account_id']; |
2116 | 2114 | } |
@@ -2134,24 +2132,24 @@ discard block |
||
2134 | 2132 | |
2135 | 2133 | // check length with some tolerance |
2136 | 2134 | $length = $event['end'] - $event['start'] - $delta; |
2137 | - $query[] = ('(cal_end-cal_start)>' . $length); |
|
2135 | + $query[] = ('(cal_end-cal_start)>'.$length); |
|
2138 | 2136 | $length += 2 * $delta; |
2139 | - $query[] = ('(cal_end-cal_start)<' . $length); |
|
2140 | - $query[] = ('cal_start>' . ($event['start'] - 86400)); |
|
2141 | - $query[] = ('cal_start<' . ($event['start'] + 86400)); |
|
2137 | + $query[] = ('(cal_end-cal_start)<'.$length); |
|
2138 | + $query[] = ('cal_start>'.($event['start'] - 86400)); |
|
2139 | + $query[] = ('cal_start<'.($event['start'] + 86400)); |
|
2142 | 2140 | } |
2143 | 2141 | elseif (isset($event['start'])) |
2144 | 2142 | { |
2145 | 2143 | if ($filter == 'relax') |
2146 | 2144 | { |
2147 | - $query[] = ('cal_start>' . ($event['start'] - 3600)); |
|
2148 | - $query[] = ('cal_start<' . ($event['start'] + 3600)); |
|
2145 | + $query[] = ('cal_start>'.($event['start'] - 3600)); |
|
2146 | + $query[] = ('cal_start<'.($event['start'] + 3600)); |
|
2149 | 2147 | } |
2150 | 2148 | else |
2151 | 2149 | { |
2152 | 2150 | // we accept a tiny tolerance |
2153 | - $query[] = ('cal_start>' . ($event['start'] - 2)); |
|
2154 | - $query[] = ('cal_start<' . ($event['start'] + 2)); |
|
2151 | + $query[] = ('cal_start>'.($event['start'] - 2)); |
|
2152 | + $query[] = ('cal_start<'.($event['start'] + 2)); |
|
2155 | 2153 | } |
2156 | 2154 | } |
2157 | 2155 | if ($filter == 'relax') |
@@ -2174,14 +2172,14 @@ discard block |
||
2174 | 2172 | if ($this->log) |
2175 | 2173 | { |
2176 | 2174 | error_log(__FILE__.'['.__LINE__.'] '.__METHOD__. |
2177 | - '(' . $event['uid'] . ")[EventUID]\n",3,$this->logfile); |
|
2175 | + '('.$event['uid'].")[EventUID]\n", 3, $this->logfile); |
|
2178 | 2176 | } |
2179 | 2177 | } |
2180 | 2178 | |
2181 | 2179 | if ($this->log) |
2182 | 2180 | { |
2183 | 2181 | error_log(__FILE__.'['.__LINE__.'] '.__METHOD__. |
2184 | - '[QUERY]: ' . array2string($query)."\n",3,$this->logfile); |
|
2182 | + '[QUERY]: '.array2string($query)."\n", 3, $this->logfile); |
|
2185 | 2183 | } |
2186 | 2184 | if (!count($users) || !($foundEvents = |
2187 | 2185 | $this->so->search(null, null, $users, 0, 'owner', false, 0, array('query' => $query)))) |
@@ -2189,19 +2187,19 @@ discard block |
||
2189 | 2187 | if ($this->log) |
2190 | 2188 | { |
2191 | 2189 | error_log(__FILE__.'['.__LINE__.'] '.__METHOD__. |
2192 | - "[NO MATCH]\n",3,$this->logfile); |
|
2190 | + "[NO MATCH]\n", 3, $this->logfile); |
|
2193 | 2191 | } |
2194 | 2192 | return $matchingEvents; |
2195 | 2193 | } |
2196 | 2194 | |
2197 | 2195 | $pseudos = array(); |
2198 | 2196 | |
2199 | - foreach($foundEvents as $egwEvent) |
|
2197 | + foreach ($foundEvents as $egwEvent) |
|
2200 | 2198 | { |
2201 | 2199 | if ($this->log) |
2202 | 2200 | { |
2203 | 2201 | error_log(__FILE__.'['.__LINE__.'] '.__METHOD__. |
2204 | - '[FOUND]: ' . array2string($egwEvent)."\n",3,$this->logfile); |
|
2202 | + '[FOUND]: '.array2string($egwEvent)."\n", 3, $this->logfile); |
|
2205 | 2203 | } |
2206 | 2204 | |
2207 | 2205 | if (in_array($egwEvent['id'], $matchingEvents)) continue; |
@@ -2275,7 +2273,7 @@ discard block |
||
2275 | 2273 | if (in_array($event['recurrence'], $exceptions)) |
2276 | 2274 | { |
2277 | 2275 | // We found a pseudo exception |
2278 | - $matchingEvents = array($egwEvent['id'] . ':' . (int)$event['recurrence']); |
|
2276 | + $matchingEvents = array($egwEvent['id'].':'.(int)$event['recurrence']); |
|
2279 | 2277 | break; |
2280 | 2278 | } |
2281 | 2279 | } |
@@ -2293,7 +2291,7 @@ discard block |
||
2293 | 2291 | if ($this->log) |
2294 | 2292 | { |
2295 | 2293 | error_log(__FILE__.'['.__LINE__.'] '.__METHOD__. |
2296 | - "() egwEvent length does not match!\n",3,$this->logfile); |
|
2294 | + "() egwEvent length does not match!\n", 3, $this->logfile); |
|
2297 | 2295 | } |
2298 | 2296 | continue; |
2299 | 2297 | } |
@@ -2305,7 +2303,7 @@ discard block |
||
2305 | 2303 | if ($this->log) |
2306 | 2304 | { |
2307 | 2305 | error_log(__FILE__.'['.__LINE__.'] '.__METHOD__. |
2308 | - "() egwEvent is not a whole-day event!\n",3,$this->logfile); |
|
2306 | + "() egwEvent is not a whole-day event!\n", 3, $this->logfile); |
|
2309 | 2307 | } |
2310 | 2308 | continue; |
2311 | 2309 | } |
@@ -2326,8 +2324,8 @@ discard block |
||
2326 | 2324 | if ($this->log) |
2327 | 2325 | { |
2328 | 2326 | error_log(__FILE__.'['.__LINE__.'] '.__METHOD__. |
2329 | - "() event[$key] differ: '" . $event[$key] . |
|
2330 | - "' <> '" . $egwEvent[$key] . "'\n",3,$this->logfile); |
|
2327 | + "() event[$key] differ: '".$event[$key]. |
|
2328 | + "' <> '".$egwEvent[$key]."'\n", 3, $this->logfile); |
|
2331 | 2329 | } |
2332 | 2330 | continue 2; // next foundEvent |
2333 | 2331 | } |
@@ -2345,7 +2343,7 @@ discard block |
||
2345 | 2343 | if ($this->log) |
2346 | 2344 | { |
2347 | 2345 | error_log(__FILE__.'['.__LINE__.'] '.__METHOD__. |
2348 | - "() egwEvent category $cat_id is missing!\n",3,$this->logfile); |
|
2346 | + "() egwEvent category $cat_id is missing!\n", 3, $this->logfile); |
|
2349 | 2347 | } |
2350 | 2348 | continue 2; |
2351 | 2349 | } |
@@ -2357,7 +2355,7 @@ discard block |
||
2357 | 2355 | { |
2358 | 2356 | error_log(__FILE__.'['.__LINE__.'] '.__METHOD__. |
2359 | 2357 | '() event has additional categories:' |
2360 | - . array2string($newCategories)."\n",3,$this->logfile); |
|
2358 | + . array2string($newCategories)."\n", 3, $this->logfile); |
|
2361 | 2359 | } |
2362 | 2360 | continue; |
2363 | 2361 | } |
@@ -2377,7 +2375,7 @@ discard block |
||
2377 | 2375 | if ($this->log) |
2378 | 2376 | { |
2379 | 2377 | error_log(__FILE__.'['.__LINE__.'] '.__METHOD__. |
2380 | - "() additional event['participants']: $attendee\n",3,$this->logfile); |
|
2378 | + "() additional event['participants']: $attendee\n", 3, $this->logfile); |
|
2381 | 2379 | } |
2382 | 2380 | continue 2; |
2383 | 2381 | } |
@@ -2400,8 +2398,8 @@ discard block |
||
2400 | 2398 | if ($this->log) |
2401 | 2399 | { |
2402 | 2400 | error_log(__FILE__.'['.__LINE__.'] '.__METHOD__. |
2403 | - '() missing event[participants]: ' . |
|
2404 | - array2string($egwEvent['participants'])."\n",3,$this->logfile); |
|
2401 | + '() missing event[participants]: '. |
|
2402 | + array2string($egwEvent['participants'])."\n", 3, $this->logfile); |
|
2405 | 2403 | } |
2406 | 2404 | continue; |
2407 | 2405 | } |
@@ -2413,7 +2411,7 @@ discard block |
||
2413 | 2411 | if ($egwEvent['recur_type'] != MCAL_RECUR_NONE) |
2414 | 2412 | { |
2415 | 2413 | // We found a pseudo Exception |
2416 | - $pseudos[] = $egwEvent['id'] . ':' . $event['start']; |
|
2414 | + $pseudos[] = $egwEvent['id'].':'.$event['start']; |
|
2417 | 2415 | continue; |
2418 | 2416 | } |
2419 | 2417 | } |
@@ -2435,7 +2433,7 @@ discard block |
||
2435 | 2433 | if ($this->log) |
2436 | 2434 | { |
2437 | 2435 | error_log(__FILE__.'['.__LINE__.'] '.__METHOD__. |
2438 | - "() additional event['recur_exception']: $day\n",3,$this->logfile); |
|
2436 | + "() additional event['recur_exception']: $day\n", 3, $this->logfile); |
|
2439 | 2437 | } |
2440 | 2438 | continue 2; |
2441 | 2439 | } |
@@ -2445,8 +2443,8 @@ discard block |
||
2445 | 2443 | if ($this->log) |
2446 | 2444 | { |
2447 | 2445 | error_log(__FILE__.'['.__LINE__.'] '.__METHOD__. |
2448 | - '() missing event[recur_exception]: ' . |
|
2449 | - array2string($event['recur_exception'])."\n",3,$this->logfile); |
|
2446 | + '() missing event[recur_exception]: '. |
|
2447 | + array2string($event['recur_exception'])."\n", 3, $this->logfile); |
|
2450 | 2448 | } |
2451 | 2449 | continue; |
2452 | 2450 | } |
@@ -2461,8 +2459,8 @@ discard block |
||
2461 | 2459 | if ($this->log) |
2462 | 2460 | { |
2463 | 2461 | error_log(__FILE__.'['.__LINE__.'] '.__METHOD__. |
2464 | - "() events[$key] differ: " . $event[$key] . |
|
2465 | - ' <> ' . $egwEvent[$key]."\n",3,$this->logfile); |
|
2462 | + "() events[$key] differ: ".$event[$key]. |
|
2463 | + ' <> '.$egwEvent[$key]."\n", 3, $this->logfile); |
|
2466 | 2464 | } |
2467 | 2465 | continue 2; |
2468 | 2466 | } |
@@ -2478,7 +2476,7 @@ discard block |
||
2478 | 2476 | if ($this->log) |
2479 | 2477 | { |
2480 | 2478 | error_log(__FILE__.'['.__LINE__.'] '.__METHOD__. |
2481 | - "() new exception for series found.\n",3,$this->logfile); |
|
2479 | + "() new exception for series found.\n", 3, $this->logfile); |
|
2482 | 2480 | } |
2483 | 2481 | $matchingEvents = array(); |
2484 | 2482 | } |
@@ -2489,7 +2487,7 @@ discard block |
||
2489 | 2487 | if ($this->log) |
2490 | 2488 | { |
2491 | 2489 | error_log(__FILE__.'['.__LINE__.'] '.__METHOD__. |
2492 | - '[MATCHES]:' . array2string($matches)."\n",3,$this->logfile); |
|
2490 | + '[MATCHES]:'.array2string($matches)."\n", 3, $this->logfile); |
|
2493 | 2491 | } |
2494 | 2492 | return $matches; |
2495 | 2493 | } |
@@ -2562,7 +2560,7 @@ discard block |
||
2562 | 2560 | if ($this->log) |
2563 | 2561 | { |
2564 | 2562 | error_log(__FILE__.'['.__LINE__.'] '.__METHOD__. |
2565 | - "()[MASTER]: $eventID\n",3,$this->logfile); |
|
2563 | + "()[MASTER]: $eventID\n", 3, $this->logfile); |
|
2566 | 2564 | } |
2567 | 2565 | $type = 'SERIES-EXCEPTION'; |
2568 | 2566 | if (($master_event = $this->read($eventID, 0, false, 'server'))) |
@@ -2583,7 +2581,7 @@ discard block |
||
2583 | 2581 | } |
2584 | 2582 | elseif (in_array($event['start'], $master_event['recur_exception'])) |
2585 | 2583 | { |
2586 | - $type='SERIES-PSEUDO-EXCEPTION'; // new pseudo exception? |
|
2584 | + $type = 'SERIES-PSEUDO-EXCEPTION'; // new pseudo exception? |
|
2587 | 2585 | $recurrence_event = $master_event; |
2588 | 2586 | $recurrence_event['start'] = $event['start']; |
2589 | 2587 | $recurrence_event['end'] -= $master_event['start'] - $event['start']; |
@@ -2600,8 +2598,8 @@ discard block |
||
2600 | 2598 | if ($this->log) |
2601 | 2599 | { |
2602 | 2600 | error_log(__FILE__.'['.__LINE__.'] '.__METHOD__. |
2603 | - '() try occurrence ' . $egw_rrule->current() |
|
2604 | - . " ($occurrence)\n",3,$this->logfile); |
|
2601 | + '() try occurrence '.$egw_rrule->current() |
|
2602 | + . " ($occurrence)\n", 3, $this->logfile); |
|
2605 | 2603 | } |
2606 | 2604 | if ($event['start'] == $occurrence) |
2607 | 2605 | { |
@@ -2634,8 +2632,8 @@ discard block |
||
2634 | 2632 | // default if we cannot find a proof for a fundamental change |
2635 | 2633 | // the recurrence_event is the master event with start and end adjusted to the recurrence |
2636 | 2634 | // check for changed data |
2637 | - foreach (array('start','end','uid','title','location','description', |
|
2638 | - 'priority','public','special','non_blocking') as $key) |
|
2635 | + foreach (array('start', 'end', 'uid', 'title', 'location', 'description', |
|
2636 | + 'priority', 'public', 'special', 'non_blocking') as $key) |
|
2639 | 2637 | { |
2640 | 2638 | if (!empty($event[$key]) && $recurrence_event[$key] != $event[$key]) |
2641 | 2639 | { |
@@ -2693,10 +2691,10 @@ discard block |
||
2693 | 2691 | * @param &$event the event we are working on |
2694 | 2692 | * |
2695 | 2693 | */ |
2696 | - function server2usertime (&$event) |
|
2694 | + function server2usertime(&$event) |
|
2697 | 2695 | { |
2698 | 2696 | // we run all dates through date2usertime, to adjust to user-time |
2699 | - foreach(array('start','end','recur_enddate','recurrence') as $ts) |
|
2697 | + foreach (array('start', 'end', 'recur_enddate', 'recurrence') as $ts) |
|
2700 | 2698 | { |
2701 | 2699 | // we convert here from server-time to timestamps in user-time! |
2702 | 2700 | if (isset($event[$ts])) $event[$ts] = $event[$ts] ? $this->date2usertime($event[$ts]) : 0; |
@@ -2704,7 +2702,7 @@ discard block |
||
2704 | 2702 | // same with the recur exceptions |
2705 | 2703 | if (isset($event['recur_exception']) && is_array($event['recur_exception'])) |
2706 | 2704 | { |
2707 | - foreach($event['recur_exception'] as $n => $date) |
|
2705 | + foreach ($event['recur_exception'] as $n => $date) |
|
2708 | 2706 | { |
2709 | 2707 | $event['recur_exception'][$n] = $this->date2usertime($date); |
2710 | 2708 | } |
@@ -2712,7 +2710,7 @@ discard block |
||
2712 | 2710 | // same with the alarms |
2713 | 2711 | if (isset($event['alarm']) && is_array($event['alarm'])) |
2714 | 2712 | { |
2715 | - foreach($event['alarm'] as $id => $alarm) |
|
2713 | + foreach ($event['alarm'] as $id => $alarm) |
|
2716 | 2714 | { |
2717 | 2715 | $event['alarm'][$id]['time'] = $this->date2usertime($alarm['time']); |
2718 | 2716 | } |
@@ -2729,7 +2727,7 @@ discard block |
||
2729 | 2727 | { |
2730 | 2728 | if (is_numeric($age) && $age > 0) // just make sure bogus values dont delete everything |
2731 | 2729 | { |
2732 | - $this->so->purge(time() - 365*24*3600*(float)$age); |
|
2730 | + $this->so->purge(time() - 365 * 24 * 3600 * (float)$age); |
|
2733 | 2731 | } |
2734 | 2732 | } |
2735 | 2733 | } |
@@ -27,7 +27,7 @@ discard block |
||
27 | 27 | /** |
28 | 28 | * @var $debug mixed integer level or string function-name |
29 | 29 | */ |
30 | - var $debug=false; |
|
30 | + var $debug = false; |
|
31 | 31 | /** |
32 | 32 | * instance of the bocal or bocalupdate class |
33 | 33 | * |
@@ -127,7 +127,7 @@ discard block |
||
127 | 127 | /** |
128 | 128 | * @var array $states_to_save all states that will be saved to the user prefs |
129 | 129 | */ |
130 | - var $states_to_save = array('owner','filter','cat_id','view','sortby','planner_days'); |
|
130 | + var $states_to_save = array('owner', 'filter', 'cat_id', 'view', 'sortby', 'planner_days'); |
|
131 | 131 | |
132 | 132 | /** |
133 | 133 | * Constructor |
@@ -135,7 +135,7 @@ discard block |
||
135 | 135 | * @param boolean $use_boupdate use bocalupdate as parenent instead of bocal |
136 | 136 | * @param array $set_states to manualy set / change one of the states, default NULL = use $_REQUEST |
137 | 137 | */ |
138 | - function __construct($use_boupdate=false,$set_states=NULL) |
|
138 | + function __construct($use_boupdate = false, $set_states = NULL) |
|
139 | 139 | { |
140 | 140 | if ($use_boupdate) |
141 | 141 | { |
@@ -149,27 +149,27 @@ discard block |
||
149 | 149 | $this->datetime = $GLOBALS['egw']->datetime; |
150 | 150 | $this->accountsel = $GLOBALS['egw']->uiaccountsel; |
151 | 151 | |
152 | - $this->categories = new categories($this->user,'calendar'); |
|
152 | + $this->categories = new categories($this->user, 'calendar'); |
|
153 | 153 | |
154 | - $this->common_prefs = &$GLOBALS['egw_info']['user']['preferences']['common']; |
|
154 | + $this->common_prefs = &$GLOBALS['egw_info']['user']['preferences']['common']; |
|
155 | 155 | $this->cal_prefs = &$GLOBALS['egw_info']['user']['preferences']['calendar']; |
156 | 156 | $this->bo->check_set_default_prefs(); |
157 | 157 | |
158 | - $this->wd_start = 60*$this->cal_prefs['workdaystarts']; |
|
159 | - $this->wd_end = 60*$this->cal_prefs['workdayends']; |
|
160 | - $this->interval_m = $this->cal_prefs['interval']; |
|
158 | + $this->wd_start = 60 * $this->cal_prefs['workdaystarts']; |
|
159 | + $this->wd_end = 60 * $this->cal_prefs['workdayends']; |
|
160 | + $this->interval_m = $this->cal_prefs['interval']; |
|
161 | 161 | |
162 | 162 | $this->user = $GLOBALS['egw_info']['user']['account_id']; |
163 | 163 | |
164 | 164 | $this->manage_states($set_states); |
165 | 165 | |
166 | - $GLOBALS['uical'] = &$this; // make us available for ExecMethod, else it creates a new instance |
|
166 | + $GLOBALS['uical'] = &$this; // make us available for ExecMethod, else it creates a new instance |
|
167 | 167 | |
168 | 168 | // calendar does not work with hidden sidebox atm. |
169 | 169 | unset($GLOBALS['egw_info']['user']['preferences']['common']['auto_hide_sidebox']); |
170 | 170 | |
171 | 171 | // make sure the hook for export_limit is registered |
172 | - if (!$GLOBALS['egw']->hooks->hook_exists('export_limit','calendar')) $GLOBALS['egw']->hooks->register_single_app_hook('calendar','export_limit'); |
|
172 | + if (!$GLOBALS['egw']->hooks->hook_exists('export_limit', 'calendar')) $GLOBALS['egw']->hooks->register_single_app_hook('calendar', 'export_limit'); |
|
173 | 173 | } |
174 | 174 | |
175 | 175 | /** |
@@ -182,28 +182,28 @@ discard block |
||
182 | 182 | function check_owners_access() |
183 | 183 | { |
184 | 184 | $no_access = $no_access_group = array(); |
185 | - foreach(explode(',',$this->owner) as $owner) |
|
185 | + foreach (explode(',', $this->owner) as $owner) |
|
186 | 186 | { |
187 | 187 | $owner = trim($owner); |
188 | 188 | if (is_numeric($owner) && $GLOBALS['egw']->accounts->get_type($owner) == 'g') |
189 | 189 | { |
190 | - foreach($GLOBALS['egw']->accounts->member($owner) as $member) |
|
190 | + foreach ($GLOBALS['egw']->accounts->member($owner) as $member) |
|
191 | 191 | { |
192 | 192 | $member = $member['account_id']; |
193 | - if (!$this->bo->check_perms(EGW_ACL_READ|EGW_ACL_READ_FOR_PARTICIPANTS|EGW_ACL_FREEBUSY,0,$member)) |
|
193 | + if (!$this->bo->check_perms(EGW_ACL_READ|EGW_ACL_READ_FOR_PARTICIPANTS|EGW_ACL_FREEBUSY, 0, $member)) |
|
194 | 194 | { |
195 | 195 | $no_access_group[$member] = $this->bo->participant_name($member); |
196 | 196 | } |
197 | 197 | } |
198 | 198 | } |
199 | - elseif (!$this->bo->check_perms(EGW_ACL_READ|EGW_ACL_READ_FOR_PARTICIPANTS|EGW_ACL_FREEBUSY,0,$owner)) |
|
199 | + elseif (!$this->bo->check_perms(EGW_ACL_READ|EGW_ACL_READ_FOR_PARTICIPANTS|EGW_ACL_FREEBUSY, 0, $owner)) |
|
200 | 200 | { |
201 | 201 | $no_access[$owner] = $this->bo->participant_name($owner); |
202 | 202 | } |
203 | 203 | } |
204 | 204 | if (count($no_access)) |
205 | 205 | { |
206 | - $msg = '<p class="message" align="center">'.htmlspecialchars(lang('Access denied to the calendar of %1 !!!',implode(', ',$no_access)))."</p>\n"; |
|
206 | + $msg = '<p class="message" align="center">'.htmlspecialchars(lang('Access denied to the calendar of %1 !!!', implode(', ', $no_access)))."</p>\n"; |
|
207 | 207 | |
208 | 208 | if ($GLOBALS['egw_info']['flags']['currentapp'] == 'home') |
209 | 209 | { |
@@ -219,7 +219,7 @@ discard block |
||
219 | 219 | } |
220 | 220 | if (count($no_access_group)) |
221 | 221 | { |
222 | - $this->bo->warnings['groupmembers'] = lang('Groupmember(s) %1 not included, because you have no access.',implode(', ',$no_access_group)); |
|
222 | + $this->bo->warnings['groupmembers'] = lang('Groupmember(s) %1 not included, because you have no access.', implode(', ', $no_access_group)); |
|
223 | 223 | } |
224 | 224 | return false; |
225 | 225 | } |
@@ -243,7 +243,7 @@ discard block |
||
243 | 243 | |
244 | 244 | common::egw_header(); |
245 | 245 | |
246 | - if ($this->bo->warnings) echo '<pre class="message" align="center">'.html::htmlspecialchars(implode("\n",$this->bo->warnings))."</pre>\n"; |
|
246 | + if ($this->bo->warnings) echo '<pre class="message" align="center">'.html::htmlspecialchars(implode("\n", $this->bo->warnings))."</pre>\n"; |
|
247 | 247 | } |
248 | 248 | |
249 | 249 | /** |
@@ -260,12 +260,12 @@ discard block |
||
260 | 260 | * - view: the actual view, where dialogs should return to or which they refresh |
261 | 261 | * @param array $set_states array to manualy set / change one of the states, default NULL = use $_REQUEST |
262 | 262 | */ |
263 | - function manage_states($set_states=NULL) |
|
263 | + function manage_states($set_states = NULL) |
|
264 | 264 | { |
265 | - $states = $states_session = $GLOBALS['egw']->session->appsession('session_data','calendar'); |
|
265 | + $states = $states_session = $GLOBALS['egw']->session->appsession('session_data', 'calendar'); |
|
266 | 266 | |
267 | 267 | // retrieve saved states from prefs |
268 | - if(!$states) |
|
268 | + if (!$states) |
|
269 | 269 | { |
270 | 270 | $states = unserialize($this->bo->cal_prefs['saved_states']); |
271 | 271 | } |
@@ -283,12 +283,12 @@ discard block |
||
283 | 283 | } |
284 | 284 | else |
285 | 285 | { |
286 | - parse_str(substr($json_data['request']['parameters'][0], 10), $set_states); // cut off "/index.php?" |
|
286 | + parse_str(substr($json_data['request']['parameters'][0], 10), $set_states); // cut off "/index.php?" |
|
287 | 287 | } |
288 | 288 | } |
289 | 289 | else |
290 | 290 | { |
291 | - $set_states = substr($_GET['menuaction'],0,9) == 'calendar.' ? $_REQUEST : array(); |
|
291 | + $set_states = substr($_GET['menuaction'], 0, 9) == 'calendar.' ? $_REQUEST : array(); |
|
292 | 292 | } |
293 | 293 | } |
294 | 294 | if (!$states['date'] && $states['year'] && $states['month'] && $states['day']) |
@@ -296,16 +296,16 @@ discard block |
||
296 | 296 | $states['date'] = $this->bo->date2string($states); |
297 | 297 | } |
298 | 298 | |
299 | - foreach(array( |
|
299 | + foreach (array( |
|
300 | 300 | 'date' => $this->bo->date2string($this->bo->now_su), |
301 | 301 | 'cat_id' => 0, |
302 | 302 | 'filter' => 'default', |
303 | 303 | 'owner' => $this->user, |
304 | 304 | 'save_owner' => 0, |
305 | 305 | 'sortby' => 'category', |
306 | - 'planner_days'=> 0, // full month |
|
307 | - 'view' => ($this->bo->cal_prefs['defaultcalendar']?$this->bo->cal_prefs['defaultcalendar']:'day'), // use pref, if exists else use the dayview |
|
308 | - 'listview_days'=> '', // no range |
|
306 | + 'planner_days'=> 0, // full month |
|
307 | + 'view' => ($this->bo->cal_prefs['defaultcalendar'] ? $this->bo->cal_prefs['defaultcalendar'] : 'day'), // use pref, if exists else use the dayview |
|
308 | + 'listview_days'=> '', // no range |
|
309 | 309 | 'test' => 'false', |
310 | 310 | ) as $state => $default) |
311 | 311 | { |
@@ -314,38 +314,38 @@ discard block |
||
314 | 314 | if ($state == 'owner') |
315 | 315 | { |
316 | 316 | // only change the owners of the same resource-type as given in set_state[owner] |
317 | - $set_owners = explode(',',$set_states['owner']); |
|
317 | + $set_owners = explode(',', $set_states['owner']); |
|
318 | 318 | if ((string)$set_owners[0] === '0') // set exactly the specified owners (without the 0) |
319 | 319 | { |
320 | 320 | if ($set_states['owner'] === '0,r0') // small fix for resources |
321 | 321 | { |
322 | - $set_states['owner'] = $default; // --> set default, instead of none |
|
322 | + $set_states['owner'] = $default; // --> set default, instead of none |
|
323 | 323 | } |
324 | 324 | else |
325 | 325 | { |
326 | - $set_states['owner'] = substr($set_states['owner'],2); |
|
326 | + $set_states['owner'] = substr($set_states['owner'], 2); |
|
327 | 327 | } |
328 | 328 | } |
329 | 329 | else // change only the owners of the given type |
330 | 330 | { |
331 | 331 | $res_type = is_numeric($set_owners[0]) ? false : $set_owners[0][0]; |
332 | - $owners = explode(',',$states['owner'] ? $states['owner'] : $default); |
|
333 | - foreach($owners as $key => $owner) |
|
332 | + $owners = explode(',', $states['owner'] ? $states['owner'] : $default); |
|
333 | + foreach ($owners as $key => $owner) |
|
334 | 334 | { |
335 | 335 | if (!$res_type && is_numeric($owner) || $res_type && $owner[0] == $res_type) |
336 | 336 | { |
337 | 337 | unset($owners[$key]); |
338 | 338 | } |
339 | 339 | } |
340 | - if (!$res_type || !in_array($res_type.'0',$set_owners)) |
|
340 | + if (!$res_type || !in_array($res_type.'0', $set_owners)) |
|
341 | 341 | { |
342 | - $owners = array_merge($owners,$set_owners); |
|
342 | + $owners = array_merge($owners, $set_owners); |
|
343 | 343 | } |
344 | - $set_states['owner'] = implode(',',$owners); |
|
344 | + $set_states['owner'] = implode(',', $owners); |
|
345 | 345 | } |
346 | 346 | } |
347 | 347 | // for the uiforms class (eg. edit), dont store the (new) owner, as it might change the view |
348 | - if (substr($_GET['menuaction'],0,25) == 'calendar.calendar_uiforms') |
|
348 | + if (substr($_GET['menuaction'], 0, 25) == 'calendar.calendar_uiforms') |
|
349 | 349 | { |
350 | 350 | $this->owner = $set_states[$state]; |
351 | 351 | continue; |
@@ -359,7 +359,7 @@ discard block |
||
359 | 359 | if ($state == 'date') |
360 | 360 | { |
361 | 361 | $date_arr = $this->bo->date2array($states['date']); |
362 | - foreach(array('year','month','day') as $name) |
|
362 | + foreach (array('year', 'month', 'day') as $name) |
|
363 | 363 | { |
364 | 364 | $this->$name = $states[$name] = $date_arr[$name]; |
365 | 365 | } |
@@ -367,13 +367,13 @@ discard block |
||
367 | 367 | $this->$state = $states[$state]; |
368 | 368 | } |
369 | 369 | // remove a given calendar from the view |
370 | - if (isset($_GET['close']) && ($k = array_search($_GET['close'], $owners=explode(',',$this->owner))) !== false) |
|
370 | + if (isset($_GET['close']) && ($k = array_search($_GET['close'], $owners = explode(',', $this->owner))) !== false) |
|
371 | 371 | { |
372 | 372 | unset($owners[$k]); |
373 | - $this->owner = $states['owner'] = implode(',',$owners); |
|
373 | + $this->owner = $states['owner'] = implode(',', $owners); |
|
374 | 374 | } |
375 | 375 | |
376 | - if (substr($this->view,0,8) == 'planner_') |
|
376 | + if (substr($this->view, 0, 8) == 'planner_') |
|
377 | 377 | { |
378 | 378 | $states['sortby'] = $this->sortby = $this->view == 'planner_cat' ? 'category' : 'user'; |
379 | 379 | $states['view'] = $this->view = 'planner'; |
@@ -381,10 +381,10 @@ discard block |
||
381 | 381 | // set the actual view as return_to |
382 | 382 | if (isset($_GET['menuaction'])) |
383 | 383 | { |
384 | - list(,$class,$func) = explode('.',$_GET['menuaction']); |
|
384 | + list(,$class, $func) = explode('.', $_GET['menuaction']); |
|
385 | 385 | if ($func == 'index') |
386 | 386 | { |
387 | - $func = $this->view; $this->view = 'index'; // switch to the default view |
|
387 | + $func = $this->view; $this->view = 'index'; // switch to the default view |
|
388 | 388 | } |
389 | 389 | } |
390 | 390 | else // eg. calendar/index.php |
@@ -397,9 +397,9 @@ discard block |
||
397 | 397 | // if planner_start_with_group is set in the users prefs: switch owner for planner to planner_start_with_group and back |
398 | 398 | if ($this->cal_prefs['planner_start_with_group']) |
399 | 399 | { |
400 | - if ($this->cal_prefs['planner_start_with_group'] > 0) $this->cal_prefs['planner_start_with_group'] *= -1; // fix old 1.0 pref |
|
400 | + if ($this->cal_prefs['planner_start_with_group'] > 0) $this->cal_prefs['planner_start_with_group'] *= -1; // fix old 1.0 pref |
|
401 | 401 | |
402 | - if (!$states_session && !$_GET['menuaction']) $this->view = ''; // first call to calendar |
|
402 | + if (!$states_session && !$_GET['menuaction']) $this->view = ''; // first call to calendar |
|
403 | 403 | |
404 | 404 | if ($func == 'planner' && $this->view != 'planner' && $this->owner == $this->user) |
405 | 405 | { |
@@ -418,24 +418,24 @@ discard block |
||
418 | 418 | } |
419 | 419 | $this->view_menuaction = $this->view == 'listview' ? 'calendar.calendar_uilist.listview' : 'calendar.calendar_uiviews.'.$this->view; |
420 | 420 | |
421 | - if ($this->debug > 0 || $this->debug == 'manage_states') $this->bo->debug_message('uical::manage_states(%1) session was %2, states now %3',True,$set_states,$states_session,$states); |
|
421 | + if ($this->debug > 0 || $this->debug == 'manage_states') $this->bo->debug_message('uical::manage_states(%1) session was %2, states now %3', True, $set_states, $states_session, $states); |
|
422 | 422 | // save the states in the session only when we are in calendar |
423 | - if ($GLOBALS['egw_info']['flags']['currentapp']=='calendar') |
|
423 | + if ($GLOBALS['egw_info']['flags']['currentapp'] == 'calendar') |
|
424 | 424 | { |
425 | - $GLOBALS['egw']->session->appsession('session_data','calendar',$states); |
|
425 | + $GLOBALS['egw']->session->appsession('session_data', 'calendar', $states); |
|
426 | 426 | // save defined states into the user-prefs |
427 | - if(!empty($states) && is_array($states)) |
|
427 | + if (!empty($states) && is_array($states)) |
|
428 | 428 | { |
429 | - $saved_states = serialize(array_intersect_key($states,array_flip($this->states_to_save))); |
|
429 | + $saved_states = serialize(array_intersect_key($states, array_flip($this->states_to_save))); |
|
430 | 430 | if ($saved_states != $this->cal_prefs['saved_states']) |
431 | 431 | { |
432 | - $GLOBALS['egw']->preferences->add('calendar','saved_states',$saved_states); |
|
433 | - $GLOBALS['egw']->preferences->save_repository(false,'user',true); |
|
432 | + $GLOBALS['egw']->preferences->add('calendar', 'saved_states', $saved_states); |
|
433 | + $GLOBALS['egw']->preferences->save_repository(false, 'user', true); |
|
434 | 434 | } |
435 | 435 | |
436 | 436 | // store state in request for clientside favorites to use |
437 | 437 | // remove date and other states never stored in a favorite |
438 | - $states = array_diff_key($states,array('date'=>false,'year'=>false,'month'=>false,'day'=>false,'save_owner'=>false)); |
|
438 | + $states = array_diff_key($states, array('date'=>false, 'year'=>false, 'month'=>false, 'day'=>false, 'save_owner'=>false)); |
|
439 | 439 | if (strpos($_GET['menuaction'], 'ajax_sidebox') !== false) |
440 | 440 | { |
441 | 441 | // sidebox request is from top frame, which has app.calendar NOT loaded by time response arrives |
@@ -462,35 +462,35 @@ discard block |
||
462 | 462 | */ |
463 | 463 | function event_icons($event) |
464 | 464 | { |
465 | - $is_private = !$event['public'] && !$this->bo->check_perms(EGW_ACL_READ,$event); |
|
465 | + $is_private = !$event['public'] && !$this->bo->check_perms(EGW_ACL_READ, $event); |
|
466 | 466 | |
467 | 467 | $icons = array(); |
468 | 468 | if (!$is_private) |
469 | 469 | { |
470 | - if($event['priority'] == 3) |
|
470 | + if ($event['priority'] == 3) |
|
471 | 471 | { |
472 | - $icons[] = html::image('calendar','high',lang('high priority')); |
|
472 | + $icons[] = html::image('calendar', 'high', lang('high priority')); |
|
473 | 473 | } |
474 | - if($event['recur_type'] != MCAL_RECUR_NONE) |
|
474 | + if ($event['recur_type'] != MCAL_RECUR_NONE) |
|
475 | 475 | { |
476 | - $icons[] = html::image('calendar','recur',lang('recurring event')); |
|
476 | + $icons[] = html::image('calendar', 'recur', lang('recurring event')); |
|
477 | 477 | } |
478 | 478 | // icons for single user, multiple users or group(s) and resources |
479 | - foreach(array_keys($event['participants']) as $uid) |
|
479 | + foreach (array_keys($event['participants']) as $uid) |
|
480 | 480 | { |
481 | - if(is_numeric($uid) || !isset($this->bo->resources[$uid[0]]['icon'])) |
|
481 | + if (is_numeric($uid) || !isset($this->bo->resources[$uid[0]]['icon'])) |
|
482 | 482 | { |
483 | 483 | if (isset($icons['single']) || $GLOBALS['egw']->accounts->get_type($uid) == 'g') |
484 | 484 | { |
485 | 485 | unset($icons['single']); |
486 | - $icons['multiple'] = html::image('calendar','users'); |
|
486 | + $icons['multiple'] = html::image('calendar', 'users'); |
|
487 | 487 | } |
488 | 488 | elseif (!isset($icons['multiple'])) |
489 | 489 | { |
490 | - $icons['single'] = html::image('calendar','single'); |
|
490 | + $icons['single'] = html::image('calendar', 'single'); |
|
491 | 491 | } |
492 | 492 | } |
493 | - elseif(!isset($icons[$uid[0]]) && isset($this->bo->resources[$uid[0]]) && isset($this->bo->resources[$uid[0]]['icon'])) |
|
493 | + elseif (!isset($icons[$uid[0]]) && isset($this->bo->resources[$uid[0]]) && isset($this->bo->resources[$uid[0]]['icon'])) |
|
494 | 494 | { |
495 | 495 | $icons[$uid[0]] = html::image($this->bo->resources[$uid[0]]['app'], |
496 | 496 | ($this->bo->resources[$uid[0]]['icon'] ? $this->bo->resources[$uid[0]]['icon'] : 'navbar'), |
@@ -499,21 +499,21 @@ discard block |
||
499 | 499 | } |
500 | 500 | } |
501 | 501 | } |
502 | - if($event['non_blocking']) |
|
502 | + if ($event['non_blocking']) |
|
503 | 503 | { |
504 | - $icons[] = html::image('calendar','nonblocking',lang('non blocking')); |
|
504 | + $icons[] = html::image('calendar', 'nonblocking', lang('non blocking')); |
|
505 | 505 | } |
506 | - if($event['public'] == 0) |
|
506 | + if ($event['public'] == 0) |
|
507 | 507 | { |
508 | - $icons[] = html::image('calendar','private',lang('private')); |
|
508 | + $icons[] = html::image('calendar', 'private', lang('private')); |
|
509 | 509 | } |
510 | - if(isset($event['alarm']) && count($event['alarm']) >= 1 && !$is_private) |
|
510 | + if (isset($event['alarm']) && count($event['alarm']) >= 1 && !$is_private) |
|
511 | 511 | { |
512 | - $icons[] = html::image('calendar','alarm',lang('alarm')); |
|
512 | + $icons[] = html::image('calendar', 'alarm', lang('alarm')); |
|
513 | 513 | } |
514 | - if($event['participants'][$this->user][0] == 'U') |
|
514 | + if ($event['participants'][$this->user][0] == 'U') |
|
515 | 515 | { |
516 | - $icons[] = html::image('calendar','needs-action',lang('Needs action')); |
|
516 | + $icons[] = html::image('calendar', 'needs-action', lang('Needs action')); |
|
517 | 517 | } |
518 | 518 | return $icons; |
519 | 519 | } |
@@ -522,10 +522,10 @@ discard block |
||
522 | 522 | * Create a select-box item in the sidebox-menu |
523 | 523 | * @privat used only by sidebox_menu ! |
524 | 524 | */ |
525 | - function _select_box($title,$name,$options,$width='99%') |
|
525 | + function _select_box($title, $name, $options, $width = '99%') |
|
526 | 526 | { |
527 | 527 | $select = " <select style=\"width: $width;\" name=\"".$name.'" id="calendar_'.$name.'" title="'. |
528 | - lang('Select a %1',lang($title)).'">'. |
|
528 | + lang('Select a %1', lang($title)).'">'. |
|
529 | 529 | $options."</select>\n"; |
530 | 530 | |
531 | 531 | return array( |
@@ -546,17 +546,17 @@ discard block |
||
546 | 546 | * @param array $vars |
547 | 547 | * @return string the link incl. content |
548 | 548 | */ |
549 | - function add_link($content,$date=null,$hour=null,$minute=0,array $vars=null) |
|
549 | + function add_link($content, $date = null, $hour = null, $minute = 0, array $vars = null) |
|
550 | 550 | { |
551 | 551 | $vars['menuaction'] = 'calendar.calendar_uiforms.edit'; |
552 | - $vars['date'] = $date ? $date : $this->date; |
|
552 | + $vars['date'] = $date ? $date : $this->date; |
|
553 | 553 | |
554 | 554 | if (!is_null($hour)) |
555 | 555 | { |
556 | 556 | $vars['hour'] = $hour; |
557 | 557 | $vars['minute'] = $minute; |
558 | 558 | } |
559 | - return html::a_href($content,'',$vars,' data-date="' .$vars['date'].'|'.$vars['hour'].'|'.$vars['minute'] |
|
559 | + return html::a_href($content, '', $vars, ' data-date="'.$vars['date'].'|'.$vars['hour'].'|'.$vars['minute'] |
|
560 | 560 | . '" title="'.html::htmlspecialchars(lang('Add')).'"'); |
561 | 561 | } |
562 | 562 | |
@@ -569,7 +569,7 @@ discard block |
||
569 | 569 | * @param int $height height of the window |
570 | 570 | * @return string javascript (using single quotes) |
571 | 571 | */ |
572 | - function popup($link,$target='_blank',$width=750,$height=410) |
|
572 | + function popup($link, $target = '_blank', $width = 750, $height = 410) |
|
573 | 573 | { |
574 | 574 | return 'egw_openWindowCentered2('.($link == 'this.href' ? $link : "'".$link."'").','. |
575 | 575 | ($target == 'this.target' ? $target : "'".$target."'").",$width,$height,'yes')"; |
@@ -584,11 +584,11 @@ discard block |
||
584 | 584 | // Magic etemplate2 favorites menu (from nextmatch widget) |
585 | 585 | display_sidebox('calendar', lang('Favorites'), egw_framework::favorite_list('calendar')); |
586 | 586 | |
587 | - $file = array('menuOpened' => true); // menu open by default |
|
588 | - $n = 0; // index for file-array |
|
587 | + $file = array('menuOpened' => true); // menu open by default |
|
588 | + $n = 0; // index for file-array |
|
589 | 589 | |
590 | 590 | $planner_days_for_view = false; |
591 | - switch($this->view) |
|
591 | + switch ($this->view) |
|
592 | 592 | { |
593 | 593 | case 'month': $planner_days_for_view = 0; break; |
594 | 594 | case 'week': $planner_days_for_view = $this->cal_prefs['days_in_weekview'] == 5 ? 5 : 7; break; |
@@ -596,31 +596,31 @@ discard block |
||
596 | 596 | } |
597 | 597 | // Toolbar with the views |
598 | 598 | $views = '<table style="width: 100%;"><tr>'."\n"; |
599 | - foreach(array( |
|
600 | - 'add' => array('icon'=>'new','text'=>'add'), |
|
601 | - 'day' => array('icon'=>'today','text'=>'Today','menuaction' => 'calendar.calendar_uiviews.day','date' => $this->bo->date2string($this->bo->now_su)), |
|
602 | - 'week' => array('icon'=>'week','text'=>'Weekview','menuaction' => 'calendar.calendar_uiviews.week'), |
|
603 | - 'weekN' => array('icon'=>'multiweek','text'=>'Multiple week view','menuaction' => 'calendar.calendar_uiviews.weekN'), |
|
604 | - 'month' => array('icon'=>'month','text'=>'Monthview','menuaction' => 'calendar.calendar_uiviews.month'), |
|
599 | + foreach (array( |
|
600 | + 'add' => array('icon'=>'new', 'text'=>'add'), |
|
601 | + 'day' => array('icon'=>'today', 'text'=>'Today', 'menuaction' => 'calendar.calendar_uiviews.day', 'date' => $this->bo->date2string($this->bo->now_su)), |
|
602 | + 'week' => array('icon'=>'week', 'text'=>'Weekview', 'menuaction' => 'calendar.calendar_uiviews.week'), |
|
603 | + 'weekN' => array('icon'=>'multiweek', 'text'=>'Multiple week view', 'menuaction' => 'calendar.calendar_uiviews.weekN'), |
|
604 | + 'month' => array('icon'=>'month', 'text'=>'Monthview', 'menuaction' => 'calendar.calendar_uiviews.month'), |
|
605 | 605 | //'year' => array('icon'=>'year','text'=>'yearview','menuaction' => 'calendar.calendar_uiviews.year'), |
606 | - 'planner' => array('icon'=>'planner','text'=>'Group planner','menuaction' => 'calendar.calendar_uiviews.planner','sortby' => $this->sortby), |
|
607 | - 'list' => array('icon'=>'list','text'=>'Listview','menuaction'=>'calendar.calendar_uilist.listview','ajax'=>'true'), |
|
606 | + 'planner' => array('icon'=>'planner', 'text'=>'Group planner', 'menuaction' => 'calendar.calendar_uiviews.planner', 'sortby' => $this->sortby), |
|
607 | + 'list' => array('icon'=>'list', 'text'=>'Listview', 'menuaction'=>'calendar.calendar_uilist.listview', 'ajax'=>'true'), |
|
608 | 608 | ) as $view => $data) |
609 | 609 | { |
610 | 610 | $icon_name = array_shift($data); |
611 | 611 | $title = array_shift($data); |
612 | - $vars = array_merge($link_vars,$data); |
|
612 | + $vars = array_merge($link_vars, $data); |
|
613 | 613 | |
614 | - $icon = html::image('calendar',$icon_name,lang($title),"class=sideboxstar"); //to avoid jscadender from not displaying with pngfix |
|
614 | + $icon = html::image('calendar', $icon_name, lang($title), "class=sideboxstar"); //to avoid jscadender from not displaying with pngfix |
|
615 | 615 | if ($view == 'add') |
616 | 616 | { |
617 | - $link = html::a_href($icon,'javascript:'.$this->popup(egw::link('/index.php',array( |
|
617 | + $link = html::a_href($icon, 'javascript:'.$this->popup(egw::link('/index.php', array( |
|
618 | 618 | 'menuaction' => 'calendar.calendar_uiforms.edit', |
619 | - ),false))); |
|
619 | + ), false))); |
|
620 | 620 | } |
621 | 621 | else |
622 | 622 | { |
623 | - $link = html::a_href($icon,'/index.php',$vars); |
|
623 | + $link = html::a_href($icon, '/index.php', $vars); |
|
624 | 624 | } |
625 | 625 | $views .= '<td align="center">'.$link."</td>\n"; |
626 | 626 | } |
@@ -633,11 +633,11 @@ discard block |
||
633 | 633 | $views .= "<style type='text/css'>\n\t.aclInviteColumn { display: none; }\n</style>\n"; |
634 | 634 | } |
635 | 635 | |
636 | - $file[++$n] = array('text' => $views,'no_lang' => True,'link' => False,'icon' => False); |
|
636 | + $file[++$n] = array('text' => $views, 'no_lang' => True, 'link' => False, 'icon' => False); |
|
637 | 637 | |
638 | 638 | // special views and view-options menu |
639 | 639 | $options = ''; |
640 | - foreach(array( |
|
640 | + foreach (array( |
|
641 | 641 | array( |
642 | 642 | 'text' => lang('dayview'), |
643 | 643 | 'value' => 'menuaction=calendar.calendar_uiviews.day', |
@@ -699,7 +699,7 @@ discard block |
||
699 | 699 | { |
700 | 700 | $options .= '<option value="'.$data['value'].'"'.($data['selected'] ? ' selected="1"' : '').'>'.html::htmlspecialchars($data['text'])."</option>\n"; |
701 | 701 | } |
702 | - $file[++$n] = $this->_select_box('displayed view','view',$options); |
|
702 | + $file[++$n] = $this->_select_box('displayed view', 'view', $options); |
|
703 | 703 | |
704 | 704 | // Search |
705 | 705 | $file[++$n] = array( |
@@ -711,15 +711,15 @@ discard block |
||
711 | 711 | ); |
712 | 712 | // Minicalendar |
713 | 713 | $link = array(); |
714 | - foreach(array( |
|
714 | + foreach (array( |
|
715 | 715 | 'day' => 'calendar.calendar_uiviews.day', |
716 | 716 | 'week' => 'calendar.calendar_uiviews.week', |
717 | 717 | 'month' => 'calendar.calendar_uiviews.month') as $view => $menuaction) |
718 | 718 | { |
719 | 719 | if ($this->view == 'planner' || $this->view == 'listview') |
720 | 720 | { |
721 | - $link_vars['menuaction'] = $this->view_menuaction; // must be first one |
|
722 | - switch($view) |
|
721 | + $link_vars['menuaction'] = $this->view_menuaction; // must be first one |
|
722 | + switch ($view) |
|
723 | 723 | { |
724 | 724 | case 'day': $link_vars[$this->view.'_days'] = $this->view == 'planner' ? 1 : ''; break; |
725 | 725 | case 'week': $link_vars[$this->view.'_days'] = $this->cal_prefs['days_in_weekview'] == 5 ? 5 : 7; break; |
@@ -727,44 +727,43 @@ discard block |
||
727 | 727 | } |
728 | 728 | if ($this->view == 'listview') $link_vars['ajax'] = 'true'; |
729 | 729 | } |
730 | - elseif(substr($this->view,0,4) == 'week' && $view == 'week') |
|
730 | + elseif (substr($this->view, 0, 4) == 'week' && $view == 'week') |
|
731 | 731 | { |
732 | - $link_vars['menuaction'] = $this->view_menuaction; // stay in the N-week-view |
|
732 | + $link_vars['menuaction'] = $this->view_menuaction; // stay in the N-week-view |
|
733 | 733 | } |
734 | 734 | elseif ($view == 'day' && $this->view == 'day4') |
735 | 735 | { |
736 | - $link_vars['menuaction'] = $this->view_menuaction; // stay in the day-view |
|
736 | + $link_vars['menuaction'] = $this->view_menuaction; // stay in the day-view |
|
737 | 737 | } |
738 | 738 | else |
739 | 739 | { |
740 | 740 | $link_vars['menuaction'] = $menuaction; |
741 | 741 | } |
742 | - unset($link_vars['date']); // gets set in jscal |
|
743 | - $link[$view] = $l = egw::link('/index.php',$link_vars,false); |
|
742 | + unset($link_vars['date']); // gets set in jscal |
|
743 | + $link[$view] = $l = egw::link('/index.php', $link_vars, false); |
|
744 | 744 | } |
745 | 745 | |
746 | 746 | if (($flatdate = $this->date)) // string if format YYYYmmdd or timestamp |
747 | 747 | { |
748 | - $flatdate = is_int($flatdate) ? adodb_date('m/d/Y',$flatdate) : |
|
749 | - substr($flatdate,4,2).'/'.substr($flatdate,6,2).'/'.substr($flatdate,0,4); |
|
748 | + $flatdate = is_int($flatdate) ? adodb_date('m/d/Y', $flatdate) : substr($flatdate, 4, 2).'/'.substr($flatdate, 6, 2).'/'.substr($flatdate, 0, 4); |
|
750 | 749 | } |
751 | 750 | $jscalendar = '<div id="calendar-container"></div>'; |
752 | 751 | |
753 | - $file[++$n] = array('text' => $jscalendar,'no_lang' => True,'link' => False,'icon' => False); |
|
752 | + $file[++$n] = array('text' => $jscalendar, 'no_lang' => True, 'link' => False, 'icon' => False); |
|
754 | 753 | |
755 | 754 | // Category Selection |
756 | - $cat_id = explode(',',$this->cat_id); |
|
755 | + $cat_id = explode(',', $this->cat_id); |
|
757 | 756 | |
758 | - $current_view_url = egw::link('/index.php',array( |
|
757 | + $current_view_url = egw::link('/index.php', array( |
|
759 | 758 | 'menuaction' => $this->view_menuaction, |
760 | 759 | 'date' => $this->date, |
761 | - )+($this->view == 'listview' ? array('ajax' => 'true') : array()),false); |
|
760 | + ) + ($this->view == 'listview' ? array('ajax' => 'true') : array()), false); |
|
762 | 761 | |
763 | 762 | $select = ' <select style="width: 86%;" id="calendar_cat_id" name="cat_id" title="'. |
764 | - lang('Select a %1',lang('Category')). '"'.($cat_id && count($cat_id) > 1 ? ' multiple=true size=4':''). '>'. |
|
763 | + lang('Select a %1', lang('Category')).'"'.($cat_id && count($cat_id) > 1 ? ' multiple=true size=4' : '').'>'. |
|
765 | 764 | '<option value="0">'.lang('All categories').'</option>'. |
766 | - $this->categories->formatted_list('select','all',$cat_id,'True'). |
|
767 | - "</select>\n" . html::image('phpgwapi','category','','id="calendar_cat_id_multiple"')." |
|
765 | + $this->categories->formatted_list('select', 'all', $cat_id, 'True'). |
|
766 | + "</select>\n".html::image('phpgwapi', 'category', '', 'id="calendar_cat_id_multiple"')." |
|
768 | 767 | <script type=\"text/javascript\" src=\"{$GLOBALS['egw_info']['server']['webserver_url']}/calendar/js/navigation.js\" id=\"calendar-navigation-script\"". |
769 | 768 | " data-link-day-url =\"".htmlspecialchars($link['day']). |
770 | 769 | "\" data-link-week-url=\"".htmlspecialchars($link['week']). |
@@ -773,7 +772,7 @@ discard block |
||
773 | 772 | "\" data-current-date=\"".htmlspecialchars(egw_time::to('now', 'Ymd')). |
774 | 773 | "\" data-current-view-url=\"".htmlspecialchars($current_view_url)."\"/></script>\n"; |
775 | 774 | |
776 | - $file[++$n] = array( |
|
775 | + $file[++$n] = array( |
|
777 | 776 | 'text' => $select, |
778 | 777 | 'no_lang' => True, |
779 | 778 | 'link' => False, |
@@ -781,27 +780,27 @@ discard block |
||
781 | 780 | ); |
782 | 781 | |
783 | 782 | // Calendarselection: User or Group |
784 | - if(count($this->bo->grants) > 0 && $this->accountsel->account_selection != 'none') |
|
783 | + if (count($this->bo->grants) > 0 && $this->accountsel->account_selection != 'none') |
|
785 | 784 | { |
786 | 785 | $grants = array(); |
787 | - foreach($this->bo->list_cals() as $grant) |
|
786 | + foreach ($this->bo->list_cals() as $grant) |
|
788 | 787 | { |
789 | 788 | $grants[] = $grant['grantor']; |
790 | 789 | } |
791 | 790 | // we no longer exclude non-accounts from the account-selection: it shows all types of participants |
792 | - $accounts = explode(',',$this->owner); |
|
791 | + $accounts = explode(',', $this->owner); |
|
793 | 792 | |
794 | 793 | // Remove '0' - it means current user but will show as #0 with some account selection options |
795 | - $zero_index = array_search('0',$accounts); |
|
796 | - if($zero_index !== FALSE) |
|
794 | + $zero_index = array_search('0', $accounts); |
|
795 | + if ($zero_index !== FALSE) |
|
797 | 796 | { |
798 | 797 | $accounts[$zero_index] = $this->user; |
799 | 798 | } |
800 | 799 | $file[] = array( |
801 | 800 | 'text' => |
802 | - $this->accountsel->selection('owner','uical_select_owner',$accounts,'calendar+',count($accounts) > 1 ? 4 : 1,False, |
|
803 | - ' style="width: '.(count($accounts) > 1 && in_array($this->common_prefs['account_selection'],array('selectbox','groupmembers')) ? '86%' : '86%').';"'. |
|
804 | - ' title="'.lang('select a %1',lang('user')).'"','',$grants,false,array($this->bo,'participant_name')), |
|
801 | + $this->accountsel->selection('owner', 'uical_select_owner', $accounts, 'calendar+', count($accounts) > 1 ? 4 : 1, False, |
|
802 | + ' style="width: '.(count($accounts) > 1 && in_array($this->common_prefs['account_selection'], array('selectbox', 'groupmembers')) ? '86%' : '86%').';"'. |
|
803 | + ' title="'.lang('select a %1', lang('user')).'"', '', $grants, false, array($this->bo, 'participant_name')), |
|
805 | 804 | 'no_lang' => True, |
806 | 805 | 'link' => False, |
807 | 806 | 'icon' => false, |
@@ -810,30 +809,30 @@ discard block |
||
810 | 809 | |
811 | 810 | // Filter all or hideprivate |
812 | 811 | $filter_options = ''; |
813 | - foreach(array( |
|
812 | + foreach (array( |
|
814 | 813 | 'default' => array(lang('Not rejected'), lang('Show all status, but rejected')), |
815 | 814 | 'accepted' => array(lang('Accepted'), lang('Show only accepted events')), |
816 | 815 | 'unknown' => array(lang('Invitations'), lang('Show only invitations, not yet accepted or rejected')), |
817 | 816 | 'tentative' => array(lang('Tentative'), lang('Show only tentative accepted events')), |
818 | 817 | 'delegated' => array(lang('Delegated'), lang('Show only delegated events')), |
819 | - 'rejected' => array(lang('Rejected'),lang('Show only rejected events')), |
|
820 | - 'owner' => array(lang('Owner too'),lang('Show also events just owned by selected user')), |
|
821 | - 'all' => array(lang('All incl. rejected'),lang('Show all status incl. rejected events')), |
|
822 | - 'hideprivate' => array(lang('Hide private infos'),lang('Show all events, as if they were private')), |
|
823 | - 'showonlypublic' => array(lang('Hide private events'),lang('Show only events flagged as public, (not checked as private)')), |
|
824 | - 'no-enum-groups' => array(lang('only group-events'),lang('Do not include events of group members')), |
|
825 | - 'not-unknown' => array(lang('No meeting requests'),lang('Show all status, but unknown')), |
|
818 | + 'rejected' => array(lang('Rejected'), lang('Show only rejected events')), |
|
819 | + 'owner' => array(lang('Owner too'), lang('Show also events just owned by selected user')), |
|
820 | + 'all' => array(lang('All incl. rejected'), lang('Show all status incl. rejected events')), |
|
821 | + 'hideprivate' => array(lang('Hide private infos'), lang('Show all events, as if they were private')), |
|
822 | + 'showonlypublic' => array(lang('Hide private events'), lang('Show only events flagged as public, (not checked as private)')), |
|
823 | + 'no-enum-groups' => array(lang('only group-events'), lang('Do not include events of group members')), |
|
824 | + 'not-unknown' => array(lang('No meeting requests'), lang('Show all status, but unknown')), |
|
826 | 825 | ) as $value => $label) |
827 | 826 | { |
828 | - list($label,$title) = $label; |
|
827 | + list($label, $title) = $label; |
|
829 | 828 | $filter_options .= '<option value="'.$value.'"'.($this->filter == $value ? ' selected="selected"' : '').' title="'.$title.'">'.$label.'</options>'."\n"; |
830 | 829 | } |
831 | 830 | // add deleted filter, if history logging is activated |
832 | - if($GLOBALS['egw_info']['server']['calendar_delete_history']) |
|
831 | + if ($GLOBALS['egw_info']['server']['calendar_delete_history']) |
|
833 | 832 | { |
834 | 833 | $filter_options .= '<option value="deleted"'.($this->filter == 'deleted' ? ' selected="selected"' : '').' title="'.lang('Show events that have been deleted').'">'.lang('Deleted').'</options>'."\n"; |
835 | 834 | } |
836 | - $file[] = $this->_select_box('Filter','filter',$filter_options,'86%'); |
|
835 | + $file[] = $this->_select_box('Filter', 'filter', $filter_options, '86%'); |
|
837 | 836 | // enable this to get checkbox setting $this->test eg. usable to trigger different code in calendar_so |
838 | 837 | //$file[count($file)-1]['text'] .= html::checkbox('test', $this->test==='true', 'true', 'id="calendar_test"'); |
839 | 838 | |
@@ -842,15 +841,15 @@ discard block |
||
842 | 841 | { |
843 | 842 | $options = ''; |
844 | 843 | |
845 | - $documents = calendar_merge::get_documents($GLOBALS['egw_info']['user']['preferences']['calendar']['document_dir'], '', null,'calendar'); |
|
846 | - foreach($documents as $key => $value) |
|
844 | + $documents = calendar_merge::get_documents($GLOBALS['egw_info']['user']['preferences']['calendar']['document_dir'], '', null, 'calendar'); |
|
845 | + foreach ($documents as $key => $value) |
|
847 | 846 | { |
848 | 847 | $options .= '<option value="'.html::htmlspecialchars($key).'">'.html::htmlspecialchars($value)."</option>\n"; |
849 | 848 | } |
850 | - if($options != '') { |
|
851 | - $options = '<option value="">'.lang('Insert in document')."</option>\n" . $options; |
|
849 | + if ($options != '') { |
|
850 | + $options = '<option value="">'.lang('Insert in document')."</option>\n".$options; |
|
852 | 851 | $select = ' <select style="width: 86%;" name="merge" id="calendar_merge" title="'. |
853 | - html::htmlspecialchars(lang('Select a %1',lang('merge document...'))).'">'. |
|
852 | + html::htmlspecialchars(lang('Select a %1', lang('merge document...'))).'">'. |
|
854 | 853 | $options."</select>\n"; |
855 | 854 | |
856 | 855 | $file[] = array( |
@@ -860,43 +859,43 @@ discard block |
||
860 | 859 | 'icon' => false, |
861 | 860 | ); |
862 | 861 | } |
863 | - $file['Placeholders'] = egw::link('/index.php','menuaction=calendar.calendar_merge.show_replacements'); |
|
862 | + $file['Placeholders'] = egw::link('/index.php', 'menuaction=calendar.calendar_merge.show_replacements'); |
|
864 | 863 | } |
865 | 864 | |
866 | 865 | $appname = 'calendar'; |
867 | 866 | $menu_title = lang('Calendar Menu'); |
868 | - display_sidebox($appname,$menu_title,$file); |
|
867 | + display_sidebox($appname, $menu_title, $file); |
|
869 | 868 | |
870 | 869 | // resources menu hooks |
871 | 870 | foreach ($this->bo->resources as $resource) |
872 | 871 | { |
873 | - if(!is_array($resource['cal_sidebox'])) continue; |
|
872 | + if (!is_array($resource['cal_sidebox'])) continue; |
|
874 | 873 | $menu_title = $resource['cal_sidebox']['menu_title'] ? $resource['cal_sidebox']['menu_title'] : lang($resource['app']); |
875 | - $file = ExecMethod($resource['cal_sidebox']['file'],array( |
|
874 | + $file = ExecMethod($resource['cal_sidebox']['file'], array( |
|
876 | 875 | 'menuaction' => $this->view_menuaction, |
877 | 876 | 'owner' => $this->owner, |
878 | 877 | )); |
879 | - display_sidebox($appname,$menu_title,$file); |
|
878 | + display_sidebox($appname, $menu_title, $file); |
|
880 | 879 | } |
881 | 880 | |
882 | 881 | if ($GLOBALS['egw_info']['user']['apps']['admin']) |
883 | 882 | { |
884 | 883 | $file = Array( |
885 | - 'Configuration'=>egw::link('/index.php','menuaction=admin.uiconfig.index&appname=calendar'), |
|
886 | - 'Custom Fields'=>egw::link('/index.php','menuaction=admin.customfields.index&appname=calendar'), |
|
887 | - 'Holiday Management'=>egw::link('/index.php','menuaction=calendar.uiholiday.admin'), |
|
888 | - 'Global Categories' =>egw::link('/index.php','menuaction=admin.admin_categories.index&appname=calendar'), |
|
884 | + 'Configuration'=>egw::link('/index.php', 'menuaction=admin.uiconfig.index&appname=calendar'), |
|
885 | + 'Custom Fields'=>egw::link('/index.php', 'menuaction=admin.customfields.index&appname=calendar'), |
|
886 | + 'Holiday Management'=>egw::link('/index.php', 'menuaction=calendar.uiholiday.admin'), |
|
887 | + 'Global Categories' =>egw::link('/index.php', 'menuaction=admin.admin_categories.index&appname=calendar'), |
|
889 | 888 | ); |
890 | - $GLOBALS['egw']->framework->sidebox($appname,lang('Admin'),$file,'admin'); |
|
889 | + $GLOBALS['egw']->framework->sidebox($appname, lang('Admin'), $file, 'admin'); |
|
891 | 890 | } |
892 | 891 | } |
893 | 892 | |
894 | 893 | public function merge($timespan = array()) |
895 | 894 | { |
896 | 895 | // Merge print |
897 | - if($_GET['merge']) |
|
896 | + if ($_GET['merge']) |
|
898 | 897 | { |
899 | - if(!$timespan) |
|
898 | + if (!$timespan) |
|
900 | 899 | { |
901 | 900 | $timespan = array(array( |
902 | 901 | 'start' => is_array($this->first) ? $this->bo->date2ts($this->first) : $this->first, |
@@ -27,15 +27,15 @@ discard block |
||
27 | 27 | * |
28 | 28 | * @param egw_record $_definition |
29 | 29 | */ |
30 | - public function export( $_stream, importexport_definition $_definition) { |
|
30 | + public function export($_stream, importexport_definition $_definition) { |
|
31 | 31 | $options = $_definition->plugin_options; |
32 | 32 | |
33 | 33 | $limit_exception = bo_merge::is_export_limit_excepted(); |
34 | 34 | if (!$limit_exception) $export_limit = bo_merge::getExportLimit('calendar'); |
35 | 35 | // Custom fields need to be specifically requested |
36 | 36 | $cfs = array(); |
37 | - foreach($options['mapping'] + (array)$_definition->filter as $key => $label) { |
|
38 | - if($key[0] == '#') $cfs[] = substr($key,1); |
|
37 | + foreach ($options['mapping'] + (array)$_definition->filter as $key => $label) { |
|
38 | + if ($key[0] == '#') $cfs[] = substr($key, 1); |
|
39 | 39 | } |
40 | 40 | |
41 | 41 | $query = array( |
@@ -43,48 +43,48 @@ discard block |
||
43 | 43 | 'num_rows' => -1, |
44 | 44 | 'csv_export' => true |
45 | 45 | ); |
46 | - switch($options['selection']) |
|
46 | + switch ($options['selection']) |
|
47 | 47 | { |
48 | 48 | case 'criteria': |
49 | 49 | $query = array( |
50 | 50 | 'start' => $options['criteria']['start'], |
51 | - 'end' => strtotime('+1 day',$options['criteria']['end'])-1, |
|
51 | + 'end' => strtotime('+1 day', $options['criteria']['end']) - 1, |
|
52 | 52 | 'categories' => $options['categories'] ? $options['categories'] : $options['criteria']['categories'], |
53 | 53 | //'enum_recuring' => false, // we want the recurring events enumerated for csv export |
54 | 54 | 'daywise' => false, |
55 | 55 | 'users' => $options['criteria']['owner'], |
56 | 56 | 'cfs' => $cfs // Otherwise we shouldn't get any custom fields |
57 | 57 | ); |
58 | - if(bo_merge::hasExportLimit($export_limit) && !$limit_exception) { |
|
58 | + if (bo_merge::hasExportLimit($export_limit) && !$limit_exception) { |
|
59 | 59 | $query['offset'] = 0; |
60 | 60 | $query['num_rows'] = (int)$export_limit; // ! int of 'no' is 0 |
61 | 61 | } |
62 | - $events =& $this->bo->search($query); |
|
62 | + $events = & $this->bo->search($query); |
|
63 | 63 | break; |
64 | 64 | case 'search_results': |
65 | - $states = $GLOBALS['egw']->session->appsession('session_data','calendar'); |
|
66 | - if($states['view'] == 'listview') { |
|
67 | - $query = $GLOBALS['egw']->session->appsession('calendar_list','calendar'); |
|
68 | - $query['num_rows'] = -1; // all |
|
69 | - $query['csv_export'] = true; // so get_rows method _can_ produce different content or not store state in the session |
|
65 | + $states = $GLOBALS['egw']->session->appsession('session_data', 'calendar'); |
|
66 | + if ($states['view'] == 'listview') { |
|
67 | + $query = $GLOBALS['egw']->session->appsession('calendar_list', 'calendar'); |
|
68 | + $query['num_rows'] = -1; // all |
|
69 | + $query['csv_export'] = true; // so get_rows method _can_ produce different content or not store state in the session |
|
70 | 70 | $query['start'] = 0; |
71 | 71 | $query['cfs'] = $cfs; |
72 | 72 | |
73 | - if(bo_merge::hasExportLimit($export_limit) && !$limit_exception) { |
|
73 | + if (bo_merge::hasExportLimit($export_limit) && !$limit_exception) { |
|
74 | 74 | $query['num_rows'] = (int)$export_limit; // ! int of 'no' is 0 |
75 | 75 | } |
76 | 76 | $ui = new calendar_uilist(); |
77 | 77 | $ui->get_rows($query, $events, $unused); |
78 | 78 | } else { |
79 | - $query = $GLOBALS['egw']->session->appsession('session_data','calendar'); |
|
79 | + $query = $GLOBALS['egw']->session->appsession('session_data', 'calendar'); |
|
80 | 80 | $query['users'] = explode(',', $query['owner']); |
81 | 81 | $query['num_rows'] = -1; |
82 | - if(bo_merge::hasExportLimit($export_limit) && !$limit_exception) { |
|
83 | - $query['num_rows'] = (int)$export_limit; // ! int of 'no' is 0 |
|
82 | + if (bo_merge::hasExportLimit($export_limit) && !$limit_exception) { |
|
83 | + $query['num_rows'] = (int)$export_limit; // ! int of 'no' is 0 |
|
84 | 84 | } |
85 | 85 | |
86 | 86 | $events = array(); |
87 | - switch($states['view']) { |
|
87 | + switch ($states['view']) { |
|
88 | 88 | case 'month': |
89 | 89 | $query += $this->get_query_month($states); |
90 | 90 | break; |
@@ -98,7 +98,7 @@ discard block |
||
98 | 98 | default: |
99 | 99 | // Let UI set the date ranges |
100 | 100 | $ui = new calendar_uiviews($query); |
101 | - if(method_exists($ui, $states['view'])) |
|
101 | + if (method_exists($ui, $states['view'])) |
|
102 | 102 | { |
103 | 103 | ob_start(); |
104 | 104 | $ui->$states['view'](); |
@@ -122,35 +122,35 @@ discard block |
||
122 | 122 | $filter = $_definition->filter; |
123 | 123 | |
124 | 124 | // Handle ranges |
125 | - foreach($filter as $field => $value) |
|
125 | + foreach ($filter as $field => $value) |
|
126 | 126 | { |
127 | - if($field == 'filter' && $value) |
|
127 | + if ($field == 'filter' && $value) |
|
128 | 128 | { |
129 | 129 | $query['filter'] = $value; |
130 | 130 | continue; |
131 | 131 | } |
132 | - if(!is_array($value) || (!$value['from'] && !$value['to'])) |
|
132 | + if (!is_array($value) || (!$value['from'] && !$value['to'])) |
|
133 | 133 | { |
134 | 134 | $query['query']["cal_$field"] = $value; |
135 | 135 | continue; |
136 | 136 | } |
137 | 137 | |
138 | 138 | // Ranges are inclusive, so should be provided that way (from 2 to 10 includes 2 and 10) |
139 | - if($value['from']) $query['sql_filter'][] = "cal_$field >= " . (int)$value['from']; |
|
140 | - if($value['to']) $query['sql_filter'][] = "cal_$field <= " . (int)$value['to']; |
|
139 | + if ($value['from']) $query['sql_filter'][] = "cal_$field >= ".(int)$value['from']; |
|
140 | + if ($value['to']) $query['sql_filter'][] = "cal_$field <= ".(int)$value['to']; |
|
141 | 141 | |
142 | 142 | } |
143 | - if($query['sql_filter'] && is_array($query['sql_filter'])) |
|
143 | + if ($query['sql_filter'] && is_array($query['sql_filter'])) |
|
144 | 144 | { |
145 | 145 | // Set as an extra parameter |
146 | - $sql_filter = implode(' AND ',$query['sql_filter']); |
|
146 | + $sql_filter = implode(' AND ', $query['sql_filter']); |
|
147 | 147 | } |
148 | 148 | |
149 | 149 | case 'all': |
150 | 150 | $events = $this->bo->search($query + array( |
151 | 151 | 'offset' => 0, |
152 | 152 | 'order' => 'cal_start', |
153 | - ),$sql_filter); |
|
153 | + ), $sql_filter); |
|
154 | 154 | break; |
155 | 155 | } |
156 | 156 | |
@@ -167,24 +167,24 @@ discard block |
||
167 | 167 | // Get rid of yearly recurring events that don't belong |
168 | 168 | //if($options['selection']['select'] == 'criteria' && ($event['start'] > $query['end'] || $event['end'] < $query['start'])) continue; |
169 | 169 | // Add in participants |
170 | - if($options['mapping']['participants']) { |
|
171 | - $event['participants'] = implode(", ",$this->bo->participants($event,true)); |
|
170 | + if ($options['mapping']['participants']) { |
|
171 | + $event['participants'] = implode(", ", $this->bo->participants($event, true)); |
|
172 | 172 | } |
173 | 173 | if (is_array($event)) |
174 | 174 | { |
175 | 175 | $record->set_record($event); |
176 | - if($options['mapping']['recurrence']) { |
|
176 | + if ($options['mapping']['recurrence']) { |
|
177 | 177 | $record->recurrence = $recurrence[$record->recur_type]; |
178 | - if($record->recur_type != MCAL_RECUR_NONE) $record->recurrence .= ' / '. $record->recur_interval; |
|
178 | + if ($record->recur_type != MCAL_RECUR_NONE) $record->recurrence .= ' / '.$record->recur_interval; |
|
179 | 179 | } |
180 | 180 | |
181 | 181 | // Standard stuff |
182 | - if($options['convert']) { |
|
182 | + if ($options['convert']) { |
|
183 | 183 | importexport_export_csv::convert($record, $convert_fields, 'calendar', $this->selects); |
184 | 184 | } else { |
185 | 185 | // Implode arrays, so they don't say 'Array' |
186 | - foreach($record->get_record_array() as $key => $value) { |
|
187 | - if(is_array($value)) $record->$key = implode(',', $value); |
|
186 | + foreach ($record->get_record_array() as $key => $value) { |
|
187 | + if (is_array($value)) $record->$key = implode(',', $value); |
|
188 | 188 | } |
189 | 189 | } |
190 | 190 | $export_object->export_record($record); |
@@ -237,8 +237,8 @@ discard block |
||
237 | 237 | * |
238 | 238 | */ |
239 | 239 | public function get_selectors_etpl($definition = null) { |
240 | - $states = $GLOBALS['egw']->session->appsession('session_data','calendar'); |
|
241 | - switch($states['view']) { |
|
240 | + $states = $GLOBALS['egw']->session->appsession('session_data', 'calendar'); |
|
241 | + switch ($states['view']) { |
|
242 | 242 | case 'month': |
243 | 243 | $query = $this->get_query_month($states); |
244 | 244 | break; |
@@ -250,32 +250,32 @@ discard block |
||
250 | 250 | $query = $this->get_query_day($states); |
251 | 251 | break; |
252 | 252 | } |
253 | - $start= new egw_time($query['start']); |
|
253 | + $start = new egw_time($query['start']); |
|
254 | 254 | $end = new egw_time($query['end']); |
255 | 255 | if ($states['view'] == 'listview') |
256 | 256 | { |
257 | - $list = $GLOBALS['egw']->session->appsession('calendar_list','calendar'); |
|
257 | + $list = $GLOBALS['egw']->session->appsession('calendar_list', 'calendar'); |
|
258 | 258 | |
259 | 259 | // Use UI to get dates |
260 | 260 | $ui = new calendar_uilist(); |
261 | - $list['csv_export'] = true; // so get_rows method _can_ produce different content or not store state in the session |
|
262 | - $ui->get_rows($list,$rows,$readonlys); |
|
261 | + $list['csv_export'] = true; // so get_rows method _can_ produce different content or not store state in the session |
|
262 | + $ui->get_rows($list, $rows, $readonlys); |
|
263 | 263 | $start = $ui->first ? $ui->first : new egw_time($ui->date); |
264 | 264 | $end = $ui->last; |
265 | 265 | |
266 | 266 | // Special handling |
267 | - if($list['filter'] == 'all') $start = $end = null; |
|
268 | - if($list['filter'] == 'before') |
|
267 | + if ($list['filter'] == 'all') $start = $end = null; |
|
268 | + if ($list['filter'] == 'before') |
|
269 | 269 | { |
270 | 270 | $end = $start; |
271 | 271 | $start = null; |
272 | 272 | } |
273 | 273 | $ui = null; |
274 | 274 | } |
275 | - elseif(!$end) |
|
275 | + elseif (!$end) |
|
276 | 276 | { |
277 | - $end = '+1 ' . $states['view']; |
|
278 | - $end = strtotime($end, $start->format('ts'))-1; |
|
277 | + $end = '+1 '.$states['view']; |
|
278 | + $end = strtotime($end, $start->format('ts')) - 1; |
|
279 | 279 | } |
280 | 280 | $prefs = unserialize($GLOBALS['egw_info']['user']['preferences']['importexport'][$definition->definition_id]); |
281 | 281 | $data = array( |
@@ -300,8 +300,8 @@ discard block |
||
300 | 300 | public static function get_query_month($states) |
301 | 301 | { |
302 | 302 | $timespan = array( |
303 | - 'start' => mktime(0,0,0,$states['month'],1,$states['year']), |
|
304 | - 'end' => mktime(0,0,0,$states['month']+1,1,$states['year'])-1 |
|
303 | + 'start' => mktime(0, 0, 0, $states['month'], 1, $states['year']), |
|
304 | + 'end' => mktime(0, 0, 0, $states['month'] + 1, 1, $states['year']) - 1 |
|
305 | 305 | ); |
306 | 306 | return $timespan; |
307 | 307 | } |
@@ -319,24 +319,24 @@ discard block |
||
319 | 319 | if ($states['view'] == 'week' && $days == 4) // next 4 days view |
320 | 320 | { |
321 | 321 | $query['start'] = $this->bo->date2ts($states['date']); |
322 | - $query['end'] = strtotime("+$days days",$query['start']) - 1; |
|
322 | + $query['end'] = strtotime("+$days days", $query['start']) - 1; |
|
323 | 323 | } |
324 | 324 | else |
325 | 325 | { |
326 | - $query['start'] = $ui->datetime->get_weekday_start($states['year'],$states['month'],$states['day']); |
|
326 | + $query['start'] = $ui->datetime->get_weekday_start($states['year'], $states['month'], $states['day']); |
|
327 | 327 | if ($days == 5) // no weekend-days |
328 | 328 | { |
329 | - switch($ui->cal_prefs['weekdaystarts']) |
|
329 | + switch ($ui->cal_prefs['weekdaystarts']) |
|
330 | 330 | { |
331 | 331 | case 'Saturday': |
332 | - $query['start'] = strtotime("+2 days",$query['start']); |
|
332 | + $query['start'] = strtotime("+2 days", $query['start']); |
|
333 | 333 | break; |
334 | 334 | case 'Sunday': |
335 | - $query['start'] = strtotime("+1 day",$query['start']); |
|
335 | + $query['start'] = strtotime("+1 day", $query['start']); |
|
336 | 336 | break; |
337 | 337 | } |
338 | 338 | } |
339 | - $query['end'] = strtotime($states['view'] == 'week' ? "+$days days" : "+{$ui->cal_prefs['multiple_weeks']} weeks",$query['start']) - 1; |
|
339 | + $query['end'] = strtotime($states['view'] == 'week' ? "+$days days" : "+{$ui->cal_prefs['multiple_weeks']} weeks", $query['start']) - 1; |
|
340 | 340 | } |
341 | 341 | return $query; |
342 | 342 | } |
@@ -346,7 +346,7 @@ discard block |
||
346 | 346 | $query = array(); |
347 | 347 | $bo = new calendar_bo(); |
348 | 348 | $query['start'] = $bo->date2ts((string)$states['date']); |
349 | - $query['end'] = $query['start']+DAY_s-1; |
|
349 | + $query['end'] = $query['start'] + DAY_s - 1; |
|
350 | 350 | return $query; |
351 | 351 | } |
352 | 352 | |
@@ -395,17 +395,17 @@ discard block |
||
395 | 395 | ); |
396 | 396 | $filters = array_reverse($filters, true); |
397 | 397 | |
398 | - foreach($filters as $field_name => &$settings) |
|
398 | + foreach ($filters as $field_name => &$settings) |
|
399 | 399 | { |
400 | 400 | // Can't filter on a custom field |
401 | - if(strpos($field_name, '#') === 0) |
|
401 | + if (strpos($field_name, '#') === 0) |
|
402 | 402 | { |
403 | 403 | unset($filters[$field_name]); |
404 | 404 | continue; |
405 | 405 | } |
406 | 406 | |
407 | 407 | // Pass on select options |
408 | - if($this->selects[$field_name]) $settings['values'] = $this->selects[$field_name]; |
|
408 | + if ($this->selects[$field_name]) $settings['values'] = $this->selects[$field_name]; |
|
409 | 409 | } |
410 | 410 | |
411 | 411 | } |
@@ -39,9 +39,9 @@ discard block |
||
39 | 39 | $holiday['observance_rule'] = @$holiday['observance_rule'] ? 1 : 0; |
40 | 40 | $holiday['locale'] = strtoupper($holiday['locale']); |
41 | 41 | |
42 | - foreach($holiday as $name => $val) |
|
42 | + foreach ($holiday as $name => $val) |
|
43 | 43 | { |
44 | - if (substr($name,0,4) != 'hol_') |
|
44 | + if (substr($name, 0, 4) != 'hol_') |
|
45 | 45 | { |
46 | 46 | if (!is_numeric($name)) |
47 | 47 | { |
@@ -56,15 +56,15 @@ discard block |
||
56 | 56 | |
57 | 57 | if ($hol_id) |
58 | 58 | { |
59 | - if($this->debug) |
|
59 | + if ($this->debug) |
|
60 | 60 | { |
61 | 61 | echo "Updating LOCALE='".$holiday['locale']."' NAME='".$holiday['name']."' extra=(".$holiday['mday'].'/'.$holiday['month_num'].'/'.$holiday['occurence'].'/'.$holiday['dow'].'/'.$holiday['observance_rule'].")<br>\n"; |
62 | 62 | } |
63 | - $this->db->update($this->table,$holiday,array('hol_id' => $hol_id),__LINE__,__FILE__,'calendar'); |
|
63 | + $this->db->update($this->table, $holiday, array('hol_id' => $hol_id), __LINE__, __FILE__, 'calendar'); |
|
64 | 64 | } |
65 | 65 | else |
66 | 66 | { |
67 | - if($this->debug) |
|
67 | + if ($this->debug) |
|
68 | 68 | { |
69 | 69 | echo "Inserting LOCALE='".$holiday['locale']."' NAME='".$holiday['name']."' extra=(".$holiday['mday'].'/'.$holiday['month_num'].'/'.$holiday['occurence'].'/'.$holiday['dow'].'/'.$holiday['observance_rule'].")<br>\n"; |
70 | 70 | } |
@@ -74,13 +74,13 @@ discard block |
||
74 | 74 | 'hol_occurence' => $holiday['hol_occurence'], |
75 | 75 | 'hol_locale' => $holiday['hol_locale'], |
76 | 76 | ), __LINE__, __FILES__, 'calendar'); |
77 | - $this->db->insert($this->table,$holiday,False,__LINE__,__FILE__,'calendar'); |
|
77 | + $this->db->insert($this->table, $holiday, False, __LINE__, __FILE__, 'calendar'); |
|
78 | 78 | } |
79 | 79 | } |
80 | 80 | |
81 | - function store_to_array(&$holidays,$rs) |
|
81 | + function store_to_array(&$holidays, $rs) |
|
82 | 82 | { |
83 | - foreach($rs as $row) |
|
83 | + foreach ($rs as $row) |
|
84 | 84 | { |
85 | 85 | $holidays[] = Array( |
86 | 86 | 'index' => $row['hol_id'], |
@@ -92,31 +92,31 @@ discard block |
||
92 | 92 | 'dow' => (int)$row['hol_dow'], |
93 | 93 | 'observance_rule' => $row['hol_observance_rule'] |
94 | 94 | ); |
95 | - if($this->debug) |
|
95 | + if ($this->debug) |
|
96 | 96 | { |
97 | 97 | echo 'Holiday ID: '.$row['hol_id'].'<br>'."\n"; |
98 | 98 | } |
99 | 99 | } |
100 | 100 | } |
101 | 101 | |
102 | - function read_holidays($locales='',$query='',$order='',$year=0) |
|
102 | + function read_holidays($locales = '', $query = '', $order = '', $year = 0) |
|
103 | 103 | { |
104 | 104 | $holidays = Array(); |
105 | 105 | |
106 | - if($locales == '') |
|
106 | + if ($locales == '') |
|
107 | 107 | { |
108 | 108 | return $holidays; |
109 | 109 | } |
110 | 110 | |
111 | - $where = $this->_build_where($locales,$query,$order,$year); |
|
111 | + $where = $this->_build_where($locales, $query, $order, $year); |
|
112 | 112 | |
113 | - if($this->debug) |
|
113 | + if ($this->debug) |
|
114 | 114 | { |
115 | 115 | echo 'Read Holidays : '.$where.'<br>'."\n"; |
116 | 116 | } |
117 | 117 | |
118 | - $rs = $this->db->select($this->table,'*',$where,__LINE__,__FILE__,false,'','calendar'); |
|
119 | - $this->store_to_array($holidays,$rs); |
|
118 | + $rs = $this->db->select($this->table, '*', $where, __LINE__, __FILE__, false, '', 'calendar'); |
|
119 | + $this->store_to_array($holidays, $rs); |
|
120 | 120 | |
121 | 121 | return $holidays; |
122 | 122 | } |
@@ -124,38 +124,38 @@ discard block |
||
124 | 124 | function read_holiday($id) |
125 | 125 | { |
126 | 126 | $holidays = Array(); |
127 | - if($this->debug) |
|
127 | + if ($this->debug) |
|
128 | 128 | { |
129 | 129 | echo 'Reading Holiday ID : '.$id.'<br>'."\n"; |
130 | 130 | } |
131 | - $rs = $this->db->select($this->table,'*',array('hol_id'=>$id),__LINE__,__FILE__,false,'','calendar'); |
|
132 | - $this->store_to_array($holidays,$rs); |
|
131 | + $rs = $this->db->select($this->table, '*', array('hol_id'=>$id), __LINE__, __FILE__, false, '', 'calendar'); |
|
132 | + $this->store_to_array($holidays, $rs); |
|
133 | 133 | return $holidays[0]; |
134 | 134 | } |
135 | 135 | |
136 | 136 | function delete_holiday($id) |
137 | 137 | { |
138 | - $this->db->delete($this->table,array('hol_id' => $id),__LINE__,__FILE__,'calendar'); |
|
138 | + $this->db->delete($this->table, array('hol_id' => $id), __LINE__, __FILE__, 'calendar'); |
|
139 | 139 | } |
140 | 140 | |
141 | 141 | function delete_locale($locale) |
142 | 142 | { |
143 | - $this->db->delete($this->table,array('hol_locale' => $locale),__LINE__,__FILE__,'calendar'); |
|
143 | + $this->db->delete($this->table, array('hol_locale' => $locale), __LINE__, __FILE__, 'calendar'); |
|
144 | 144 | } |
145 | 145 | |
146 | 146 | /* Private functions */ |
147 | - function _build_where($locales,$query='',$order='',$year=0,$add_order_by=True) |
|
147 | + function _build_where($locales, $query = '', $order = '', $year = 0, $add_order_by = True) |
|
148 | 148 | { |
149 | 149 | $querymethod = 'hol_locale'; |
150 | 150 | if (is_array($locales)) |
151 | 151 | { |
152 | - $querymethod .= ' IN ('.$this->db->column_data_implode(',',$locales,False).')'; |
|
152 | + $querymethod .= ' IN ('.$this->db->column_data_implode(',', $locales, False).')'; |
|
153 | 153 | } |
154 | 154 | else |
155 | 155 | { |
156 | 156 | $querymethod .= '='.$this->db->quote($locales); |
157 | 157 | } |
158 | - if($query) |
|
158 | + if ($query) |
|
159 | 159 | { |
160 | 160 | $querymethod .= " AND hol_name LIKE ".$this->db->quote('%'.$query.'%'); |
161 | 161 | } |
@@ -165,44 +165,44 @@ discard block |
||
165 | 165 | } |
166 | 166 | if ($add_order_by) |
167 | 167 | { |
168 | - $querymethod .= ' ORDER BY '.(preg_match('/^[a-zA-Z0-9_,]+$/',$order) ? $order : 'hol_month_num,hol_mday'); |
|
168 | + $querymethod .= ' ORDER BY '.(preg_match('/^[a-zA-Z0-9_,]+$/', $order) ? $order : 'hol_month_num,hol_mday'); |
|
169 | 169 | } |
170 | 170 | return $querymethod; |
171 | 171 | } |
172 | 172 | |
173 | - function get_locale_list($sort='', $order='', $query='') |
|
173 | + function get_locale_list($sort = '', $order = '', $query = '') |
|
174 | 174 | { |
175 | 175 | $querymethod = ''; |
176 | - if($query) |
|
176 | + if ($query) |
|
177 | 177 | { |
178 | 178 | $querymethod = 'hol_locale LIKE '.$this->db->quote('%'.$query.'%'); |
179 | 179 | } |
180 | 180 | |
181 | - if(!preg_match('/^[a-zA-Z0-9_,]+$/',$order)) |
|
181 | + if (!preg_match('/^[a-zA-Z0-9_,]+$/', $order)) |
|
182 | 182 | { |
183 | 183 | $order = 'hol_locale'; |
184 | 184 | } |
185 | 185 | if (strtoupper($sort) != 'DESC') $sort = 'ASC'; |
186 | 186 | if (strpos($order, ',') === false) $order .= ' '.$sort; |
187 | - foreach($this->db->select($this->table,'DISTINCT hol_locale',$querymethod,__LINE__,__FILE__,false,'ORDER BY '.$order,'calendar') as $row) |
|
187 | + foreach ($this->db->select($this->table, 'DISTINCT hol_locale', $querymethod, __LINE__, __FILE__, false, 'ORDER BY '.$order, 'calendar') as $row) |
|
188 | 188 | { |
189 | 189 | $locale[] = $row['hol_locale']; |
190 | 190 | } |
191 | 191 | return $locale; |
192 | 192 | } |
193 | 193 | |
194 | - function holiday_total($locale,$query='',$year=0) |
|
194 | + function holiday_total($locale, $query = '', $year = 0) |
|
195 | 195 | { |
196 | - $where = $this->_build_where($locale,$query,'',$year,False); |
|
196 | + $where = $this->_build_where($locale, $query, '', $year, False); |
|
197 | 197 | |
198 | - if($this->debug) |
|
198 | + if ($this->debug) |
|
199 | 199 | { |
200 | 200 | echo 'HOLIDAY_TOTAL : '.$where.'<br>'."\n"; |
201 | 201 | } |
202 | 202 | |
203 | - $retval = $this->db->select($this->table,'count(*)',$where,__LINE__,__FILE__,false,'','calendar')->fetchColumn(); |
|
203 | + $retval = $this->db->select($this->table, 'count(*)', $where, __LINE__, __FILE__, false, '', 'calendar')->fetchColumn(); |
|
204 | 204 | |
205 | - if($this->debug) |
|
205 | + if ($this->debug) |
|
206 | 206 | { |
207 | 207 | echo 'Total Holidays for : '.$locale.' : '.$retval."<br>\n"; |
208 | 208 | } |
@@ -23,7 +23,7 @@ discard block |
||
23 | 23 | */ |
24 | 24 | static function search_link($location) |
25 | 25 | { |
26 | - unset($location); // not used, but in function signature for hooks |
|
26 | + unset($location); // not used, but in function signature for hooks |
|
27 | 27 | return array( |
28 | 28 | 'query' => 'calendar.calendar_bo.link_query', |
29 | 29 | 'title' => 'calendar.calendar_bo.link_title', |
@@ -41,7 +41,7 @@ discard block |
||
41 | 41 | 'add_id' => 'link_id', |
42 | 42 | 'add_popup' => '750x400', |
43 | 43 | 'file_access' => 'calendar.calendar_bo.file_access', |
44 | - 'file_access_user' => true, // file_access supports 4th parameter $user |
|
44 | + 'file_access_user' => true, // file_access supports 4th parameter $user |
|
45 | 45 | 'mime' => array( |
46 | 46 | 'text/calendar' => array( |
47 | 47 | 'menuaction' => 'calendar.calendar_uiforms.edit', |
@@ -65,7 +65,7 @@ discard block |
||
65 | 65 | */ |
66 | 66 | static function getAppExportLimit($location) |
67 | 67 | { |
68 | - unset($location); // not used, but in function signature for hooks |
|
68 | + unset($location); // not used, but in function signature for hooks |
|
69 | 69 | return $GLOBALS['egw_info']['server']['calendar_export_limit']; |
70 | 70 | } |
71 | 71 | |
@@ -75,14 +75,14 @@ discard block |
||
75 | 75 | static function admin() |
76 | 76 | { |
77 | 77 | $file = Array( |
78 | - 'Site Configuration' => egw::link('/index.php','menuaction=admin.uiconfig.index&appname=calendar'), |
|
79 | - 'Custom fields' => egw::link('/index.php','menuaction=admin.customfields.index&appname=calendar'), |
|
80 | - 'Calendar Holiday Management' => egw::link('/index.php','menuaction=calendar.uiholiday.admin'), |
|
81 | - 'Global Categories' => egw::link('/index.php','menuaction=admin.admin_categories.index&appname=calendar'), |
|
82 | - 'Category ACL' => egw::link('/index.php','menuaction=calendar.calendar_uiforms.cat_acl'), |
|
83 | - 'Update timezones' => egw::link('/index.php','menuaction=calendar.calendar_timezones.update'), |
|
78 | + 'Site Configuration' => egw::link('/index.php', 'menuaction=admin.uiconfig.index&appname=calendar'), |
|
79 | + 'Custom fields' => egw::link('/index.php', 'menuaction=admin.customfields.index&appname=calendar'), |
|
80 | + 'Calendar Holiday Management' => egw::link('/index.php', 'menuaction=calendar.uiholiday.admin'), |
|
81 | + 'Global Categories' => egw::link('/index.php', 'menuaction=admin.admin_categories.index&appname=calendar'), |
|
82 | + 'Category ACL' => egw::link('/index.php', 'menuaction=calendar.calendar_uiforms.cat_acl'), |
|
83 | + 'Update timezones' => egw::link('/index.php', 'menuaction=calendar.calendar_timezones.update'), |
|
84 | 84 | ); |
85 | - display_section('calendar','calendar',$file); |
|
85 | + display_section('calendar', 'calendar', $file); |
|
86 | 86 | } |
87 | 87 | |
88 | 88 | /** |
@@ -163,14 +163,14 @@ discard block |
||
163 | 163 | 'Saturday' => lang('Saturday') |
164 | 164 | ); |
165 | 165 | |
166 | - for ($i=0; $i < 24; ++$i) |
|
166 | + for ($i = 0; $i < 24; ++$i) |
|
167 | 167 | { |
168 | - $times[$i] = $GLOBALS['egw']->common->formattime($i,'00'); |
|
168 | + $times[$i] = $GLOBALS['egw']->common->formattime($i, '00'); |
|
169 | 169 | } |
170 | 170 | |
171 | 171 | for ($i = 2; $i <= 9; ++$i) |
172 | 172 | { |
173 | - $muliple_weeks[$i] = lang('%1 weeks',$i); |
|
173 | + $muliple_weeks[$i] = lang('%1 weeks', $i); |
|
174 | 174 | } |
175 | 175 | |
176 | 176 | $intervals = array( |
@@ -202,14 +202,14 @@ discard block |
||
202 | 202 | if (!$hook_data['setup']) // does not work at setup time |
203 | 203 | { |
204 | 204 | $options = array('0' => lang('none')); |
205 | - foreach($GLOBALS['egw']->accounts->search(array('type' => 'owngroups','app' => 'calendar')) as $group) |
|
205 | + foreach ($GLOBALS['egw']->accounts->search(array('type' => 'owngroups', 'app' => 'calendar')) as $group) |
|
206 | 206 | { |
207 | 207 | $options[$group['account_id']] = common::grab_owner_name($group['account_id']); |
208 | 208 | } |
209 | - $freebusy_url = calendar_bo::freebusy_url($GLOBALS['egw_info']['user']['account_lid'],$GLOBALS['egw_info']['user']['preferences']['calendar']['freebusy_pw']); |
|
209 | + $freebusy_url = calendar_bo::freebusy_url($GLOBALS['egw_info']['user']['account_lid'], $GLOBALS['egw_info']['user']['preferences']['calendar']['freebusy_pw']); |
|
210 | 210 | $freebusy_url = '<a href="'.$freebusy_url.'" target="_blank">'.$freebusy_url.'</a>'; |
211 | 211 | $freebusy_help = lang('Should not loged in persons be able to see your freebusy information? You can set an extra password, different from your normal password, to protect this informations. The freebusy information is in iCal format and only include the times when you are busy. It does not include the event-name, description or locations. The URL to your freebusy information is'); |
212 | - $freebusy_help .= ' ' . $freebusy_url; |
|
212 | + $freebusy_help .= ' '.$freebusy_url; |
|
213 | 213 | |
214 | 214 | // Timezone for file exports |
215 | 215 | $export_tzs = array('0' => 'Use Event TZ'); |
@@ -382,7 +382,7 @@ discard block |
||
382 | 382 | 'default'=> 60, |
383 | 383 | ), |
384 | 384 | 'default-alarm' => array( |
385 | - 'type' => 'date-duration',//'select', |
|
385 | + 'type' => 'date-duration', //'select', |
|
386 | 386 | 'label' => lang('Default alarm for regular events').' ('.lang('empty = no alarm').')', |
387 | 387 | 'name' => 'default-alarm', |
388 | 388 | 'help' => 'Alarm added automatic to new events before event start-time', |
@@ -391,7 +391,7 @@ discard block |
||
391 | 391 | 'default' => '', |
392 | 392 | ), |
393 | 393 | 'default-alarm-wholeday' => array( |
394 | - 'type' => 'date-duration',//'select', |
|
394 | + 'type' => 'date-duration', //'select', |
|
395 | 395 | 'label' => lang('Default alarm for whole-day events').' ('.lang('empty = no alarm').')', |
396 | 396 | 'name' => 'default-alarm-wholeday', |
397 | 397 | 'help' => lang('Alarm added automatic to new events before event start-time').' ('.lang('Midnight').')', |
@@ -404,7 +404,7 @@ discard block |
||
404 | 404 | { |
405 | 405 | $prefs = $GLOBALS['egw_info']['user']['preferences']['calendar']; |
406 | 406 | $data = array( |
407 | - 'prefs' => &$prefs, // use reference to get preference value back |
|
407 | + 'prefs' => &$prefs, // use reference to get preference value back |
|
408 | 408 | 'preprocess' => true, |
409 | 409 | 'type' => 'user', |
410 | 410 | ); |
@@ -577,9 +577,9 @@ discard block |
||
577 | 577 | 'size' => 60, |
578 | 578 | 'label' => 'Default document to insert entries', |
579 | 579 | 'name' => 'default_document', |
580 | - 'help' => lang('If you specify a document (full vfs path) here, %1 displays an extra document icon for each entry. That icon allows to download the specified document with the data inserted.',lang('calendar')).' '. |
|
581 | - lang('The document can contain placeholder like {{%1}}, to be replaced with the data.','calendar_title').' '. |
|
582 | - lang('The following document-types are supported:'). implode(',',bo_merge::get_file_extensions()), |
|
580 | + 'help' => lang('If you specify a document (full vfs path) here, %1 displays an extra document icon for each entry. That icon allows to download the specified document with the data inserted.', lang('calendar')).' '. |
|
581 | + lang('The document can contain placeholder like {{%1}}, to be replaced with the data.', 'calendar_title').' '. |
|
582 | + lang('The following document-types are supported:').implode(',', bo_merge::get_file_extensions()), |
|
583 | 583 | 'run_lang' => false, |
584 | 584 | 'xmlrpc' => True, |
585 | 585 | 'admin' => False, |
@@ -589,9 +589,9 @@ discard block |
||
589 | 589 | 'size' => 60, |
590 | 590 | 'label' => 'Directory with documents to insert entries', |
591 | 591 | 'name' => 'document_dir', |
592 | - 'help' => lang('If you specify a directory (full vfs path) here, %1 displays an action for each document. That action allows to download the specified document with the data inserted.',lang('calendar')).' '. |
|
593 | - lang('The document can contain placeholder like {{%1}}, to be replaced with the data.','calendar_title').' '. |
|
594 | - lang('The following document-types are supported:'). implode(',',bo_merge::get_file_extensions()), |
|
592 | + 'help' => lang('If you specify a directory (full vfs path) here, %1 displays an action for each document. That action allows to download the specified document with the data inserted.', lang('calendar')).' '. |
|
593 | + lang('The document can contain placeholder like {{%1}}, to be replaced with the data.', 'calendar_title').' '. |
|
594 | + lang('The following document-types are supported:').implode(',', bo_merge::get_file_extensions()), |
|
595 | 595 | 'run_lang' => false, |
596 | 596 | 'xmlrpc' => True, |
597 | 597 | 'admin' => False, |
@@ -616,7 +616,7 @@ discard block |
||
616 | 616 | } |
617 | 617 | catch (Exception $e) |
618 | 618 | { |
619 | - unset($e); // not used |
|
619 | + unset($e); // not used |
|
620 | 620 | // permission error |
621 | 621 | continue; |
622 | 622 | } |
@@ -704,14 +704,14 @@ discard block |
||
704 | 704 | if ($data['type'] != 'user') return; |
705 | 705 | |
706 | 706 | $account_lid = $GLOBALS['egw_info']['user']['account_lid']; |
707 | - foreach(array( |
|
707 | + foreach (array( |
|
708 | 708 | 'default-alarm' => 'default-alarm-vevent-datetime:/'.$account_lid.'/:urn:ietf:params:xml:ns:caldav', |
709 | 709 | 'default-alarm-wholeday' => 'default-alarm-vevent-date:/'.$account_lid.'/:urn:ietf:params:xml:ns:caldav', |
710 | 710 | ) as $name => $dav) |
711 | 711 | { |
712 | - $pref =& $GLOBALS['egw_info']['user']['preferences']['groupdav'][$dav]; |
|
713 | - if (true) $pref = str_replace("\r", '', $pref); // remove CR messing up multiline preg_match |
|
714 | - $val =& $data['prefs'][$name]; |
|
712 | + $pref = & $GLOBALS['egw_info']['user']['preferences']['groupdav'][$dav]; |
|
713 | + if (true) $pref = str_replace("\r", '', $pref); // remove CR messing up multiline preg_match |
|
714 | + $val = & $data['prefs'][$name]; |
|
715 | 715 | |
716 | 716 | //error_log(__METHOD__."() groupdav[$dav]=$pref, calendar[$name]=$val"); |
717 | 717 | |
@@ -732,7 +732,7 @@ discard block |
||
732 | 732 | 'D' => 1440, |
733 | 733 | ); |
734 | 734 | $factor = $factors[strtoupper($matches[2])]; |
735 | - $val = $factor*(int)$matches[1]; |
|
735 | + $val = $factor * (int)$matches[1]; |
|
736 | 736 | } |
737 | 737 | else |
738 | 738 | { |
@@ -763,7 +763,7 @@ discard block |
||
763 | 763 | } |
764 | 764 | else |
765 | 765 | { |
766 | - $pref = preg_replace('/^TRIGGER:.*$/m', $trigger.number_format(abs($val)/60, 0).'H', $pref); |
|
766 | + $pref = preg_replace('/^TRIGGER:.*$/m', $trigger.number_format(abs($val) / 60, 0).'H', $pref); |
|
767 | 767 | } |
768 | 768 | $GLOBALS['egw']->preferences->add('groupdav', $dav, $pref, 'user'); |
769 | 769 | //error_log(__METHOD__."() storing $name=$val --> $dav='$pref'"); |
@@ -824,7 +824,7 @@ discard block |
||
824 | 824 | */ |
825 | 825 | public static function categories($data) |
826 | 826 | { |
827 | - unset($data); // not used, but in function signature for hooks |
|
827 | + unset($data); // not used, but in function signature for hooks |
|
828 | 828 | return true; |
829 | 829 | } |
830 | 830 | |
@@ -835,7 +835,7 @@ discard block |
||
835 | 835 | */ |
836 | 836 | public static function mail_import($args) |
837 | 837 | { |
838 | - return array ( |
|
838 | + return array( |
|
839 | 839 | 'menuaction' => 'calendar.calendar_uiforms.mail_import', |
840 | 840 | 'popup' => egw_link::get_registry('calendar', 'edit_popup') |
841 | 841 | ); |
@@ -850,7 +850,7 @@ discard block |
||
850 | 850 | // Cancel old purge |
851 | 851 | ExecMethod('phpgwapi.asyncservice.cancel_timer', $id); |
852 | 852 | |
853 | - if((float)$config > 0) |
|
853 | + if ((float)$config > 0) |
|
854 | 854 | { |
855 | 855 | $result = ExecMethod2('phpgwapi.asyncservice.set_timer', |
856 | 856 | array('month' => '*', 'day' => 1), |
@@ -858,7 +858,7 @@ discard block |
||
858 | 858 | 'calendar.calendar_boupdate.purge', |
859 | 859 | (float)$config |
860 | 860 | ); |
861 | - if(!$result) |
|
861 | + if (!$result) |
|
862 | 862 | { |
863 | 863 | $GLOBALS['config_error'] = 'Unable to schedule purge'; |
864 | 864 | } |
@@ -43,26 +43,26 @@ discard block |
||
43 | 43 | function uiholiday() |
44 | 44 | { |
45 | 45 | egw_framework::csp_script_src_attrs('unsafe-inline'); |
46 | - $this->bo =& CreateObject('calendar.boholiday'); |
|
46 | + $this->bo = & CreateObject('calendar.boholiday'); |
|
47 | 47 | $this->bo->check_admin(); |
48 | 48 | $this->base_url = $this->bo->base_url; |
49 | 49 | $this->template_dir = common::get_tpl_dir('calendar'); |
50 | - $this->sb =& CreateObject('calendar.sbox'); |
|
50 | + $this->sb = & CreateObject('calendar.sbox'); |
|
51 | 51 | |
52 | 52 | // calendar does not work with hidden sidebox atm. |
53 | 53 | unset($GLOBALS['egw_info']['user']['preferences']['common']['auto_hide_sidebox']); |
54 | 54 | |
55 | 55 | $GLOBALS['egw_info']['flags']['app_header'] = $GLOBALS['egw_info']['apps']['calendar']['title'].' - '.lang('Holiday Management'); |
56 | 56 | |
57 | - $GLOBALS['egw']->template->set_var('help_msg',lang('<b>Please note</b>: The calendar use the holidays of your country, which is set to %1. You can change it in your %2.<br />Holidays are %3 automatic installed from %4. You can changed it in %5.', |
|
58 | - '<b>'.$GLOBALS['egw_info']['user']['preferences']['common']['country'].'</b>',lang('common preferences'), |
|
57 | + $GLOBALS['egw']->template->set_var('help_msg', lang('<b>Please note</b>: The calendar use the holidays of your country, which is set to %1. You can change it in your %2.<br />Holidays are %3 automatic installed from %4. You can changed it in %5.', |
|
58 | + '<b>'.$GLOBALS['egw_info']['user']['preferences']['common']['country'].'</b>', lang('common preferences'), |
|
59 | 59 | $GLOBALS['egw_info']['server']['auto_load_holidays'] ? '' : '<b>'.lang('not').'</b>', |
60 | 60 | '<b>'.$GLOBALS['egw_info']['server']['holidays_url_path'].'</b>', |
61 | - '<a href="'.$GLOBALS['egw']->link('/index.php',array( |
|
61 | + '<a href="'.$GLOBALS['egw']->link('/index.php', array( |
|
62 | 62 | 'menuaction' => 'admin.uiconfig.index', |
63 | 63 | 'appname' => 'calendar', |
64 | 64 | )).'">'.lang('admin').' >> '.lang('calendar').' >> '.lang('site configuration').'</a>')); |
65 | - $GLOBALS['egw']->template->set_var('total',''); |
|
65 | + $GLOBALS['egw']->template->set_var('total', ''); |
|
66 | 66 | } |
67 | 67 | |
68 | 68 | function admin() |
@@ -74,16 +74,16 @@ discard block |
||
74 | 74 | |
75 | 75 | $p = &$GLOBALS['egw']->template; |
76 | 76 | $p->set_file(Array('locales'=>'locales.tpl')); |
77 | - $p->set_block('locales','list','list'); |
|
78 | - $p->set_block('locales','row','row'); |
|
79 | - $p->set_block('locales','row_empty','row_empty'); |
|
77 | + $p->set_block('locales', 'list', 'list'); |
|
78 | + $p->set_block('locales', 'row', 'row'); |
|
79 | + $p->set_block('locales', 'row_empty', 'row_empty'); |
|
80 | 80 | |
81 | 81 | $var = Array( |
82 | 82 | 'th_bg' => $GLOBALS['egw_info']['theme']['th_bg'], |
83 | - 'left_next_matchs' => $GLOBALS['egw']->nextmatchs->left('/index.php?menuaction=calendar.uiholiday.admin',$this->bo->start,$this->bo->total), |
|
84 | - 'right_next_matchs' => $GLOBALS['egw']->nextmatchs->right('/index.php?menuaction=calendar.uiholiday.admin',$this->bo->start,$this->bo->total), |
|
83 | + 'left_next_matchs' => $GLOBALS['egw']->nextmatchs->left('/index.php?menuaction=calendar.uiholiday.admin', $this->bo->start, $this->bo->total), |
|
84 | + 'right_next_matchs' => $GLOBALS['egw']->nextmatchs->right('/index.php?menuaction=calendar.uiholiday.admin', $this->bo->start, $this->bo->total), |
|
85 | 85 | 'center' => '<td align="center">'.lang('Countries').'</td>', |
86 | - 'sort_name' => $GLOBALS['egw']->nextmatchs->show_sort_order($this->bo->sort,'hol_locale',$this->bo->order,'/calendar/'.basename($SCRIPT_FILENAME),lang('Country')), |
|
86 | + 'sort_name' => $GLOBALS['egw']->nextmatchs->show_sort_order($this->bo->sort, 'hol_locale', $this->bo->order, '/calendar/'.basename($SCRIPT_FILENAME), lang('Country')), |
|
87 | 87 | 'header_edit' => lang('Edit'), |
88 | 88 | 'header_delete' => lang('Delete'), |
89 | 89 | 'header_extra' => lang('Submit to Repository'), |
@@ -99,42 +99,42 @@ discard block |
||
99 | 99 | @reset($locales); |
100 | 100 | if (!$locales) |
101 | 101 | { |
102 | - $p->set_var('message',lang('no matches found')); |
|
103 | - $p->parse('rows','row_empty',True); |
|
102 | + $p->set_var('message', lang('no matches found')); |
|
103 | + $p->parse('rows', 'row_empty', True); |
|
104 | 104 | } |
105 | 105 | else |
106 | 106 | { |
107 | - $p->set_var('submit_extra',' width="5%"'); |
|
107 | + $p->set_var('submit_extra', ' width="5%"'); |
|
108 | 108 | while (list(,$value) = each($locales)) |
109 | 109 | { |
110 | 110 | $tr_color = $GLOBALS['egw']->nextmatchs->alternate_row_color($tr_color); |
111 | - if (! $value) $value = ' '; |
|
111 | + if (!$value) $value = ' '; |
|
112 | 112 | |
113 | 113 | $var = Array( |
114 | 114 | 'tr_color' => $tr_color, |
115 | 115 | 'group_name' => $value, |
116 | - 'edit_link' => '<a href="'.$GLOBALS['egw']->link($this->base_url,Array('menuaction'=>'calendar.uiholiday.edit_locale','locale'=>$value)) . '"> '.lang('Edit').' </a>', |
|
117 | - 'delete_link' => '<a href="'.$GLOBALS['egw']->link($this->base_url,Array('menuaction'=>'calendar.uiholiday.delete_locale','locale'=>$value)).'"> '.lang('Delete').' </a>', |
|
118 | - 'extra_link' => '<a href="'.$GLOBALS['egw']->link($this->base_url,Array('menuaction'=>'calendar.uiholiday.submit','locale'=>$value)).'"> '.lang('Submit').' </a>'. |
|
119 | - ' <a href="'.$GLOBALS['egw']->link($this->base_url,Array('menuaction'=>'calendar.uiholiday.submit','locale'=>$value,'download'=>1)).'"> '.lang('Download').' </a>' |
|
116 | + 'edit_link' => '<a href="'.$GLOBALS['egw']->link($this->base_url, Array('menuaction'=>'calendar.uiholiday.edit_locale', 'locale'=>$value)).'"> '.lang('Edit').' </a>', |
|
117 | + 'delete_link' => '<a href="'.$GLOBALS['egw']->link($this->base_url, Array('menuaction'=>'calendar.uiholiday.delete_locale', 'locale'=>$value)).'"> '.lang('Delete').' </a>', |
|
118 | + 'extra_link' => '<a href="'.$GLOBALS['egw']->link($this->base_url, Array('menuaction'=>'calendar.uiholiday.submit', 'locale'=>$value)).'"> '.lang('Submit').' </a>'. |
|
119 | + ' <a href="'.$GLOBALS['egw']->link($this->base_url, Array('menuaction'=>'calendar.uiholiday.submit', 'locale'=>$value, 'download'=>1)).'"> '.lang('Download').' </a>' |
|
120 | 120 | ); |
121 | 121 | $p->set_var($var); |
122 | - $p->parse('rows','row',True); |
|
122 | + $p->parse('rows', 'row', True); |
|
123 | 123 | } |
124 | 124 | } |
125 | 125 | |
126 | 126 | $var = Array( |
127 | - 'new_action' => $GLOBALS['egw']->link($this->base_url,Array('menuaction'=>'calendar.uiholiday.edit_holiday','id'=>0)), |
|
127 | + 'new_action' => $GLOBALS['egw']->link($this->base_url, Array('menuaction'=>'calendar.uiholiday.edit_holiday', 'id'=>0)), |
|
128 | 128 | 'lang_add' => lang('add'), |
129 | - 'search_action' => $GLOBALS['egw']->link($this->base_url,Array('menuaction'=>'calendar.uiholiday.admin')), |
|
129 | + 'search_action' => $GLOBALS['egw']->link($this->base_url, Array('menuaction'=>'calendar.uiholiday.admin')), |
|
130 | 130 | 'lang_search' => lang('search') |
131 | 131 | ); |
132 | 132 | |
133 | 133 | $p->set_var($var); |
134 | - $p->pparse('out','list'); |
|
134 | + $p->pparse('out', 'list'); |
|
135 | 135 | } |
136 | 136 | |
137 | - function edit_locale($locale='') |
|
137 | + function edit_locale($locale = '') |
|
138 | 138 | { |
139 | 139 | if ($locale === '') |
140 | 140 | { |
@@ -143,33 +143,33 @@ discard block |
||
143 | 143 | if ($locale) |
144 | 144 | { |
145 | 145 | $this->bo->locales = array($locale); |
146 | - $this->bo->total = $this->bo->so->holiday_total($locale,$this->bo->query); |
|
146 | + $this->bo->total = $this->bo->so->holiday_total($locale, $this->bo->query); |
|
147 | 147 | } |
148 | - if(!$this->bo->total && !isset($this->bo->query)) |
|
148 | + if (!$this->bo->total && !isset($this->bo->query)) |
|
149 | 149 | { |
150 | 150 | $link_params = Array( |
151 | 151 | 'menuaction' => 'calendar.uiholiday.admin' |
152 | 152 | ); |
153 | - $GLOBALS['egw']->redirect_link($this->base_url,$link_params); |
|
153 | + $GLOBALS['egw']->redirect_link($this->base_url, $link_params); |
|
154 | 154 | } |
155 | 155 | unset($GLOBALS['egw_info']['flags']['noheader']); |
156 | 156 | unset($GLOBALS['egw_info']['flags']['nonavbar']); |
157 | 157 | $GLOBALS['egw_info']['flags']['noappfooter'] = True; |
158 | 158 | common::egw_header(); |
159 | - $p =& $GLOBALS['egw']->template; |
|
159 | + $p = & $GLOBALS['egw']->template; |
|
160 | 160 | $p->set_file(Array('locale'=>'locales.tpl')); |
161 | - $p->set_block('locale','list','list'); |
|
162 | - $p->set_block('locale','row','row'); |
|
163 | - $p->set_block('locale','row_empty','row_empty'); |
|
164 | - $p->set_block('locale','back_button_form','back_button_form'); |
|
161 | + $p->set_block('locale', 'list', 'list'); |
|
162 | + $p->set_block('locale', 'row', 'row'); |
|
163 | + $p->set_block('locale', 'row_empty', 'row_empty'); |
|
164 | + $p->set_block('locale', 'back_button_form', 'back_button_form'); |
|
165 | 165 | |
166 | 166 | if (!is_object($GLOBALS['egw']->html)) |
167 | 167 | { |
168 | - $GLOBALS['egw']->html =& CreateObject('phpgwapi.html'); |
|
168 | + $GLOBALS['egw']->html = & CreateObject('phpgwapi.html'); |
|
169 | 169 | } |
170 | 170 | $html = &$GLOBALS['egw']->html; |
171 | - $year_form = str_replace('<option value=""></option>','',$html->form($html->sbox_submit($this->sb->getYears('year',$this->bo->year),true),array(), |
|
172 | - $this->base_url,Array('menuaction'=>'calendar.uiholiday.edit_locale','locale'=>$this->bo->locales[0]))); |
|
171 | + $year_form = str_replace('<option value=""></option>', '', $html->form($html->sbox_submit($this->sb->getYears('year', $this->bo->year), true), array(), |
|
172 | + $this->base_url, Array('menuaction'=>'calendar.uiholiday.edit_locale', 'locale'=>$this->bo->locales[0]))); |
|
173 | 173 | unset($html); |
174 | 174 | |
175 | 175 | $holidays = $this->bo->get_holiday_list(); |
@@ -177,13 +177,13 @@ discard block |
||
177 | 177 | |
178 | 178 | $var = Array( |
179 | 179 | 'th_bg' => $GLOBALS['egw_info']['theme']['th_bg'], |
180 | - 'left_next_matchs' => $GLOBALS['egw']->nextmatchs->left('/index.php',$this->bo->start,$total,'&menuaction=calendar.uiholiday.edit_locale&locale='.$this->bo->locales[0].'&year='.$this->bo->year), |
|
181 | - 'right_next_matchs' => $GLOBALS['egw']->nextmatchs->right('/index.php',$this->bo->start,$total,'&menuaction=calendar.uiholiday.edit_locale&locale='.$this->bo->locales[0].'&year='.$this->bo->year), |
|
180 | + 'left_next_matchs' => $GLOBALS['egw']->nextmatchs->left('/index.php', $this->bo->start, $total, '&menuaction=calendar.uiholiday.edit_locale&locale='.$this->bo->locales[0].'&year='.$this->bo->year), |
|
181 | + 'right_next_matchs' => $GLOBALS['egw']->nextmatchs->right('/index.php', $this->bo->start, $total, '&menuaction=calendar.uiholiday.edit_locale&locale='.$this->bo->locales[0].'&year='.$this->bo->year), |
|
182 | 182 | 'center' => '<td align="right">'.lang('Holidays').' ('.$this->bo->locales[0].')</td><td align="left">'.$year_form.'</td>', |
183 | - 'sort_name' => $GLOBALS['egw']->nextmatchs->show_sort_order($this->bo->sort,'hol_name',$this->bo->order,'/index.php',lang('Holiday'),'&menuaction=calendar.uiholiday.edit_locale&locale='.$this->bo->locales[0].'&year='.$this->bo->year), |
|
183 | + 'sort_name' => $GLOBALS['egw']->nextmatchs->show_sort_order($this->bo->sort, 'hol_name', $this->bo->order, '/index.php', lang('Holiday'), '&menuaction=calendar.uiholiday.edit_locale&locale='.$this->bo->locales[0].'&year='.$this->bo->year), |
|
184 | 184 | 'header_edit' => lang('Edit'), |
185 | 185 | 'header_delete' => lang('Delete'), |
186 | - 'header_rule' => '<td>'.$GLOBALS['egw']->nextmatchs->show_sort_order($this->bo->sort,'hol_month_num,hol_mday',$this->bo->order,'/index.php',lang('Rule'),'&menuaction=calendar.uiholiday.edit_locale&locale='.$this->bo->locales[0].'&year='.$this->bo->year).'</td>', |
|
186 | + 'header_rule' => '<td>'.$GLOBALS['egw']->nextmatchs->show_sort_order($this->bo->sort, 'hol_month_num,hol_mday', $this->bo->order, '/index.php', lang('Rule'), '&menuaction=calendar.uiholiday.edit_locale&locale='.$this->bo->locales[0].'&year='.$this->bo->year).'</td>', |
|
187 | 187 | 'header_extra' => lang('Copy'), |
188 | 188 | 'extra_width' => 'width="5%"' |
189 | 189 | ); |
@@ -192,16 +192,16 @@ discard block |
||
192 | 192 | |
193 | 193 | if (!count($holidays)) |
194 | 194 | { |
195 | - $p->set_var('total',lang('no matches found')); |
|
195 | + $p->set_var('total', lang('no matches found')); |
|
196 | 196 | //$p->parse('rows','row_empty',True); |
197 | 197 | } |
198 | 198 | else |
199 | 199 | { |
200 | 200 | $maxmatchs = $GLOBALS['egw_info']['user']['preferences']['common']['maxmatchs']; |
201 | - $end = min($total,$this->bo->start+$maxmatchs); |
|
202 | - $p->set_var('total',lang('showing %1 - %2 of %3',1+$this->bo->start,$end,$total)); |
|
201 | + $end = min($total, $this->bo->start + $maxmatchs); |
|
202 | + $p->set_var('total', lang('showing %1 - %2 of %3', 1 + $this->bo->start, $end, $total)); |
|
203 | 203 | //$p->parse('rows','row_empty',True); |
204 | - for($i=$this->bo->start; $i < $end; $i++) |
|
204 | + for ($i = $this->bo->start; $i < $end; $i++) |
|
205 | 205 | { |
206 | 206 | $tr_color = $GLOBALS['egw']->nextmatchs->alternate_row_color($tr_color); |
207 | 207 | if (!$holidays[$i]['name']) |
@@ -214,32 +214,32 @@ discard block |
||
214 | 214 | 'header_delete'=> lang('Delete'), |
215 | 215 | 'group_name' => $holidays[$i]['name'], |
216 | 216 | 'rule' => '<td>'.$this->bo->rule_string($holidays[$i]).'</td>', |
217 | - 'edit_link' => '<a href="'.$GLOBALS['egw']->link($this->base_url,Array('menuaction'=>'calendar.uiholiday.edit_holiday','locale'=>$this->bo->locales[0],'id'=>$holidays[$i]['index'],'year'=>$this->bo->year)).'"> '.lang('Edit').' </a>', |
|
218 | - 'extra_link' => '<a href="'.$GLOBALS['egw']->link($this->base_url,Array('menuaction'=>'calendar.uiholiday.copy_holiday','locale'=>$this->bo->locales[0],'id'=>$holidays[$i]['index'],'year'=>$this->bo->year)).'"> '.lang('Copy').' </a>', |
|
219 | - 'delete_link' => '<a href="'.$GLOBALS['egw']->link($this->base_url,Array('menuaction'=>'calendar.uiholiday.delete_holiday','locale'=>$this->bo->locales[0],'id'=>$holidays[$i]['index'],'year'=>$this->bo->year)).'"> '.lang('Delete').' </a>' |
|
217 | + 'edit_link' => '<a href="'.$GLOBALS['egw']->link($this->base_url, Array('menuaction'=>'calendar.uiholiday.edit_holiday', 'locale'=>$this->bo->locales[0], 'id'=>$holidays[$i]['index'], 'year'=>$this->bo->year)).'"> '.lang('Edit').' </a>', |
|
218 | + 'extra_link' => '<a href="'.$GLOBALS['egw']->link($this->base_url, Array('menuaction'=>'calendar.uiholiday.copy_holiday', 'locale'=>$this->bo->locales[0], 'id'=>$holidays[$i]['index'], 'year'=>$this->bo->year)).'"> '.lang('Copy').' </a>', |
|
219 | + 'delete_link' => '<a href="'.$GLOBALS['egw']->link($this->base_url, Array('menuaction'=>'calendar.uiholiday.delete_holiday', 'locale'=>$this->bo->locales[0], 'id'=>$holidays[$i]['index'], 'year'=>$this->bo->year)).'"> '.lang('Delete').' </a>' |
|
220 | 220 | ); |
221 | 221 | |
222 | 222 | $p->set_var($var); |
223 | - $p->parse('rows','row',True); |
|
223 | + $p->parse('rows', 'row', True); |
|
224 | 224 | } |
225 | 225 | } |
226 | 226 | |
227 | 227 | $var = Array( |
228 | - 'new_action' => $GLOBALS['egw']->link($this->base_url,Array('menuaction'=>'calendar.uiholiday.edit_holiday','locale'=>$this->bo->locales[0],'id'=>0,'year'=>$this->bo->year)), |
|
228 | + 'new_action' => $GLOBALS['egw']->link($this->base_url, Array('menuaction'=>'calendar.uiholiday.edit_holiday', 'locale'=>$this->bo->locales[0], 'id'=>0, 'year'=>$this->bo->year)), |
|
229 | 229 | 'lang_add' => lang('add'), |
230 | - 'back_action' => $GLOBALS['egw']->link($this->base_url,Array('menuaction'=>'calendar.uiholiday.admin')), |
|
230 | + 'back_action' => $GLOBALS['egw']->link($this->base_url, Array('menuaction'=>'calendar.uiholiday.admin')), |
|
231 | 231 | 'lang_back' => lang('Back'), |
232 | - 'search_action'=> $GLOBALS['egw']->link($this->base_url,Array('menuaction'=>'calendar.uiholiday.edit_locale','locale'=>$this->bo->locales[0],'year'=>$this->bo->year)), |
|
232 | + 'search_action'=> $GLOBALS['egw']->link($this->base_url, Array('menuaction'=>'calendar.uiholiday.edit_locale', 'locale'=>$this->bo->locales[0], 'year'=>$this->bo->year)), |
|
233 | 233 | 'lang_search' => lang('search') |
234 | 234 | ); |
235 | 235 | $p->set_var($var); |
236 | - $p->parse('back_button','back_button_form',False); |
|
237 | - $p->pparse('out','list'); |
|
236 | + $p->parse('back_button', 'back_button_form', False); |
|
237 | + $p->pparse('out', 'list'); |
|
238 | 238 | } |
239 | 239 | |
240 | 240 | function copy_holiday() |
241 | 241 | { |
242 | - if(@$this->bo->id) |
|
242 | + if (@$this->bo->id) |
|
243 | 243 | { |
244 | 244 | $holiday = $this->bo->read_entry($this->bo->id); |
245 | 245 | } |
@@ -249,12 +249,12 @@ discard block |
||
249 | 249 | { |
250 | 250 | $holiday['occurence'] = date('Y'); |
251 | 251 | } |
252 | - $this->edit_holiday('',$holiday); |
|
252 | + $this->edit_holiday('', $holiday); |
|
253 | 253 | } |
254 | 254 | |
255 | - function edit_holiday($error='',$holiday='') |
|
255 | + function edit_holiday($error = '', $holiday = '') |
|
256 | 256 | { |
257 | - if(@$this->bo->id && !$holiday) |
|
257 | + if (@$this->bo->id && !$holiday) |
|
258 | 258 | { |
259 | 259 | $holiday = $this->bo->read_entry($this->bo->id); |
260 | 260 | } |
@@ -269,9 +269,9 @@ discard block |
||
269 | 269 | common::egw_header(); |
270 | 270 | |
271 | 271 | $t = &$GLOBALS['egw']->template; |
272 | - $t->set_file(Array('holiday'=>'holiday.tpl','form_button'=>'form_button_script.tpl')); |
|
273 | - $t->set_block('holiday','form','form'); |
|
274 | - $t->set_block('holiday','list','list'); |
|
272 | + $t->set_file(Array('holiday'=>'holiday.tpl', 'form_button'=>'form_button_script.tpl')); |
|
273 | + $t->set_block('holiday', 'form', 'form'); |
|
274 | + $t->set_block('holiday', 'list', 'list'); |
|
275 | 275 | |
276 | 276 | if (@count($error)) |
277 | 277 | { |
@@ -285,20 +285,20 @@ discard block |
||
285 | 285 | $var = Array( |
286 | 286 | 'title_holiday' => ($this->bo->id ? lang('Edit') : lang('Add')).' '.lang('Holiday'), |
287 | 287 | 'message' => $message, |
288 | - 'actionurl' => $GLOBALS['egw']->link($this->base_url,'menuaction=calendar.boholiday.add&year='.$this->bo->year), |
|
288 | + 'actionurl' => $GLOBALS['egw']->link($this->base_url, 'menuaction=calendar.boholiday.add&year='.$this->bo->year), |
|
289 | 289 | 'hidden_vars' => '<input type="hidden" name="holiday[hol_id]" value="'.$this->bo->id.'">'."\n" |
290 | 290 | . '<input type="hidden" name="holiday[locales]" value="'.$this->bo->locales[0].'">'."\n" |
291 | 291 | ); |
292 | 292 | $t->set_var($var); |
293 | 293 | |
294 | 294 | // Locale |
295 | - $this->display_item($t,lang('Country'),$this->sb->form_select($holiday['locale'],'holiday[locale]')); |
|
295 | + $this->display_item($t, lang('Country'), $this->sb->form_select($holiday['locale'], 'holiday[locale]')); |
|
296 | 296 | |
297 | 297 | // Title/Name |
298 | - $this->display_item($t,lang('title'),'<input name="holiday[name]" size="60" maxlength="50" value="'.$holiday['name'].'">'); |
|
298 | + $this->display_item($t, lang('title'), '<input name="holiday[name]" size="60" maxlength="50" value="'.$holiday['name'].'">'); |
|
299 | 299 | |
300 | 300 | // Date |
301 | - $this->display_item($t,lang('Date'),common::dateformatorder($this->sb->getYears('holiday[year]',$holiday['occurence']>1900?$holiday['occurence']:0),$this->sb->getMonthText('holiday[month_num]',$holiday['month']),$this->sb->getDays('holiday[mday]',$holiday['day'])). |
|
301 | + $this->display_item($t, lang('Date'), common::dateformatorder($this->sb->getYears('holiday[year]', $holiday['occurence'] > 1900 ? $holiday['occurence'] : 0), $this->sb->getMonthText('holiday[month_num]', $holiday['month']), $this->sb->getDays('holiday[mday]', $holiday['day'])). |
|
302 | 302 | ' '.lang('Set a Year only for one-time / non-regular holidays.')); |
303 | 303 | |
304 | 304 | // Occurence |
@@ -312,9 +312,9 @@ discard block |
||
312 | 312 | 99 => lang('Last') |
313 | 313 | ); |
314 | 314 | $out = ''; |
315 | - while(list($key,$value) = each($occur)) |
|
315 | + while (list($key, $value) = each($occur)) |
|
316 | 316 | { |
317 | - $out .= '<option value="'.$key.'"'.($holiday['occurence']==$key?' selected':'').'>'.$value.'</option>'."\n"; |
|
317 | + $out .= '<option value="'.$key.'"'.($holiday['occurence'] == $key ? ' selected' : '').'>'.$value.'</option>'."\n"; |
|
318 | 318 | } |
319 | 319 | $occurence_html = '<select name="holiday[occurence]">'."\n".$out.'</select>'."\n"; |
320 | 320 | |
@@ -328,20 +328,20 @@ discard block |
||
328 | 328 | 6 => lang('Sat') |
329 | 329 | ); |
330 | 330 | $out = ''; |
331 | - for($i=0;$i<7;$i++) |
|
331 | + for ($i = 0; $i < 7; $i++) |
|
332 | 332 | { |
333 | - $out .= '<option value="'.$i.'"'.($holiday['dow']==$i?' selected':'').'>'.$dow[$i].'</option>'."\n"; |
|
333 | + $out .= '<option value="'.$i.'"'.($holiday['dow'] == $i ? ' selected' : '').'>'.$dow[$i].'</option>'."\n"; |
|
334 | 334 | } |
335 | 335 | $dow_html = '<select name="holiday[dow]">'."\n".$out.'</select>'."\n"; |
336 | - $this->display_item($t,lang('Occurence'),$occurence_html.' '.$dow_html. |
|
336 | + $this->display_item($t, lang('Occurence'), $occurence_html.' '.$dow_html. |
|
337 | 337 | ' '.lang('You can either set a Year or a Occurence, not both !!!')); |
338 | - $this->display_item($t,lang('Observance Rule'),'<input type="checkbox" name="holiday[observance_rule]" value="True"'.($holiday['observance_rule']?' checked':'').'>'. |
|
338 | + $this->display_item($t, lang('Observance Rule'), '<input type="checkbox" name="holiday[observance_rule]" value="True"'.($holiday['observance_rule'] ? ' checked' : '').'>'. |
|
339 | 339 | ' '.lang('If checked holidays falling on a weekend, are taken on the monday after.')); |
340 | 340 | |
341 | - $t->set_var('lang_add',lang('Save')); |
|
342 | - $t->set_var('lang_reset',lang('Reset')); |
|
341 | + $t->set_var('lang_add', lang('Save')); |
|
342 | + $t->set_var('lang_reset', lang('Reset')); |
|
343 | 343 | |
344 | - if(@$this->bo->locales[0]) |
|
344 | + if (@$this->bo->locales[0]) |
|
345 | 345 | { |
346 | 346 | $link_params = Array( |
347 | 347 | 'menuaction' => 'calendar.uiholiday.edit_locale', |
@@ -357,12 +357,12 @@ discard block |
||
357 | 357 | } |
358 | 358 | |
359 | 359 | $t->set_var(Array( |
360 | - 'action_url_button' => $GLOBALS['egw']->link($this->base_url,$link_params), |
|
360 | + 'action_url_button' => $GLOBALS['egw']->link($this->base_url, $link_params), |
|
361 | 361 | 'action_text_button' => lang('Cancel'), |
362 | 362 | 'action_confirm_button' => '', |
363 | 363 | 'action_extra_field' => '' |
364 | 364 | )); |
365 | - $t->parse('cancel_button','form_button'); |
|
365 | + $t->parse('cancel_button', 'form_button'); |
|
366 | 366 | |
367 | 367 | if ($this->bo->id) |
368 | 368 | { |
@@ -373,18 +373,18 @@ discard block |
||
373 | 373 | 'id' => $this->bo->id |
374 | 374 | ); |
375 | 375 | $t->set_var(Array( |
376 | - 'action_url_button' => $GLOBALS['egw']->link($this->base_url,$link_params), |
|
376 | + 'action_url_button' => $GLOBALS['egw']->link($this->base_url, $link_params), |
|
377 | 377 | 'action_text_button' => lang('Delete'), |
378 | 378 | 'action_confirm_button' => '', |
379 | 379 | 'action_extra_field' => '' |
380 | 380 | )); |
381 | - $t->parse('delete_button','form_button'); |
|
381 | + $t->parse('delete_button', 'form_button'); |
|
382 | 382 | } |
383 | 383 | else |
384 | 384 | { |
385 | - $t->set_var('delete_button',' '); |
|
385 | + $t->set_var('delete_button', ' '); |
|
386 | 386 | } |
387 | - $t->pparse('out','form'); |
|
387 | + $t->pparse('out', 'form'); |
|
388 | 388 | } |
389 | 389 | |
390 | 390 | |
@@ -392,37 +392,37 @@ discard block |
||
392 | 392 | { |
393 | 393 | $this->admin(); |
394 | 394 | |
395 | - $p =& CreateObject('phpgwapi.Template',$this->template_dir); |
|
396 | - $p->set_file(Array('form'=>'delete_common.tpl','form_button'=>'form_button_script.tpl')); |
|
395 | + $p = & CreateObject('phpgwapi.Template', $this->template_dir); |
|
396 | + $p->set_file(Array('form'=>'delete_common.tpl', 'form_button'=>'form_button_script.tpl')); |
|
397 | 397 | |
398 | - $p->set_var('messages',lang('Are you sure you want to delete this Country ?')."<br>".$this->bo->locales[0]); |
|
398 | + $p->set_var('messages', lang('Are you sure you want to delete this Country ?')."<br>".$this->bo->locales[0]); |
|
399 | 399 | |
400 | 400 | $var = Array( |
401 | - 'action_url_button' => $GLOBALS['egw']->link($this->base_url,Array('menuaction'=>'calendar.uiholiday.admin')), |
|
401 | + 'action_url_button' => $GLOBALS['egw']->link($this->base_url, Array('menuaction'=>'calendar.uiholiday.admin')), |
|
402 | 402 | 'action_text_button' => lang('No'), |
403 | 403 | 'action_confirm_button' => '', |
404 | 404 | 'action_extra_field' => '' |
405 | 405 | ); |
406 | 406 | $p->set_var($var); |
407 | - $p->parse('no','form_button'); |
|
407 | + $p->parse('no', 'form_button'); |
|
408 | 408 | |
409 | 409 | $var = Array( |
410 | - 'action_url_button' => $GLOBALS['egw']->link($this->base_url,Array('menuaction'=>'calendar.boholiday.delete_locale','locale'=>$this->bo->locales[0])), |
|
410 | + 'action_url_button' => $GLOBALS['egw']->link($this->base_url, Array('menuaction'=>'calendar.boholiday.delete_locale', 'locale'=>$this->bo->locales[0])), |
|
411 | 411 | 'action_text_button' => lang('Yes'), |
412 | 412 | 'action_confirm_button' => '', |
413 | 413 | 'action_extra_field' => '' |
414 | 414 | ); |
415 | 415 | $p->set_var($var); |
416 | - $p->parse('yes','form_button'); |
|
416 | + $p->parse('yes', 'form_button'); |
|
417 | 417 | |
418 | - $p->pparse('out','form'); |
|
418 | + $p->pparse('out', 'form'); |
|
419 | 419 | } |
420 | 420 | |
421 | 421 | function delete_holiday() |
422 | 422 | { |
423 | 423 | $holiday = $this->bo->read_entry($this->bo->id); |
424 | 424 | |
425 | - if(!$holiday) |
|
425 | + if (!$holiday) |
|
426 | 426 | { |
427 | 427 | return $this->edit_locale(); |
428 | 428 | } |
@@ -432,39 +432,39 @@ discard block |
||
432 | 432 | $GLOBALS['egw_info']['flags']['noappfooter'] = True; |
433 | 433 | common::egw_header(); |
434 | 434 | |
435 | - $p =& CreateObject('phpgwapi.Template',$this->template_dir); |
|
436 | - $p->set_file(Array('form'=>'delete_common.tpl','form_button'=>'form_button_script.tpl')); |
|
435 | + $p = & CreateObject('phpgwapi.Template', $this->template_dir); |
|
436 | + $p->set_file(Array('form'=>'delete_common.tpl', 'form_button'=>'form_button_script.tpl')); |
|
437 | 437 | |
438 | - $p->set_var('messages',lang('Are you sure you want to delete this holiday ?')."<br>".$holiday['name'].' ('.$this->bo->locales[0].') '.$this->bo->rule_string($holiday)); |
|
438 | + $p->set_var('messages', lang('Are you sure you want to delete this holiday ?')."<br>".$holiday['name'].' ('.$this->bo->locales[0].') '.$this->bo->rule_string($holiday)); |
|
439 | 439 | |
440 | 440 | $var = Array( |
441 | - 'action_url_button' => $GLOBALS['egw']->link($this->base_url,Array('menuaction'=>'calendar.uiholiday.edit_locale','locale'=>$this->bo->locales[0],'year'=>$this->bo->year)), |
|
441 | + 'action_url_button' => $GLOBALS['egw']->link($this->base_url, Array('menuaction'=>'calendar.uiholiday.edit_locale', 'locale'=>$this->bo->locales[0], 'year'=>$this->bo->year)), |
|
442 | 442 | 'action_text_button' => lang('No'), |
443 | 443 | 'action_confirm_button' => '', |
444 | 444 | 'action_extra_field' => '' |
445 | 445 | ); |
446 | 446 | $p->set_var($var); |
447 | - $p->parse('no','form_button'); |
|
447 | + $p->parse('no', 'form_button'); |
|
448 | 448 | |
449 | 449 | $var = Array( |
450 | - 'action_url_button' => $GLOBALS['egw']->link($this->base_url,Array('menuaction'=>'calendar.boholiday.delete_holiday','locale'=>$this->bo->locales[0],'id'=>$this->bo->id,'year'=>$this->bo->year)), |
|
450 | + 'action_url_button' => $GLOBALS['egw']->link($this->base_url, Array('menuaction'=>'calendar.boholiday.delete_holiday', 'locale'=>$this->bo->locales[0], 'id'=>$this->bo->id, 'year'=>$this->bo->year)), |
|
451 | 451 | 'action_text_button' => lang('Yes'), |
452 | 452 | 'action_confirm_button' => '', |
453 | 453 | 'action_extra_field' => '' |
454 | 454 | ); |
455 | 455 | $p->set_var($var); |
456 | - $p->parse('yes','form_button'); |
|
456 | + $p->parse('yes', 'form_button'); |
|
457 | 457 | |
458 | - $p->pparse('out','form'); |
|
458 | + $p->pparse('out', 'form'); |
|
459 | 459 | } |
460 | 460 | |
461 | 461 | function submit() |
462 | 462 | { |
463 | - if(!@$this->bo->locales[0]) |
|
463 | + if (!@$this->bo->locales[0]) |
|
464 | 464 | { |
465 | 465 | return $this->admin(); |
466 | 466 | } |
467 | - $this->bo->year = 0; // for a complete list with all years |
|
467 | + $this->bo->year = 0; // for a complete list with all years |
|
468 | 468 | $holidays = $this->bo->get_holiday_list(); |
469 | 469 | |
470 | 470 | if (!is_array($holidays) || !count($holidays)) |
@@ -472,16 +472,16 @@ discard block |
||
472 | 472 | $this->admin(); |
473 | 473 | } |
474 | 474 | // sort holidays by year / occurence: |
475 | - usort($holidays,'_holiday_cmp'); |
|
475 | + usort($holidays, '_holiday_cmp'); |
|
476 | 476 | |
477 | 477 | if (isset($_GET['download'])) |
478 | 478 | { |
479 | 479 | $locale = $this->bo->locales[0]; |
480 | - html::content_header("holidays.$locale.csv",'text/text'); |
|
480 | + html::content_header("holidays.$locale.csv", 'text/text'); |
|
481 | 481 | |
482 | 482 | echo "charset\t".translation::charset()."\n"; |
483 | 483 | $last_year = -1; |
484 | - foreach($holidays as $holiday) |
|
484 | + foreach ($holidays as $holiday) |
|
485 | 485 | { |
486 | 486 | $year = $holiday['occurence'] <= 0 ? 0 : $holiday['occurence']; |
487 | 487 | if ($year != $last_year) |
@@ -493,7 +493,7 @@ discard block |
||
493 | 493 | } |
494 | 494 | common::egw_exit(); |
495 | 495 | } |
496 | - if($this->debug) |
|
496 | + if ($this->debug) |
|
497 | 497 | { |
498 | 498 | $action = $GLOBALS['egw']->link('/calendar/egroupware.org/accept_holiday.php'); |
499 | 499 | } |
@@ -511,7 +511,7 @@ discard block |
||
511 | 511 | |
512 | 512 | echo '<input type="hidden" name="locale" value="'.$this->bo->locales[0].'">'."\n"; |
513 | 513 | echo '<input type="hidden" name="charset" value="'.translation::charset().'">'."\n"; |
514 | - foreach($holidays as $holiday) |
|
514 | + foreach ($holidays as $holiday) |
|
515 | 515 | { |
516 | 516 | echo '<input type="hidden" name="name[]" value="'.htmlspecialchars($holiday['name']).'">'."\n" |
517 | 517 | . '<input type="hidden" name="day[]" value="'.$holiday['day'].'">'."\n" |
@@ -524,7 +524,7 @@ discard block |
||
524 | 524 | } |
525 | 525 | |
526 | 526 | /* private functions */ |
527 | - function display_item(&$p,$field,$data) |
|
527 | + function display_item(&$p, $field, $data) |
|
528 | 528 | { |
529 | 529 | $var = Array( |
530 | 530 | 'tr_color' => $GLOBALS['egw']->nextmatchs->alternate_row_color(), |
@@ -532,7 +532,7 @@ discard block |
||
532 | 532 | 'data' => $data |
533 | 533 | ); |
534 | 534 | $p->set_var($var); |
535 | - $p->parse('rows','list',True); |
|
535 | + $p->parse('rows', 'list', True); |
|
536 | 536 | } |
537 | 537 | } |
538 | 538 | ?> |