Esempio n. 1
0
 public function getOverviewContent($echo = true)
 {
     $time = mktime(0, 0, 1);
     $Datum = new Datum($time);
     $Datum->addMonth();
     $lastTime = $Datum->time();
     $Datum->subMonth();
     $Woche = date("W");
     $K = $this->getData($time, $lastTime);
     $hasEvent = array();
     $html = "<div class=\"touchHeader\"><span class=\"lastUpdate\" id=\"lastUpdatemKalenderGUI\"></span><p>Kalender</p></div><div style=\"padding:10px;padding-left:0px;\">";
     $html .= "<div style=\"width:25px;float:left;margin-right:5px;color:grey;font-size:11px;\">%%SMALLCALCONTENT%%</div>";
     $html .= "<div style=\"border-bottom-width:1px;border-bottom-style:dashed;padding:3px;margin-left:30px;\" class=\"borderColor1\">Heute</div>";
     $list = new HTMLList();
     $list->addListStyle("list-style-type:none;margin-left:30px;");
     $events = $K->getEventsOnDay(date("dmY", $Datum->time()));
     if ($events != null and count($events) > 0) {
         foreach ($events as $ev) {
             foreach ($ev as $KE) {
                 $hasEvent[date("d", $K->parseDay($KE->getDay()))] = true;
                 $B = new Button("", $KE->icon(), "icon");
                 $B->style("float:left;margin-right:5px;margin-bottom:10px;");
                 $list->addItem("{$B}<b style=\"font-size:15px;\">" . $KE->title() . "</b><br /><small>" . Datum::getGerWeekArray(date("w", $K->parseDay($KE->getDay()))) . ", " . Util::CLDateParser($K->parseDay($KE->getDay())) . " " . Util::CLTimeParser($K->parseTime($KE->getTime())) . "</small>");
             }
         }
     }
     if (count($events) == 0) {
         $list->addItem("<span style=\"color:grey;\">Kein Eintrag</span>");
     }
     $html .= $list;
     $Datum->addDay();
     $html .= "<div style=\"border-bottom-width:1px;border-bottom-style:dashed;padding:3px;margin-top:15px;margin-left:30px;\" class=\"borderColor1\">Morgen</div>";
     $list = new HTMLList();
     $list->addListStyle("list-style-type:none;margin-left:30px;");
     $events = $K->getEventsOnDay(date("dmY", $Datum->time()));
     if ($events != null and count($events) > 0) {
         foreach ($events as $ev) {
             foreach ($ev as $KE) {
                 $hasEvent[date("d", $K->parseDay($KE->getDay()))] = true;
                 $B = new Button("", $KE->icon(), "icon");
                 $B->style("float:left;margin-right:5px;margin-bottom:10px;");
                 $list->addItem("{$B}<b style=\"font-size:15px;\">" . $KE->title() . "</b><br /><small>" . Datum::getGerWeekArray(date("w", $K->parseDay($KE->getDay()))) . ", " . Util::CLDateParser($K->parseDay($KE->getDay())) . " " . Util::CLTimeParser($K->parseTime($KE->getTime())) . "</small>");
             }
         }
     }
     if (count($events) == 0) {
         $list->addItem("<span style=\"color:grey;\">Kein Eintrag</span>");
     }
     $html .= $list;
     $Datum->addDay();
     $html .= "<div style=\"border-bottom-width:1px;border-bottom-style:dashed;padding:3px;margin-top:15px;margin-left:30px;\" class=\"borderColor1\">Später</div>";
     $list = new HTMLList();
     $list->addListStyle("list-style-type:none;margin-left:30px;");
     $c = 0;
     while ($Datum->time() < $lastTime) {
         $events = $K->getEventsOnDay(date("dmY", $Datum->time()));
         if ($events != null and count($events) > 0) {
             foreach ($events as $ev) {
                 foreach ($ev as $KE) {
                     $hasEvent[date("d", $K->parseDay($KE->getDay()))] = true;
                     $B = new Button("", $KE->icon(), "icon");
                     $B->style("float:left;margin-right:5px;margin-bottom:10px;");
                     $list->addItem("{$B}<b style=\"font-size:15px;\">" . $KE->title() . "</b><br /><small>" . Datum::getGerWeekArray(date("w", $K->parseDay($KE->getDay()))) . ", " . Util::CLDateParser($K->parseDay($KE->getDay())) . "</small>");
                     if (date("W", $K->parseDay($KE->getDay())) > $Woche + 1) {
                         $list->addItemStyle("color:grey;");
                     }
                     $c++;
                 }
             }
         }
         $Datum->addDay();
     }
     if ($c == 0) {
         $list->addItem("<span style=\"color:grey;\">Kein Eintrag</span>");
     }
     $html .= $list . "</div>";
     $smallCal = "";
     $DatumC = clone $Datum;
     for ($i = 0; $i < 14; $i++) {
         $smallCal .= "<div style=\"padding:5px;text-align:right;" . (isset($hasEvent[date("d", $DatumC->time())]) ? "color:black;" : "") . "\" " . (isset($hasEvent[date("d", $DatumC->time())]) ? "class=\"backgroundColor3\"" : "") . "\">" . date("d", $DatumC->time()) . "</div>";
         $DatumC->addDay();
     }
     $html = str_replace("%%SMALLCALCONTENT%%", $smallCal, $html);
     if ($echo) {
         echo $html;
     }
     return $html;
 }
