当前位置: 首页>>代码示例>>PHP>>正文


PHP Kronolith::getTagger方法代码示例

本文整理汇总了PHP中Kronolith::getTagger方法的典型用法代码示例。如果您正苦于以下问题:PHP Kronolith::getTagger方法的具体用法?PHP Kronolith::getTagger怎么用?PHP Kronolith::getTagger使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Kronolith的用法示例。


在下文中一共展示了Kronolith::getTagger方法的11个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: synchronizeTags

 /**
  * Syncronizes tags from the tagging backend with the task storage backend,
  * if necessary.
  *
  * @param array $tags  Tags from the tagging backend.
  */
 public function synchronizeTags($tags)
 {
     if (isset($this->_internaltags)) {
         $lower_internaltags = array_map('Horde_String::lower', $this->_internaltags);
         $lower_tags = array_map('Horde_String::lower', $tags);
         usort($lower_tags, 'strcoll');
         if (array_diff($lower_internaltags, $lower_tags)) {
             Kronolith::getTagger()->replaceTags($this->uid, $this->_internaltags, $this->_creator, Kronolith_Tagger::TYPE_EVENT);
         }
         $this->_tags = $this->_internaltags;
     } else {
         $this->_tags = $tags;
     }
 }
开发者ID:DSNS-LAB,项目名称:Dmail,代码行数:20,代码来源:Event.php

示例2: _addTags

 /**
  * Helper function to add tags from a newly creted event to the tagger.
  *
  * @param Kronolith_Event $event  The event to save tags to storage for.
  */
 protected function _addTags(Kronolith_Event $event)
 {
     $tagger = Kronolith::getTagger();
     $tagger->tag($event->uid, $event->tags, $event->creator, Kronolith_Tagger::TYPE_EVENT);
     // Resources don't currently have owners, so can't tag as owner.
     if ($event->calendarType == 'resource') {
         return;
     }
     // Add tags again, but as the share owner.
     try {
         $cal = $GLOBALS['injector']->getInstance('Kronolith_Shares')->getShare($event->calendar);
     } catch (Horde_Share_Exception $e) {
         Horde::log($e->getMessage(), 'ERR');
         throw new Kronolith_Exception($e);
     }
     if ($cal->get('owner') != $event->creator) {
         $tagger->tag($event->uid, $event->tags, $cal->get('owner'), 'event');
     }
 }
开发者ID:jubinpatel,项目名称:horde,代码行数:24,代码来源:Driver.php

示例3: _listEvents

 /**
  * Lists all events in the time range, optionally restricting results to
  * only events with alarms.
  *
  * @param Horde_Date $startDate  The start of range date.
  * @param Horde_Date $endDate    The end of date range.
  * @param array $options         Additional options:
  *   - show_recurrence: (boolean) Return every instance of a recurring
  *                       event?
  *                      DEFAULT: false (Only return recurring events once
  *                      inside $startDate - $endDate range)
  *   - has_alarm:       (boolean) Only return events with alarms.
  *                      DEFAULT: false (Return all events)
  *   - json:            (boolean) Store the results of the event's toJson()
  *                      method?
  *                      DEFAULT: false
  *   - cover_dates:     (boolean) Add the events to all days that they
  *                      cover?
  *                      DEFAULT: true
  *   - hide_exceptions: (boolean) Hide events that represent exceptions to
  *                      a recurring event.
  *                      DEFAULT: false (Do not hide exception events)
  *   - fetch_tags:      (boolean) Fetch tags for all events.
  *                      DEFAULT: false (Do not fetch event tags)
  *
  * @throws Kronolith_Exception
  */
 protected function _listEvents(Horde_Date $startDate = null, Horde_Date $endDate = null, array $options = array())
 {
     if (!is_null($startDate)) {
         $startDate = clone $startDate;
         $startDate->hour = $startDate->min = $startDate->sec = 0;
     }
     if (!is_null($endDate)) {
         $endDate = clone $endDate;
         $endDate->hour = 23;
         $endDate->min = $endDate->sec = 59;
     }
     $conditions = $options['has_alarm'] ? 'event_alarm > ?' : '';
     $values = $options['has_alarm'] ? array(0) : array();
     if ($options['hide_exceptions']) {
         if (!empty($conditions)) {
             $conditions .= ' AND ';
         }
         $conditions .= "event_baseid = ''";
     }
     $events = $this->_listEventsConditional($startDate, $endDate, $conditions, $values);
     $results = array();
     $tags = null;
     if ($options['fetch_tags'] && count($events)) {
         $tags = Kronolith::getTagger()->getTags(array_keys($events));
     }
     foreach ($events as $id) {
         $event = $this->getEvent($id);
         if (isset($tags) && !empty($tags[$event->uid])) {
             $event->tags = $tags[$event->uid];
         }
         Kronolith::addEvents($results, $event, $startDate, $endDate, $options['show_recurrence'], $options['json'], $options['cover_dates']);
     }
     return $results;
 }
