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


PHP OC_Calendar_Calendar::allCalendars方法代码示例

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


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

示例1: search

 /**
  * Search for query in calendar events
  *
  * @param string $query
  * @return array list of \OCA\Calendar\Search\Event
  */
 function search($query)
 {
     $calendars = \OC_Calendar_Calendar::allCalendars(\OCP\USER::getUser(), true);
     // check if the calenar is enabled
     if (count($calendars) == 0 || !\OCP\App::isEnabled('calendar')) {
         return array();
     }
     $results = array();
     foreach ($calendars as $calendar) {
         $objects = \OC_Calendar_Object::all($calendar['id']);
         $date = strtotime($query);
         // search all calendar objects, one by one
         foreach ($objects as $object) {
             // skip non-events
             if ($object['objecttype'] != 'VEVENT') {
                 continue;
             }
             // check the event summary string
             if (stripos($object['summary'], $query) !== false) {
                 $results[] = new \OCA\Calendar\Search\Event($object);
                 continue;
             }
             // check if the event is happening on a queried date
             $range = $this->getDateRange($object);
             if ($date && $this->fallsWithin($date, $range)) {
                 $results[] = new \OCA\Calendar\Search\Event($object);
                 continue;
             }
         }
     }
     return $results;
 }
开发者ID:yheric455042,项目名称:owncloud82,代码行数:38,代码来源:provider.php

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

示例3: getTasks

 /**
  * @NoAdminRequired
  */
 public function getTasks()
 {
     $calendars = \OC_Calendar_Calendar::allCalendars($this->userId, true);
     $user_timezone = \OC_Calendar_App::getTimezone();
     $tasks = array();
     foreach ($calendars as $calendar) {
         $calendar_tasks = \OC_Calendar_Object::all($calendar['id']);
         foreach ($calendar_tasks as $task) {
             if ($task['objecttype'] != 'VTODO') {
                 continue;
             }
             if (is_null($task['summary'])) {
                 continue;
             }
             $vtodo = Helper::parseVTODO($task['calendardata']);
             try {
                 $task_data = Helper::arrayForJSON($task['id'], $vtodo, $user_timezone);
                 $task_data['calendarid'] = $calendar['id'];
                 $task_data['calendarcolor'] = $calendar['calendarcolor'];
                 $tasks[] = $task_data;
             } catch (\Exception $e) {
                 \OCP\Util::writeLog('tasks', $e->getMessage(), \OCP\Util::ERROR);
             }
         }
     }
     $result = array('data' => array('tasks' => $tasks));
     $response = new JSONResponse();
     $response->setData($result);
     return $response;
 }
开发者ID:msbt,项目名称:tasks,代码行数:33,代码来源:taskscontroller.php

示例4: 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;
 }
开发者ID:blablubli,项目名称:owncloudapps,代码行数:13,代码来源:hooks.php

示例5: getCalendars

 private function getCalendars()
 {
     $calendars = array();
     foreach (OC_Calendar_Calendar::allCalendars($this->user, true) as $cal) {
         $calendars[$cal['id']] = $cal['displayname'];
     }
     return $calendars;
 }
开发者ID:kam1katze,项目名称:ocDashboard,代码行数:8,代码来源:tasks.php

示例6: generateTarget

 /**
  * @brief Get a unique name of the item for the specified user
  * @param string Item
  * @param string|false User the item is being shared with
  * @param array|null List of similar item names already existing as shared items
  * @return string Target name
  *
  * This function needs to verify that the user does not already have an item with this name.
  * If it does generate a new name e.g. name_#
  */
 public function generateTarget($itemSource, $shareWith, $exclude = null)
 {
     $calendar = OC_Calendar_App::getCalendar($itemSource);
     $user_calendars = array();
     foreach (OC_Calendar_Calendar::allCalendars($shareWith) as $user_calendar) {
         $user_calendars[] = $user_calendar['displayname'];
     }
     $name = $calendar['userid'] . "'s " . $calendar['displayname'];
     $suffix = '';
     while (in_array($name . $suffix, $user_calendars)) {
         $suffix++;
     }
     return $name . $suffix;
 }
