当前位置: 首页>>代码示例>>PHP>>正文


PHP OC_Calendar_Calendar::find方法代码示例

本文整理汇总了PHP中OC_Calendar_Calendar::find方法的典型用法代码示例。如果您正苦于以下问题:PHP OC_Calendar_Calendar::find方法的具体用法?PHP OC_Calendar_Calendar::find怎么用?PHP OC_Calendar_Calendar::find使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在OC_Calendar_Calendar的用法示例。


在下文中一共展示了OC_Calendar_Calendar::find方法的11个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: addList

 /**
  * @NoAdminRequired
  */
 public function addList()
 {
     $listName = $this->params('name');
     $userId = $this->api->getUserId();
     if (trim($listName) == '') {
         // OCP\JSON::error(array('message'=>'empty'));
         exit;
     }
     $calendars = \OC_Calendar_Calendar::allCalendars($userId, true);
     foreach ($calendars as $cal) {
         if ($cal['displayname'] == $listName) {
             // OCP\JSON::error(array('message'=>'namenotavailable'));
             exit;
         }
     }
     $color = '#CCCCCC';
     $calendarId = \OC_Calendar_Calendar::addCalendar($userId, strip_tags($listName), 'VEVENT,VTODO,VJOURNAL', null, 0, $color);
     \OC_Calendar_Calendar::setCalendarActive($calendarId, 1);
     $list = \OC_Calendar_Calendar::find($calendarId);
     $list['tmpID'] = $this->params('tmpID');
     $result = array('data' => array('list' => $list));
     $response = new JSONResponse();
     $response->setData($result);
     return $response;
 }
开发者ID:WYSAC,项目名称:oregon-owncloud,代码行数:28,代码来源:listscontroller.php

示例2: calendar

 /**
  * @brief exports a calendar and convert all times to UTC
  * @param integer $id id of the calendar
  * @return string
  */
 private static function calendar($id)
 {
     $events = OC_Calendar_Object::all($id);
     $calendar = OC_Calendar_Calendar::find($id);
     $return = "BEGIN:VCALENDAR\nVERSION:2.0\nPRODID:ownCloud Calendar " . OCP\App::getAppVersion('calendar') . "\nX-WR-CALNAME:" . $calendar['displayname'] . "\n";
     foreach ($events as $event) {
         $return .= self::generateEvent($event);
     }
     $return .= "END:VCALENDAR";
     return $return;
 }
开发者ID:WYSAC,项目名称:oregon-owncloud,代码行数:16,代码来源:export.php

示例3: getCalendar

 /**
  * @brief returns informations about a calendar
  * @param int $id - id of the calendar
  * @param bool $security - check access rights or not
  * @param bool $shared - check if the user got access via sharing
  * @return mixed - bool / array
  */
 public static function getCalendar($id, $security = true, $shared = false)
 {
     if (!is_numeric($id)) {
         return false;
     }
     $calendar = OC_Calendar_Calendar::find($id);
     // FIXME: Correct arguments to just check for permissions
     if ($security === true || $shared === true) {
         if (OCP\Share::getItemSharedWithBySource('calendar', $id)) {
             return $calendar;
         }
     }
     return $calendar;
 }
开发者ID:blablubli,项目名称:owncloudapps,代码行数:21,代码来源:app.php

示例4: add

 /**
  * add a list
  *
  * @param $name
  * @param $tmpID
  * @return array
  * @throws \Exception
  */
 public function add($name, $tmpID)
 {
     if (trim($name) == '') {
         // OCP\JSON::error(array('message'=>'empty'));
         exit;
     }
     $calendars = \OC_Calendar_Calendar::allCalendars($this->userId, true);
     foreach ($calendars as $cal) {
         if ($cal['displayname'] == $name) {
             // OCP\JSON::error(array('message'=>'namenotavailable'));
             exit;
         }
     }
     $color = '#CCCCCC';
     $calendarId = \OC_Calendar_Calendar::addCalendar($this->userId, strip_tags($name), 'VEVENT,VTODO,VJOURNAL', null, 0, $color);
     \OC_Calendar_Calendar::setCalendarActive($calendarId, 1);
     $list = \OC_Calendar_Calendar::find($calendarId);
     $list['tmpID'] = $tmpID;
     return $list;
 }