开发者ID:horde,项目名称:horde,代码行数:61,代码来源:Sql.php

示例4: updateCalendar

 /**
  * Update an internal calendar's information.
  *
  * @param string $id      The calendar id.
  * @param array $info     An array of calendar information.
  *                        @see self::addCalendar()
  * @since 4.2.0
  */
 public function updateCalendar($id, array $info)
 {
     $calendar = $this->getCalendar(null, $id);
     // Prevent wiping tags if they were not passed.
     if (!array_key_exists('tags', $info)) {
         $info['tags'] = Kronolith::getTagger()->getTags($id, Kronolith_Tagger::TYPE_CALENDAR);
     }
     Kronolith::updateShare($calendar->share(), $info);
 }
开发者ID:horde,项目名称:horde,代码行数:17,代码来源:Api.php

示例5: catch

// Execute if the form is valid.
if ($owner && $form->validate($vars)) {
    $original_name = $calendar->get('name');
    try {
        $form->execute();
        if ($calendar->get('name') != $original_name) {
            $notification->push(sprintf(_("The calendar \"%s\" has been renamed to \"%s\"."), $original_name, $calendar->get('name')), 'horde.success');
        } else {
            $notification->push(sprintf(_("The calendar \"%s\" has been saved."), $original_name), 'horde.success');
        }
    } catch (Exception $e) {
        $notification->push($e, 'horde.error');
    }
    $default->redirect();
}
$vars->set('name', $calendar->get('name'));
$vars->set('color', $calendar->get('color'));
$vars->set('system', is_null($calendar->get('owner')));
$vars->set('description', $calendar->get('desc'));
$tagger = Kronolith::getTagger();
$vars->set('tags', implode(',', array_values($tagger->getTags($calendar->getName(), Kronolith_Tagger::TYPE_CALENDAR))));
$page_output->header(array('title' => $form->getTitle()));
require KRONOLITH_TEMPLATES . '/javascript_defs.php';
$notification->notify(array('listeners' => 'status'));
if ($owner) {
    $injector->getInstance('Horde_Core_Factory_Imple')->create('Kronolith_Ajax_Imple_TagAutoCompleter', array('id' => 'tags'));
    echo $form->renderActive($form->getRenderer(), $vars, Horde::url('calendars/edit.php'), 'post');
} else {
    echo $form->renderInactive($form->getRenderer(), $vars);
}
$page_output->footer();
开发者ID:jubinpatel,项目名称:horde,代码行数:31,代码来源:edit.php

示例6: synchronize

 /**
  * Synchronize kolab storage backend.
  *
  * We delay initial synchronization to the first use so multiple calendars
  * don't add to the total latency. This function must be called before all
  * internal driver functions.
  *
  * @param boolean $force  If true, forces synchronization, even if we have
  *                        already done so.
  */
 public function synchronize($force = false)
 {
     if ($this->_synchronized && !$force) {
         return;
     }
     // Connect to the Kolab backend
     try {
         $this->_data = $this->_kolab->getData($GLOBALS['calendar_manager']->getEntry(Kronolith::ALL_CALENDARS, $this->calendar)->share()->get('folder'), 'event');
     } catch (Kolab_Storage_Exception $e) {
         throw new Kronolith_Exception($e);
     }
     // build internal event cache
     $this->_events_cache = $uids = array();
     $events = $this->_data->getObjects();
     foreach ($events as $event) {
         $this->_events_cache[Horde_Url::uriB64Encode($event['uid'])] = new Kronolith_Event_Kolab($this, $event);
         $uids[] = $event['uid'];
     }
     $tags = Kronolith::getTagger()->getTags(array_unique($uids));
     foreach ($this->_events_cache as &$event) {
         if (isset($tags[$event->uid])) {
             $event->synchronizeTags($tags[$event->uid]);
         }
     }
     $this->_synchronized = true;
 }
开发者ID:Gomez,项目名称:horde,代码行数:36,代码来源:Kolab.php

