break;
case self::TASKS_FOLDER:
- // @TODO?
+ $tasks = $this->_connector->tasks_listTasks();
+ foreach ($tasks as $task)
+ {
+ $messages[] = $this->_smartStatMessage($folderid, $task, true);
+ }
+ break;
+
default:
return false;
}
/**
* Get a message from the backend
- *
+ *
* @see framework/ActiveSync/lib/Horde/ActiveSync/Driver/Horde_ActiveSync_Driver_Base#GetMessage($folderid, $id, $truncsize, $mimesupport)
*/
public function GetMessage($folderid, $id, $truncsize, $mimesupport = 0)
$this->_logger->err($e->GetMessage());
return false;
}
- //$message = self::_fromVCalendar($event);
-
break;
case self::CONTACTS_FOLDER:
return false;
}
- $message = self::_fromHash($contact);
+ return self::_fromHash($contact);
break;
case self::TASKS_FOLDER:
- // @TODO
+ try {
+ return $this->_connector->tasks_export($id);
+ } catch (Horde_Exception $e) {
+ $this->_logger->err($e->GetMessage());
+ return false;
+ }
break;
default:
return false;
}
-
- return $message;
}
/**
break;
case self::TASKS_FOLDER:
+ try {
+ $status = $this->_connector->tasks_delete($id);
+ } catch (Horde_Exception $e) {
+ $this->_logger->err($e->getMessage());
+ return false;
+ }
break;
default:
return false;
$stat = $this->_smartStatMessage($folderid, $id, false);
}
case self::TASKS_FOLDER:
+ if (!$id) {
+ try {
+ $id = $this->_connector->tasks_import($message);
+ } catch (Horde_Exception $e) {
+ $this->_logger->err($e->getMessage());
+ return false;
+ }
+
+ $stat = $this->_smartStatMessage($folderid, $id, false);
+ } else {
+ try {
+ $this->_connector->tasks_replace($id, $message);
+ } catch (Horde_Exception $e) {
+ $this->_logger->err($e->getMessage());
+ return false;
+ }
+ $stat = $this->_smartStatMessage($folderid, $id, false);
+ }
+
break;
default:
return false;
}
+
return $stat;
}
$mod = $this->_connector->contacts_getActionTimestamp($id, 'modify');
break;
case self::TASKS_FOLDER:
+ $mod = $this->_connector->tasks_getActionTimestamp($id, 'modify');
+
break;
default:
return false;
public function tasks_listTasks()
{
- return $this->_registry->tasks->listTasks();
+ $app = $this->horde_hasInterface('tasks');
+ $tasklist = $this->horde_getPref($app, 'default_tasklist');
+ return $this->_registry->tasks->listTaskUids($tasklist);
+ }
+
+ public function tasks_export($uid)
+ {
+ return $this->_registry->tasks->export($uid, 'activesync');
+ }
+
+ public function tasks_import($message)
+ {
+ return $this->_registry->tasks->import($message, 'activesync');
+ }
+
+ public function tasks_replace($uid, $message)
+ {
+ return $this->_registry->tasks->replace($uid, $message, 'activesync');
+ }
+
+ public function tasks_delete($id)
+ {
+ return $this->_registry->tasks->delete($id);
+ }
+
+ public function tasks_getActionTimestamp($uid, $action)
+ {
+ return $this->_registry->tasks->getActionTimestamp($uid, $action);
}
public function horde_listApis()
public function horde_getPref($app, $pref)
{
- return $this->_registry->horde->getPref($app, $pref);
+ return $this->_registry->horde->getPreference($app, $pref);
+ }
+
+ public function horde_hasInterface($api)
+ {
+ return $this->_registry->hasInterface($api);
}
}
\ No newline at end of file
const POOMTASKS_SUBJECT = 'POOMTASKS:Subject';
const POOMTASKS_RTF = 'POOMTASKS:Rtf';
+ const TASK_COMPLETE_TRUE = 1;
+ const TASK_COMPLETE_FALSE = 0;
+
+ const IMPORTANCE_LOW = 0;
+ const IMPORTANCE_NORMAL = 1;
+ const IMPORTANCE_HIGH = 2;
+
+ const REMINDER_SET_FALSE = 0;
+ const REMINDER_SET_TRUE = 1;
+
/**
* Const'r
*
parent::__construct($mapping, $params);
}
-
+
+ /**
+ * Sets the task subject
+ *
+ * @param string $subject
+ */
+ public function setSubject($subject)
+ {
+ $this->_properties['subject'] = $subject;
+ }
+
+ /**
+ * Get the task subject/title
+ *
+ * @return string The task subject
+ */
+ public function getSubject()
+ {
+ return $this->_getAttribute('subject');
+ }
+
+ /**
+ * Returns the body of the task.
+ *
+ * @return string The descriptive body.
+ */
+ public function getBody()
+ {
+ return $this->_getAttribute('body');
+ }
+
+ /**
+ * Set the task body element.
+ *
+ * @param string $body The task body
+ */
+ public function setBody($body)
+ {
+ $this->_properties['body'] = $body;
+ }
+
+ /**
+ * Set the task completion flag
+ *
+ * @param integer $flag TASK_COMPLETE constant
+ */
+ public function setComplete($flag)
+ {
+ $this->_properties['complete'] = $flag;
+ }
+
+ /**
+ * Get the completion flag
+ *
+ * @return integer A TASK_COMPLETE constant
+ */
+ public function getComplete()
+ {
+ return $this->_getAttribute('complete');
+ }
+
+ /**
+ * Set the date the task was completed.
+ *
+ * @param Horde_Date $date The date in local tz.
+ */
+ public function setDateCompleted($date)
+ {
+ $this->_properties['datecompleted'] = $date;
+ }
+
+ /**
+ * Get the date completed.
+ *
+ * @return Horde_Date The date in the local tz.
+ */
+ public function getDateCompleted()
+ {
+ return $this->_getAttribute('datecompleted');
+ }
+
+ /**
+ * Set the due date. Note that even though the property is called UTCDueDate
+ * we still pass a Horde_Date in the user's timezone since the dates are
+ * transformed to UTC during encoding. Yay consistency...
+ *
+ *
+ */
+ public function setDueDate($date)
+ {
+ $this->_properties['utcduedate'] = $date;
+ }
+
+ /**
+ * Get the task due date.
+ *
+ * @return Horde_Date Date in local tz
+ */
+ public function getDueDate()
+ {
+ return $this->_getAttribute('utcduedate');
+ }
+
+ /**
+ * Set the importance
+ *
+ * @param integer $importance A IMPORTANCE_* flag
+ */
+ public function setImportance($importance)
+ {
+ if (is_null($importance)) {
+ $importance = self::IMPORTANCE_NORMAL;
+ }
+
+ $this->_properties['importance'] = $importance;
+ }
+
+ /**
+ * Get the task importance level
+ *
+ * @return integer A IMPORTANCE_* constant
+ */
+ public function getImportance()
+ {
+ return $this->_getAttribute('importance', self::IMPORTANCE_NORMAL);
+ }
+
+ /**
+ * Set the reminder datetime
+ *
+ * @param Horde_Date $datetime The time to trigger the alarm in local tz.
+ */
+ public function setReminder($datetime)
+ {
+ $this->_properties['remindertime'] = $datetime;
+ $this->_properties['reminderset'] = self::REMINDER_SET_TRUE;
+ }
+
+ /**
+ * Get the reminder time.
+ *
+ * @return Horde_Date in local tz
+ */
+ public function getReminder()
+ {
+ if (!$this->_getAttribute('reminderset')) {
+ return false;
+ }
+
+ return $this->_getAttribute('remindertime');
+ }
+
+ /**
+ * Set the task start datetime
+ *
+ * @param Horde_Date $date Date in local tz
+ */
+ public function setStartDate($date)
+ {
+ $this->_properties['utcstartdate'] = $date;
+ }
+
+ /**
+ * Get the task start datetime
+ *
+ * @return Horde_Date
+ */
+ public function getStartDate()
+ {
+ return $this->_getAttribute('utcstartdate');
+ }
+
+ /**
+ * Return this object's folder class
+ *
+ * @return string
+ */
+ public function getClass()
+ {
+ return 'Tasks';
+ }
+
}
\ No newline at end of file