public function test180TageInDerZunkunft()
 {
     $ohneJahr = date('d.m', time() + 181 * 24 * 3600);
     $richtigesJahr = date('Y');
     if (Datum::toDay()->month() < 7) {
         $richtigesJahr -= 1;
     }
     $datum = new Datum($ohneJahr);
     $this->assertEquals($ohneJahr . '.' . $richtigesJahr, $datum->format('d.m.Y'));
 }
 public function DateWithin(Datum $date)
 {
     if ($date->Before($this->start)) {
         return false;
     }
     if ($this->end !== null && $this->end->Before($date)) {
         return false;
     }
     return true;
 }
Esempio n. 3
0
 function __construct()
 {
     $this->dataFile = "chart";
     parent::__construct();
     $this->bps = BPS::getAllProperties("StatistikControllingGUI");
     $D1 = new Datum(time());
     $D1->setToJan1st(date("Y"));
     $D2 = new Datum(time());
     $D2->setToJan1st(date("Y") + 1);
     $D2->subDay();
     $this->startDatum = isset($this->bps["start"]) ? $this->bps["start"] : Util::CLFormatDate($D1->time());
     $this->endDatum = isset($this->bps["ende"]) ? $this->bps["ende"] : Util::CLFormatDate($D2->time());
     $this->mK = null;
 }
 public function testConstructor()
 {
     $event = new Event(1, 'name', 'Datum oder Datumsbereich', new Datumsbereich(Datum::toDay(), Datum::toDay()->dateAdd(7)), "Location", 'email1@mail.de;email2@mail.de', 7);
     $this->assertEquals(1, $event->id);
     $this->assertEquals('name', $event->name);
     $this->assertEquals('Datum oder Datumsbereich', $event->datum);
     $this->assertEquals(new Datumsbereich(Datum::toDay(), Datum::toDay()->dateAdd(7)), $event->aktiv);
     $this->assertEquals('Location', $event->ort);
     $this->assertEquals('email1@mail.de;email2@mail.de', $event->informieren);
     $this->assertEquals(7, $event->formularId);
     $this->assertEquals('name', $event->__toString());
 }
Esempio n. 5
0
 function when($startDay, $endDay)
 {
     $when = array();
     $start = Kalender::parseDay($this->firstDay);
     $end = Kalender::parseDay($this->lastDay);
     $D = new Datum($start);
     if ($this->callbackOnShow !== null) {
         $ex = explode("::", $this->callbackOnShow);
     }
     while ($D->time() <= $end) {
         $W = new stdClass();
         $W->day = Kalender::formatDay($D->time());
         $W->time = "0800";
         $cb = true;
         if ($this->callbackOnShow !== null) {
             $cb = Util::invokeStaticMethod($ex[0], $ex[1], array($this, $D, $W));
         }
         if ($cb) {
             $when[] = $W;
         }
         $D->addDay();
     }
     return $when;
 }
Esempio n. 6
0
 public function hasMultiDayEvents($firstDay, $lastDay)
 {
     #echo date("dmY", $firstDay).";".$lastDay;
     $return = 0;
     $counted = array();
     $stack = array();
     foreach ($this->events as $D) {
         foreach ($D as $T) {
             foreach ($T as $E) {
                 if ($E->getDay() != $E->getEndDay() or $E->allDay()) {
                     # AND !isset($counted[$E->ownerClass().$E->ownerClassID()])){
                     $stackCalcFirst = Kalender::parseDay($E->currentWhen()->day);
                     #$E->getDay()
                     $stackCalcLast = Kalender::parseDay($E->currentWhen()->endDay);
                     if ($stackCalcFirst < $firstDay and $stackCalcLast < $firstDay) {
                         continue;
                     }
                     #echo $E->title()." (".$E->ownerClassID()."): ".$E->getDay()."/".$E->currentWhen()->day."<br />";
                     #if($stackCalcFirst > $lastDay)
                     #	continue;
                     #$return++;
                     #$counted[$E->ownerClass().$E->ownerClassID()] = true;
                     #echo "::".$E->currentWhen()->day."<br />";
                     if ($stackCalcLast > $lastDay) {
                         $stackCalcLast = $lastDay;
                     }
                     if ($stackCalcFirst < $firstDay) {
                         $stackCalcFirst = $firstDay;
                     }
                     $D = new Datum($stackCalcFirst);
                     while ($D->time() <= $stackCalcLast) {
                         if (!isset($stack[date("Ymd", $D->time())])) {
                             $stack[date("Ymd", $D->time())] = array();
                         }
                         if (in_array($E->ownerClass() . $E->ownerClassID(), $stack[date("Ymd", $D->time())])) {
                             $D->addDay();
                             continue;
                         }
                         $stack[date("Ymd", $D->time())][] = $E->ownerClass() . $E->ownerClassID();
                         $D->addDay();
                     }
                 }
             }
         }
     }
     $max = 0;
     foreach ($stack as $ev) {
         if (count($ev) > $max) {
             $max = count($ev);
         }
     }
     #echo "<pre style=\"font-size:10px;\">";
     #print_r($stack);
     #echo "</pre>";
     return $max;
 }
Esempio n. 7
0
 function getDatabaseWaarde()
 {
     try {
         global $pdo;
         $query = "\n\t\t\tSELECT \n\t\t\t\tvoornaam, \n\t\t\t\tachternaam, \n\t\t\t\tgeboortedatum, \n\t\t\t\tbeschrijving\n\t\t\tFROM \n\t\t\t\tmaster \n\t\t\tWHERE \n\t\t\t\tid = " . (int) $this->getID();
         $queryPDO = $pdo->query($query);
         $masterResultaat = $queryPDO->fetch(PDO::FETCH_ASSOC);
         $geboortedatum = Datum::getDatabaseWaarde((int) $masterResultaat['geboortedatum']);
         parent::setVoornaam($masterResultaat['voornaam']);
         parent::setAchternaam($masterResultaat['achternaam']);
         parent::setGeboortedatum($geboortedatum->getDag(), $geboortedatum->getMaand(), $geboortedatum->getJaar());
         parent::setBeschrijving($masterResultaat['beschrijving']);
     } catch (PDOException $e) {
         throw new Exception($e);
     }
 }