示例7: toHash

 /**
  * Returns a hash representing this calendar.
  *
  * @return array  A simple hash.
  */
 public function toHash()
 {
     global $calendar_manager, $conf, $injector, $registry;
     $id = $this->_share->getName();
     $owner = $registry->getAuth() && $this->owner() == $registry->getAuth();
     $hash = parent::toHash();
     $hash['name'] = $this->name();
     $hash['owner'] = $owner;
     $hash['users'] = Kronolith::listShareUsers($this->_share);
     $hash['show'] = in_array($id, $calendar_manager->get(Kronolith::DISPLAY_CALENDARS));
     $hash['edit'] = $this->hasPermission(Horde_Perms::EDIT);
     try {
         $hash['caldav'] = Horde::url($registry->get('webroot', 'horde') . ($conf['urls']['pretty'] == 'rewrite' ? '/rpc/calendars/' : '/rpc.php/calendars/'), true, -1) . $registry->getAuth() . '/' . $injector->getInstance('Horde_Dav_Storage')->getExternalCollectionId($id, 'calendar') . '/';
     } catch (Horde_Exception $e) {
     }
     $hash['sub'] = Horde::url($registry->get('webroot', 'horde') . ($conf['urls']['pretty'] == 'rewrite' ? '/rpc/kronolith/' : '/rpc.php/kronolith/'), true, -1) . ($this->owner() ? $this->owner() : '-system-') . '/' . $id . '.ics';
     $hash['feed'] = (string) Kronolith::feedUrl($id);
     $hash['embed'] = Kronolith::embedCode($id);
     $hash['tg'] = array_values(Kronolith::getTagger()->getTags($id, Kronolith_Tagger::TYPE_CALENDAR));
     if ($owner) {
         $hash['perms'] = Kronolith::permissionToJson($this->_share->getPermission());
     }
     return $hash;
 }
开发者ID:jubinpatel,项目名称:horde,代码行数:29,代码来源:Internal.php

示例8: toKolab

 /**
  * Prepares this event to be saved to the backend.
  */
 public function toKolab()
 {
     $event = array();
     $event['uid'] = $this->uid;
     $event['summary'] = $this->title;
     $event['body'] = $this->description;
     $event['location'] = $this->location;
     $event['sensitivity'] = $this->private ? 'private' : 'public';
     // Only set organizer if this is a new event
     if ($this->_id == null) {
         $organizer = array('display-name' => Kronolith::getUserName($this->creator), 'smtp-address' => Kronolith::getUserEmail($this->creator));
         $event['organizer'] = $organizer;
     }
     if ($this->alarm != 0) {
         $event['alarm'] = $this->alarm;
     }
     if ($this->methods !== null) {
         $event['horde-alarm-methods'] = serialize($this->methods);
     }
     $event['start-date'] = $this->start->toDateTime();
     $event['end-date'] = $this->end->toDateTime();
     $event['_is_all_day'] = $this->isAllDay();
     switch ($this->status) {
         case Kronolith::STATUS_FREE:
         case Kronolith::STATUS_CANCELLED:
             $event['show-time-as'] = 'free';
             break;
         case Kronolith::STATUS_TENTATIVE:
             $event['show-time-as'] = 'tentative';
             break;
             // No mapping for outofoffice
         // No mapping for outofoffice
         case Kronolith::STATUS_CONFIRMED:
         default:
             $event['show-time-as'] = 'busy';
     }
     // Recurrence
     if ($this->recurs()) {
         $event['recurrence'] = $this->recurrence->toKolab();
     }
     // Attendees
     $event['attendee'] = array();
     foreach ($this->attendees as $attendee) {
         $new_attendee = array();
         $new_attendee['display-name'] = $attendee->name;
         // Attendee without an email address
         if (strpos($attendee->email, '@') === false) {
             $new_attendee['smtp-address'] = '';
         } else {
             $new_attendee['smtp-address'] = $attendee->email;
         }
         switch ($attendee->role) {
             case Kronolith::PART_OPTIONAL:
                 $new_attendee['role'] = 'optional';
                 break;
             case Kronolith::PART_NONE:
                 $new_attendee['role'] = 'resource';
                 break;
             case Kronolith::PART_REQUIRED:
             default:
                 $new_attendee['role'] = 'required';
                 break;
         }
         $new_attendee['request-response'] = 'false';
         switch ($attendee->response) {
             case Kronolith::RESPONSE_ACCEPTED:
                 $new_attendee['status'] = 'accepted';
                 break;
             case Kronolith::RESPONSE_DECLINED:
                 $new_attendee['status'] = 'declined';
                 break;
             case Kronolith::RESPONSE_TENTATIVE:
                 $new_attendee['status'] = 'tentative';
                 break;
             case Kronolith::RESPONSE_NONE:
             default:
                 $new_attendee['status'] = 'none';
                 break;
         }
         $event['attendee'][] = $new_attendee;
     }
     // Tags
     if (!is_array($this->tags)) {
         $this->tags = Kronolith::getTagger()->split($this->tags);
     }
     if ($this->tags) {
         $event['categories'] = $this->tags;
     }
     return $event;
 }
