本文整理汇总了PHP中OC_Calendar_Calendar::allCalendarsWherePrincipalURIIs方法的典型用法代码示例。如果您正苦于以下问题:PHP OC_Calendar_Calendar::allCalendarsWherePrincipalURIIs方法的具体用法?PHP OC_Calendar_Calendar::allCalendarsWherePrincipalURIIs怎么用?PHP OC_Calendar_Calendar::allCalendarsWherePrincipalURIIs使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类OC_Calendar_Calendar
的用法示例。
在下文中一共展示了OC_Calendar_Calendar::allCalendarsWherePrincipalURIIs方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: getCalendarsForUser
/**
* Returns a list of calendars for a principal.
*
* Every project is an array with the following keys:
* * id, a unique id that will be used by other functions to modify the
* calendar. This can be the same as the uri or a database key.
* * uri, which the basename of the uri with which the calendar is
* accessed.
* * principalUri. The owner of the calendar. Almost always the same as
* principalUri passed to this method.
*
* Furthermore it can contain webdav properties in clark notation. A very
* common one is '{DAV:}displayname'.
*
* @param string $principalUri
* @return array
*/
public function getCalendarsForUser($principalUri)
{
$raw = OC_Calendar_Calendar::allCalendarsWherePrincipalURIIs($principalUri);
$calendars = array();
foreach ($raw as $row) {
$components = explode(',', $row['components']);
if ($row['userid'] != OCP\USER::getUser()) {
$row['uri'] = $row['uri'] . '_shared_by_' . $row['userid'];
}
$calendar = array('id' => $row['id'], 'uri' => $row['uri'], 'principaluri' => 'principals/' . $row['userid'], '{' . \Sabre\CalDAV\Plugin::NS_CALENDARSERVER . '}getctag' => $row['ctag'] ? $row['ctag'] : '0', '{' . \Sabre\CalDAV\Plugin::NS_CALDAV . '}supported-calendar-component-set' => new \Sabre\CalDAV\Property\SupportedCalendarComponentSet($components));
foreach ($this->propertyMap as $xmlName => $dbName) {
$calendar[$xmlName] = isset($row[$dbName]) ? $row[$dbName] : '';
}
$calendars[] = $calendar;
}
if (\OCP\App::isEnabled('contacts')) {
$ctag = 0;
$app = new \OCA\Contacts\App();
$addressBooks = $app->getAddressBooksForUser();
foreach ($addressBooks as $addressBook) {
$tmp = $addressBook->lastModified();
if (!is_null($tmp)) {
$ctag = max($ctag, $tmp);
}
}
$ctag++;
$calendars[] = array('id' => 'contact_birthdays', 'uri' => 'contact_birthdays', '{DAV:}displayname' => (string) OC_Calendar_App::$l10n->t('Contact birthdays'), 'principaluri' => 'principals/contact_birthdays', '{' . \Sabre\CalDAV\Plugin::NS_CALENDARSERVER . '}getctag' => $ctag, '{' . \Sabre\CalDAV\Plugin::NS_CALDAV . '}supported-calendar-component-set' => new \Sabre\CalDAV\Property\SupportedCalendarComponentSet(array('VEVENT')), '{http://apple.com/ns/ical/}calendar-color' => '#CCCCCC');
}
return $calendars;
}
示例2: getCalendarsForUser
/**
* Returns a list of calendars for a principal.
*
* Every project is an array with the following keys:
* * id, a unique id that will be used by other functions to modify the
* calendar. This can be the same as the uri or a database key.
* * uri, which the basename of the uri with which the calendar is
* accessed.
* * principalUri. The owner of the calendar. Almost always the same as
* principalUri passed to this method.
*
* Furthermore it can contain webdav properties in clark notation. A very
* common one is '{DAV:}displayname'.
*
* @param string $principalUri
* @return array
*/
public function getCalendarsForUser($principalUri)
{
$raw = OC_Calendar_Calendar::allCalendarsWherePrincipalURIIs($principalUri);
$calendars = array();
foreach ($raw as $row) {
$components = explode(',', $row['components']);
$calendar = array('id' => $row['id'], 'uri' => $row['uri'], 'principaluri' => 'principals/' . $row['userid'], '{' . Sabre_CalDAV_Plugin::NS_CALENDARSERVER . '}getctag' => $row['ctag'] ? $row['ctag'] : '0', '{' . Sabre_CalDAV_Plugin::NS_CALDAV . '}supported-calendar-component-set' => new Sabre_CalDAV_Property_SupportedCalendarComponentSet($components));
foreach ($this->propertyMap as $xmlName => $dbName) {
$calendar[$xmlName] = $row[$dbName];
}
$calendars[] = $calendar;
}
return $calendars;
}
示例3: getCalendarsForUser
/**
* Returns a list of calendars for a principal.
*
* Every project is an array with the following keys:
* * id, a unique id that will be used by other functions to modify the
* calendar. This can be the same as the uri or a database key.
* * uri, which the basename of the uri with which the calendar is
* accessed.
* * principalUri. The owner of the calendar. Almost always the same as
* principalUri passed to this method.
*
* Furthermore it can contain webdav properties in clark notation. A very
* common one is '{DAV:}displayname'.
*
* @param string $principalUri
* @return array
*/
public function getCalendarsForUser($principalUri)
{
$raw = OC_Calendar_Calendar::allCalendarsWherePrincipalURIIs($principalUri);
$calendars = array();
foreach ($raw as $row) {
$components = explode(',', $row['components']);
if ($row['userid'] != OCP\USER::getUser()) {
$row['uri'] = $row['uri'] . '_shared_by_' . $row['userid'];
}
$calendar = array('id' => $row['id'], 'uri' => $row['uri'], 'principaluri' => 'principals/' . $row['userid'], '{' . Sabre_CalDAV_Plugin::NS_CALENDARSERVER . '}getctag' => $row['ctag'] ? $row['ctag'] : '0', '{' . Sabre_CalDAV_Plugin::NS_CALDAV . '}supported-calendar-component-set' => new Sabre_CalDAV_Property_SupportedCalendarComponentSet($components));
foreach ($this->propertyMap as $xmlName => $dbName) {
$calendar[$xmlName] = $row[$dbName];
}
$calendars[] = $calendar;
}
if (\OCP\App::isEnabled('contacts')) {
\OCP\Share::registerBackend('addressbook', 'OCA\\Contacts\\Share\\Addressbook', 'contact');
$app = new \OCA\Contacts\App(\OCP\User::getUser());
$calendars[] = array('id' => 'contact_birthdays', 'uri' => 'contact_birthdays', '{DAV:}displayname' => (string) OC_Calendar_App::$l10n->t('Contact birthdays'), 'principaluri' => 'principals/contact_birthdays', '{' . Sabre_CalDAV_Plugin::NS_CALENDARSERVER . '}getctag' => '0', '{' . Sabre_CalDAV_Plugin::NS_CALDAV . '}supported-calendar-component-set' => new Sabre_CalDAV_Property_SupportedCalendarComponentSet(array('VEVENT')));
}
return $calendars;
}