本文整理汇总了PHP中OC_Calendar_Calendar::deleteCalendar方法的典型用法代码示例。如果您正苦于以下问题:PHP OC_Calendar_Calendar::deleteCalendar方法的具体用法?PHP OC_Calendar_Calendar::deleteCalendar怎么用?PHP OC_Calendar_Calendar::deleteCalendar使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类OC_Calendar_Calendar
的用法示例。
在下文中一共展示了OC_Calendar_Calendar::deleteCalendar方法的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: testBasic
function testBasic()
{
$uid = uniqid();
$this->assertEquals(OC_Calendar_Calendar::allCalendars($uid), array());
OC_User::setUserId($uid);
$calId1 = OC_Calendar_Calendar::addCalendar($uid, 'test');
$all = OC_Calendar_Calendar::allCalendars($uid);
$this->assertEquals(count($all), 1);
$this->assertEquals($all[0]['id'], $calId1);
$this->assertEquals($all[0]['displayname'], 'test');
$this->assertEquals($all[0]['uri'], 'test');
$this->assertEquals($uid, $all[0]['userid']);
$calId2 = OC_Calendar_Calendar::addCalendar($uid, 'test');
$this->assertNotEquals($calId1, $calId2);
$all = OC_Calendar_Calendar::allCalendars($uid);
$this->assertEquals(count($all), 2);
$this->assertEquals($all[1]['id'], $calId2);
$this->assertEquals($all[1]['displayname'], 'test');
$this->assertEquals($all[1]['uri'], 'test1');
//$cal1=OC_Calendar_Calendar::find($calId1);
//$this->assertEquals($cal1,$all[0]);
OC_Calendar_Calendar::deleteCalendar($calId1);
OC_Calendar_Calendar::deleteCalendar($calId2);
$this->assertEquals(OC_Calendar_Calendar::allCalendars($uid), array());
}
示例2: deleteUser
/**
* @brief Deletes all calendars of a certain user
* @param paramters parameters from postDeleteUser-Hook
* @return array
*/
public static function deleteUser($parameters)
{
$calendars = OC_Calendar_Calendar::allCalendars($parameters['uid']);
foreach ($calendars as $calendar) {
OC_Calendar_Calendar::deleteCalendar($calendar['id']);
}
return true;
}
示例3: delete
/**
* delete list by id
*
* @param $id
* @return array
*/
public function delete($id)
{
try {
$del = \OC_Calendar_Calendar::deleteCalendar($id);
if ($del == true) {
return array('data' => array());
} else {
return array('error' => 'dberror');
}
} catch (\Exception $e) {
return array('message' => $e->getMessage());
}
}
示例4: deleteList
/**
* @NoAdminRequired
*/
public function deleteList()
{
$listId = $this->params('listID');
$response = new JSONResponse();
try {
$del = \OC_Calendar_Calendar::deleteCalendar($listId);
if ($del == true) {
$result = array('data' => array());
} else {
$result = array('error' => 'dberror');
}
} catch (\Exception $e) {
$result = array('message' => $e->getMessage());
}
$response->setData($result);
return $response;
}
示例5: explode
/**
* Copyright (c) 2012 Georg Ehrke <ownclouddev@georgswebsite.de>
* This file is licensed under the Affero General Public License version 3 or
* later.
* See the COPYING-README file.
*/
$data = $_POST['data'];
$data = explode(',', $data);
$data = end($data);
$data = base64_decode($data);
OCP\JSON::checkLoggedIn();
OCP\App::checkAppEnabled('calendar');
$import = new OC_Calendar_Import($data);
$import->setUserID(OCP\User::getUser());
$import->setTimeZone(OC_Calendar_App::$tz);
$import->disableProgressCache();
if (!$import->isValid()) {
OCP\JSON::error();
exit;
}
$newcalendarname = strip_tags($import->createCalendarName());
$newid = OC_Calendar_Calendar::addCalendar(OCP\User::getUser(), $newcalendarname, 'VEVENT,VTODO,VJOURNAL', null, 0, $import->createCalendarColor());
$import->setCalendarID($newid);
$import->import();
$count = $import->getCount();
if ($count == 0) {
OC_Calendar_Calendar::deleteCalendar($newid);
OCP\JSON::error(array('message' => OC_Calendar_App::$l10n->t('The file contained either no events or all events are already saved in your calendar.')));
} else {
OCP\JSON::success(array('message' => $count . ' ' . OC_Calendar_App::$l10n->t('events has been saved in the new calendar') . ' ' . $newcalendarname, 'eventSource' => OC_Calendar_Calendar::getEventSourceInfo(OC_Calendar_Calendar::find($newid))));
}
示例6: catch
OC_Calendar_Calendar::setCalendarActive($id, 1);
}
} else {
$calendar = OC_Calendar_App::getCalendar($_POST['id']);
if ($calendar['userid'] != OCP\USER::getUser()) {
OCP\JSON::error(array('error' => 'missingcalendarrights'));
exit;
}
$id = $_POST['id'];
$import->setOverwrite($_POST['overwrite']);
}
$import->setCalendarID($id);
try {
$import->import();
} catch (Exception $e) {
OCP\JSON::error(array('message' => OC_Calendar_App::$l10n->t('Import failed'), 'debug' => $e->getMessage()));
//write some log
}
$count = $import->getCount();
if ($count == 0) {
if ($newcal) {
OC_Calendar_Calendar::deleteCalendar($id);
}
OCP\JSON::error(array('message' => OC_Calendar_App::$l10n->t('The file contained either no events or all events are already saved in your calendar.')));
} else {
if ($newcal) {
OCP\JSON::success(array('message' => $count . ' ' . OC_Calendar_App::$l10n->t('events has been saved in the new calendar') . ' ' . strip_tags($_POST['calname'])));
} else {
OCP\JSON::success(array('message' => $count . ' ' . OC_Calendar_App::$l10n->t('events has been saved in your calendar')));
}
}
示例7: deleteCalendar
/**
* Delete a calendar and all it's objects
*
* @param string $calendarId
* @return void
*/
public function deleteCalendar($calendarId)
{
if (preg_match('=iCal/[1-4]?.*Mac OS X/10.[1-6](.[0-9])?=', $_SERVER['HTTP_USER_AGENT'])) {
throw new \Sabre\DAV\Exception\Forbidden("Action is not possible with OSX 10.6.x", 403);
}
OC_Calendar_Calendar::deleteCalendar($calendarId);
}
示例8: deleteCalendar
/**
* Delete a calendar and all it's objects
*
* @param string $calendarId
* @return void
*/
public function deleteCalendar($calendarId)
{
OC_Calendar_Calendar::deleteCalendar($calendarId);
}
示例9: catch
<?php
/**
* Copyright (c) 2011 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();
$cal = $_POST["calendarid"];
try {
$del = OC_Calendar_Calendar::deleteCalendar($cal);
if ($del == true) {
OCP\JSON::success();
} else {
OCP\JSON::error(array('error' => 'dberror'));
}
} catch (Exception $e) {
OCP\JSON::error(array('message' => $e->getMessage()));
exit;
}