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


PHP OC_Calendar_Object::find方法代码示例

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


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

示例1: event

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

示例2: formatItems

 public function formatItems($items, $format, $parameters = null)
 {
     $events = array();
     if ($format == self::FORMAT_EVENT) {
         foreach ($items as $item) {
             $event = OC_Calendar_Object::find($item['item_source']);
             $event['summary'] = $item['item_target'];
             $event['permissions'] = $item['permissions'];
             $events[] = $event;
         }
     }
     return $events;
 }
开发者ID:blablubli,项目名称:owncloudapps,代码行数:13,代码来源:event.php

示例3: formatItems

 public function formatItems($items, $format, $parameters = null)
 {
     $events = array();
     if ($format == self::FORMAT_EVENT) {
         foreach ($items as $item) {
             $event = OC_Calendar_Object::find($item['item_source']);
             if ($event == False) {
                 \OCP\Util::writeLog('calendar', __METHOD__ . ', Missing event: ' . $item['item_target'], \OCP\Util::DEBUG);
             } else {
                 $event['summary'] = $item['item_target'];
                 $event['permissions'] = $item['permissions'];
                 $events[] = $event;
             }
         }
     }
     return $events;
 }
开发者ID:enoch85,项目名称:owncloud-testserver,代码行数:17,代码来源:event.php

示例4: generate

 /**
  * @brief generates the cache the first time
  * @param (int) id - id of the event
  * @return (bool)
  */
 public static function generate($id)
 {
     $event = OC_Calendar_Object::find($id);
     if ($event['repeating'] == 0) {
         return false;
     }
     $object = OC_VObject::parse($event['calendardata']);
     $start = new DateTime('01-01-' . date('Y') . ' 00:00:00', new DateTimeZone('UTC'));
     $start->modify('-5 years');
     $end = new DateTime('31-12-' . date('Y') . ' 23:59:59', new DateTimeZone('UTC'));
     $end->modify('+5 years');
     $object->expand($start, $end);
     foreach ($object->getComponents() as $vevent) {
         if (!$vevent instanceof Sabre\VObject\Component\VEvent) {
             continue;
         }
         $startenddate = OC_Calendar_Object::generateStartEndDate($vevent->DTSTART, OC_Calendar_Object::getDTEndFromVEvent($vevent), $vevent->DTSTART->getDateType() == Sabre\VObject\Property\DateTime::DATE ? true : false, 'UTC');
         $stmt = OCP\DB::prepare('INSERT INTO `*PREFIX*calendar_repeat` (`eventid`,`calid`,`startdate`,`enddate`) VALUES(?,?,?,?)');
         $stmt->execute(array($id, OC_Calendar_Object::getCalendarid($id), $startenddate['start'], $startenddate['end']));
     }
     return true;
 }
开发者ID:netcon-source,项目名称:apps,代码行数:27,代码来源:repeat.php

示例5: getPermissions

 /**
  * @brief Get the permissions for a calendar / an event
  * @param (int) $id - id of the calendar / event
  * @param (string) $type - type of the id (calendar/event)
  * @return (int) $permissions - CRUDS permissions
  * @param (string) $accessclass - access class (rfc5545, section 3.8.1.3)
  * @see OCP\Share
  */
 public static function getPermissions($id, $type, $accessclass = '')
 {
     $permissions_all = OCP\PERMISSION_ALL;
     if ($type == self::CALENDAR) {
         $calendar = self::getCalendar($id, false, false);
         if ($calendar['userid'] == OCP\USER::getUser()) {
             return $permissions_all;
         } else {
             $sharedCalendar = OCP\Share::getItemSharedWithBySource('calendar', $id);
             if ($sharedCalendar) {
                 return $sharedCalendar['permissions'];
             }
         }
     } elseif ($type == self::EVENT) {
         if (OC_Calendar_Object::getowner($id) == OCP\USER::getUser()) {
             return $permissions_all;
         } else {
             $object = OC_Calendar_Object::find($id);
             $sharedCalendar = OCP\Share::getItemSharedWithBySource('calendar', $object['calendarid']);
             $sharedEvent = OCP\Share::getItemSharedWithBySource('event', $id);
             $calendar_permissions = 0;
             $event_permissions = 0;
             if ($sharedCalendar) {
                 $calendar_permissions = $sharedCalendar['permissions'];
             }
             if ($sharedEvent) {
                 $event_permissions = $sharedEvent['permissions'];
             }
             if ($accessclass === 'PRIVATE') {
                 return 0;
             } elseif ($accessclass === 'CONFIDENTIAL') {
                 return OCP\PERMISSION_READ;
             } else {
                 return max($calendar_permissions, $event_permissions);
             }
         }
     }
     return 0;
 }