Esempio n. 2
0
 function __construct()
 {
     if ($this->ansicht == null) {
         $this->ansicht = "monat";
     }
     $display = mUserdata::getUDValueS("KalenderDisplay" . ucfirst($this->ansicht), "0");
     switch ($this->ansicht) {
         case "jahr":
             $Date = new Datum(Datum::parseGerDate("1.1." . date("Y")));
             for ($i = 0; $i < abs($display); $i++) {
                 if ($display > 0) {
                     $Date->addYear();
                 } else {
                     $Date->subYear();
                 }
             }
             break;
         case "monat":
             $Date = new Datum(Datum::parseGerDate("1." . date("m.Y")));
             for ($i = 0; $i < abs($display); $i++) {
                 if ($display > 0) {
                     $Date->addMonth();
                 } else {
                     $Date->subMonth();
                 }
             }
             break;
         case "woche":
             $Date = new Datum(Datum::parseGerDate(date("d.m.Y")));
             for ($i = 0; $i < abs($display); $i++) {
                 if ($display > 0) {
                     $Date->addWeek(true);
                 } else {
                     $Date->subWeek();
                 }
             }
             break;
         case "tag":
             $Date = new Datum(Datum::parseGerDate(date("d.m.Y")));
             for ($i = 0; $i < abs($display); $i++) {
                 if ($display > 0) {
                     $Date->addDay();
                 } else {
                     $Date->subDay();
                 }
             }
             break;
     }
     $this->current = clone $Date;
     if ($this->ansicht != "tag" and $this->ansicht != "jahr") {
         while (date("w", $Date->time()) > 1) {
             $Date->subDay();
         }
         if (date("w", $Date->time()) == 0) {
             $Date->addDay();
         }
     }
     $this->date = $Date;
     $this->first = $Date->time();
     $D = clone $Date;
     $rows = 5;
     if ($this->ansicht == "woche") {
         $rows = 1;
     }
     $cols = 7;
     if ($this->ansicht == "tag") {
         $cols = 1;
         $rows = 1;
     }
     if ($this->ansicht == "jahr") {
         $cols = 31;
         $rows = 12;
     }
     if ($this->ansicht != "jahr") {
         for ($i = 0; $i < $rows; $i++) {
             if ($i > 0 and date("m.Y", $D->time()) != date("m.Y", $this->current->time())) {
                 break;
             }
             for ($j = 0; $j < 7; $j++) {
                 $D->addDay();
             }
         }
         $D->subDay();
     }
     if ($this->ansicht == "jahr") {
         $D->addYear();
         $D->subDay();
     }
     $this->rows = $rows;
     $this->cols = $cols;
     $this->last = $D->time();
 }