本文整理汇总了PHP中OC_Calendar_Calendar::editCalendar方法的典型用法代码示例。如果您正苦于以下问题:PHP OC_Calendar_Calendar::editCalendar方法的具体用法?PHP OC_Calendar_Calendar::editCalendar怎么用?PHP OC_Calendar_Calendar::editCalendar使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类OC_Calendar_Calendar
的用法示例。
在下文中一共展示了OC_Calendar_Calendar::editCalendar方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: setName
/**
* set name of list by id
*
* @param $id
* @param $name
* @return array
* @throws \Exception
*/
public function setName($id, $name)
{
if (trim($name) == '') {
// OCP\JSON::error(array('message'=>'empty'));
exit;
}
$calendars = \OC_Calendar_Calendar::allCalendars($this->userId, true);
foreach ($calendars as $cal) {
if ($cal['userid'] != $this->userId) {
continue;
}
if ($cal['displayname'] == $name && $cal['id'] != $id) {
// OCP\JSON::error(array('message'=>'namenotavailable'));
exit;
}
}
$color = '#CCCCCC';
\OC_Calendar_Calendar::editCalendar($id, strip_tags($name), null, null, null, $color);
return array();
}
示例2: foreach
OCP\JSON::error(array('message' => 'empty'));
exit;
}
$calendars = OC_Calendar_Calendar::allCalendars(OCP\USER::getUser());
foreach ($calendars as $cal) {
if ($cal['userid'] != OCP\User::getUser()) {
continue;
}
if ($cal['displayname'] == $_POST['name'] && $cal['id'] != $_POST['id']) {
OCP\JSON::error(array('message' => 'namenotavailable'));
exit;
}
}
$calendarid = $_POST['id'];
try {
OC_Calendar_Calendar::editCalendar($calendarid, strip_tags($_POST['name']), null, null, null, $_POST['color']);
OC_Calendar_Calendar::setCalendarActive($calendarid, $_POST['active']);
} catch (Exception $e) {
OCP\JSON::error(array('message' => $e->getMessage()));
exit;
}
$calendar = OC_Calendar_Calendar::find($calendarid);
$tmpl = new OCP\Template('calendar', 'part.choosecalendar.rowfields');
$tmpl->assign('calendar', $calendar);
$shared = false;
if ($calendar['userid'] != OCP\User::getUser()) {
$sharedCalendar = OCP\Share::getItemSharedWithBySource('calendar', $calendarid);
if ($sharedCalendar && $sharedCalendar['permissions'] & OCP\Share::PERMISSION_UPDATE) {
$shared = true;
}
}
示例3: setListName
/**
* @NoAdminRequired
*/
public function setListName()
{
$listId = (int) $this->params('listID');
$listName = $this->params('name');
$response = new JSONResponse();
if (trim($listName) == '') {
// OCP\JSON::error(array('message'=>'empty'));
exit;
}
$calendars = \OC_Calendar_Calendar::allCalendars($this->userId, true);
foreach ($calendars as $cal) {
if ($cal['userid'] != $this->userId) {
continue;
}
if ($cal['displayname'] == $listName && $cal['id'] != $listId) {
// OCP\JSON::error(array('message'=>'namenotavailable'));
exit;
}
}
$color = '#CCCCCC';
\OC_Calendar_Calendar::editCalendar($listId, strip_tags($listName), null, null, null, $color);
$result = array('data' => array());
$response->setData($result);
return $response;
}
示例4: updateCalendar
/**
* Updates a calendars properties
*
* The properties array uses the propertyName in clark-notation as key,
* and the array value for the property value. In the case a property
* should be deleted, the property value will be null.
*
* This method must be atomic. If one property cannot be changed, the
* entire operation must fail.
*
* If the operation was successful, true can be returned.
* If the operation failed, false can be returned.
*
* Deletion of a non-existant property is always succesful.
*
* Lastly, it is optional to return detailed information about any
* failures. In this case an array should be returned with the following
* structure:
*
* array(
* 403 => array(
* '{DAV:}displayname' => null,
* ),
* 424 => array(
* '{DAV:}owner' => null,
* )
* )
*
* In this example it was forbidden to update {DAV:}displayname.
* (403 Forbidden), which in turn also caused {DAV:}owner to fail
* (424 Failed Dependency) because the request needs to be atomic.
*
* @param string $calendarId
* @param PropPatch $propPatch
* @return bool|array
*/
public function updateCalendar($calendarId, PropPatch $propPatch)
{
$newValues = array();
$result = array(200 => array(), 403 => array(), 424 => array());
$hasError = false;
$properties = $propPatch->getRemainingMutations();
foreach ($properties as $propertyName => $propertyValue) {
// We don't know about this property.
if (!isset($this->propertyMap[$propertyName])) {
$hasError = true;
$result[403][$propertyName] = null;
unset($properties[$propertyName]);
continue;
}
$fieldName = $this->propertyMap[$propertyName];
$newValues[$fieldName] = $propertyValue;
}
// If there were any errors we need to fail the request
if ($hasError) {
// Properties has the remaining properties
foreach ($properties as $propertyName => $propertyValue) {
$result[424][$propertyName] = null;
}
// Removing unused statuscodes for cleanliness
foreach ($result as $status => $properties) {
if (is_array($properties) && count($properties) === 0) {
unset($result[$status]);
}
}
return $result;
}
// Success
if (!isset($newValues['displayname'])) {
$newValues['displayname'] = null;
}
if (!isset($newValues['timezone'])) {
$newValues['timezone'] = null;
}
if (!isset($newValues['calendarorder'])) {
$newValues['calendarorder'] = null;
}
if (!isset($newValues['calendarcolor'])) {
$newValues['calendarcolor'] = null;
}
if (!is_null($newValues['calendarcolor']) && strlen($newValues['calendarcolor']) == 9) {
$newValues['calendarcolor'] = substr($newValues['calendarcolor'], 0, 7);
}
OC_Calendar_Calendar::editCalendar($calendarId, $newValues['displayname'], null, $newValues['timezone'], $newValues['calendarorder'], $newValues['calendarcolor']);
return true;
}
示例5: OC_L10N
<?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.
*/
require_once '../../../lib/base.php';
$l10n = new OC_L10N('calendar');
// Check if we are a user
OC_JSON::checkLoggedIn();
OC_JSON::checkAppEnabled('calendar');
$calendarid = $_POST['id'];
OC_Calendar_Calendar::editCalendar($calendarid, $_POST['name'], null, null, null, $_POST['color']);
OC_Calendar_Calendar::setCalendarActive($calendarid, $_POST['active']);
$calendar = OC_Calendar_Calendar::findCalendar($calendarid);
$tmpl = new OC_Template('calendar', 'part.choosecalendar.rowfields');
$tmpl->assign('calendar', $calendar);
OC_JSON::success(array('data' => $tmpl->fetchPage()));
开发者ID:Teino1978-Corp,项目名称:Teino1978-Corp-owncloud_.htaccess-,代码行数:20,代码来源:owncloud_apps_calendar_ajax_updatecalendar.php