/** * converts a string or Addressbook_Model_List to a list id * * @param string|Addressbook_Model_List $_listId the contact id to convert * * @return string * @throws UnexpectedValueException if no list id set */ public static function convertListIdToInt($_listId) { if ($_listId instanceof self) { if ($_listId->getId() == null) { throw new UnexpectedValueException('No identifier set.'); } $id = (string) $_listId->getId(); } else { $id = (string) $_listId; } if (empty($id)) { throw new UnexpectedValueException('Identifier can not be empty.'); } return $id; }
/** * convert list model to principal array * * @param Addressbook_Model_List $list * @param string $prefix * @return array */ protected function _listToPrincipal(Addressbook_Model_List $list, $prefix) { $calUserType = $prefix == self::PREFIX_INTELLIGROUPS ? 'INTELLIGROUP' : 'GROUP'; $principal = array('uri' => $prefix . '/' . $list->getId(), '{DAV:}displayname' => $list->name . ' (' . ($translation = Tinebase_Translation::getTranslation('Calendar')->_('Group') . ')'), '{DAV:}alternate-URI-set' => array('urn:uuid:' . $prefix . '/' . $list->getId()), '{' . \Sabre\CalDAV\Plugin::NS_CALDAV . '}calendar-user-type' => $calUserType, '{' . \Sabre\CalDAV\Plugin::NS_CALENDARSERVER . '}record-type' => 'groups', '{' . \Sabre\CalDAV\Plugin::NS_CALENDARSERVER . '}first-name' => Tinebase_Translation::getTranslation('Calendar')->_('Group'), '{' . \Sabre\CalDAV\Plugin::NS_CALENDARSERVER . '}last-name' => $list->name); if ($calUserType == 'INTELLIGROUP') { // OSX needs an email adress to send the attendee $principal['{http://sabredav.org/ns}email-address'] = 'urn:uuid:' . $prefix . '/' . $list->getId(); } return $principal; }
/** * @param Addressbook_Model_List $record * @return Tinebase_Record_RecordSet|Addressbook_Model_ListMemberRole */ protected function _getMemberRoles($record) { $result = $this->_getMemberRolesBackend()->getMultipleByProperty($record->getId(), 'list_id'); return $result; }
/** * convert list model to principal array * * @param Addressbook_Model_List $list * @return array */ protected function _listToPrincipal(Addressbook_Model_List $list) { $principal = array('uri' => self::PREFIX_GROUPS . '/' . $list->getId(), '{DAV:}displayname' => $list->name . ' (Group)', '{DAV:}alternate-URI-set' => array('urn:uuid:' . $list->getId()), '{' . \Sabre\CalDAV\Plugin::NS_CALDAV . '}calendar-user-type' => 'GROUP', '{' . \Sabre\CalDAV\Plugin::NS_CALENDARSERVER . '}record-type' => 'groups', '{' . \Sabre\CalDAV\Plugin::NS_CALENDARSERVER . '}first-name' => 'Group', '{' . \Sabre\CalDAV\Plugin::NS_CALENDARSERVER . '}last-name' => $list->name); return $principal; }