Esempio n. 8
0
 public function setValue($val)
 {
     if (!is_array($val)) {
         throw new RqlDriverError("Not an array: " . $val);
     }
     foreach ($val as $k => $v) {
         if (!is_string($k) && !is_numeric($k)) {
             throw new RqlDriverError("Not a string or number: " . $k);
         }
         if (!(is_object($v) && is_subclass_of($v, "\\r\\Query"))) {
             throw new RqlDriverError("Not a Query: " . $v);
         }
     }
     parent::setValue($val);
 }
Esempio n. 9
0
 public function reminderDone($target, $id)
 {
     switch ($target) {
         case "KalenderEvent":
             $ex = explode("@", $id);
             if (strpos($ex[0], "TodoID") !== false) {
                 $T = new Todo(str_replace("TodoID", "", $ex[0]));
                 $D = new Datum();
                 $D->normalize();
                 $after = $D->time() + $T->A("TodoFromTime") - 60 * 5;
                 $T->changeA("TodoReminded", $after + 60);
                 $T->saveMe(true, false, false);
             }
             break;
         case "Aufgabe":
             $A = new Aufgabe($id);
             $A->changeA("AufgabeReminded", time());
             $A->saveMe();
             break;
     }
 }
 public static function Now()
 {
     return new Zeitpunkt(Datum::ToDay()->__toString() . " " . Zeit::Now()->__toString());
 }
Esempio n. 11
0
 function getMeetingData()
 {
     $currentTime = date("Hi");
     //create obj for today
     $D = new Datum();
     $D->normalize();
     $DE = clone $D;
     $DE->addDay();
     $T = new mTodoGUI();
     $K = $T->getCalendarData($D->time(), $DE->time(), Session::currentUser()->getID());
     while ($DE->time() > $D->time()) {
         $termine = $K->getEventsOnDay(date("dmY", $D->time()));
         //debug message
         echo "<div style='display:none'>";
         print_r($termine);
         echo "</div>";
         if ($termine != null) {
             foreach ($termine as $ev) {
                 foreach ($ev as $v) {
                     //start time in future = upcomming
                     if ($v->getTime() > $currentTime) {
                         array_push($this->upcommingMeetings, $v);
                         //current events
                     } else {
                         if ($v->getTime() <= $currentTime && $v->getEndTime() > $currentTime) {
                             array_push($this->currentMeetings, $v);
                         } else {
                             array_push($this->oldMeetings, $v);
                         }
                     }
                     //echo get_class($v).": ".$v->title()."<br>";
                 }
             }
         }
         $D->addDay();
     }
 }
Esempio n. 12
0
 public static function parserDG($w)
 {
     $ex = explode("-", $w);
     $D = new Datum(mktime(0, 1, 0, $ex[1], $ex[2], $ex[0]));
     return Util::CLDateParser($D->time());
 }
