diff --git a/livesupport/modules/htmlUI/var/templates/scheduler/calendar.tpl b/livesupport/modules/htmlUI/var/templates/scheduler/calendar.tpl index f8668430a..91203588d 100755 --- a/livesupport/modules/htmlUI/var/templates/scheduler/calendar.tpl +++ b/livesupport/modules/htmlUI/var/templates/scheduler/calendar.tpl @@ -52,7 +52,12 @@ {else} <div style="background-color: white"> {/if} + {if $_Day.isScheduled} + <b><a href="#" onClick="hpopup('{$UI_HANDLER}?act=SCHEDULER.set&day={$_Day.day}&month={$_Day.month}&year={$_Day.year}')">{$_Day.day}</a></b> + {else} <a href="#" onClick="hpopup('{$UI_HANDLER}?act=SCHEDULER.set&day={$_Day.day}&month={$_Day.month}&year={$_Day.year}')">{$_Day.day}</a> + {/if} + </div> </td> {if $_Day.isLast} diff --git a/livesupport/modules/htmlUI/var/ui_calendar.class.php b/livesupport/modules/htmlUI/var/ui_calendar.class.php index d1dd09eb4..d0242835c 100755 --- a/livesupport/modules/htmlUI/var/ui_calendar.class.php +++ b/livesupport/modules/htmlUI/var/ui_calendar.class.php @@ -55,16 +55,19 @@ class uiCalendar $Month->build($selections); while ($Day = $Month->fetch()) { + $corrMonth = $Day->thisMonth()<=12 ? $this->Base->_twoDigits($Day->thisMonth()) : '01'; ## due to bug in + $corrYear = $Day->thisMonth()<=12 ? $Day->thisYear() : $Day->thisYear()+1; ## Calendar_Month_Weekdays $this->Month[] = array( 'day' => $this->Base->_twoDigits($Day->thisDay()), 'week' => $this->_getWeekNr($Day), - 'month' => $Day->thisMonth()<=12 ? $this->Base->_twoDigits($Day->thisMonth()) : '01', ## due to bug in - 'year' => $Day->thisMonth()<=12 ? $Day->thisYear() : $Day->thisYear()+1, ## Calendar_Month_Weekdays + 'month' => $corrMonth, + 'year' => $corrYear, 'label' => $this->_getDayName($Day), 'isEmpty' => $Day->isEmpty(), 'isFirst' => $Day->isFirst(), 'isLast' => $Day->isLast(), - 'isSelected' => $Day->isSelected() + 'isSelected' => $Day->isSelected(), + 'isScheduled' => $this->getDayUsagePercentage($corrYear, $corrMonth, $this->Base->_twoDigits($Day->thisDay())) ); } } diff --git a/livesupport/modules/htmlUI/var/ui_scheduler.class.php b/livesupport/modules/htmlUI/var/ui_scheduler.class.php index 41fcc64fd..a25ad6f59 100755 --- a/livesupport/modules/htmlUI/var/ui_scheduler.class.php +++ b/livesupport/modules/htmlUI/var/ui_scheduler.class.php @@ -71,16 +71,23 @@ class uiScheduler extends uiCalendar function getDayUsagePercentage($year, $month, $day) { - $duration = 0; + if (isset($this->_duration[$year.$month.$day])) + return $this->_duration[$year.$month.$day]; + + $this->_duration[$year.$month.$day] = 0; if (!$arr = $this->getDayUsage($year, $month, $day)) return false; foreach ($arr as $val) { - $duration =+ $this->_datetime2timestamp($val['end'])-$this->_datetime2timestamp($val['start']); + $this->_duration[$year.$month.$day] =+ ($this->_datetime2timestamp($val['end'])-$this->_datetime2timestamp($val['start']))/86400*100; } - return $duration/86400*100; + return $this->_duration[$year.$month.$day]; } + function getPeriodicUsage($start, $end) + { + + } function copyPlFromSP() {