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

Retrieve all objects in the current folder.
public getObjects ( ) : array
Результат array An array of all objects.
Пример #1
0
 /**
  * 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;
 }
Пример #2
0
 /**
  * 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');
     } 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;
 }
Пример #3
0
 /**
  * Synchronize the preferences information with the information from the
  * backend.
  *
  * @param array $params Additional parameters.
  *
  * @return NULL
  */
 public function synchronize($params = array())
 {
     $this->_mapping = array();
     foreach ($this->_data->getObjects() as $id => $data) {
         $this->_mapping[$data['application']] = $id;
     }
     $this->_data_cache->setQuery(self::PREFS, $this->_mapping);
 }
Пример #4
0
 /**
  * Initialize the application <-> object mapping.
  *
  * @return NULL
  */
 private function _initMapping()
 {
     if ($this->_mapping === null) {
         foreach ($this->_data->getObjects() as $id => $data) {
             $this->_mapping[$data['application']] = $id;
         }
     }
 }
Пример #5
0
 /**
  * Retrieve all objects in the current folder.
  *
  * @return array An array of all objects.
  */
 public function getObjects()
 {
     $result = $this->_data->getObjects();
     if (count($result) < 20) {
         $ids = '[' . join(', ', array_keys($result)) . ']';
     } else {
         $ids = '[too many to list]';
     }
     $this->_logger->debug(sprintf('%s has %s objects %s.', $this->_data->getPath(), count($result), $ids));
     return $result;
 }