/** * force activesync calendar resync for iOS devices */ public function update_11() { if (Tinebase_Application::getInstance()->isInstalled('ActiveSync')) { $deviceBackend = new ActiveSync_Backend_Device(); $usersWithiPhones = $deviceBackend->search(new ActiveSync_Model_DeviceFilter(array('devicetype' => 'iphone')))->owner_id; $activeSyncController = ActiveSync_Controller::getInstance(); foreach ($usersWithiPhones as $userId) { try { $activeSyncController->resetSyncForUser($userId, 'Calendar'); } catch (Exception $e) { Tinebase_Exception::log($e, false); } } } $this->setApplicationVersion('Calendar', '8.12'); }
/** * Returns registry data of the application. * * Each application has its own registry to supply static data to the client. * Registry data is queried only once per session from the client. * * This registry must not be used for rights or ACL purposes. Use the generic * rights and ACL mechanisms instead! */ public function getRegistryData() { $deviceBackend = new ActiveSync_Backend_Device(); $userDevices = $deviceBackend->search(new ActiveSync_Model_DeviceFilter(array(array('field' => 'owner_id', 'operator' => 'equals', 'value' => Tinebase_Core::getUser()->getId())))); return array('userDevices' => $userDevices->toArray()); }
/** * fetch devices for user * * @param string $userId */ protected function _getDevicesForUser($userId) { $deviceBackend = new ActiveSync_Backend_Device(); $deviceFilter = new ActiveSync_Model_DeviceFilter(array(array('field' => 'owner_id', 'operator' => 'equals', 'value' => $userId))); $devices = $deviceBackend->search($deviceFilter); return $devices; }
/** * search device * * @param string $_deviceId * @param string $_type * @param string|optional $_counter * @return ActiveSync_Model_SyncState */ public function searchDevice(ActiveSync_Model_DeviceFilter $_deviceFilter) { $device = $this->_deviceBackend->search($_deviceFilter); return $device; }