Esempio n. 13
0
 public static function stamp($args, $die = true)
 {
     #if(strtolower($args["P0"]) == "303005f7b4")
     #	die('{"status":"command", "action":"reload"}');
     if (!isset($_SESSION["BPS"])) {
         $_SESSION["BPS"] = new BackgroundPluginState();
     }
     addClassPath(Util::getRootPath() . "personalKartei/Zeiterfassung/");
     addClassPath(Util::getRootPath() . "personalKartei/Personal/");
     addClassPath(Util::getRootPath() . "personalKartei/ObjekteL/");
     #if(file_exists(Util::getRootPath()."personalKartei/Schichten/"))
     #	addClassPath(Util::getRootPath()."personalKartei/Schichten/");
     addClassPath(Util::getRootPath() . "open3A/Kategorien/");
     $CCP = new CCPage();
     $CCP->loadPlugin("personalKartei", "Schichten", true);
     $T = anyC::getFirst("ZETerminal", "ZETerminalID", $args["P1"]);
     if (!$T) {
         if ($die) {
             die('{"status":"error", "message":"Unbekanntes Terminal"}');
         } else {
             return;
         }
     }
     $CT = FileStorage::getFilesDir() . "ChipTrans.csv";
     if ($args["P3"] and $args["P4"] > 0) {
         $P = new Personal($args["P4"]);
         if (trim($P->A("PersonalChipNummer")) == "") {
             $P->changeA("PersonalChipNummer", trim(strtolower($args["P0"])));
             $P->saveMe();
         } else {
             file_put_contents($CT, "{$args['P4']}:" . trim(strtolower($args["P0"])) . "\n", FILE_APPEND);
         }
     }
     $A = new stdClass();
     $Date = new Datum();
     $Date->subDay();
     $Date->addDay();
     $A->ChipID = trim(strtolower($args["P0"]));
     $A->Date = $Date->time();
     $A->Time = Util::parseTime("de_DE", date("H:i", !isset($args["P5"]) ? time() : $args["P5"]));
     $A->Type = $args["P2"];
     $A->Mode = "";
     $A->TerminalID = $args["P1"];
     try {
         $ok = ZEData::addTime($A);
     } catch (Exception $e) {
         try {
             $hex = str_pad(trim(strtolower(dechex($args["P0"]))), 10, "0", STR_PAD_LEFT);
             $A->ChipID = $hex;
             $ok = ZEData::addTime($A);
         } catch (Exception $e) {
             try {
                 if (!$args["P3"]) {
                     throw new Exception("Chip unknown", 100);
                 }
                 if (!file_exists($CT)) {
                     file_put_contents($CT, "");
                 }
                 $trans = file_get_contents($CT);
                 $found = false;
                 foreach (explode("\n", $trans) as $line) {
                     $line = trim($line);
                     $ex = explode(":", $line);
                     if (trim(strtolower($ex[1])) != trim(strtolower($args["P0"]))) {
                         continue;
                     }
                     $P = new Personal($ex[0]);
                     $A->ChipID = $P->A("PersonalChipNummer");
                     $found = true;
                 }
                 if (!$found) {
                     throw new Exception("Learn", 200);
                 }
                 #if(!$found)
                 #	throw new Exception ("Chip unknown", 100);
                 $ok = ZEData::addTime($A);
             } catch (Exception $e) {
                 switch ($e->getCode()) {
                     case 100:
                         try {
                             $F = new Factory("ZETerminalFail");
                             $F->sA("ZETerminalFailTime", time());
                             $F->sA("ZETerminalFailData", json_encode($args));
                             $F->sA("ZETerminalFailZETerminalID", $args["P1"]);
                             $F->store();
                         } catch (Exception $e) {
                         }
                         if ($die) {
                             die('{"status":"error", "message":"Unbekannter Chip"}');
                         } else {
                             return;
                         }
                         break;
                     case 200:
                         $AC = anyC::get("Personal", "isDeleted", "0");
                         $AC->setFieldsV3(array("CONCAT(nachname, ' ', vorname) AS name"));
                         $AC->addAssocV3("TRIM(CONCAT(nachname, vorname))", "!=", "");
                         $AC->addOrderV3("nachname");
                         $AC->addOrderV3("vorname");
                         $knownPID = array();
                         $file = file($CT);
                         foreach ($file as $line) {
                             $line = trim($line);
                             $ex = explode(":", $line);
                             $knownPID[$ex[0]] = true;
                         }
                         $array = array();
                         while ($A = $AC->n()) {
                             if (isset($knownPID[$A->getID()])) {
                                 continue;
                             }
                             $subArray = array();
                             foreach ($A->getA() as $key => $value) {
                                 $subArray[$key] = $value;
                             }
                             $array[] = $subArray;
                         }
                         if ($die) {
                             die('{"status":"learn", "message":' . json_encode($array, defined("JSON_UNESCAPED_UNICODE") ? JSON_UNESCAPED_UNICODE : 0) . '}');
                         } else {
                             return;
                         }
                         break;
                     default:
                         try {
                             $F = new Factory("ZETerminalFail");
                             $F->sA("ZETerminalFailTime", time());
                             $F->sA("ZETerminalFailData", $e->getMessage());
                             $F->sA("ZETerminalFailZETerminalID", $args["P1"]);
                             $F->store();
                         } catch (Exception $e) {
                         }
                         if ($die) {
                             die('{"status":"error", "message":"' . $e->getMessage() . '"}');
                         } else {
                             return;
                         }
                 }
             }
         }
     }
     if ($args["P2"] == "G") {
         $AC = anyC::get("ZEData", "ZEDataPersonalID", $ok["Personal"]->getID());
         $AC->addAssocV3("ZEDataType", "=", "K");
         $AC->addAssocV3("ZEDataDate + ZEDataTime", ">", time() - 3600 * 13);
         $AC->addAssocV3("ZEDataDate + ZEDataTime", "<", time());
         $AC->addAssocV3("ZEDataIsDeleted", "=", "0");
         $AC->addOrderV3("ZEDataDate + ZEDataTime", "DESC");
         $AC->setLimitV3("1");
         $Kommen = $AC->getNextEntry();
         if ($Kommen != null) {
             $Gehen = $ok["ZEData"];
             $T = new ZETerminal($args["P1"]);
             $AC2 = anyC::get("PZuO", "ObjektLID", $T->A("ZETerminalObjektLID"));
             $AC2->addAssocV3("PersonalID", "=", $Kommen->A("ZEDataPersonalID"));
             $PZuO = $AC2->n();
             if ($PZuO !== null) {
                 $worked = $Gehen->A("ZEDataDate") + $Gehen->A("ZEDataTime") - ($Kommen->A("ZEDataDate") + $Kommen->A("ZEDataTime"));
                 $AZ = mZEArbeitsZeit::getArbeitszeiten($PZuO->getID(), time());
                 if (isset($AZ[0])) {
                     $hasTo = $AZ[0]->A("ZEArbeitsZeitEnde") - $AZ[0]->A("ZEArbeitsZeitStart");
                     if ($worked > 0 and $worked / $hasTo > 0.9) {
                         # AND $hasTo / $worked < 1.15){
                         $DE = $ok["ZEData"];
                         $DE->changeA("ZEDataPause", $AZ[0]->A("ZEArbeitsZeitMittag"));
                         $DE->saveMe(false, false);
                     }
                 }
             }
         }
     }
     #303046a1b7
     BPS::setProperty("ZEAuswertung", "objektLID", $T->A("ZETerminalObjektLID"));
     BPS::setProperty("ZEAuswertung", "personalID", $ok["Personal"]->getID());
     BPS::setProperty("ZEAuswertung", "month", date("Ym"));
     #$ZEA = new ZEAuswertung($A->ChipID);
     #$ZEA->debug = false;
     #$current = $ZEA->getContent();
     if ($die) {
         die('{"status":"OK", "message": "' . addslashes($ok["Personal"]->A("vorname") . " " . $ok["Personal"]->A("nachname")) . '", "details": ""}');
     } else {
         return;
     }
 }
