/** * Writes a SyncTask to MAPI * * @param mixed $mapimessage * @param SyncTask $task * * @access private * @return boolean */ private function setTask($mapimessage, $task) { mapi_setprops($mapimessage, array(PR_MESSAGE_CLASS => "IPM.Task")); $taskmapping = MAPIMapping::GetTaskMapping(); $taskprops = MAPIMapping::GetTaskProperties(); $this->setPropsInMAPI($mapimessage, $task, $taskmapping); $taskprops = array_merge($this->getPropIdsFromStrings($taskmapping), $this->getPropIdsFromStrings($taskprops)); // task specific properties to be set $props = array(); if (isset($task->asbody)) { $this->setASbody($task->asbody, $props, $taskprops); } if (isset($task->complete)) { if ($task->complete) { // Set completion to 100% // Set status to 'complete' $props[$taskprops["completion"]] = 1.0; $props[$taskprops["status"]] = 2; } else { // Set completion to 0% // Set status to 'not started' $props[$taskprops["completion"]] = 0.0; $props[$taskprops["status"]] = 0; } } if (isset($task->recurrence) && class_exists('TaskRecurrence')) { $deadoccur = false; if (isset($task->recurrence->occurrences) && $task->recurrence->occurrences == 1 || isset($task->recurrence->deadoccur) && $task->recurrence->deadoccur == 1) { //ios5 sends deadoccur inside the recurrence $deadoccur = true; } // Set PR_ICON_INDEX to 1281 to show correct icon in category view $props[$taskprops["icon"]] = 1281; // dead occur - false if new occurrences should be generated from the task // true - if it is the last ocurrence of the task $props[$taskprops["deadoccur"]] = $deadoccur; $props[$taskprops["isrecurringtag"]] = true; $recurrence = new TaskRecurrence($this->store, $mapimessage); $recur = array(); $this->setRecurrence($task, $recur); // task specific recurrence properties which we need to set here // "start" and "end" are in GMT when passing to class.recurrence // set recurrence start here because it's calculated differently for tasks and appointments $recur["start"] = $task->recurrence->start; $recur["regen"] = $task->regenerate; //Also add dates to $recur $recur["duedate"] = $task->duedate; $recurrence->setRecurrence($recur); } mapi_setprops($mapimessage, $props); }
/** * Writes a SyncTask to MAPI * * @param mixed $mapimessage * @param SyncTask $task * * @access private * @return boolean */ private function setTask($mapimessage, $task) { mapi_setprops($mapimessage, array(PR_MESSAGE_CLASS => "IPM.Task")); $taskmapping = MAPIMapping::GetTaskMapping(); $taskprops = MAPIMapping::GetTaskProperties(); $this->setPropsInMAPI($mapimessage, $task, $taskmapping); $taskprops = array_merge($this->getPropIdsFromStrings($taskmapping), $this->getPropIdsFromStrings($taskprops)); // task specific properties to be set $props = array(); if (isset($task->asbody)) { $this->setASbody($task->asbody, $props, $taskprops); } if (isset($task->complete)) { if ($task->complete) { // Set completion to 100% // Set status to 'complete' $props[$taskprops["completion"]] = 1.0; $props[$taskprops["status"]] = 2; $props[$taskprops["reminderset"]] = false; } else { // Set completion to 0% // Set status to 'not started' $props[$taskprops["completion"]] = 0.0; $props[$taskprops["status"]] = 0; } } if (isset($task->recurrence) && class_exists('TaskRecurrence')) { $deadoccur = false; if (isset($task->recurrence->occurrences) && $task->recurrence->occurrences == 1 || isset($task->recurrence->deadoccur) && $task->recurrence->deadoccur == 1) { //ios5 sends deadoccur inside the recurrence $deadoccur = true; } // Set PR_ICON_INDEX to 1281 to show correct icon in category view $props[$taskprops["icon"]] = 1281; // dead occur - false if new occurrences should be generated from the task // true - if it is the last ocurrence of the task $props[$taskprops["deadoccur"]] = $deadoccur; $props[$taskprops["isrecurringtag"]] = true; $recurrence = new TaskRecurrence($this->store, $mapimessage); $recur = array(); $this->setRecurrence($task, $recur); // task specific recurrence properties which we need to set here // "start" and "end" are in GMT when passing to class.recurrence // set recurrence start here because it's calculated differently for tasks and appointments $recur["start"] = $task->recurrence->start; $recur["regen"] = $task->regenerate; //Also add dates to $recur $recur["duedate"] = $task->duedate; $recurrence->setRecurrence($recur); } //open addresss book for user resolve to set the owner $addrbook = $this->getAddressbook(); // check if there is already an owner for the task, set current user if not $p = array($taskprops["owner"]); $owner = $this->getProps($mapimessage, $p); if (!isset($owner[$taskprops["owner"]])) { $userinfo = mapi_zarafa_getuser($this->store, Request::GetAuthUser()); if (mapi_last_hresult() == NOERROR && isset($userinfo["fullname"])) { $props[$taskprops["owner"]] = $userinfo["fullname"]; } } mapi_setprops($mapimessage, $props); }