本文整理汇总了PHP中OC_Calendar_Object::getowner方法的典型用法代码示例。如果您正苦于以下问题:PHP OC_Calendar_Object::getowner方法的具体用法?PHP OC_Calendar_Object::getowner怎么用?PHP OC_Calendar_Object::getowner使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类OC_Calendar_Object
的用法示例。
在下文中一共展示了OC_Calendar_Object::getowner方法的11个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: generateTarget
public function generateTarget($itemSource, $shareWith, $exclude = null)
{
if (!self::$event) {
self::$event = OC_Calendar_Object::find($itemSource);
}
return self::$event['summary'] .= ' (' . OC_Calendar_App::$l10n->t('by') . ' ' . OC_Calendar_Object::getowner(self::$event['id']) . ')';
}
示例2: generateEvent
/**
* @brief generates the VEVENT/VTODO/VJOURNAL with UTC dates
* @param array $event
* @return string
*/
private static function generateEvent($event)
{
$object = OC_VObject::parse($event['calendardata']);
if (!$object) {
return false;
}
$sharedAccessClassPermissions = OC_Calendar_Object::getAccessClassPermissions($object);
if (OC_Calendar_Object::getowner($event['id']) !== OCP\User::getUser()) {
if (!($sharedAccessClassPermissions & OCP\PERMISSION_READ)) {
return '';
}
}
$object = OC_Calendar_Object::cleanByAccessClass($event['id'], $object);
if ($object->VEVENT) {
$dtstart = $object->VEVENT->DTSTART;
$start_dt = $dtstart->getDateTime();
$dtend = OC_Calendar_Object::getDTEndFromVEvent($object->VEVENT);
$end_dt = $dtend->getDateTime();
if ($dtstart->getDateType() !== Sabre\VObject\Property\DateTime::DATE) {
$start_dt->setTimezone(new DateTimeZone('UTC'));
$end_dt->setTimezone(new DateTimeZone('UTC'));
$object->VEVENT->setDateTime('DTSTART', $start_dt, Sabre\VObject\Property\DateTime::UTC);
$object->VEVENT->setDateTime('DTEND', $end_dt, Sabre\VObject\Property\DateTime::UTC);
}
return $object->VEVENT->serialize();
}
if ($object->VTODO) {
return $object->VTODO->serialize();
}
if ($object->VJOURNAL) {
return $object->VJOURNAL->serialize();
}
return '';
}
示例3: parseVTODO
public static function parseVTODO($task)
{
$object = \Sabre\VObject\Reader::read($task['calendardata']);
if (!$object) {
return false;
}
$sharedAccessClassPermissions = \OC_Calendar_Object::getAccessClassPermissions($object);
if (\OC_Calendar_Object::getowner($task['id']) !== \OC::$server->getUserSession()->getUser()->getUID()) {
if (!($sharedAccessClassPermissions & \OCP\Constants::PERMISSION_READ)) {
return false;
}
}
$object = \OC_Calendar_Object::cleanByAccessClass($task['id'], $object);
$vtodo = $object->VTODO;
return $vtodo;
}
示例4: checkTask
/**
* check if task is valid
*
* @param \OCA\Tasks\Db\Tasks $task
* @return mixed
*/
public function checkTask($task)
{
$object = $this->readTask($task);
if (!$object) {
return false;
}
if (\OC_Calendar_Object::getowner($task->getId()) !== \OC::$server->getUserSession()->getUser()->getUID()) {
$sharedAccessClassPermissions = \OC_Calendar_Object::getAccessClassPermissions($object);
if (!($sharedAccessClassPermissions & \OCP\Constants::PERMISSION_READ)) {
return false;
}
}
$taskID = $task->getId();
$object = \OC_Calendar_Object::cleanByAccessClass($taskID, $object);
$vtodo = $object->VTODO;
$vtodo->ID = $taskID;
return $vtodo;
}
示例5: generateEvent
/**
* @brief generates the VEVENT/VTODO/VJOURNAL with UTC dates
* @param array $event
* @return string
*/
private static function generateEvent($event)
{
$object = OC_VObject::parse($event['calendardata']);
if (!$object) {
return false;
}
$sharedAccessClassPermissions = OC_Calendar_Object::getAccessClassPermissions($object);
if (OC_Calendar_Object::getowner($event['id']) !== OCP\User::getUser()) {
if (!($sharedAccessClassPermissions & OCP\PERMISSION_READ)) {
return '';
}
}
$object = OC_Calendar_Object::cleanByAccessClass($event['id'], $object);
if ($object->VEVENT) {
return $object->VEVENT->serialize();
}
if ($object->VTODO) {
return $object->VTODO->serialize();
}
if ($object->VJOURNAL) {
return $object->VJOURNAL->serialize();
}
return '';
}
示例6: cleanByAccessClass
/**
* @brief Remove all properties which should not be exported for the AccessClass Confidential
* @param string $id Event ID
* @param Sabre_VObject $vobject Sabre VObject
* @return object
*/
public static function cleanByAccessClass($id, $vobject)
{
// Do not clean your own calendar
if (OC_Calendar_Object::getowner($id) === OCP\USER::getUser()) {
return $vobject;
}
if (isset($vobject->VEVENT)) {
$velement = $vobject->VEVENT;
} elseif (isset($vobject->VJOURNAL)) {
$velement = $vobject->VJOURNAL;
} elseif (isset($vobject->VTODO)) {
$velement = $vobject->VTODO;
}
if (isset($velement->CLASS) && $velement->CLASS->value == 'CONFIDENTIAL') {
foreach ($velement->children as &$property) {
switch ($property->name) {
case 'CREATED':
case 'DTSTART':
case 'RRULE':
case 'DURATION':
case 'DTEND':
case 'CLASS':
case 'UID':
break;
case 'SUMMARY':
$property->value = OC_Calendar_App::$l10n->t('Busy');
break;
default:
$velement->__unset($property->name);
unset($property);
break;
}
}
}
return $vobject;
}
示例7: generateEventOutput
/**
* @brief generates the output for an event which will be readable for our js
* @param (mixed) $event - event object / array
* @param (int) $start - DateTime object of start
* @param (int) $end - DateTime object of end
* @return (array) $output - readable output
*/
public static function generateEventOutput(array $event, $start, $end)
{
if (!isset($event['calendardata']) && !isset($event['vevent'])) {
return false;
}
if (!isset($event['calendardata']) && isset($event['vevent'])) {
$event['calendardata'] = "BEGIN:VCALENDAR\nVERSION:2.0\nPRODID:ownCloud's Internal iCal System\n" . $event['vevent']->serialize() . "END:VCALENDAR";
}
try {
$object = OC_VObject::parse($event['calendardata']);
if (!$object) {
\OCP\Util::writeLog('calendar', __METHOD__ . ' Error parsing event: ' . print_r($event, true), \OCP\Util::DEBUG);
return array();
}
$output = array();
if ($object->name === 'VEVENT') {
$vevent = $object;
} elseif (isset($object->VEVENT)) {
$vevent = $object->VEVENT;
} else {
\OCP\Util::writeLog('calendar', __METHOD__ . ' Object contains not event: ' . print_r($event, true), \OCP\Util::DEBUG);
return $output;
}
$id = $event['id'];
if (OC_Calendar_Object::getowner($id) !== OCP\USER::getUser()) {
// do not show events with private or unknown access class
if (isset($vevent->CLASS) && ($vevent->CLASS->value === 'PRIVATE' || $vevent->CLASS->value === '')) {
return $output;
}
$object = OC_Calendar_Object::cleanByAccessClass($id, $object);
}
$allday = $vevent->DTSTART->getDateType() == Sabre\VObject\Property\DateTime::DATE ? true : false;
$last_modified = @$vevent->__get('LAST-MODIFIED');
$lastmodified = $last_modified ? $last_modified->getDateTime()->format('U') : 0;
$staticoutput = array('id' => (int) $event['id'], 'title' => !is_null($vevent->SUMMARY) && $vevent->SUMMARY->value != '' ? strtr($vevent->SUMMARY->value, array('\\,' => ',', '\\;' => ';')) : self::$l10n->t('unnamed'), 'description' => isset($vevent->DESCRIPTION) ? strtr($vevent->DESCRIPTION->value, array('\\,' => ',', '\\;' => ';')) : '', 'lastmodified' => $lastmodified, 'allDay' => $allday);
if (OC_Calendar_Object::isrepeating($id) && OC_Calendar_Repeat::is_cached_inperiod($event['id'], $start, $end)) {
$cachedinperiod = OC_Calendar_Repeat::get_inperiod($id, $start, $end);
foreach ($cachedinperiod as $cachedevent) {
$dynamicoutput = array();
if ($allday) {
$start_dt = new DateTime($cachedevent['startdate'], new DateTimeZone('UTC'));
$end_dt = new DateTime($cachedevent['enddate'], new DateTimeZone('UTC'));
$dynamicoutput['start'] = $start_dt->format('Y-m-d');
$dynamicoutput['end'] = $end_dt->format('Y-m-d');
} else {
$start_dt = new DateTime($cachedevent['startdate'], new DateTimeZone('UTC'));
$end_dt = new DateTime($cachedevent['enddate'], new DateTimeZone('UTC'));
$start_dt->setTimezone(new DateTimeZone(self::$tz));
$end_dt->setTimezone(new DateTimeZone(self::$tz));
$dynamicoutput['start'] = $start_dt->format('Y-m-d H:i:s');
$dynamicoutput['end'] = $end_dt->format('Y-m-d H:i:s');
}
$output[] = array_merge($staticoutput, $dynamicoutput);
}
} else {
if (OC_Calendar_Object::isrepeating($id) || $event['repeating'] == 1) {
$object->expand($start, $end);
}
foreach ($object->getComponents() as $singleevent) {
if (!$singleevent instanceof Sabre\VObject\Component\VEvent) {
continue;
}
$dynamicoutput = OC_Calendar_Object::generateStartEndDate($singleevent->DTSTART, OC_Calendar_Object::getDTEndFromVEvent($singleevent), $allday, self::$tz);
$output[] = array_merge($staticoutput, $dynamicoutput);
}
}
return $output;
} catch (Exception $e) {
$uid = 'unknown';
if (isset($event['uri'])) {
$uid = $event['uri'];
}
\OCP\Util::writeLog('calendar', 'Event (' . $uid . ') contains invalid data: ' . $e->getMessage(), \OCP\Util::WARN);
}
}
示例8: isset
$tmpl->assign('repeat_bymonth', isset($repeat['bymonth']) ? $repeat['bymonth'] : array());
$tmpl->assign('repeat_byweekno', isset($repeat['byweekno']) ? $repeat['byweekno'] : array());
} else {
//Some hidden init Values prevent User Errors
//init translation util
$l = OCP\Util::getL10N('calendar');
//init
$start = $dtstart->getDateTime();
$tWeekDay = $start->format('l');
$transWeekDay = $l->t((string) $tWeekDay);
$tDayOfMonth = $start->format('j');
$tMonth = $start->format('F');
$transMonth = $l->t((string) $tMonth);
$transByWeekNo = $start->format('W');
$transByYearDay = $start->format('z');
$tmpl->assign('repeat_weekdays', $transWeekDay);
$tmpl->assign('repeat_bymonthday', $tDayOfMonth);
$tmpl->assign('repeat_bymonth', $transMonth);
$tmpl->assign('repeat_byweekno', $transByWeekNo);
$tmpl->assign('repeat_byyearday', $transByYearDay);
$tmpl->assign('repeat_month', 'monthday');
//$tmpl->assign('repeat_weekdays', array());
$tmpl->assign('repeat_interval', 1);
$tmpl->assign('repeat_end', 'never');
$tmpl->assign('repeat_count', '10');
$tmpl->assign('repeat_weekofmonth', 'auto');
$tmpl->assign('repeat_date', '');
$tmpl->assign('repeat_year', 'bydate');
$tmpl->assign('userid', OC_Calendar_Object::getowner($id));
}
$tmpl->printpage();
示例9: getrequestedEvents
public static function getrequestedEvents($calendarid, $start, $end)
{
$events = array();
if ($calendarid == 'shared_rw' || $calendarid == 'shared_r') {
$calendars = OC_Calendar_Share::allSharedwithuser(OCP\USER::getUser(), OC_Calendar_Share::CALENDAR, 1, $_GET['calendar_id'] == 'shared_rw' ? 'rw' : 'r');
foreach ($calendars as $calendar) {
$calendarevents = OC_Calendar_Object::allInPeriod($calendar['calendarid'], $start, $end);
foreach ($calendarevents as $event) {
$event['summary'] .= ' (' . self::$l10n->t('by') . ' ' . OC_Calendar_Object::getowner($event['id']) . ')';
}
$events = array_merge($events, $calendarevents);
}
$singleevents = OC_Calendar_Share::allSharedwithuser(OCP\USER::getUser(), OC_Calendar_Share::EVENT, 1, $_GET['calendar_id'] == 'shared_rw' ? 'rw' : 'r');
foreach ($singleevents as $singleevent) {
$event = OC_Calendar_Object::find($singleevent['eventid']);
if (!array_key_exists('summary', $event)) {
$event['summary'] = self::$l10n->t('unnamed');
}
$event['summary'] .= ' (' . self::$l10n->t('by') . ' ' . OC_Calendar_Object::getowner($event['id']) . ')';
$events[] = $event;
}
} else {
if (is_numeric($calendarid)) {
$calendar = self::getCalendar($calendarid);
OCP\Response::enableCaching(0);
OCP\Response::setETagHeader($calendar['ctag']);
$events = OC_Calendar_Object::allInPeriod($calendarid, $start, $end);
} else {
OCP\Util::emitHook('OC_Calendar', 'getEvents', array('calendar_id' => $calendarid, 'events' => &$events));
}
}
return $events;
}
示例10: getrequestedEvents
/**
* @brief analyses the parameter for calendar parameter and returns the objects
* @param (string) $calendarid - calendarid
* @param (int) $start - unixtimestamp of start
* @param (int) $end - unixtimestamp of end
* @return (array) $events
*/
public static function getrequestedEvents($calendarid, $start, $end)
{
$events = array();
if ($calendarid == 'shared_events') {
$singleevents = OCP\Share::getItemsSharedWith('event', OC_Share_Backend_Event::FORMAT_EVENT);
foreach ($singleevents as $singleevent) {
$singleevent['summary'] .= ' (' . self::$l10n->t('by') . ' ' . OC_Calendar_Object::getowner($singleevent['id']) . ')';
$events[] = $singleevent;
}
} else {
if (is_numeric($calendarid)) {
$calendar = self::getCalendar($calendarid);
OCP\Response::enableCaching(0);
OCP\Response::setETagHeader($calendar['ctag']);
$events = OC_Calendar_Object::allInPeriod($calendarid, $start, $end);
} else {
OCP\Util::emitHook('OC_Calendar', 'getEvents', array('calendar_id' => $calendarid, 'events' => &$events));
}
}
return $events;
}
示例11: getaccess
public static function getaccess($id, $type)
{
if ($type == self::CALENDAR) {
$calendar = self::getCalendar($id, false, false);
if ($calendar['userid'] == OCP\USER::getUser()) {
return 'owner';
}
$isshared = OC_Calendar_Share::check_access(OCP\USER::getUser(), $id, OC_Calendar_Share::CALENDAR);
if ($isshared) {
$writeaccess = OC_Calendar_Share::is_editing_allowed(OCP\USER::getUser(), $id, OC_Calendar_Share::CALENDAR);
if ($writeaccess) {
return 'rw';
} else {
return 'r';
}
} else {
return false;
}
} elseif ($type == self::EVENT) {
if (OC_Calendar_Object::getowner($id) == OCP\USER::getUser()) {
return 'owner';
}
$isshared = OC_Calendar_Share::check_access(OCP\USER::getUser(), $id, OC_Calendar_Share::EVENT);
if ($isshared) {
$writeaccess = OC_Calendar_Share::is_editing_allowed(OCP\USER::getUser(), $id, OC_Calendar_Share::EVENT);
if ($writeaccess) {
return 'rw';
} else {
return 'r';
}
} else {
return false;
}
}
}