Esempio n. 14
0
 function getWeekViewHTML($time, $multiDayOffset = 0)
 {
     if ($this->exception !== false and $this->exception[1] == "1") {
         return "";
     }
     self::$displayNr = 3;
     $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::parseTime($this->time);
     $endTime = Kalender::parseTime($this->endTime);
     $multiDays = false;
     if ($this->day != $this->endDay or $this->allDay) {
         $multiDays = true;
         $stackCalcFirst = Kalender::parseDay($this->day);
         $stackCalcLast = Kalender::parseDay($this->currentWhen->endDay);
         $D = new Datum($stackCalcFirst);
         while ($D->time() <= $stackCalcLast) {
             if (!isset(self::$stack[date("Ymd", $D->time())])) {
                 self::$stack[date("Ymd", $D->time())] = array();
             }
             if (in_array($this->className . $this->classID, self::$stack[date("Ymd", $D->time())])) {
                 $D->addDay();
                 continue;
             }
             self::$stack[date("Ymd", $D->time())][] = $this->className . $this->classID;
             $D->addDay();
         }
     }
     #echo "<pre style=\"font-size:10px;\">";
     #print_r(self::$stack);
     #echo "</pre>";
     if (Kalender::parseDay($this->currentWhen->endDay) - 60 + Kalender::parseTime($this->endTime) > $time + 24 * 3600) {
         //OK
         $endTime = 24 * 3600;
     }
     if (Kalender::parseDay($this->day) - 60 + Kalender::parseTime($this->time) < $time) {
         $startTime = 60 + Kalender::parseTime($this->time);
     }
     $height = ceil(($endTime - $startTime) / 3600 * 22);
     for ($h = $startTime; $h < $endTime; $h += 3600) {
         $height -= $h < 3600 * 6 ? 11 : 0;
     }
     if ($height < 22) {
         $height = 22;
     }
     $top = 0;
     $hours = substr($this->time, 0, 2);
     $minutes = substr($this->time, 2, 2) / 60;
     for ($h = 0; $h < $hours; $h++) {
         $top += $h < 6 ? 11 : 22;
     }
     if ($hours > 5) {
         $top += $minutes * 22;
     }
     if ($multiDays) {
         $height = 22;
         if (!isset(self::$multiDayStack[$this->className . $this->classID])) {
             self::$multiDayStack[$this->className . $this->classID] = count(self::$multiDayStack);
         }
         #echo date("Ymd", $time).":".count(self::$stack[date("Ymd", $time)])."<br />";
         $top = array_search($this->className . $this->classID, self::$stack[date("Ymd", $time)]) * 22;
         #$top = self::$multiDayStack[$this->className.$this->classID] * 22;
     } else {
         $top += $multiDayOffset * 22;
     }
     $grey = false;
     if ($this->owner != null and $this->owner != -1 and $this->owner != Session::currentUser()->getID()) {
         $grey = true;
     }
     if ($this->status == 2) {
         $grey = true;
     }
     $bgColor = "rgba(126, 194, 37, 0.5)";
     $titleColor = "rgb(126, 194, 37)";
     if ($multiDays and $this->day != date("dmY", $time)) {
         $titleColor = "rgba(126, 194, 37, 0.5)";
     }
     return "\n\t\t\t<div class=\"weekEventEntry\" onclick=\"{$this->onClick}\" style=\"background-color:" . ($grey ? "#DDD" : $bgColor) . ";padding:0px;cursor:pointer;height:" . $height . "px;overflow:hidden;position:absolute;margin-top:{$top}px;width:137px;\">\n\t\t\t\t<div style=\"padding:5px;background-color:{$titleColor};\">\n\t\t\t\t\t<div style=\"overflow:hidden;\">\n\t\t\t\t\t<small>" . (!$this->allDay ? "<b>" . $this->formatTime($this->time) . "</b>&nbsp;" : "") . "" . str_replace(" ", "&nbsp;", $this->title) . "</small>\n\t\t\t\t\t</div>\n\t\t\t\t</div>\n\t\t\t</div>";
 }
Esempio n. 15
0
 public static function stamp($args)
 {
     #if(strtolower($args["P0"]) == "303005f7b4")
     #	die('{"status":"command", "action":"reload"}');
     if (!isset($_SESSION["BPS"])) {
         $_SESSION["BPS"] = new BackgroundPluginState();
     }
     addClassPath(Util::getRootPath() . "personalKartei/Zeiterfassung/");
     addClassPath(Util::getRootPath() . "personalKartei/Personal/");
     addClassPath(Util::getRootPath() . "personalKartei/ObjekteL/");
     addClassPath(Util::getRootPath() . "open3A/Kategorien/");
     $T = anyC::getFirst("ZETerminal", "ZETerminalID", $args["P1"]);
     if (!$T) {
         die('{"status":"error", "message":"Unbekanntes Terminal"}');
     }
     $A = new stdClass();
     $Date = new Datum();
     $Date->subDay();
     $Date->addDay();
     $A->ChipID = trim(strtolower($args["P0"]));
     $A->Date = $Date->time();
     $A->Time = Util::parseTime("de_DE", date("H:i", time()));
     $A->Type = $args["P2"];
     $A->Mode = "";
     $A->TerminalID = $args["P1"];
     try {
         $ok = ZEData::addTime($A);
     } catch (Exception $e) {
         try {
             $A->ChipID = trim(strtolower(dechex($args["P0"])));
             $ok = ZEData::addTime($A);
         } catch (Exception $e) {
             switch ($e->getCode()) {
                 case 100:
                     die('{"status":"error", "message":"Unbekannter Chip"}');
                     break;
                 default:
                     die('{"status":"error", "message":"' . $e->getMessage() . '"}');
             }
         }
     }
     if ($args["P2"] == "G") {
         $AC = anyC::get("ZEData", "ZEDataChipID", $A->ChipID);
         $AC->addAssocV3("ZEDataType", "=", "K");
         $AC->addAssocV3("ZEDataDate + ZEDataTime", ">", time() - 3600 * 13);
         $AC->addOrderV3("ZEDataID", "DESC");
         $AC->addAssocV3("ZEDataIsDeleted", "=", "0");
         $AC->setLimitV3("1");
         $D = $AC->getNextEntry();
         if ($D != null) {
             $pause = ZEAuswertung::calcPause($D, $ok["ZEData"]);
             if ($pause !== null) {
                 $DE = $ok["ZEData"];
                 $DE->changeA("ZEDataPause", $pause);
                 $DE->saveMe(false, false);
             }
         }
     }
     #303046a1b7
     BPS::setProperty("ZEAuswertung", "objektLID", $T->A("ZETerminalObjektLID"));
     BPS::setProperty("ZEAuswertung", "personalID", $ok["Personal"]->getID());
     BPS::setProperty("ZEAuswertung", "month", date("Ym"));
     #$ZEA = new ZEAuswertung($A->ChipID);
     #$ZEA->debug = false;
     #$current = $ZEA->getContent();
     die('{"status":"OK", "message": "' . addslashes($ok["Personal"]->A("vorname") . " " . $ok["Personal"]->A("nachname")) . '", "details": ""}');
     #Stunden '.Util::CLMonthName(date("m")).': '.Util::formatSeconds($current["totalHours"][1], false).'
 }
