public function GetHomeCollectionUrl($siteId, $account, $arPath) { if (is_null($siteId)) { return ""; } $url = "/" . $siteId; if (is_null($account)) { if (is_null($arPath) || count($arPath) == 0) { return ""; } return $url . "/calendar/" . $arPath[0] . "/"; } $arAccount = CDavAccount::GetAccountById($account); if (is_null($arAccount)) { return ""; } return $url . "/" . $arAccount["CODE"] . "/calendar/"; }
private function GetCollectionProperties(&$resource, $siteId, $account = null, $arPath = null) { $resource->AddProperty('current-user-principal', array('href', $this->request->GetPrincipalUrl())); $resource->AddProperty('principal-collection-set', array('href', $this->request->GetBaseUri() . '/principals/')); $resource->AddProperty('principal-URL', array('href', $this->request->GetPrincipalUrl())); $arAccount = null; if ($account != null) { $arAccount = CDavAccount::GetAccountById($account); $resource->AddProperty('owner', array('href', $this->request->GetBaseUri() . '/principals/' . $arAccount["TYPE"] . '/' . $arAccount["CODE"] . '/')); $resource->AddProperty('alternate-URI-set', array('href', 'MAILTO:' . $arAccount['EMAIL'])); $resource->AddProperty('email-address-set', array('email-address', $arAccount['EMAIL'], self::CALENDARSERVER), self::CALENDARSERVER); } $resource->AddProperty('getetag', 'no-etag'); $resource->AddProperty('displayname', $arAccount != null ? $arAccount["NAME"] : "Company"); }
public function GetAddressbookProperties(CDavResource $resource, $siteId, $account = null, $arPath = null, $options = 0) { $resource->AddProperty('resourcetype', array(array('collection', ''), array('vcard-collection', '', CDavGroupDav::GROUPDAV), array('addressbook', '', CDavGroupDav::CARDDAV))); $resource->AddProperty('component-set', 'VCARD', CDavGroupDav::GROUPDAV); $resource->AddProperty('supported-report-set', array(array('supported-report', array(CDavResource::MakeProp('report', array(CDavResource::MakeProp('addressbook-query', '', CDavGroupDav::CARDDAV))))), array('supported-report', array(CDavResource::MakeProp('report', array(CDavResource::MakeProp('addressbook-multiget', '', CDavGroupDav::CARDDAV))))))); $resource->AddProperty('getctag', $this->GetCTag($siteId, $account, $arPath), CDavGroupDav::CALENDARSERVER); $arAccount = null; if ($account != null) { $arAccount = CDavAccount::GetAccountById($account); $resource->AddProperty('addressbook-description', $arAccount["NAME"], CDavGroupDav::CARDDAV); } }
protected function PropfindUsers(&$arResources, $siteId, $account, $arPath, $id = null, $depth = 0) { $request = $this->groupdav->GetRequest(); if (is_null($account)) { $resource = new CDavResource("/principals/user/"); $resource->AddProperty('current-user-principal', array('href', $request->GetPrincipalUrl())); $resource->AddProperty('resourcetype', array(array('collection', ''), array('principal', '', CDavGroupDav::DAV))); $arResources[] = $resource; if ($depth) { $arUsers = CDavAccount::GetAccountsList("user"); foreach ($arUsers as $u) { $this->AddUser($arResources, $siteId, $u); } } } else { $arUser = CDavAccount::GetAccountById($account); if (!$arUser) { return '404 Not Found'; } $this->AddUser($arResources, $siteId, $arUser); } return true; }