开发者ID:horde,项目名称:horde,代码行数:93,代码来源:Kolab.php

示例9: synchronize

 /**
  * Synchronize kolab storage backend.
  *
  * We delay initial synchronization to the first use so multiple calendars
  * don't add to the total latency. This function must be called before all
  * internal driver functions.
  *
  * @param boolean $force  If true, forces synchronization, even if we have
  *                        already done so.
  */
 public function synchronize($force = false, $token = false)
 {
     // Only sync once unless $force.
     if ($this->_synchronized && !$force) {
         return;
     }
     // If we are synching and have a token, only synch if it is different.
     $last_token = $GLOBALS['session']->get('kronolith', 'kolab/token/' . $this->calendar);
     if (!empty($token) && $last_token == $token) {
         return;
     }
     if (!empty($token)) {
         $GLOBALS['session']->set('kronolith', 'kolab/token/' . $this->calendar, $token);
     }
     // Connect to the Kolab backend
     try {
         $this->_data = $this->_kolab->getData($GLOBALS['calendar_manager']->getEntry(Kronolith::ALL_CALENDARS, $this->calendar)->share()->get('folder'), 'event');
         $this->_data->synchronize();
     } catch (Kolab_Storage_Exception $e) {
         throw new Kronolith_Exception($e);
     }
     // build internal event cache
     $this->_events_cache = $uids = array();
     $events = $this->_data->getObjects();
     foreach ($events as $event) {
         $this->_events_cache[Horde_Url::uriB64Encode($event['uid'])] = new Kronolith_Event_Kolab($this, $event);
         $uids[] = $event['uid'];
     }
     $tags = Kronolith::getTagger()->getTags(array_unique($uids));
     foreach ($this->_events_cache as &$event) {
         if (isset($tags[$event->uid])) {
             $event->synchronizeTags($tags[$event->uid]);
         }
     }
     $this->_synchronized = true;
 }
开发者ID:horde,项目名称:horde,代码行数:46,代码来源:Kolab.php

示例10: _handleAutoCompleter

 /**
  */
 protected function _handleAutoCompleter($input)
 {
     return array_values(Kronolith::getTagger()->listTags($input));
 }
开发者ID:DSNS-LAB,项目名称:Dmail,代码行数:6,代码来源:TagAutoCompleter.php

示例11: toHash

 /**
  * Returns a hash representing this calendar.
  *
  * @return array  A simple hash.
  */
 public function toHash()
 {
     global $calendar_manager, $conf, $injector, $registry;
     $id = $this->_share->getName();
     $owner = $registry->getAuth() && ($this->owner() == $registry->getAuth() || $this->isSystem() && $registry->isAdmin());
     $hash = parent::toHash();
     $hash['name'] = $this->name();
     $hash['owner'] = $owner;
     $hash['system'] = $this->isSystem();
     $hash['users'] = Kronolith::listShareUsers($this->_share);
     $hash['show'] = in_array($id, $calendar_manager->get(Kronolith::DISPLAY_CALENDARS));
     $hash['edit'] = $this->hasPermission(Horde_Perms::EDIT);
     $hash['delete'] = $this->hasPermission(Horde_Perms::DELETE);
     $hash['caldav'] = $this->caldavUrl();
     $hash['sub'] = Horde::url($registry->get('webroot', 'horde') . ($conf['urls']['pretty'] == 'rewrite' ? '/rpc/kronolith/' : '/rpc.php/kronolith/'), true, -1) . ($this->owner() ? $registry->convertUsername($this->owner(), false) : '-system-') . '/' . $id . '.ics';
     $hash['feed'] = (string) Kronolith::feedUrl($id);
     $hash['embed'] = Kronolith::embedCode($id);
     $hash['tg'] = array_values(Kronolith::getTagger()->getTags($id, Kronolith_Tagger::TYPE_CALENDAR));
     if ($owner) {
         $hash['perms'] = Kronolith::permissionToJson($this->_share->getPermission(), is_null($this->_share->get('owner')));
     }
     return $hash;
 }
开发者ID:horde,项目名称:horde,代码行数:28,代码来源:Internal.php


注:本文中的Kronolith::getTagger方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。