本文整理汇总了PHP中OC_Calendar_App::getVCalendar方法的典型用法代码示例。如果您正苦于以下问题:PHP OC_Calendar_App::getVCalendar方法的具体用法?PHP OC_Calendar_App::getVCalendar怎么用?PHP OC_Calendar_App::getVCalendar使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类OC_Calendar_App
的用法示例。
在下文中一共展示了OC_Calendar_App::getVCalendar方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: createReminder
/**
* create reminder for task
* @param int $taskID
* @param string $type
* @param mixed $action
* @param mixed $date
* @param bool $invert
* @param string $related
* @param mixed $week
* @param mixed $day
* @param mixed $hour
* @param mixed $minute
* @param mixed $second
* @return bool
* @throws \Exception
*/
public function createReminder($taskID, $type, $action, $date, $invert, $related = null, $week, $day, $hour, $minute, $second)
{
$types = array('DATE-TIME', 'DURATION');
$vcalendar = \OC_Calendar_App::getVCalendar($taskID);
$vtodo = $vcalendar->VTODO;
$valarm = $vtodo->VALARM;
if (in_array($type, $types)) {
if ($valarm == null) {
$valarm = $vcalendar->createComponent('VALARM');
$valarm->ACTION = $action;
$valarm->DESCRIPTION = 'Default Event Notification';
$vtodo->add($valarm);
} else {
unset($valarm->TRIGGER);
}
$string = '';
if ($type == 'DATE-TIME') {
$string = $this->createReminderDateTime($date);
} elseif ($type == 'DURATION') {
$string = $this->createReminderDuration($week, $day, $hour, $minute, $second, $invert);
}
if ($related == 'END') {
$valarm->add('TRIGGER', $string, array('VALUE' => $type, 'RELATED' => $related));
} else {
$valarm->add('TRIGGER', $string, array('VALUE' => $type));
}
} else {
unset($vtodo->VALARM);
}
return $this->helper->editVCalendar($vcalendar, $taskID);
}
示例2: deleteComment
/**
* delete comment of task by id
* @param int $taskID
* @param int $commentID
* @return bool
* @throws \Exception
*/
public function deleteComment($taskID, $commentID)
{
$vcalendar = \OC_Calendar_App::getVCalendar($taskID);
$vtodo = $vcalendar->VTODO;
$commentIndex = $this->getCommentById($vtodo, $commentID);
$comment = $vtodo->children[$commentIndex];
if ($comment['X-OC-USERID']->getValue() == $this->userId) {
unset($vtodo->children[$commentIndex]);
return $this->helper->editVCalendar($vcalendar, $taskID);
} else {
throw new \Exception('Not allowed.');
}
}
示例3: 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();
$id = $_POST['id'];
$access = OC_Calendar_App::getaccess($id, OC_Calendar_App::EVENT);
if ($access != 'owner' && $access != 'rw') {
OCP\JSON::error(array('message' => 'permission denied'));
exit;
}
$vcalendar = OC_Calendar_App::getVCalendar($id, false, false);
$vevent = $vcalendar->VEVENT;
$allday = $_POST['allDay'];
$delta = new DateInterval('P0D');
$delta->d = $_POST['dayDelta'];
$delta->i = $_POST['minuteDelta'];
OC_Calendar_App::isNotModified($vevent, $_POST['lastmodified']);
$dtstart = $vevent->DTSTART;
$dtend = OC_Calendar_Object::getDTEndFromVEvent($vevent);
$start_type = $dtstart->getDateType();
$end_type = $dtend->getDateType();
if ($allday && $start_type != Sabre_VObject_Property_DateTime::DATE) {
$start_type = $end_type = Sabre_VObject_Property_DateTime::DATE;
$dtend->setDateTime($dtend->getDateTime()->modify('+1 day'), $end_type);
}
if (!$allday && $start_type == Sabre_VObject_Property_DateTime::DATE) {
示例4:
<?php
/**
* Copyright (c) 2012 Bart Visscher <bartv@thisnet.nl>
* This file is licensed under the Affero General Public License version 3 or
* later.
* See the COPYING-README file.
*/
// Init owncloud
OCP\JSON::checkLoggedIn();
OCP\JSON::checkAppEnabled('tasks');
$id = $_POST['id'];
$property = $_POST['type'];
$vcalendar = OC_Calendar_App::getVCalendar($id);
$vtodo = $vcalendar->VTODO;
switch ($property) {
case 'summary':
$summary = $_POST['summary'];
$vtodo->setString('SUMMARY', $summary);
break;
case 'description':
$description = $_POST['description'];
$vtodo->setString('DESCRIPTION', $description);
break;
case 'location':
$location = $_POST['location'];
$vtodo->setString('LOCATION', $location);
break;
case 'categories':
$categories = $_POST['categories'];
$vtodo->setString('CATEGORIES', $categories);
示例5: deleteComment
/**
* @NoAdminRequired
*/
public function deleteComment()
{
$taskId = $this->params('taskID');
$commentId = $this->params('commentID');
$response = new JSONResponse();
try {
$vcalendar = \OC_Calendar_App::getVCalendar($taskId);
$vtodo = $vcalendar->VTODO;
$commentIndex = $this->getCommentById($vtodo, $commentId);
$comment = $vtodo->children[$commentIndex];
if ($comment['USERID'] == $this->userId) {
unset($vtodo->children[$commentIndex]);
\OC_Calendar_Object::edit($taskId, $vcalendar->serialize());
} else {
throw new \Exception('Not allowed.');
}
} catch (\Exception $e) {
// throw new BusinessLayerException($e->getMessage());
}
return $response;
}
示例6: setProperty
/**
* set property of a task
*
* @param int $taskID
* @param string $property
* @param mixed $value
* @return bool
* @throws \Exception
*/
public function setProperty($taskID, $property, $value)
{
$vcalendar = \OC_Calendar_App::getVCalendar($taskID);
$vtodo = $vcalendar->VTODO;
if ($value) {
$vtodo->{$property} = $value;
} else {
unset($vtodo->{$property});
}
return $this->editVCalendar($vcalendar, $taskID);
}
示例7: removeCategory
/**
* remove category from task by id
* @param int $taskID
* @param string $category
* @return bool
* @throws \Exception
*/
public function removeCategory($taskID, $category)
{
$vcalendar = \OC_Calendar_App::getVCalendar($taskID);
$vtodo = $vcalendar->VTODO;
// fetch categories from TODO
$categories = $vtodo->CATEGORIES;
if ($categories) {
$taskcategories = $categories->getParts();
// remove category
$key = array_search($category, $taskcategories);
if ($key !== null && $key !== false) {
unset($taskcategories[$key]);
if (count($taskcategories)) {
$vtodo->CATEGORIES = $taskcategories;
} else {
unset($vtodo->{'CATEGORIES'});
}
return $this->helper->editVCalendar($vcalendar, $taskID);
}
}
return true;
}
示例8: range
<?php
// Init owncloud
OCP\JSON::checkLoggedIn();
OCP\JSON::checkAppEnabled('tasks');
$id = $_GET['id'];
$details = OC_Calendar_App::getVCalendar($id)->VTODO;
$categories = $details->getAsString('CATEGORIES');
$category_options = OC_Calendar_App::getCategoryOptions();
$percent_options = range(0, 100, 10);
$priority_options = OC_Task_App::getPriorityOptions();
$tmpl = new OCP\Template('tasks', 'part.edittaskform');
$tmpl->assign('category_options', $category_options);
$tmpl->assign('percent_options', $percent_options);
$tmpl->assign('priority_options', $priority_options);
$tmpl->assign('id', $id);
$tmpl->assign('details', $details);
$tmpl->assign('categories', $categories);
$page = $tmpl->fetchPage();
OCP\JSON::success(array('data' => array('page' => $page)));