开发者ID:netcon-source,项目名称:apps,代码行数:24,代码来源:calendar.php

示例7: search

 /**
  * Search for query in tasks
  *
  * @param string $query
  * @return array list of \OCA\Tasks\Controller\Task
  */
 function search($query)
 {
     $calendars = \OC_Calendar_Calendar::allCalendars(\OC::$server->getUserSession()->getUser()->getUID(), true);
     $user_timezone = \OC_Calendar_App::getTimezone();
     // check if the calenar is enabled
     if (count($calendars) == 0 || !\OCP\App::isEnabled('tasks')) {
         return array();
     }
     $results = array();
     foreach ($calendars as $calendar) {
         // $calendar_entries = \OC_Calendar_Object::all($calendar['id']);
         $objects = \OC_Calendar_Object::all($calendar['id']);
         // $date = strtotime($query);
         // 	// search all calendar objects, one by one
         foreach ($objects as $object) {
             // skip non-todos
             if ($object['objecttype'] != 'VTODO') {
                 continue;
             }
             if (!($vtodo = Helper::parseVTODO($object))) {
                 continue;
             }
             $id = $object['id'];
             $calendarId = $object['calendarid'];
             // check these properties
             $properties = array('SUMMARY', 'DESCRIPTION', 'LOCATION', 'CATEGORIES');
             foreach ($properties as $property) {
                 $string = $vtodo->{$property};
                 if (stripos($string, $query) !== false) {
                     // $results[] = new \OCA\Tasks\Controller\Task($id,$calendarId,$vtodo,$property,$query,$user_timezone);
                     $results[] = Helper::arrayForJSON($id, $vtodo, $user_timezone, $calendarId);
                     continue 2;
                 }
             }
             $comments = $vtodo->COMMENT;
             if ($comments) {
                 foreach ($comments as $com) {
                     if (stripos($com->getValue(), $query) !== false) {
                         // $results[] = new \OCA\Tasks\Controller\Task($id,$calendarId,$vtodo,'COMMENTS',$query,$user_timezone);
                         $results[] = Helper::arrayForJSON($id, $vtodo, $user_timezone, $calendarId);
                         continue 2;
                     }
                 }
             }
         }
     }
     usort($results, array($this, 'sort_completed'));
     return $results;
 }
开发者ID:sbambach,项目名称:tasks,代码行数:55,代码来源:searchcontroller.php

示例8: search

 function search($query)
 {
     $calendars = OC_Calendar_Calendar::allCalendars(OCP\USER::getUser(), true);
     if (count($calendars) == 0 || !OCP\App::isEnabled('calendar')) {
         //return false;
     }
     $results = array();
     $searchquery = array();
     if (substr_count($query, ' ') > 0) {
         $searchquery = explode(' ', $query);
     } else {
         $searchquery[] = $query;
     }
     $user_timezone = OC_Calendar_App::getTimezone();
     $l = new OC_l10n('calendar');
     foreach ($calendars as $calendar) {
         $objects = OC_Calendar_Object::all($calendar['id']);
         foreach ($objects as $object) {
             if ($object['objecttype'] != 'VEVENT') {
                 continue;
             }
             if (substr_count(strtolower($object['summary']), strtolower($query)) > 0) {
                 $calendardata = OC_VObject::parse($object['calendardata']);
                 $vevent = $calendardata->VEVENT;
                 $dtstart = $vevent->DTSTART;
                 $dtend = OC_Calendar_Object::getDTEndFromVEvent($vevent);
                 $start_dt = $dtstart->getDateTime();
                 $start_dt->setTimezone(new DateTimeZone($user_timezone));
                 $end_dt = $dtend->getDateTime();
                 $end_dt->setTimezone(new DateTimeZone($user_timezone));
                 if ($dtstart->getDateType() == Sabre\VObject\Property\DateTime::DATE) {
                     $end_dt->modify('-1 sec');
                     if ($start_dt->format('d.m.Y') != $end_dt->format('d.m.Y')) {
                         $info = $l->t('Date') . ': ' . $start_dt->format('d.m.Y') . ' - ' . $end_dt->format('d.m.Y');
                     } else {
                         $info = $l->t('Date') . ': ' . $start_dt->format('d.m.Y');
                     }
                 } else {
                     $info = $l->t('Date') . ': ' . $start_dt->format('d.m.y H:i') . ' - ' . $end_dt->format('d.m.y H:i');
                 }
                 $link = OCP\Util::linkTo('calendar', 'index.php') . '?showevent=' . urlencode($object['id']);
                 $results[] = new OC_Search_Result($object['summary'], $info, $link, (string) $l->t('Cal.'));
                 //$name,$text,$link,$type
             }
         }
     }
     return $results;
 }