开发者ID:sbambach,项目名称:tasks,代码行数:28,代码来源:listsservice.php

示例5: getCalendar

 public static function getCalendar($id, $security = true, $shared = false)
 {
     if (!is_numeric($id)) {
         return false;
     }
     $calendar = OC_Calendar_Calendar::find($id);
     if ($shared === true) {
         if (OC_Calendar_Share::check_access(OCP\USER::getUser(), $id, OC_Calendar_Share::CALENDAR)) {
             return $calendar;
         }
     }
     if ($security === true) {
         if ($calendar['userid'] != OCP\USER::getUser()) {
             return false;
         }
     }
     if ($calendar === false) {
         return false;
     }
     return OC_Calendar_Calendar::find($id);
 }
开发者ID:noci2012,项目名称:owncloud,代码行数:21,代码来源:app.php

示例6: testBasic

 function testBasic()
 {
     $uid = uniqid();
     $this->assertEqual(OC_Calendar_Calendar::allCalendars($uid), array());
     $calId1 = OC_Calendar_Calendar::addCalendar($uid, 'test');
     $all = OC_Calendar_Calendar::allCalendars($uid);
     $this->assertEqual(count($all), 1);
     $this->assertEqual($all[0]['id'], $calId1);
     $this->assertEqual($all[0]['displayname'], 'test');
     $this->assertEqual($all[0]['uri'], 'test');
     $calId2 = OC_Calendar_Calendar::addCalendar($uid, 'test');
     $this->assertNotEqual($calId1, $calId2);
     $all = OC_Calendar_Calendar::allCalendars($uid);
     $this->assertEqual(count($all), 2);
     $this->assertEqual($all[1]['id'], $calId2);
     $this->assertEqual($all[1]['displayname'], 'test');
     $this->assertEqual($all[1]['uri'], 'test1');
     $cal1 = OC_Calendar_Calendar::find($calId1);
     $this->assertEqual($cal1, $all[0]);
     OC_Calendar_Calendar::deleteCalendar($calId1);
     OC_Calendar_Calendar::deleteCalendar($calId2);
     $this->assertEqual(OC_Calendar_Calendar::allCalendars($uid), array());
 }
开发者ID:blablubli,项目名称:owncloudapps,代码行数:23,代码来源:calendar.php

示例7: getowner

 /**
  * @brief returns the owner of an object
  * @param integer $id
  * @return string
  */
 public static function getowner($id)
 {
     if ($id == 0) {
         return null;
     }
     $event = self::find($id);
     $cal = OC_Calendar_Calendar::find($event['calendarid']);
     if ($cal === false || is_array($cal) === false) {
         return null;
     }
     if (array_key_exists('userid', $cal)) {
         return $cal['userid'];
     } else {
         return null;
     }
 }
开发者ID:omusico,项目名称:isle-web-framework,代码行数:21,代码来源:object.php

示例8: 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))));
}
开发者ID:omusico,项目名称:isle-web-framework,代码行数:31,代码来源:dropimport.php

示例9: foreach

<?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.
 */
// Check if we are a user
OCP\JSON::checkLoggedIn();
OCP\JSON::checkAppEnabled('calendar');
OCP\JSON::callCheck();
if (trim($_POST['name']) == '') {
    OCP\JSON::error(array('message' => 'empty'));
    exit;
}
$calendars = OC_Calendar_Calendar::allCalendars(OCP\USER::getUser());
foreach ($calendars as $cal) {
    if ($cal['displayname'] == $_POST['name']) {
        OCP\JSON::error(array('message' => 'namenotavailable'));
        exit;
    }
}
$userid = OCP\USER::getUser();
$calendarid = OC_Calendar_Calendar::addCalendar($userid, strip_tags($_POST['name']), 'VEVENT,VTODO,VJOURNAL', null, 0, $_POST['color']);
OC_Calendar_Calendar::setCalendarActive($calendarid, 1);
$calendar = OC_Calendar_Calendar::find($calendarid);
$tmpl = new OCP\Template('calendar', 'part.choosecalendar.rowfields');
$tmpl->assign('calendar', $calendar);
$tmpl->assign('shared', false);
OCP\JSON::success(array('page' => $tmpl->fetchPage(), 'eventSource' => OC_Calendar_Calendar::getEventSourceInfo($calendar)));
开发者ID:omusico,项目名称:isle-web-framework,代码行数:31,代码来源:new.php