Esempio n. 16
0
            if (mysql_num_rows($result) > 0) {
                $doc = mysql_fetch_array($result);
                if ($doc['type'] == 'normal') {
                    // kui tegu on hariliku dokumendiga,
                    // siis laeme selle tavalise lehena
                    $this->LoadNormalPage($doc);
                } elseif ($doc['type'] == 'standalone') {
                    // kui tegu on iseseisva lehega,
                    // siis lihtsalt incluudime selle lehe
                    // ning väljume
                    include $doc['address'];
                    exit;
                } else {
                    // muudel juhtudel saadame kliendile
                    // vastavat tüüpi faili
                    $fp = fopen($doc['address'], 'rb');
                    header("Content-Type: " . $doc['type']);
                    header("Content-Length: " . filesize($doc['address']));
                    fpassthru($fp);
                    exit;
                }
            } else {
                $this->LoadDateInfo();
            }
        } else {
            $this->LoadDateInfo();
        }
    }
}
$datum = new Datum($_GET['date'], UrlVars::url2real($_GET['document_name']));
$datum->Load();
Esempio n. 17
0
 public function Alter(Datum $date = null)
 {
     if ($date === null) {
         $date = Datum::ToDay();
     }
     return $date->Year() - $this->Year();
 }
/**
 * Smarty datum_format modifier plugin
 *
 * Type:     modifier<br>
 * Name:     datum_format<br>
 * Purpose:  format strings via datum_format
 * @param string
 * @param string
 * @return string
 */
function smarty_modifier_datum_format(Datum $datum)
{
    return $datum->Format();
}
Esempio n. 19
0
 public function getPDFContent($save = false)
 {
     if ($this->userdata == null or count($this->userdata) == 0) {
         die(Util::getBasicHTMLError("Bitte wählen Sie Monat und Jahr aus", "Fehler"));
     }
     self::$pdf->SetAutoPageBreak(false);
     $this->AddPage();
     $D = new Datum(mktime(0, 0, 1, $this->userdata["lightCRMKalBerichtMonth"], 1, $this->userdata["lightCRMKalBerichtYear"]));
     $day = clone $D;
     $D->setToMonthLast();
     $lastDay = $D;
     $Kalender = new mKalenderGUI();
     $K = $Kalender->getData($day->time(), $lastDay->time());
     $i = 0;
     while ($day->time() <= $lastDay->time()) {
         $events = $K->getEventsOnDay(date("dmY", $day->time()));
         if (count($events) == 0) {
             $day->addDay();
             continue;
         }
         if (self::$pdf->getY() > $this->pageBreakMargin - 15) {
             $this->AddPage();
             $i = 0;
         }
         if ($i > 0) {
             self::$pdf->ln(10);
         }
         self::$pdf->SetFont($this->defaultFont, "B", $this->defaultFontSize);
         self::$pdf->Cell(0, $this->defaultCellHeight, "Termine am " . Util::CLWeekdayName(date("w", $day->time())) . ", " . Util::CLFormatDate($day->time()), 0, 1);
         self::$pdf->Line(10, self::$pdf->GetY(), 200, self::$pdf->GetY());
         self::$pdf->SetFont($this->defaultFont, $this->defaultFontStyle, $this->defaultFontSize);
         foreach ($events as $time) {
             foreach ($time as $event) {
                 if (self::$pdf->getY() > $this->pageBreakMargin) {
                     $this->AddPage();
                     $i = 0;
                     if ($this->between) {
                         self::$pdf->SetFont($this->defaultFont, "B", $this->defaultFontSize);
                         self::$pdf->Cell(0, $this->defaultCellHeight, "Termine am " . Util::CLWeekdayName(date("w", $day->time())) . ", " . Util::CLFormatDate($day->time()), 0, 1);
                         self::$pdf->Line(10, self::$pdf->GetY(), 200, self::$pdf->GetY());
                         self::$pdf->SetFont($this->defaultFont, $this->defaultFontStyle, $this->defaultFontSize);
                     }
                 }
                 $this->between = true;
                 self::$pdf->Cell8(isset($this->widths["time"]) ? $this->widths["time"] : 20, $this->defaultCellHeight, Util::CLTimeParser(Kalender::parseTime($event->getTime())) . " - " . Util::CLTimeParser(Kalender::parseTime($event->getEndTime())), 0, 0);
                 self::$pdf->Cell8(isset($this->widths["title"]) ? $this->widths["title"] : 20, $this->defaultCellHeight, $event->title(), 0, 0);
                 self::$pdf->Cell8(isset($this->widths["location"]) ? $this->widths["location"] : 20, $this->defaultCellHeight, $event->location(), 0, 1);
                 $summary = $event->summary();
                 if ($summary != "") {
                     self::$pdf->setTextColor(100, 100, 100);
                     self::$pdf->SetFont($this->defaultFont, $this->defaultFontStyle, $this->defaultFontSize - 1);
                     self::$pdf->MultiCell8(isset($this->widths["summary"]) ? $this->widths["summary"] : 20, $this->defaultCellHeight - 1, trim(str_replace("<br />", "", $summary)), 0, 1);
                     self::$pdf->setTextColor(0, 0, 0);
                     self::$pdf->SetFont($this->defaultFont, $this->defaultFontStyle, $this->defaultFontSize);
                 }
                 self::$pdf->SetDrawColor(150, 150, 150);
                 self::$pdf->Line(10, self::$pdf->GetY(), 200, self::$pdf->GetY());
                 self::$pdf->SetDrawColor(0, 0, 0);
                 self::$pdf->ln(5);
             }
         }
         $this->between = false;
         $day->addDay();
         $i++;
     }
     $tmpfname = Util::getTempFilename("Bericht");
     self::$pdf->Output($tmpfname, $save ? "F" : "I");
     if ($save) {
         return $tmpfname;
     }
 }
