public static function getCalendarDetails($className, $classID, $T = null) { $K = new Kalender(); if ($T == null) { $T = new FAdresseGUI($classID); } $name = $T->A("vorname") . " " . $T->A("nachname") . " <span style=\"color:grey;\">" . (date("Y") - date("Y", $T->A("geb"))) . "</span>"; $day = mktime(8, 0, 0, date("m", $T->A("geb")), date("d", $T->A("geb")), date("Y")); $KE = new KalenderEvent($className, $classID, $K->formatDay($day), "0900", $name); #$KE->repeat(true, "yearly"); $KE->icon("./fheME/FAdressen/birthday.png"); $KE->summary("Geburtstag"); return $KE; }
function getDayViewHTML($time = null) { if ($this->exception !== false and $this->exception[1] == "1") { return ""; } if (self::$displayNr > count(self::$bgColors) - 1) { self::$displayNr = 0; } $B = ""; if ($this->icon != null) { $B = new Button("", $this->icon, "icon"); $B->style("margin-top:-4px;margin-left:-2px;"); } $this->onClick = str_replace(array("%%CLASSNAME%%", "%%CLASSID%%", "%%TIME%%"), array($this->className, $this->classID, $time != null ? $time : ""), $this->onClick); $startTime = Kalender::parseDay($this->day) - 60 + Kalender::parseTime($this->time); $endTime = Kalender::parseDay($this->currentWhen->endDay) - 60 + Kalender::parseTime($this->endTime); if ($endTime > $time + 24 * 3600 or $this->allDay) { //OK $endTime = $time + 24 * 3600 - 61; } if ($startTime < $time) { $startTime = $time - 60 + Kalender::parseTime($this->time); } if (self::$colsStack == null) { self::$colsStack = array(array(), array(), array(), array()); } $useCol = null; for ($i = 0; $i < count(self::$colsStack); $i++) { if (!isset(self::$colsStack[$i][date("Hi", $startTime)])) { $useCol = $i; break; } } $minutes = $endTime - $startTime; if ($minutes < 30 * 60) { $minutes = 30 * 60; } $i = 0; while ($i < $minutes) { self::$colsStack[$useCol][date("Hi", $startTime + $i)] = true; $i += 60; } $height = ceil(($endTime - $startTime) / 3600 * 40); if ($height < 20) { $height = 20; } $top = (substr($this->time, 0, 2) + substr($this->time, 2, 2) / 60) * 40; $left = 80 + $useCol * 210; if ($top + $height > 24 * 40) { $height = 24 * 40 - $top; } $grey = false; if ($this->owner != null and $this->owner != -1 and $this->owner != Session::currentUser()->getID()) { $grey = true; } if ($this->status == 2) { $grey = true; } #echo "$this->title: col $useCol; $left x $top<br />"; return "\n\t\t\t<div onclick=\"{$this->onClick}\" style=\"background-color:" . ($grey ? "#DDD" : self::$bgColors[self::$displayNr++]) . ";position:absolute;top:{$top}px;left:{$left}px;padding:0px;cursor:pointer;height:" . $height . "px;margin-right:10px;width:200px;overflow:hidden;z-index:" . self::$z-- . ";\">\n\t\t\t\t<div style=\"padding:5px;\">\n\t\t\t\t\t<span style=\"float:left;margin-right:3px;\">\n\t\t\t\t\t\t{$B}\n\t\t\t\t\t</span>\n\t\t\t\t\n\t\t\t\t\t<!--<span style=\"display:none;\" id=\"time_{$this->className}{$this->classID}{$this->time}\">{$this->time}<br /></span>-->" . (!$this->allDay ? "<b>" . $this->formatTime($this->time) . "</b> " : "") . "{$this->title}\n\t\t\t\t</div>\n\t\t\t</div>"; }
public static function getCalendarDetails($className, $classId) { $calendar = new Kalender(); $ids = preg_split("/:/", $classId); $server = anyC::getFirst("xCal", "xCalID", $ids[0]); $xmlBuffer = xCalUtil::getSimpleXmlByXCal($server->A("xCalCache")); foreach ($xmlBuffer->vcalendar->vevent as $event) { if ((string) $event->uid != $ids[1]) { continue; } // Konvertierung der Zeitstempel $match = array(); preg_match("/^(\\d{4})(\\d{2})(\\d{2})T(\\d{2})(\\d{2})(\\d{2})Z\$/", (string) $event->dtstart, $match); $startTimestamp = gmmktime($match[4], $match[5], $match[6], $match[2], $match[3], $match[1]); $match = array(); preg_match("/^(\\d{4})(\\d{2})(\\d{2})T(\\d{2})(\\d{2})(\\d{2})Z\$/", (string) $event->dtend, $match); $endTimestamp = gmmktime($match[4], $match[5], $match[6], $match[2], $match[3], $match[1]); $calendarEvent = new KalenderEvent("mxCalGUI", $server->A("xCalID") . ":" . (string) $event->uid, $calendar->formatDay($startTimestamp), $calendar->formatTime($startTimestamp), (string) $event->summary); $description = preg_replace("/\n|\r/", "<br>", (string) $event->description); $calendarEvent->summary($description); return $calendarEvent; } }
public static function getCalendarDetails($className, $classID, $T = null) { $K = new Kalender(); if ($T == null) { $AC = anyC::get("Folge", "FolgeID", $classID); $AC->addJoinV3("Serie", "SerieID", "=", "SerieID"); $AC->setFieldsV3(array("t1.name", "season", "episode", "t1.description", "airDate")); $T = $AC->getNextEntry(); } $ex = explode("-", $T->A("airDate")); $day = mktime(8, 0, 0, $ex[1], $ex[2], $ex[0]); $KE = new KalenderEvent($className, $classID, $K->formatDay($day), "1800", $T->A("name") . " S" . ($T->A("season") < 10 ? "0" : "") . $T->A("season") . "E" . ($T->A("episode") < 10 ? "0" : "") . $T->A("episode")); #$KE->repeat(true, "yearly"); $KE->endDay($K->formatDay($day)); $KE->endTime("1845"); $KE->icon("./fheME/FAdressen/birthday.png"); $KE->summary($T->A("description")); return $KE; }
public static function toKalenderEvent($iCal, $ownerClass = "iCal", $ownerClassID = "-1") { $VC = new vcalendar(); $VC->parse($iCal); $event = $VC->getComponent("vevent"); $dayStart = $event->getProperty("DTSTART"); $dayEnd = $event->getProperty("DTEND"); $dayStartTS = strtotime(implode("", $dayStart)); $dayEndTS = strtotime(implode("", $dayEnd)); $KE = new KalenderEvent($ownerClass, $ownerClassID, Kalender::formatDay($dayStartTS), Kalender::formatTime($dayStartTS), $event->getProperty("SUMMARY")); $KE->UID($event->getProperty("UID")); $organizer = $event->getProperty("ORGANIZER", 0, true); $organizer["value"] = str_replace("MAILTO:", "", $organizer["value"]); $ON = $organizer["value"]; if (isset($organizer["params"]["CN"])) { $ON = $organizer["params"]["CN"]; } $OE = $organizer["value"]; $KE->organizer($ON, $OE); if ($dayStart["hour"] . $dayStart["min"] == "" and $dayEnd["hour"] . $dayEnd["min"] == "") { $KE->allDay(true); } else { $KE->endDay(Kalender::formatDay($dayEndTS)); $KE->endTime(Kalender::formatTime($dayEndTS)); } return $KE; }
public static function newFromKalenderEvent(KalenderEvent $KE) { $T = new Todo(-1); $T->loadMeOrEmpty(); $T->changeA("TodoFromDay", Kalender::parseDay($KE->getDay())); $T->changeA("TodoFromTime", Kalender::parseTime($KE->getTime())); $T->changeA("TodoTillDay", Kalender::parseDay($KE->getEndDay())); $T->changeA("TodoTillTime", Kalender::parseTime($KE->getEndTime())); $T->changeA("TodoType", "2"); $T->changeA("TodoName", $KE->title()); $T->changeA("TodoClass", $KE->ownerClass()); $T->changeA("TodoClassID", $KE->ownerClassID()); $T->changeA("TodoUserID", Session::currentUser()->getID()); $T->changeA("TodoOrganizer", $KE->organizer()); return $T->newMe(); }
public static function getCalendarDetails($className, $classID, $T = null) { $K = new Kalender(); if ($T == null) { $T = new Todo($classID); } $name = ""; if ($T->A("TodoClass") == "Projekt" or $T->A("TodoClass") == "GRLBM") { $O = $T->getOwnerObject(); $name = $O->getCalendarTitle(); } else { $name = $T->A("TodoName"); } $day = $T->A("TodoTillDay"); if ($T->A("TodoFromDay") != "0") { $day = $T->A("TodoFromDay"); } $time = $T->A("TodoTillTime"); if ($T->A("TodoFromTime") != "0") { $time = $T->A("TodoFromTime"); } $KE = new KalenderEvent($className, $classID, $K->formatDay($day), $K->formatTime($time), $name); #echo $T->A("TodoOrt"); if ($T->A("TodoClass") == "WAdresse") { $O = $T->getOwnerObject(); $KE->value("Kunde", $O->getHTMLFormattedAddress()); } $KE->value("Typ", TodoGUI::types($T->A("TodoType"))); $KE->value("Ort", $T->A("TodoLocation")); #$KE->value("Status", TodoGUI::getStatus($T->A("TodoStatus"))); $KE->owner($T->A("TodoUserID")); if ($T->A("TodoClass") == "WAdresse") { $KE->value("Telefon", $O->A("tel")); $KE->value("Notiz", nl2br($O->A("bemerkung"))); $KE->canNotify(true, $T->A("TodoNotified") == "1"); if ($T->A("TodoType") == "1" and Session::isPluginLoaded("mAkquise")) { $B = new Button("Akquise", "./lightCRM/Akquise/callTel.png"); #$B->doBefore(OnEvent::rme($T, "setStatus", array("'2'"), OnEvent::closePopup("mKalender").OnEvent::reload("Screen"))." %AFTER"); $B->doBefore(OnEvent::closePopup("mKalender") . "contentManager.emptyFrame('contentScreen'); %AFTER"); $B->loadFrame("contentLeft", "WAdresse", $T->A("TodoClassID"), 0, "mWAdresseGUI;Akquise:1;from:mKalender"); #$B->popup("", "Akquise", "mAkquise", "-1", "showTelPopup", array($T->A("TodoClassID")), "", "{width: 950, top:20, hPosition:'center'}"); $KE->addTopButton($B); } } $KE->allDay($T->A("TodoAllDay") == "1"); if ($T->A("TodoClass") == "Projekt" and $O->A("ProjektKunde") != "0") { $Adresse = new Adresse($O->A("ProjektKunde")); $KE->value("Telefon", $Adresse->A("tel")); } if ($T->A("TodoClass") == "GRLBM") { $Auftrag = new Auftrag($O->A("AuftragID")); $Adresse = new Adresse($Auftrag->A("AdresseID")); $KE->value("Telefon", $Adresse->A("tel")); } $KE->status($T->A("TodoStatus")); $KE->endDay($K->formatDay($T->A("TodoTillDay"))); $KE->endTime($K->formatTime($T->A("TodoTillTime"))); $KE->icon(TodoGUI::typesImage($T->A("TodoType"), true)); $KE->summary(nl2br($T->A("TodoDescription"))); if ($T->A("TodoExceptionForID") != "0") { $KE->exception($T->A("TodoExceptionStarttime"), $T->A("TodoIsDeleted") == "1", $T->A("TodoExceptionForID")); } if ($T->A("TodoRemind") != "-1") { $KE->remind($T->A("TodoRemind") / 60, $T->A("TodoReminded")); } $editMethod = "editInPopup"; if ($T->A("TodoOrganizer") != "") { $editMethod = null; $KE->organizer($T->A("TodoOrganizer")); } if (!$T->A("TodoDoneTime")) { $KE->editable($editMethod, "deleteFromCalendar"); } if ($T->A("TodoOrganizer") == "" and !$T->A("TodoDoneTime")) { $KE->repeatable("editRepeatable"); } $KE->location($T->A("TodoLocation")); $KE->repeat($T->A("TodoRepeat") != "", $T->A("TodoRepeat"), $T->A("TodoRepeatWeekOfMonth") * 1, $T->A("TodoRepeatDayOfWeek"), $T->A("TodoRepeatInterval"), $T->A("TodoRepeatUntil")); $KE->UID("TodoID" . $T->getID() . "@" . substr(Util::eK(), 0, 20)); $KE->closeable($T->A("TodoDoneTime"), $T->A("TodoReport")); if (!$T->A("TodoDoneTime")) { $KE->canInvite(); } return $KE; }