Example #1
0
 function getDayViewHTML($time = null)
 {
     if ($this->exception !== false and $this->exception[1] == "1") {
         return "";
     }
     if (self::$displayNr > count(self::$bgColors) - 1) {
         self::$displayNr = 0;
     }
     $B = "";
     if ($this->icon != null) {
         $B = new Button("", $this->icon, "icon");
         $B->style("margin-top:-4px;margin-left:-2px;");
     }
     $this->onClick = str_replace(array("%%CLASSNAME%%", "%%CLASSID%%", "%%TIME%%"), array($this->className, $this->classID, $time != null ? $time : ""), $this->onClick);
     $startTime = Kalender::parseDay($this->day) - 60 + Kalender::parseTime($this->time);
     $endTime = Kalender::parseDay($this->currentWhen->endDay) - 60 + Kalender::parseTime($this->endTime);
     if ($endTime > $time + 24 * 3600 or $this->allDay) {
         //OK
         $endTime = $time + 24 * 3600 - 61;
     }
     if ($startTime < $time) {
         $startTime = $time - 60 + Kalender::parseTime($this->time);
     }
     if (self::$colsStack == null) {
         self::$colsStack = array(array(), array(), array(), array());
     }
     $useCol = null;
     for ($i = 0; $i < count(self::$colsStack); $i++) {
         if (!isset(self::$colsStack[$i][date("Hi", $startTime)])) {
             $useCol = $i;
             break;
         }
     }
     $minutes = $endTime - $startTime;
     if ($minutes < 30 * 60) {
         $minutes = 30 * 60;
     }
     $i = 0;
     while ($i < $minutes) {
         self::$colsStack[$useCol][date("Hi", $startTime + $i)] = true;
         $i += 60;
     }
     $height = ceil(($endTime - $startTime) / 3600 * 40);
     if ($height < 20) {
         $height = 20;
     }
     $top = (substr($this->time, 0, 2) + substr($this->time, 2, 2) / 60) * 40;
     $left = 80 + $useCol * 210;
     if ($top + $height > 24 * 40) {
         $height = 24 * 40 - $top;
     }
     $grey = false;
     if ($this->owner != null and $this->owner != -1 and $this->owner != Session::currentUser()->getID()) {
         $grey = true;
     }
     if ($this->status == 2) {
         $grey = true;
     }
     #echo "$this->title: col $useCol; $left x $top<br />";
     return "\n\t\t\t<div onclick=\"{$this->onClick}\" style=\"background-color:" . ($grey ? "#DDD" : self::$bgColors[self::$displayNr++]) . ";position:absolute;top:{$top}px;left:{$left}px;padding:0px;cursor:pointer;height:" . $height . "px;margin-right:10px;width:200px;overflow:hidden;z-index:" . self::$z-- . ";\">\n\t\t\t\t<div style=\"padding:5px;\">\n\t\t\t\t\t<span style=\"float:left;margin-right:3px;\">\n\t\t\t\t\t\t{$B}\n\t\t\t\t\t</span>\n\t\t\t\t\n\t\t\t\t\t<!--<span style=\"display:none;\" id=\"time_{$this->className}{$this->classID}{$this->time}\">{$this->time}<br /></span>-->" . (!$this->allDay ? "<b>" . $this->formatTime($this->time) . "</b>&nbsp;" : "") . "{$this->title}\n\t\t\t\t</div>\n\t\t\t</div>";
 }