示例10: getowner

 /**
  * @brief returns the owner of an object
  * @param integer $id
  * @return string
  */
 public static function getowner($id)
 {
     $event = self::find($id);
     $cal = OC_Calendar_Calendar::find($event['calendarid']);
     return $cal['userid'];
 }
开发者ID:blablubli,项目名称:owncloudapps,代码行数:11,代码来源:object.php

示例11: getCalendarObjects

 /**
  * Returns all calendar objects within a calendar object.
  *
  * Every item contains an array with the following keys:
  *   * id - unique identifier which will be used for subsequent updates
  *   * calendardata - The iCalendar-compatible calnedar data
  *   * uri - a unique key which will be used to construct the uri. This can be any arbitrary string.
  *   * lastmodified - a timestamp of the last modification time
  *   * etag - An arbitrary string, surrounded by double-quotes. (e.g.:
  *   '  "abcdef"')
  *   * calendarid - The calendarid as it was passed to this function.
  *
  * Note that the etag is optional, but it's highly encouraged to return for
  * speed reasons.
  *
  * The calendardata is also optional. If it's not returned
  * 'getCalendarObject' will be called later, which *is* expected to return
  * calendardata.
  *
  * @param string $calendarId
  * @return array
  */
 public function getCalendarObjects($calendarId)
 {
     $data = array();
     if ($calendarId === 'contact_birthdays') {
         $app = new \OCA\Contacts\App();
         $addressBooks = $app->getAddressBooksForUser();
         foreach ($addressBooks as $addressBook) {
             foreach ($addressBook->getChildren() as $contact) {
                 $vevent = $contact->getBirthdayEvent();
                 if (is_null($vevent)) {
                     continue;
                 }
                 $data[] = $this->OCAddETag(array('id' => 0, 'calendarid' => 'contact_birthdays', 'uri' => $addressBook->getBackend()->name . '::' . $addressBook->getId() . '::' . $contact->getId() . '.ics', 'lastmodified' => $contact->lastModified(), 'summary' => $vevent->SUMMARY, 'calendardata' => $vevent->serialize()));
             }
         }
     } else {
         $calendar = OC_Calendar_Calendar::find($calendarId);
         $isShared = $calendar['userid'] !== OCP\USER::getUser();
         foreach (OC_Calendar_Object::all($calendarId) as $row) {
             if (!$isShared) {
                 $data[] = $this->OCAddETag($row);
             } else {
                 if (substr_count($row['calendardata'], 'CLASS') === 0) {
                     $data[] = $this->OCAddETag($row);
                 } else {
                     $object = \Sabre\VObject\Reader::read($row['calendardata']);
                     if (!$object) {
                         return false;
                     }
                     $isPrivate = false;
                     $toCheck = array('VEVENT', 'VJOURNAL', 'VTODO');
                     foreach ($toCheck as $type) {
                         foreach ($object->select($type) as $vobject) {
                             if (isset($vobject->{'CLASS'}) && $vobject->{'CLASS'}->getValue() === 'PRIVATE') {
                                 $isPrivate = true;
                             }
                         }
                     }
                     if ($isPrivate === false) {
                         $data[] = $this->OCAddETag($row);
                     }
                 }
             }
         }
     }
     return $data;
 }
开发者ID:AlfredoCubitos,项目名称:calendar,代码行数:69,代码来源:backend.php


注:本文中的OC_Calendar_Calendar::find方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。