Esempio n. 1
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. 2
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;
     }
 }
Esempio n. 3
0
 public function getAdresse($TodoID)
 {
     $T = new Todo($TodoID);
     $C = $T->A("TodoClass");
     if ($C == "WAdresse") {
         $C = "Adresse";
     }
     $C = new $C($T->A("TodoClassID"));
     return $C;
 }