本文整理汇总了PHP中OC_Calendar_Object::add方法的典型用法代码示例。如果您正苦于以下问题:PHP OC_Calendar_Object::add方法的具体用法?PHP OC_Calendar_Object::add怎么用?PHP OC_Calendar_Object::add使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类OC_Calendar_Object
的用法示例。
在下文中一共展示了OC_Calendar_Object::add方法的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: catch
<?php
/**
* Copyright (c) 2012 Georg Ehrke <ownclouddev at georgswebsite dot de>
* This file is licensed under the Affero General Public License version 3 or
* later.
* See the COPYING-README file.
*/
OCP\JSON::checkLoggedIn();
OCP\JSON::checkAppEnabled('calendar');
OCP\JSON::callCheck();
$errarr = OC_Calendar_Object::validateRequest($_POST);
$event_id = -1;
if ($errarr) {
//show validate errors
OCP\JSON::error($errarr);
exit;
} else {
$cal = $_POST['calendar'];
$vcalendar = OC_Calendar_Object::createVCalendarFromRequest($_POST);
try {
$event_id = OC_Calendar_Object::add($cal, $vcalendar->serialize());
} catch (Exception $e) {
OCP\JSON::error(array('message' => $e->getMessage()));
exit;
}
OCP\JSON::success(array('event_id' => $event_id));
}
示例2: import
public function import()
{
if (!$this->isValid()) {
return false;
}
$numofcomponents = count($this->calobject->getComponents());
if ($this->overwrite) {
foreach (OC_Calendar_Object::all($this->id) as $obj) {
OC_Calendar_Object::delete($obj['id']);
}
}
foreach ($this->calobject->getComponents() as $object) {
if (!$object instanceof Sabre\VObject\Component\VEvent && !$object instanceof Sabre\VObject\Component\VJournal && !$object instanceof Sabre\VObject\Component\VTodo) {
continue;
}
if (!is_null($object->DTSTART)) {
$dtend = OC_Calendar_Object::getDTEndFromVEvent($object);
if ($object->DTEND) {
$object->DTEND->setDateTime($dtend->getDateTime(), $object->DTSTART->getDateType());
}
}
$vcalendar = $this->createVCalendar($object->serialize());
$insertid = OC_Calendar_Object::add($this->id, $vcalendar);
$this->abscount++;
if ($this->isDuplicate($insertid)) {
OC_Calendar_Object::delete($insertid);
} else {
$this->count++;
}
$this->updateProgress(intval($this->abscount / $numofcomponents * 100));
}
OC_Cache::remove($this->progresskey);
return true;
}
示例3: array
<?php
/**
* Copyright (c) 2012 Georg Ehrke <ownclouddev at georgswebsite dot de>
* This file is licensed under the Affero General Public License version 3 or
* later.
* See the COPYING-README file.
*/
OCP\JSON::checkLoggedIn();
OCP\JSON::checkAppEnabled('calendar');
OCP\JSON::callCheck();
$errarr = OC_Calendar_Object::validateRequest($_POST);
if ($errarr) {
//show validate errors
OCP\JSON::error($errarr);
exit;
} else {
$cal = $_POST['calendar'];
$calendar = OC_Calendar_Calendar::find($cal);
if ($calendar['userid'] != OCP\USER::getUser()) {
$l = OC_L10N::get('core');
OC_JSON::error(array('data' => array('message' => $l->t('Authentication error'))));
exit;
}
$vcalendar = OC_Calendar_Object::createVCalendarFromRequest($_POST);
$result = OC_Calendar_Object::add($cal, $vcalendar->serialize());
OCP\JSON::success();
}
示例4: reset
<?php
// Init owncloud
OCP\JSON::checkLoggedIn();
OCP\JSON::checkAppEnabled('tasks');
OCP\JSON::callCheck();
$calendars = OC_Calendar_Calendar::allCalendars(OCP\User::getUser(), true);
$first_calendar = reset($calendars);
$cid = $first_calendar['id'];
$input = $_POST['text'];
$request = array();
$request['summary'] = $input;
$request["categories"] = null;
$request['priority'] = null;
$request['percent_complete'] = null;
$request['completed'] = null;
$request['location'] = null;
$request['due'] = null;
$request['description'] = null;
$vcalendar = OC_Task_App::createVCalendarFromRequest($request);
$id = OC_Calendar_Object::add($cid, $vcalendar->serialize());
$user_timezone = OCP\Config::getUserValue(OCP\User::getUser(), 'calendar', 'timezone', date_default_timezone_get());
$task = OC_Task_App::arrayForJSON($id, $vcalendar->VTODO, $user_timezone);
OCP\JSON::success(array('task' => $task));
示例5: explode
}
if ($_GET["path"] != "") {
$filename = $_GET["path"] . "/" . $_GET["file"];
} else {
$filename = "/" . $_GET["file"];
}
} else {
$id = OC_Calendar_Calendar::addCalendar(OC_User::getUser(), $_POST['calname']);
OC_Calendar_Calendar::setCalendarActive($id, 1);
$calid = $id;
if ($_POST["path"] != "") {
$filename = $_POST["path"] . "/" . $_POST["file"];
} else {
$filename = "/" . $_POST["file"];
}
}
$vcalendar = OC_Filesystem::file_get_contents($filename);
$vcalendar = explode("BEGIN:VEVENT", $vcalendar);
for ($i = 1; $i < count($vcalendar); $i++) {
$vcalendar[$i] = "BEGIN:VEVENT" . $vcalendar[$i];
}
for ($i = 1; $i < count($vcalendar) - 1; $i++) {
$vcalendar[$i] = $vcalendar[$i] . "END:VCALENDAR";
}
for ($i = 1; $i < count($vcalendar); $i++) {
$vcalendar[$i] = $vcalendar[0] . $vcalendar[$i];
}
for ($i = 1; $i < count($vcalendar); $i++) {
OC_Calendar_Object::add($calid, $vcalendar[$i]);
}
OC_JSON::success();
开发者ID:Teino1978-Corp,项目名称:Teino1978-Corp-owncloud_.htaccess-,代码行数:31,代码来源:owncloud_apps_calendar_import.php
示例6: addTask
/**
* @NoAdminRequired
*/
public function addTask()
{
$taskName = $this->params('name');
$calendarId = $this->params('calendarID');
$starred = $this->params('starred');
$due = $this->params('due');
$start = $this->params('start');
$response = new JSONResponse();
$user_timezone = \OC_Calendar_App::getTimezone();
$request = array('summary' => $taskName, 'categories' => null, 'priority' => $starred, 'location' => null, 'due' => $due, 'start' => $start, 'description' => null);
$vcalendar = Helper::createVCalendarFromRequest($request);
$taskId = \OC_Calendar_Object::add($calendarId, $vcalendar->serialize());
$task = Helper::arrayForJSON($taskId, $vcalendar->VTODO, $user_timezone);
$task['calendarid'] = $calendarId;
$task['tmpID'] = $this->params('tmpID');
$result = array('data' => array('task' => $task));
$response->setData($result);
return $response;
}
示例7: catch
<?php
/**
* Copyright (c) 2012 Georg Ehrke <ownclouddev at georgswebsite dot de>
* This file is licensed under the Affero General Public License version 3 or
* later.
* See the COPYING-README file.
*/
OCP\JSON::checkLoggedIn();
OCP\JSON::checkAppEnabled('calendar');
OCP\JSON::callCheck();
$errarr = OC_Calendar_Object::validateRequest($_POST);
if ($errarr) {
//show validate errors
OCP\JSON::error($errarr);
exit;
} else {
$cal = $_POST['calendar'];
$vcalendar = OC_Calendar_Object::createVCalendarFromRequest($_POST);
try {
$objectId = OC_Calendar_Object::add($cal, $vcalendar->serialize());
OC_Calendar_Object::addAlarmsDB($_POST['alarmsDuration'], $_POST['alarmsOptionField'], $_POST['alarmsType'], $_POST['alarmsTimeType'], $vcalendar->VEVENT, $objectId);
} catch (Exception $e) {
OCP\JSON::error(array('message' => $e->getMessage()));
exit;
}
OCP\JSON::success();
}
示例8: array_slice
if (!isset($cals[$cal])) {
continue;
// from corrupt/incomplete calendar
}
$cdata = $cals[$cal];
// if we have multiple components from different calendar objects,
// we should really merge their elements (enhancement?) -- 1st one wins for now.
if (!count($prefix)) {
$prefix = array_slice($lines, $cal, $cdata['first'] - $cal);
}
if (!count($suffix)) {
$suffix = array_slice($lines, $cdata['last'] + 1, $cdata['end'] - $cdata['last']);
}
$content = array_merge($content, array_slice($lines, $begin, $details['end'] - $begin + 1));
}
if (count($content)) {
$import = join($nl, array_merge($prefix, $content, $suffix)) . $nl;
OC_Calendar_Object::add($id, $import);
}
}
// finished import
if (is_writable('import_tmp/')) {
$progressfopen = fopen($progressfile, 'w');
fwrite($progressfopen, '100');
fclose($progressfopen);
}
sleep(3);
if (is_writable('import_tmp/')) {
unlink($progressfile);
}
OCP\JSON::success();
示例9: add
/**
* create new task
*
* @param string $taskName
* @param int $calendarId
* @param bool $starred
* @param mixed $due
* @param mixed $start
* @param int $tmpID
* @return array
*/
public function add($taskName, $calendarId, $starred, $due, $start, $tmpID)
{
$user_timezone = \OC_Calendar_App::getTimezone();
$request = array('summary' => $taskName, 'categories' => null, 'priority' => $starred, 'location' => null, 'due' => $due, 'start' => $start, 'description' => null);
$vcalendar = Helper::createVCalendarFromRequest($request);
$taskID = \OC_Calendar_Object::add($calendarId, $vcalendar->serialize());
$task = Helper::arrayForJSON($taskID, $vcalendar->VTODO, $user_timezone, $calendarId);
$task['tmpID'] = $tmpID;
return $task;
}
示例10: add
/**
* create new task
*
* @param string $taskName
* @param int $calendarId
* @param bool $starred
* @param mixed $due
* @param mixed $start
* @param int $tmpID
* @return array
*/
public function add($taskName, $related, $calendarId, $starred, $due, $start, $tmpID)
{
$request = array('summary' => $taskName, 'related' => $related, 'starred' => $starred, 'due' => $due, 'start' => $start);
$vcalendar = $this->helper->createVCalendar($request);
$vtodo = $vcalendar->VTODO;
$vtodo->ID = \OC_Calendar_Object::add($calendarId, $vcalendar->serialize());
$task = $this->taskParser->parseTask($vtodo, $calendarId);
$task['tmpID'] = $tmpID;
return $task;
}