Esempio n. 20
0
 public function downloadTrashData()
 {
     $andreas = false;
     if (!$andreas) {
         $json = file_get_contents("http://awido.cubefour.de/WebServices/Awido.Service.svc/getData/00000000-0000-0000-0000-000000001190?fractions=1,5,2,6,3,4,10&client=awv-nordschwaben");
     } else {
         $json = file_get_contents("http://awido.cubefour.de/WebServices/Awido.Service.svc/getData/00000000-0000-0000-0000-000000000629?fractions=1,5,2,6,3,4,10&client=awv-nordschwaben");
     }
     echo "<pre style=\"font-size:10px;max-height:400px;overflow:auto;\">";
     $data = json_decode($json);
     foreach ($data->calendar as $day) {
         if ($day->fr == "") {
             continue;
         }
         if ($day->dt < date("Ymd")) {
             continue;
         }
         print_r($day);
         $tag = new Datum(Util::parseDate("de_DE", substr($day->dt, 6) . "." . substr($day->dt, 4, 2) . "." . substr($day->dt, 0, 4)));
         if ($andreas) {
             $tag->subDay();
         }
         $name = "";
         foreach ($day->fr as $T) {
             if ($T == "PT") {
                 $name .= ($name != "" ? ", " : "") . "Papiertonne";
             }
             if ($T == "RT") {
                 $name .= ($name != "" ? ", " : "") . "Restmüll";
             }
             if ($T == "GS") {
                 $name .= ($name != "" ? ", " : "") . "Gelber Sack";
             }
             if ($T == "BT") {
                 $name .= ($name != "" ? ", " : "") . "Biotonne";
             }
         }
         if ($name == "") {
             continue;
         }
         $F = new Factory("Todo");
         $F->sA("TodoName", $name);
         $F->sA("TodoFromDay", $tag->time());
         $F->sA("TodoTillDay", $tag->time());
         $F->sA("TodoFromTime", "32400");
         $F->sA("TodoTillTime", "36000");
         $F->sA("TodoUserID", "-1");
         $F->sA("TodoRemind", "-1");
         if ($andreas) {
             $F->sA("TodoFromTime", Util::parseTime("de_DE", "18:00"));
             $F->sA("TodoTillTime", Util::parseTime("de_DE", "18:05"));
             $F->sA("TodoUserID", Session::currentUser()->getID());
             $F->sA("TodoRemind", 60);
         }
         $F->sA("TodoClass", "Kalender");
         $F->sA("TodoClassID", "-1");
         $F->sA("TodoType", "2");
         if ($F->exists()) {
             continue;
         }
         $F->store();
     }
     echo "</pre>";
 }
Esempio n. 21
0
 public function saveMe($checkUserData = true, $output = false, $update = true)
 {
     $old = new Todo($this->getID());
     $old->loadMe();
     #$fromDay = date("Y-m-d", Util::CLDateParser($this->A("TodoFromDay"), "store"));
     #$fromTime = Util::formatTime("de_DE", Util::CLTimeParser($this->A("TodoFromTime"), "store"));
     #die($this->getID());
     if ($update) {
         $this->changeA("TodoLastChange", time());
         $this->changeA("TodoReminded", "0");
     }
     #$name = $this->getOwnerObject()->getCalendarTitle();
     if ($this->A("TodoAllDay")) {
         $this->changeA("TodoFromTime", Util::CLTimeParser(0));
         $this->changeA("TodoTillTime", Util::CLTimeParser(0));
     }
     if ($this->A("TodoRepeatWeekOfMonth") > 0 and $this->A("TodoRepeatWeekOfMonth") != 127) {
         $D = new Datum($this->hasParsers ? Util::CLDateParser($this->A("TodoFromDay"), "store") : $this->A("TodoFromDay"));
         $nthDay = $D->getNthDayOfMonth();
         if ($nthDay > 4) {
             $nthDay = 4;
         }
         $this->changeA("TodoRepeatWeekOfMonth", $nthDay);
     }
     if ($this->A("TodoClass") != "" and $this->A("TodoClass") != "Kalender" and $this->A("TodoName") == "") {
         $this->changeA("TodoName", $this->getOwnerObject()->getCalendarTitle());
     }
     if (Session::isPluginLoaded("mAufgabe") and ($this->A("TodoType") == 3 or $this->A("TodoType") == 4 or $this->A("TodoType") == 5) and $this->A("TodoUserID") > 0) {
         $F = new Factory("Aufgabe");
         $F->sA("AufgabeByClass", "Todo");
         $F->sA("AufgabeByClassID", $this->getID());
         $E = $F->exists(true);
         if (!$E) {
             $F->sA("AufgabeUserID", $this->A("TodoUserID"));
             $F->sA("AufgabeText", "Bericht für Termin '" . $this->A("TodoName") . "' eintragen");
             $F->sA("AufgabeCreated", time());
             if ($this->A("TodoDoneTime") > 0) {
                 $F->sA("AufgabeStatus", "5");
                 $F->sA("AufgabeDone", time());
             }
             if ($this->hasParsers) {
                 $F->sA("AufgabeUntil", Util::CLDateParser($this->A("TodoFromDay"), "store"));
                 $F->sA("AufgabeUhrzeitVon", Util::CLTimeParser($this->A("TodoTillTime"), "store"));
             } else {
                 $F->sA("AufgabeUntil", $this->A("TodoFromDay"));
                 $F->sA("AufgabeUhrzeitVon", $this->A("TodoTillTime"));
             }
             $F->store();
         } else {
             $E->changeA("AufgabeText", "Bericht für Termin '" . $this->A("TodoName") . "' eintragen");
             if ($this->hasParsers) {
                 $E->changeA("AufgabeUntil", Util::CLDateParser($this->A("TodoFromDay"), "store"));
                 $E->changeA("AufgabeUhrzeitVon", Util::CLTimeParser($this->A("TodoTillTime"), "store"));
             } else {
                 $E->changeA("AufgabeUntil", $this->A("TodoFromDay"));
                 $E->changeA("AufgabeUhrzeitVon", $this->A("TodoTillTime"));
             }
             if ($this->A("TodoDoneTime") > 0) {
                 $E->changeA("AufgabeStatus", "5");
                 $E->changeA("AufgabeDone", time());
             }
             $E->saveMe();
         }
     }
     parent::saveMe($checkUserData, false);
     if (Session::isPluginLoaded("mGoogle") and $this->updateGoogle) {
         $KE = mTodoGUI::getCalendarDetails("Todo", $this->getID());
         if ($this->A("TodoUserID") == Session::currentUser()->getID()) {
             if ($old->A("TodoUserID") == $this->A("TodoUserID")) {
                 Google::calendarUpdateEvent(mTodoGUI::getCalendarDetails("Todo", $this->getID()));
             } else {
                 Google::calendarDeleteEvent($KE);
                 #"Todo", $this->getID());
                 Google::calendarCreateEvent($KE);
             }
         } else {
             Google::calendarDeleteEvent($KE);
             #"Todo", $this->getID());
             Google::calendarCreateEvent($KE, $this->A("TodoUserID"));
         }
     }
 }