开发者ID:yheric455042,项目名称:owncloud82,代码行数:47,代码来源:app.php

示例6: isDuplicate

    private function isDuplicate($insertid)
    {
        $newobject = OC_Calendar_Object::find($insertid);
        $stmt = OCP\DB::prepare('SELECT COUNT(*) AS `count` FROM `*PREFIX*clndr_objects`
								 INNER JOIN `*PREFIX*clndr_calendars` ON `calendarid`=`*PREFIX*clndr_calendars`.`id`
								 WHERE `objecttype`=? AND `startdate`=? AND `enddate`=? AND `repeating`=? AND `summary`=? AND `calendardata`=? AND `userid` = ?');
        $result = $stmt->execute(array($newobject['objecttype'], $newobject['startdate'], $newobject['enddate'], $newobject['repeating'], $newobject['summary'], $newobject['calendardata'], $this->userid));
        $result = $result->fetchRow();
        if ($result['count'] >= 2) {
            return true;
        }
        return false;
    }
开发者ID:CDN-Sparks,项目名称:owncloud,代码行数:13,代码来源:import.php

示例7: foreach

 $taskId = $task['id'];
 $comments = $vtodo->COMMENT;
 if ($comments) {
     foreach ($comments as $com) {
         $idx = 0;
         foreach ($children as $i => &$property) {
             if ($property->name == 'COMMENT' && $property['ID']->value == (int) $com['ID']->value) {
                 unset($vtodo->children[$idx]);
             }
             $idx += 1;
         }
         $vtodo->addProperty('COMMENT', $com->value, array('X-OC-ID' => (int) $com['ID']->value, 'X-OC-USERID' => $com['USERID']->value, 'X-OC-DATE-TIME' => $com['DATE-TIME']->value));
         OCP\Util::emitHook('OC_Calendar', 'editEvent', $taskId);
     }
     $data = $vcalendar->serialize();
     $oldobject = \OC_Calendar_Object::find($taskId);
     $object = \OC_VObject::parse($data);
     $type = 'VTODO';
     $startdate = null;
     $enddate = null;
     $summary = '';
     $repeating = 0;
     $uid = null;
     foreach ($object->children as $property) {
         if ($property->name == 'VTODO') {
             foreach ($property->children as &$element) {
                 if ($element->name == 'SUMMARY') {
                     $summary = $element->value;
                 } elseif ($element->name == 'UID') {
                     $uid = $element->value;
                 }
开发者ID:WeatherellTechnology,项目名称:weatherstorm7,代码行数:31,代码来源:update.php

示例8: OC_L10N

 * 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');
if (!OC_USER::isLoggedIn()) {
    die('<script type="text/javascript">document.location = oc_webroot;</script>');
}
OC_JSON::checkAppEnabled('calendar');
$calendar_options = OC_Calendar_Calendar::allCalendars(OC_User::getUser());
$category_options = OC_Calendar_Object::getCategoryOptions($l10n);
$repeat_options = OC_Calendar_Object::getRepeatOptions($l10n);
$id = $_GET['id'];
$data = OC_Calendar_Object::find($id);
$calendar = OC_Calendar_Calendar::findCalendar($data['calendarid']);
if ($calendar['userid'] != OC_User::getUser()) {
    echo $l10n->t('Wrong calendar');
    exit;
}
$object = Sabre_VObject_Reader::read($data['calendardata']);
$vevent = $object->VEVENT;
$dtstart = $vevent->DTSTART;
$dtend = OC_Calendar_Object::getDTEndFromVEvent($vevent);
switch ($dtstart->getDateType()) {
    case Sabre_VObject_Element_DateTime::LOCALTZ:
    case Sabre_VObject_Element_DateTime::LOCAL:
        $startdate = $dtstart->getDateTime()->format('d-m-Y');
        $starttime = $dtstart->getDateTime()->format('H:i');
        $enddate = $dtend->getDateTime()->format('d-m-Y');
开发者ID:Teino1978-Corp,项目名称:Teino1978-Corp-owncloud_.htaccess-,代码行数:31,代码来源:owncloud_apps_calendar_ajax_editeventform.php

示例9: generate_token

 private static function generate_token($id, $type)
 {
     $uniqid = uniqid();
     if ($type == self::CALENDAR) {
         $events = OC_Calendar_Object::all($id);
         $string = '';
         foreach ($events as $event) {
             $string .= $event['calendardata'];
         }
     } else {
         $string = OC_Calendar_Object::find($id);
     }
     $string = sha1($string['calendardata']);
     $id = sha1($id);
     $array = array($uniqid, $string, $id);
     shuffle($array);
     $string = implode('', $array);
     $token = md5($string);
     return substr($token, rand(0, 16), 15);
 }
开发者ID:jaeindia,项目名称:ownCloud-Enhancements,代码行数:20,代码来源:share.php

示例10: OC_L10N

<?php

// Init owncloud
OCP\JSON::checkLoggedIn();
OCP\JSON::checkAppEnabled('tasks');
$l10n = new OC_L10N('tasks');
$id = $_GET['id'];
$task = OC_Calendar_Object::find($id);
$details = OC_VObject::parse($task['calendardata']);
if (!$details) {
    OCP\JSON::error();
    exit;
}
$priority_options = OC_Task_App::getPriorityOptions();
$tmpl = new OCP\Template('tasks', 'part.details');
$tmpl->assign('priority_options', $priority_options);
$tmpl->assign('details', $details->VTODO);
$tmpl->assign('id', $id);
$page = $tmpl->fetchPage();
OCP\JSON::success(array('data' => array('id' => $id, 'page' => $page)));
开发者ID:jaeindia,项目名称:ownCloud-Enhancements,代码行数:20,代码来源:getdetails.php

示例11: getrequestedEvents

 public static function getrequestedEvents($calendarid, $start, $end)
 {
     $events = array();
     if ($calendarid == 'shared_rw' || $calendarid == 'shared_r') {
         $calendars = OC_Calendar_Share::allSharedwithuser(OCP\USER::getUser(), OC_Calendar_Share::CALENDAR, 1, $_GET['calendar_id'] == 'shared_rw' ? 'rw' : 'r');
         foreach ($calendars as $calendar) {
             $calendarevents = OC_Calendar_Object::allInPeriod($calendar['calendarid'], $start, $end);
             foreach ($calendarevents as $event) {
                 $event['summary'] .= ' (' . self::$l10n->t('by') . ' ' . OC_Calendar_Object::getowner($event['id']) . ')';
             }
             $events = array_merge($events, $calendarevents);
         }
         $singleevents = OC_Calendar_Share::allSharedwithuser(OCP\USER::getUser(), OC_Calendar_Share::EVENT, 1, $_GET['calendar_id'] == 'shared_rw' ? 'rw' : 'r');
         foreach ($singleevents as $singleevent) {
             $event = OC_Calendar_Object::find($singleevent['eventid']);
             if (!array_key_exists('summary', $event)) {
                 $event['summary'] = self::$l10n->t('unnamed');
             }
             $event['summary'] .= ' (' . self::$l10n->t('by') . ' ' . OC_Calendar_Object::getowner($event['id']) . ')';
             $events[] = $event;
         }
     } else {
         if (is_numeric($calendarid)) {
             $calendar = self::getCalendar($calendarid);
             OCP\Response::enableCaching(0);
             OCP\Response::setETagHeader($calendar['ctag']);
             $events = OC_Calendar_Object::allInPeriod($calendarid, $start, $end);
         } else {
             OCP\Util::emitHook('OC_Calendar', 'getEvents', array('calendar_id' => $calendarid, 'events' => &$events));
         }
     }
     return $events;
 }
开发者ID:noci2012,项目名称:owncloud,代码行数:33,代码来源:app.php

示例12: getPermissions

 /**
  * @brief Get the permissions for a calendar / an event
  * @param (int) $id - id of the calendar / event
  * @param (string) $type - type of the id (calendar/event)
  * @return (int) $permissions - CRUDS permissions
  * @see OCP\Share
  */
 public static function getPermissions($id, $type)
 {
     $permissions_all = OCP\Share::PERMISSION_CREATE | OCP\Share::PERMISSION_READ | OCP\Share::PERMISSION_UPDATE | OCP\Share::PERMISSION_DELETE | OCP\Share::PERMISSION_SHARE;
     if ($type == self::CALENDAR) {
         $calendar = self::getCalendar($id, false, false);
         if ($calendar['userid'] == OCP\USER::getUser()) {
             return $permissions_all;
         } else {
             $sharedCalendar = OCP\Share::getItemSharedWithBySource('calendar', $id);
             if ($sharedCalendar) {
                 return $sharedCalendar['permissions'];
             }
         }
     } elseif ($type == self::EVENT) {
         if (OC_Calendar_Object::getowner($id) == OCP\USER::getUser()) {
             return $permissions_all;
         } else {
             $object = OC_Calendar_Object::find($id);
             $sharedCalendar = OCP\Share::getItemSharedWithBySource('calendar', $object['calendarid']);
             $sharedEvent = OCP\Share::getItemSharedWithBySource('event', $id);
             $calendar_permissions = 0;
             $event_permissions = 0;
             if ($sharedCalendar) {
                 $calendar_permissions = $sharedCalendar['permissions'];
             }
             if ($sharedEvent) {
                 $event_permissions = $sharedEvent['permissions'];
             }
             return max($calendar_permissions, $event_permissions);
         }
     }
     return 0;
 }
开发者ID:blablubli,项目名称:owncloudapps,代码行数:40,代码来源:app.php

示例13: header

 * See the COPYING-README file.
 */
require_once "../../lib/base.php";
OC_Util::checkLoggedIn();
OC_Util::checkAppEnabled('calendar');
$cal = $_GET["calid"];
$event = $_GET["eventid"];
if (isset($cal)) {
    $calendar = OC_Calendar_Calendar::findCalendar($cal);
    if ($calendar["userid"] != OC_User::getUser()) {
        OC_JSON::error();
        exit;
    }
    $calobjects = OC_Calendar_Object::all($cal);
    header("Content-Type: text/Calendar");
    header("Content-Disposition: inline; filename=calendar.ics");
    for ($i = 0; $i <= count($calobjects); $i++) {
        echo $calobjects[$i]["calendardata"] . "\n";
    }
} elseif (isset($event)) {
    $data = OC_Calendar_Object::find($_GET["eventid"]);
    $calendarid = $data["calendarid"];
    $calendar = OC_Calendar_Calendar::findCalendar($calendarid);
    if ($calendar["userid"] != OC_User::getUser()) {
        OC_JSON::error();
        exit;
    }
    header("Content-Type: text/Calendar");
    header("Content-Disposition: inline; filename=" . $data["summary"] . ".ics");
    echo $data["calendardata"];
}
开发者ID:Teino1978-Corp,项目名称:Teino1978-Corp-owncloud_.htaccess-,代码行数:31,代码来源:owncloud_apps_calendar_export.php

示例14: error_reporting

<?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.
 */
error_reporting(E_ALL);
require_once '../../../lib/base.php';
OC_JSON::checkLoggedIn();
$data = OC_Calendar_Object::find($_POST["id"]);
$calendarid = $data["calendarid"];
$cal = $calendarid;
$id = $_POST["id"];
$calendar = OC_Calendar_Calendar::findCalendar($calendarid);
if (OC_User::getUser() != $calendar["userid"]) {
    OC_JSON::error();
    exit;
}
$newdate = $_POST["newdate"];
$caldata = array();
//modified part of editeventform.php
$object = Sabre_VObject_Reader::read($data['calendardata']);
$vevent = $object->VEVENT;
$dtstart = $vevent->DTSTART;
$dtend = OC_Calendar_Object::getDTEndFromVEvent($vevent);
switch ($dtstart->getDateType()) {
    case Sabre_VObject_Element_DateTime::LOCALTZ:
    case Sabre_VObject_Element_DateTime::LOCAL:
        $startdate = $dtstart->getDateTime()->format('d-m-Y');
开发者ID:Teino1978-Corp,项目名称:Teino1978-Corp-owncloud_.htaccess-,代码行数:31,代码来源:owncloud_apps_calendar_ajax_moveevent.php


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