开发者ID:omusico,项目名称:isle-web-framework,代码行数:48,代码来源:search.php

示例9: 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();
 }
开发者ID:sbambach,项目名称:tasks,代码行数:28,代码来源:listsservice.php

示例10:

<?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.
 */
$tmpl = new OCP\Template('calendar', 'settings');
$timezone = OCP\Config::getUserValue(OCP\USER::getUser(), 'calendar', 'timezone', '');
$tmpl->assign('timezone', $timezone);
$tmpl->assign('timezones', DateTimeZone::listIdentifiers());
$tmpl->assign('calendars', OC_Calendar_Calendar::allCalendars(OCP\USER::getUser()), false);
OCP\Util::addscript('calendar', 'settings');
$tmpl->printPage();
开发者ID:omusico,项目名称:isle-web-framework,代码行数:15,代码来源:settings.php

示例11:

<?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.
 */
require_once '../../lib/base.php';
OC_Util::checkLoggedIn();
OC_Util::checkAppEnabled('calendar');
// Create default calendar ...
$calendars = OC_Calendar_Calendar::allCalendars(OC_User::getUser());
if (count($calendars) == 0) {
    OC_Calendar_Calendar::addCalendar(OC_User::getUser(), 'default', 'Default calendar');
    $calendars = OC_Calendar_Calendar::allCalendars(OC_User::getUser());
}
OC_UTIL::addScript('calendar', 'calendar');
OC_UTIL::addStyle('calendar', 'style');
OC_UTIL::addScript('', 'jquery.multiselect');
OC_UTIL::addStyle('', 'jquery.multiselect');
OC_APP::setActiveNavigationEntry('calendar_index');
$output = new OC_TEMPLATE('calendar', 'calendar', 'user');
$output->printPage();
开发者ID:Teino1978-Corp,项目名称:Teino1978-Corp-owncloud_.htaccess-,代码行数:24,代码来源:owncloud_apps_calendar_index.php

示例12: getCalendars

 /**
  *
  * return array
  * key   = calendar id
  * value = name of calendar
  *
  * @return array
  */
 private function getCalendars()
 {
     $calendars = array();
     foreach (\OC_Calendar_Calendar::allCalendars($this->user, true) as $cal) {
         if ($cal['active'] == '1') {
             $calendars[$cal['id']] = array('name' => $cal['displayname'], 'color' => $cal['calendarcolor']);
         }
     }
     return $calendars;
 }
开发者ID:arnovr,项目名称:dashboard,代码行数:18,代码来源:taskscontroller.php

示例13: getrequestedEvents

 /**
  * @brief analyses the parameter for calendar parameter and returns the objects
  * @param (string) $calendarid - calendarid
  * @param (int) $start - unixtimestamp of start
  * @param (int) $end - unixtimestamp of end
  * @return (array) $events
  */
 public static function getrequestedEvents($calendarid, $start, $end)
 {
     $events = array();
     if ($calendarid == 'shared_events') {
         $singleevents = OCP\Share::getItemsSharedWith('event', OC_Share_Backend_Event::FORMAT_EVENT);
         $calendars = OC_Calendar_Calendar::allCalendars(OCP\USER::getUser());
         foreach ($singleevents as $singleevent) {
             // Skip this single event if the whole calendar is already shared with the user.
             $calendarShared = false;
             foreach ($calendars as $calendar) {
                 if ($singleevent['calendarid'] === $calendar['id']) {
                     $calendarShared = true;
                     break;
                 }
             }
             if ($calendarShared === true) {
                 continue;
             }
             $singleevent['summary'] .= ' (' . self::$l10n->t('by') . ' ' . OC_Calendar_Object::getowner($singleevent['id']) . ')';
             $events[] = $singleevent;
         }
     } 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, $calendar['userid'] !== OCP\User::getUser());
         } else {
             OCP\Util::emitHook('OC_Calendar', 'getEvents', array('calendar_id' => $calendarid, 'events' => &$events));
         }
     }
     return $events;
 }