Esempio n. 22
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();
 }
 public static function AddWorkingDays($days, Datum $date = null)
 {
     if ($date === null) {
         $date = Datum::ToDay();
     }
     if ($days == 0) {
         while (PublicHolidays::IsWeekend($date) || PublicHolidays::IsHoliday($date, new Bundesland('BB', 'Brandenburg'))) {
             $date = $date->DateAdd(1);
         }
     }
     $i = 0;
     while ($i < $days) {
         $date = $date->DateAdd(1);
         if (!PublicHolidays::IsWeekend($date) && !PublicHolidays::IsHoliday($date, new Bundesland('BB', 'Brandenburg'))) {
             $i++;
         }
     }
     return $date;
 }
Esempio n. 24
0
 public function testGetBursaWolfParameters()
 {
     $datumObject = new Datum();
     $datumObject->setDatum(Datum::OSGB36);
     $bursaWolfParameters = $datumObject->getBursaWolfParameters();
     //    Must return an object...
     $this->assertTrue(is_object($bursaWolfParameters));
     //    ... of the correct type
     $this->assertTrue(is_a($bursaWolfParameters, 'Geodetic\\BursaWolfParameters'));
 }
Esempio n. 25
0
 public static function run()
 {
     $dotenv = new \Dotenv\Dotenv(TXTROOT);
     $dotenv->load();
     if (isset($_SERVER['HTTP_USER_AGENT']) && stripos($_SERVER['HTTP_USER_AGENT'], 'Slackbot-LinkExpanding') !== false) {
         Response::sendResponse(Response::HTTP_403, ['error' => "No slackbots allowed"]);
         exit;
     }
     if (!getenv('REDIS_URL')) {
         Response::sendResponse(Response::HTTP_500, ['error' => "REDIS_URL environment variable required"]);
         exit;
     }
     if (!Request::isGet() && !Request::isPost()) {
         Response::sendResponse(Response::HTTP_405, ['error' => "Please use a GET or POST"]);
         exit;
     }
     if (getenv('AUTH') && (!isset($_POST['auth']) || !static::compareStrings(getenv('AUTH'), $_POST['auth']))) {
         Response::sendResponse(Response::HTTP_401, ['error' => "'auth' parameter is missing or invalid"]);
         exit;
     }
     //    header('Access-Control-Allow-Origin: ' . $_SERVER['ORIGIN']);
     //    header('Access-Control-Allow-Credentials: true');
     //    Access-Control-Allow-Methods: GET, POST
     // x-frame-options
     $redis = Redis::getRedis(getenv('REDIS_URL'));
     $hash = ltrim(Request::getPath(), '/');
     if ($hash) {
         if ($hash == 'robots.txt') {
             Response::setStatus(Response::HTTP_200);
             Response::setContentType(Response::TEXT);
             Response::setContent("User-agent: *\nDisallow: /");
             Response::send();
             exit;
         }
         if (Request::isPost()) {
             Response::sendResponse(Response::HTTP_405, ['error' => "Cannot post to a hash"]);
             exit;
         }
         if (strlen($hash) > Redis::MAX_KEY_LENGTH || !preg_match('/^[A-Za-z0-9]+$/', $hash)) {
             Response::sendResponse(Response::HTTP_404, ['error' => "Invalid hash"]);
             exit;
         }
         $data = $redis->hGetAll(Redis::PREFIX . $hash);
         if (!$data) {
             Response::sendResponse(Response::HTTP_404, ['error' => "Hash not found"]);
             exit;
         }
         $datum = Datum::createFromArray($data);
         if ($datum->once) {
             $redis->del(Redis::PREFIX . $hash);
         }
         // set proper cache header, esp for read-once
         // actually, PROBABLY NOT A GOOD IDEA, esp for things that are meant to expire. we should do the opposite - dont cache
         // Response::setCacheForeverHeaders();
         Response::sendResponse('datum', ['datum' => $datum]);
         exit;
     }
     if (Request::isGet()) {
         Response::sendResponse('home', ['domain' => 'http' . (Request::isSSL() ? 's' : '') . '://' . Request::getHost()]);
         exit;
     } else {
         $data = isset($_POST['data']) ? $_POST['data'] : file_get_contents("php://input");
         if (!$data) {
             Response::sendResponse(Response::HTTP_400, ['error' => 'No data submitted']);
             exit;
         }
         $datum = new Datum(trim($data), Datum::T_TEXT, Request::isFlagOn('once'));
         $key = substr(static::randId(), 0, Redis::MAX_KEY_LENGTH);
         $ttl = isset($_POST['ttl']) ? max(1, min((int) $_POST['ttl'], Redis::MAX_TTL)) : Redis::MAX_TTL;
         $redis->hMSet(Redis::PREFIX . $key, $datum->toArray());
         $redis->expire(Redis::PREFIX . $key, $ttl);
         $url = 'http' . (Request::isSSL() ? 's' : '') . '://' . Request::getHost() . '/' . $key;
         Response::sendResponse(Response::HTTP_201, ['url' => $url, 'ttl' => $ttl, '_textKey' => 'url']);
         exit;
     }
 }
