getRecurType() public method

Returns recurrence type of this event.
public getRecurType ( ) : integer
return integer A RECUR_* constant.
Exemplo n.º 1
0
 public function getLink($datetime = null, $icons = true, $from_url = null, $full = false, $encoded = true)
 {
     global $prefs;
     if (is_null($datetime)) {
         $datetime = $this->start;
     }
     if (is_null($from_url)) {
         $from_url = Horde::selfUrl(true, false, true);
     }
     $event_title = $this->getTitle();
     $view_url = $this->getViewUrl(array('datetime' => $datetime->strftime('%Y%m%d%H%M%S'), 'url' => $from_url), $full, $encoded);
     $read_permission = $this->hasPermission(Horde_Perms::READ);
     $link = '<span' . $this->getCSSColors() . '>';
     if ($read_permission && $view_url) {
         $link .= Horde::linkTooltip($view_url, $event_title, $this->getStatusClass(), '', '', $this->getTooltip(), '', array('style' => $this->getCSSColors(false)));
     }
     $link .= htmlspecialchars($event_title);
     if ($read_permission && $view_url) {
         $link .= '</a>';
     }
     if ($icons && $prefs->getValue('show_icons')) {
         $icon_color = $this->_foregroundColor == '#000' ? '000' : 'fff';
         $status = '';
         if ($this->alarm) {
             if ($this->alarm % 10080 == 0) {
                 $alarm_value = $this->alarm / 10080;
                 $title = sprintf(ngettext("Alarm %d week before", "Alarm %d weeks before", $alarm_value), $alarm_value);
             } elseif ($this->alarm % 1440 == 0) {
                 $alarm_value = $this->alarm / 1440;
                 $title = sprintf(ngettext("Alarm %d day before", "Alarm %d days before", $alarm_value), $alarm_value);
             } elseif ($this->alarm % 60 == 0) {
                 $alarm_value = $this->alarm / 60;
                 $title = sprintf(ngettext("Alarm %d hour before", "Alarm %d hours before", $alarm_value), $alarm_value);
             } else {
                 $alarm_value = $this->alarm;
                 $title = sprintf(ngettext("Alarm %d minute before", "Alarm %d minutes before", $alarm_value), $alarm_value);
             }
             $status .= Horde::fullSrcImg('alarm-' . $icon_color . '.png', array('attr' => array('alt' => $title, 'title' => $title, 'class' => 'iconAlarm')));
         }
         if ($this->recurs()) {
             $title = Kronolith::recurToString($this->recurrence->getRecurType());
             $status .= Horde::fullSrcImg('recur-' . $icon_color . '.png', array('attr' => array('alt' => $title, 'title' => $title, 'class' => 'iconRecur')));
         } elseif ($this->baseid) {
             $title = _("Exception");
             $status .= Horde::fullSrcImg('exception-' . $icon_color . '.png', array('attr' => array('alt' => $title, 'title' => $title, 'class' => 'iconRecur')));
         }
         if ($this->private) {
             $title = _("Private event");
             $status .= Horde::fullSrcImg('private-' . $icon_color . '.png', array('attr' => array('alt' => $title, 'title' => $title, 'class' => 'iconPrivate')));
         }
         if (!empty($this->attendees)) {
             $status .= Horde::fullSrcImg('attendees-' . $icon_color . '.png', array('attr' => array('alt' => _("Meeting"), 'title' => _("Meeting"), 'class' => 'iconPeople')));
         }
         $space = ' ';
         if (!empty($this->icon)) {
             $link = $status . '<img class="kronolithEventIcon" src="' . $this->icon . '" /> ' . $link;
         } elseif (!empty($status)) {
             $link .= ' ' . $status;
             $space = '';
         }
         if ((!$this->private || $this->creator == $GLOBALS['registry']->getAuth()) && Kronolith::getDefaultCalendar(Horde_Perms::EDIT)) {
             $url = $this->getEditUrl(array('datetime' => $datetime->strftime('%Y%m%d%H%M%S'), 'url' => $from_url), $full);
             if ($url) {
                 $link .= $space . $url->link(array('title' => sprintf(_("Edit %s"), $event_title), 'class' => 'iconEdit')) . Horde::fullSrcImg('edit-' . $icon_color . '.png', array('attr' => array('alt' => _("Edit")))) . '</a>';
                 $space = '';
             }
         }
         if ($this->hasPermission(Horde_Perms::DELETE)) {
             $url = $this->getDeleteUrl(array('datetime' => $datetime->strftime('%Y%m%d%H%M%S'), 'url' => $from_url), $full);
             if ($url) {
                 $link .= $space . $url->link(array('title' => sprintf(_("Delete %s"), $event_title), 'class' => 'iconDelete')) . Horde::fullSrcImg('delete-' . $icon_color . '.png', array('attr' => array('alt' => _("Delete")))) . '</a>';
             }
         }
     }
     return $link . '</span>';
 }
