getRecurrence() публичный Метод

Obtain a recurrence object. Note this returns a Horde_Date_Recurrence object, not Horde_ActiveSync_Message_Recurrence.
public getRecurrence ( ) : Horde_Date_Recurrence
Результат Horde_Date_Recurrence
Пример #1
0
 /**
  * Create a nag Task object from an activesync message
  *
  * @param Horde_ActiveSync_Message_Task $message  The task object
  */
 public function fromASTask(Horde_ActiveSync_Message_Task $message)
 {
     /* Owner is always current user. */
     $this->owner = $GLOBALS['registry']->getAuth();
     /* Notes and Title */
     if ($message->getProtocolVersion() >= Horde_ActiveSync::VERSION_TWELVE) {
         if ($message->airsyncbasebody->type == Horde_ActiveSync::BODYPREF_TYPE_HTML) {
             $this->desc = Horde_Text_Filter::filter($message->airsyncbasebody->data, 'Html2text');
         } else {
             $this->desc = $message->airsyncbasebody->data;
         }
     } else {
         $this->desc = $message->body;
     }
     $this->name = $message->subject;
     $tz = date_default_timezone_get();
     /* Completion */
     if ($this->completed = $message->complete) {
         if ($message->datecompleted) {
             $message->datecompleted->setTimezone($tz);
             $this->completed_date = $message->datecompleted->timestamp();
         } else {
             $this->completed_date = null;
         }
     }
     /* Due Date */
     if (($due = $message->utcduedate) || ($due = $message->duedate)) {
         $due->setTimezone($tz);
         $this->due = $due->timestamp();
     }
     /* Start Date */
     if (($start = $message->utcstartdate) || ($start = $message->startdate)) {
         $start->setTimezone($tz);
         $this->start = $start->timestamp();
     }
     /* Priority */
     switch ($message->getImportance()) {
         case Horde_ActiveSync_Message_Task::IMPORTANCE_LOW:
             $this->priority = 5;
             break;
         case Horde_ActiveSync_Message_Task::IMPORTANCE_NORMAL:
             $this->priority = 3;
             break;
         case Horde_ActiveSync_Message_Task::IMPORTANCE_HIGH:
             $this->priority = 1;
             break;
         default:
             $this->priority = 3;
     }
     if (($alarm = $message->getReminder()) && $this->due) {
         $alarm->setTimezone($tz);
         $this->alarm = ($this->due - $alarm->timestamp()) / 60;
     }
     if ($rrule = $message->getRecurrence()) {
         $this->recurrence = $rrule;
     }
     $this->tasklist = $GLOBALS['prefs']->getValue('default_tasklist');
     /* Categories */
     if (is_array($message->categories) && count($message->categories)) {
         $this->tags = $message->categories;
     }
 }
Пример #2
0
 /**
  * Create a nag Task object from an activesync message
  *
  * @param Horde_ActiveSync_Message_Task $message  The task object
  */
 public function fromASTask(Horde_ActiveSync_Message_Task $message)
 {
     /* Owner is always current user. */
     $this->owner = $GLOBALS['registry']->getAuth();
     /* Must set _tags so we don't lazy load tags from the backend in the
      * case that this is an edit. For edits, all current tags will be passed
      * from the client.
      */
     $this->_tags = array();
     /* Notes and Title */
     if ($message->getProtocolVersion() >= Horde_ActiveSync::VERSION_TWELVE) {
         if ($message->airsyncbasebody->type == Horde_ActiveSync::BODYPREF_TYPE_HTML) {
             $this->desc = Horde_Text_Filter::filter($message->airsyncbasebody->data, 'Html2text');
         } else {
             $this->desc = $message->airsyncbasebody->data;
         }
     } else {
         $this->desc = $message->body;
     }
     $this->name = $message->subject;
     $tz = date_default_timezone_get();
     /* Completion */
     if ($this->completed = $message->complete) {
         if ($message->datecompleted) {
             $message->datecompleted->setTimezone($tz);
             $this->completed_date = $message->datecompleted->timestamp();
         } else {
             $this->completed_date = null;
         }
     }
     /* Due Date */
     if ($due = $message->utcduedate) {
         $due->setTimezone($tz);
         $this->due = $due->timestamp();
     } elseif ($due = $message->duedate) {
         // "Local" date, sent as a UTC datetime string,
         // but must be interpreted as a local time. Since
         // we have no timezone information we have to assume it's the
         // same as $tz.
         $due = new Horde_Date(array('year' => $due->year, 'month' => $due->month, 'mday' => $due->mday, 'hour' => $due->hour, 'min' => $due->min), $tz);
         $this->due = $due->timestamp();
     }
     /* Start Date */
     if ($start = $message->utcstartdate) {
         $start->setTimezone($tz);
         $this->start = $start->timestamp();
     } elseif ($start = $message->startdate) {
         // See note above regarding utc vs local times.
         $start = new Horde_Date(array('year' => $start->year, 'month' => $start->month, 'mday' => $start->mday, 'hour' => $start->hour, 'min' => $start->min), $tz);
         $this->start = $start->timestamp();
     }
     /* Priority */
     switch ($message->getImportance()) {
         case Horde_ActiveSync_Message_Task::IMPORTANCE_LOW:
             $this->priority = 5;
             break;
         case Horde_ActiveSync_Message_Task::IMPORTANCE_NORMAL:
             $this->priority = 3;
             break;
         case Horde_ActiveSync_Message_Task::IMPORTANCE_HIGH:
             $this->priority = 1;
             break;
         default:
             $this->priority = 3;
     }
     if (($alarm = $message->getReminder()) && $this->due) {
         $alarm->setTimezone($tz);
         $this->alarm = ($this->due - $alarm->timestamp()) / 60;
     }
     if ($rrule = $message->getRecurrence()) {
         $this->recurrence = $rrule;
     }
     $this->tasklist = $GLOBALS['prefs']->getValue('default_tasklist');
     /* Categories */
     if (is_array($message->categories) && count($message->categories)) {
         $this->tags = implode(',', $message->categories);
     }
 }