Пример #1
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;
 }
Пример #2
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;
 }
Пример #3
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;
 }
Пример #4
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;
 }
Пример #5
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>";
 }
Пример #6
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();
     }
 }
Пример #7
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;
     }
 }
Пример #8
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());
 }
Пример #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;
     }
 }
Пример #10
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>";
 }
Пример #11
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();
 }
Пример #12
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).'
 }
Пример #13
0
 function getBusyList($UserID = null, $echo = false)
 {
     $cutoffDatePast = time() - 2 * 24 * 3600;
     $cutoffDateFuture = time() + 84 * 24 * 3600;
     $Kal = new mKalender();
     $K = $Kal->getData($cutoffDatePast, $cutoffDateFuture, $UserID);
     $Datum = new Datum();
     $Datum->normalize();
     $htmlEvents = "";
     $htmlEvents .= "<div class=\"backgroundColor2\"><p class=\"prettySubtitle\">KW " . date("W", $Datum->time()) . "</p></div>";
     while ($Datum->time() < $cutoffDateFuture) {
         $list = "";
         $events = $K->getEventsOnDay(date("dmY", $Datum->time()));
         if ($events != null and count($events) > 0) {
             foreach ($events as $ev) {
                 foreach ($ev as $KE) {
                     $list .= "<div style=\"white-space: nowrap;overflow: hidden;text-overflow: ellipsis;\" title=\"" . $KE->title() . "\"><span>" . Util::CLTimeParser($K->parseTime($KE->currentWhen()->time)) . " - " . Util::CLTimeParser($K->parseTime($KE->getEndTime())) . "</span> <small style=\"color:grey;\">" . $KE->title() . "</small></div>";
                 }
             }
         }
         $Datum->addDay();
         $style = "";
         if ($Datum->w() == 0 or $Datum->w() == 6) {
             continue;
         }
         #$style = "background-color:#DDD;";
         if ($Datum->w() == 1) {
             $htmlEvents .= "<div class=\"backgroundColor2\"><p class=\"prettySubtitle\">KW " . date("W", $Datum->time()) . "</p></div>";
         }
         $htmlEvents .= "<div style=\"margin-bottom:20px;{$style}display:inline-block;width:50%;box-sizing:border-box;vertical-align:top;min-height:60px;\">\n\t\t\t\t<div style=\"background-color:#EEE;padding:5px;\">\n\t\t\t\t\t<span style=\"display:inline-block;width:30px;font-weight:bold;\">" . mb_substr(Util::CLWeekdayName($Datum->w()), 0, 2) . "</span>\n\t\t\t\t\t<span style=\"color:grey;\">" . Util::CLDateParser($Datum->time()) . "</span>\n\t\t\t\t</div>\n\t\t\t\t<div style=\"padding:5px;\">\n\t\t\t\t\t{$list}\n\t\t\t\t</div>\n\t\t\t\t</div>";
     }
     if ($echo) {
         echo $htmlEvents;
     }
     return $htmlEvents;
 }
Пример #14
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>";
 }