Exemplo n.º 2
0
 /**
  * Return whether or not this object is equal to another recurrence object.
  * The objects are considered equal if the recurrence rules are the same.
  * This does not take any exceptions into account.
  *
  * @param  Horde_Date_Recurrence $recurrence  The recurrence object to check
  *                                            equality to.
  *
  * @return boolean   True if the recurrence rules are the same.
  * @since  2.2.0
  */
 public function isEqual(Horde_Date_Recurrence $recurrence)
 {
     return $this->getRecurType() == $recurrence->getRecurType() && $this->getRecurInterval() == $recurrence->getRecurInterval() && $this->getRecurCount() == $recurrence->getRecurCount() && $this->getRecurEnd() == $recurrence->getRecurEnd() && $this->getRecurStart() == $recurrence->getRecurStart() && $this->getRecurOnDays() == $recurrence->getRecurOnDays();
 }
Exemplo n.º 3
0
 /**
  * Returns a simple object suitable for json transport representing this
  * task.
  *
  * @param boolean $full        Whether to return all task details.
  * @param string $time_format  The date() format to use for time formatting.
  *
  * @return object  A simple object.
  */
 public function toJson($full = false, $time_format = 'H:i')
 {
     $json = new stdClass();
     $json->l = $this->tasklist;
     $json->p = $this->parent_id;
     $json->i = $this->indent;
     $json->n = $this->name;
     if ($this->desc) {
         //TODO: Get the proper amount of characters, and cut by last
         //whitespace
         $json->sd = Horde_String::substr($this->desc, 0, 80);
     }
     $json->cp = (bool) $this->completed;
     if ($this->due && ($due = $this->getNextDue())) {
         $json->du = $due->toJson();
     }
     if ($this->start && ($start = $this->getNextStart())) {
         $json->s = $start->toJson();
     }
     $json->pr = (int) $this->priority;
     if ($this->recurs()) {
         $json->r = $this->recurrence->getRecurType();
     }
     $json->t = array_values($this->tags);
     if ($full) {
         // @todo: do we really need all this?
         $json->id = $this->id;
         $json->de = $this->desc;
         if ($this->due) {
             $date = new Horde_Date($this->due);
             $json->dd = $date->strftime('%x');
             $json->dt = $date->format($time_format);
         }
         $json->as = $this->assignee;
         if ($this->estimate) {
             $json->e = $this->estimate;
         }
         /*
         $json->o = $this->owner;
         
         if ($this->completed_date) {
             $date = new Horde_Date($this->completed_date);
             $json->cd = $date->toJson();
         }
         */
         $json->a = (int) $this->alarm;
         $json->m = $this->methods;
         //$json->pv = (boolean)$this->private;
         if ($this->recurs()) {
             $json->r = $this->recurrence->toJson();
         }
         if ($this->tasklist == '**EXTERNAL**') {
             $json->vl = (string) $this->view_link;
             $json->cl = (string) $this->complete_link;
             $json->pe = $json->pd = false;
         } else {
             try {
                 $share = $GLOBALS['nag_shares']->getShare($this->tasklist);
             } catch (Horde_Share_Exception $e) {
                 Horde::log($e->getMessage(), 'ERR');
                 throw new Nag_Exception($e);
             }
             $json->pe = $share->hasPermission($GLOBALS['registry']->getAuth(), Horde_Perms::EDIT);
             $json->pd = $share->hasPermission($GLOBALS['registry']->getAuth(), Horde_Perms::DELETE);
         }
     }
     return $json;
 }
Exemplo n.º 4
0
 public function testHashMissingRangeType()
 {
     $r = new Horde_Date_Recurrence(new Horde_Date(1970, 1, 1));
     $r->fromKolab(array('interval' => 1, 'cycle' => 'daily'));
     $this->assertEquals(Horde_Date_Recurrence::RECUR_DAILY, $r->getRecurType());
 }