本文整理汇总了PHP中OC_Calendar_App::getPermissions方法的典型用法代码示例。如果您正苦于以下问题:PHP OC_Calendar_App::getPermissions方法的具体用法?PHP OC_Calendar_App::getPermissions怎么用?PHP OC_Calendar_App::getPermissions使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类OC_Calendar_App
的用法示例。
在下文中一共展示了OC_Calendar_App::getPermissions方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: DateInterval
<?php
/**
* Copyright (c) 2011 Bart Visscher <bartv@thisnet.nl>
* This file is licensed under the Affero General Public License version 3 or
* later.
* See the COPYING-README file.
*/
OCP\JSON::checkLoggedIn();
OCP\JSON::callCheck();
$id = $_POST['id'];
$permissions = OC_Calendar_App::getPermissions($id, OC_Calendar_App::EVENT);
if (!$permissions & OCP\Share::PERMISSION_UPDATE) {
OCP\JSON::error(array('message' => 'permission denied'));
exit;
}
$vcalendar = OC_Calendar_App::getVCalendar($id, false, false);
$vevent = $vcalendar->VEVENT;
$delta = new DateInterval('P0D');
$delta->d = $_POST['dayDelta'];
$delta->i = $_POST['minuteDelta'];
OC_Calendar_App::isNotModified($vevent, $_POST['lastmodified']);
$dtend = OC_Calendar_Object::getDTEndFromVEvent($vevent);
$end_type = $dtend->getDateType();
$dtend->setDateTime($dtend->getDateTime()->add($delta), $end_type);
unset($vevent->DURATION);
$vevent->setDateTime('LAST-MODIFIED', 'now', Sabre_VObject_Property_DateTime::UTC);
$vevent->setDateTime('DTSTAMP', 'now', Sabre_VObject_Property_DateTime::UTC);
OC_Calendar_Object::edit($id, $vcalendar->serialize());
$lastmodified = $vevent->__get('LAST-MODIFIED')->getDateTime();
OCP\JSON::success(array('lastmodified' => (int) $lastmodified->format('U')));
示例2: array
*/
if (!OCP\User::isLoggedIn()) {
OCP\User::checkLoggedIn();
}
OCP\JSON::checkAppEnabled('calendar');
$id = $_POST['id'];
$data = OC_Calendar_App::getEventObject($id, false, false);
if (!$data) {
OCP\JSON::error(array('data' => array('message' => OC_Calendar_App::$l10n->t('Wrong calendar'))));
exit;
}
$object = OC_VObject::parse($data['calendardata']);
$vevent = $object->VEVENT;
$object = OC_Calendar_Object::cleanByAccessClass($id, $object);
$accessclass = $vevent->getAsString('CLASS');
$permissions = OC_Calendar_App::getPermissions($id, OC_Calendar_App::EVENT, $accessclass);
$dtstart = $vevent->DTSTART;
$dtend = OC_Calendar_Object::getDTEndFromVEvent($vevent);
switch ($dtstart->getDateType()) {
case Sabre\VObject\Property\DateTime::UTC:
$timezone = new DateTimeZone(OC_Calendar_App::getTimezone());
$newDT = $dtstart->getDateTime();
$newDT->setTimezone($timezone);
$dtstart->setDateTime($newDT);
$newDT = $dtend->getDateTime();
$newDT->setTimezone($timezone);
$dtend->setDateTime($newDT);
case Sabre\VObject\Property\DateTime::LOCALTZ:
case Sabre\VObject\Property\DateTime::LOCAL:
$startdate = $dtstart->getDateTime()->format('d-m-Y');
$starttime = $dtstart->getDateTime()->format('H:i');