开发者ID:yheric455042,项目名称:owncloud82,代码行数:40,代码来源:app.php

示例14: array

<?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\User::checkLoggedIn();
OCP\App::checkAppEnabled('calendar');
// Create default calendar ...
$calendars = OC_Calendar_Calendar::allCalendars(OCP\USER::getUser(), 1);
if (count($calendars) == 0) {
    OC_Calendar_Calendar::addCalendar(OCP\USER::getUser(), 'Default calendar');
    $calendars = OC_Calendar_Calendar::allCalendars(OCP\USER::getUser(), 1);
}
$eventSources = array();
foreach ($calendars as $calendar) {
    $eventSources[] = OC_Calendar_Calendar::getEventSourceInfo($calendar);
}
$eventSources[] = array('url' => '?app=calendar&getfile=ajax/events.php?calendar_id=shared_rw', 'backgroundColor' => '#1D2D44', 'borderColor' => '#888', 'textColor' => 'white', 'editable' => 'true');
$eventSources[] = array('url' => '?app=calendar&getfile=ajax/events.php?calendar_id=shared_r', 'backgroundColor' => '#1D2D44', 'borderColor' => '#888', 'textColor' => 'white', 'editable' => 'false');
OCP\Util::emitHook('OC_Calendar', 'getSources', array('sources' => &$eventSources));
$categories = OC_Calendar_App::getCategoryOptions();
//Fix currentview for fullcalendar
if (OCP\Config::getUserValue(OCP\USER::getUser(), 'calendar', 'currentview', 'month') == "oneweekview") {
    OCP\Config::setUserValue(OCP\USER::getUser(), "calendar", "currentview", "agendaWeek");
}
if (OCP\Config::getUserValue(OCP\USER::getUser(), 'calendar', 'currentview', 'month') == "onemonthview") {
    OCP\Config::setUserValue(OCP\USER::getUser(), "calendar", "currentview", "month");
}
开发者ID:jaeindia,项目名称:ownCloud-Enhancements,代码行数:31,代码来源:index.php

示例15: scanCategories

 /**
  * scan events for categories.
  * @param $events VEVENTs to scan. null to check all events for the current user.
  */
 public static function scanCategories($events = null)
 {
     if (is_null($events)) {
         $calendars = OC_Calendar_Calendar::allCalendars(OCP\USER::getUser());
         if (count($calendars) > 0) {
             $events = array();
             foreach ($calendars as $calendar) {
                 if ($calendar['userid'] === OCP\User::getUser()) {
                     $calendar_events = OC_Calendar_Object::all($calendar['id']);
                     $events = $events + $calendar_events;
                 }
             }
         }
     }
     if (is_array($events) && count($events) > 0) {
         $vcategories = \OC::$server->getTagManager()->load('event');
         $getName = function ($tag) {
             return $tag['name'];
         };
         $tags = array_map($getName, $vcategories->getTags());
         $vcategories->delete($tags);
         foreach ($events as $event) {
             $vobject = OC_VObject::parse($event['calendardata']);
             if (!is_null($vobject)) {
                 $object = null;
                 if (isset($calendar->VEVENT)) {
                     $object = $calendar->VEVENT;
                 } else {
                     if (isset($calendar->VTODO)) {
                         $object = $calendar->VTODO;
                     } else {
                         if (isset($calendar->VJOURNAL)) {
                             $object = $calendar->VJOURNAL;
                         }
                     }
                 }
                 if ($object && isset($object->CATEGORIES)) {
                     $vcategories->addMultiple($object->CATEGORIES->getParts(), true, $event['id']);
                 }
             }
         }
     }
 }
开发者ID:omusico,项目名称:isle-web-framework,代码行数:47,代码来源:app.php


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