Esempio n. 26
0
 public static function getLangMonthNames($languageTag)
 {
     switch ($languageTag) {
         case "de_DE":
             return Datum::getGerMonthArray();
             break;
         default:
             return Datum::getGerMonthArray();
             break;
     }
 }
Esempio n. 27
0
 public function all()
 {
     $D = new Datum();
     $D->normalize();
     $html = "<div style=\"margin-left:2%;\">";
     while ($W = $this->n()) {
         $data = json_decode($W->A("OpenWeatherMapDataForecastDaily"));
         foreach ($data->list as $value) {
             $time = $value->dt;
             if ($time < $D->time()) {
                 continue;
             }
             $html .= $this->toIcon(false, $value);
         }
     }
     echo $html . "</div>";
 }
Esempio n. 28
0
 public function editRepeatable($todoID)
 {
     $F = new HTMLForm("RepeatableForm", array("TodoRepeat", "TodoRepeatWeekOfMonth", "TodoRepeatDayOfWeek", "TodoRepeatInterval", "TodoRepeatUntil"), "Wiederholungen");
     $F->getTable()->setColWidth(1, 120);
     $T = new Todo($todoID);
     $F->setValues($T);
     $F->setValue("TodoRepeatUntil", Util::CLDateParserE($T->A("TodoRepeatUntil")));
     $F->setLabel("TodoRepeat", "Wiederholen");
     $F->setLabel("TodoRepeatWeekOfMonth", "Tag");
     $F->setLabel("TodoRepeatDayOfWeek", "Tage");
     $F->setLabel("TodoRepeatInterval", "Intervall");
     $F->setLabel("TodoRepeatDayOfWeek", "Tage");
     $F->setLabel("TodoRepeatUntil", "Bis");
     $F->setType("TodoRepeatInterval", "select", null, array("Wöchentlich", "Jede 2. Woche", "Jede 3. Woche", "Jede 4. Woche"));
     $F->setType("TodoRepeatUntil", "date");
     #$currentWeek = ceil((date("d", $T->A("TodoFromDay")) - date("w", $T->A("TodoFromDay")) - 1) / 7) + 1;
     #echo $currentWeek;
     $D = new Datum($T->A("TodoFromDay"));
     $nthDay = $D->getNthDayOfMonth();
     if ($nthDay > 4) {
         $nthDay = 4;
     }
     $weeks = array(0 => "am " . date("d", $T->A("TodoFromDay")) . ". jeden Monats");
     $weeks[$nthDay] = "jeden {$nthDay}. " . Util::CLWeekdayName(date("w", $T->A("TodoFromDay"))) . " des Monats";
     $weeks[127] = "am letzten Tag des Monats";
     $F->setType("TodoRepeat", "select", "", Todo::$repeatTypes);
     $F->setType("TodoRepeatWeekOfMonth", "select", "", $weeks);
     #$F->setType("TodoRepeatDayOfWeek", "checkbox");
     $F->setType("TodoRepeatDayOfWeek", "parser", $T->A("TodoRepeatDayOfWeek"), array("mTodoGUI::parserDayOfWeek"));
     $F->hideIf("TodoRepeat", "!=", "monthly", "onchange", array("TodoRepeatWeekOfMonth"));
     $F->hideIf("TodoRepeat", "!=", "daily", "onchange", array("TodoRepeatDayOfWeek"));
     $F->hideIf("TodoRepeat", "!=", "weekly", "onchange", array("TodoRepeatInterval", "TodoRepeatUntil"));
     $F->setSaveClass("Todo", $todoID, "function(){ /*\$j('#eventAdditionalContent').slideUp();*/ contentManager.reloadFrame('contentScreen'); Kalender.refreshInfoPopup(); }", "Aktivität");
     return $F;
 }
Esempio n. 29
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;
 }
 public function testPreviousLastOfQuarter()
 {
     foreach (array('2014-01-01' => '2013-12-31', '2014-01-02' => '2013-12-31', '2014-03-31' => '2014-03-31', '2014-04-01' => '2014-03-31', '2014-06-30' => '2014-06-30', '2014-07-01' => '2014-06-30', '2014-09-30' => '2014-09-30', '2014-10-01' => '2014-09-30', '2014-12-31' => '2014-12-31') as $datum => $expected) {
         $datum = new Datum($datum);
         $this->assertEquals(new Datum($expected), $datum->previousLastOfQuarter());
     }
 }