| 1: | <?php |
| 2: | |
| 3: | |
| 4: | |
| 5: | |
| 6: | |
| 7: | |
| 8: | namespace Aurora\Modules\DavContacts; |
| 9: | |
| 10: | |
| 11: | |
| 12: | |
| 13: | |
| 14: | |
| 15: | |
| 16: | |
| 17: | |
| 18: | |
| 19: | |
| 20: | |
| 21: | class Module extends \Aurora\System\Module\AbstractModule |
| 22: | { |
| 23: | protected $aRequireModules = [ |
| 24: | 'Contacts' |
| 25: | ]; |
| 26: | |
| 27: | protected $_oldGroup = null; |
| 28: | |
| 29: | protected $__LOCK_AFTER_CREATE_CONTACT_SUBSCRIBE__ = false; |
| 30: | protected $__LOCK_AFTER_UPDATE_CONTACT_SUBSCRIBE__ = false; |
| 31: | |
| 32: | |
| 33: | |
| 34: | |
| 35: | public static function getInstance() |
| 36: | { |
| 37: | return parent::getInstance(); |
| 38: | } |
| 39: | |
| 40: | |
| 41: | |
| 42: | |
| 43: | public static function Decorator() |
| 44: | { |
| 45: | return parent::Decorator(); |
| 46: | } |
| 47: | |
| 48: | |
| 49: | |
| 50: | |
| 51: | public function getModuleSettings() |
| 52: | { |
| 53: | return $this->oModuleSettings; |
| 54: | } |
| 55: | |
| 56: | public function init() |
| 57: | { |
| 58: | $this->subscribeEvent('MobileSync::GetInfo', array($this, 'onGetMobileSyncInfo')); |
| 59: | } |
| 60: | |
| 61: | public function onGetMobileSyncInfo($aArgs, &$mResult) |
| 62: | { |
| 63: | $oDavModule = \Aurora\Modules\Dav\Module::Decorator(); |
| 64: | |
| 65: | $sDavServer = $oDavModule->GetServerUrl(); |
| 66: | $aAddressBooks = \Aurora\Modules\Contacts\Module::Decorator()->GetStorages(); |
| 67: | |
| 68: | $mResult['Dav']['Contacts'] = array(); |
| 69: | if (is_array($aAddressBooks) && count($aAddressBooks) > 0) { |
| 70: | foreach ($aAddressBooks as $oBook) { |
| 71: | $mResult['Dav']['Contacts'][] = array( |
| 72: | 'Name' => isset($oBook['DisplayName']) ? $oBook['DisplayName'] : '', |
| 73: | 'Url' => isset($oBook['Url']) ? rtrim($sDavServer . $oBook['Url'], '/') . '/' : '' |
| 74: | ); |
| 75: | } |
| 76: | } |
| 77: | } |
| 78: | } |
| 79: | |