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


PHP OC_Calendar_App::getCalendar方法代码示例

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


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

示例1: getAll

 /**
  * get a list of Tasks filtered by listID and type
  * 
  * @param  string $listID
  * @param  string $type
  * @return array
  * @throws \Exception
  */
 public function getAll($listID = 'all', $type = 'all')
 {
     if ($listID == 'all') {
         $calendars = \OC_Calendar_Calendar::allCalendars($this->userId, true);
     } else {
         $calendar = \OC_Calendar_App::getCalendar($listID, true, false);
         $calendars = array($calendar);
     }
     $tasks = array();
     $lists = array();
     foreach ($calendars as $calendar) {
         $tasksMap = $this->mapperHelper->createTasksMap($calendar['id']);
         list($lists[], $rootTasks) = $this->mapperHelper->getRootTasks($tasksMap, $type, $calendar['id']);
         $tasks = array_merge($tasks, $rootTasks);
         foreach ($rootTasks as $rootTask) {
             $tasks = array_merge($tasks, $this->mapperHelper->getChildTasks($rootTask['uid'], $tasksMap, true));
         }
     }
     return array('tasks' => array_values($tasks), 'lists' => $lists);
 }
开发者ID:hesaid,项目名称:tasks-1,代码行数:28,代码来源:tasksservice.php

示例2: foreach

if ($_POST['method'] == 'new') {
    $calendars = OC_Calendar_Calendar::allCalendars(OCP\User::getUser());
    foreach ($calendars as $calendar) {
        if ($calendar['displayname'] == $_POST['calname']) {
            $id = $calendar['id'];
            $newcal = false;
            break;
        }
        $newcal = true;
    }
    if ($newcal) {
        $id = OC_Calendar_Calendar::addCalendar(OCP\USER::getUser(), strip_tags($_POST['calname']), 'VEVENT,VTODO,VJOURNAL', null, 0, strip_tags($_POST['calcolor']));
        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();
开发者ID:omusico,项目名称:isle-web-framework,代码行数:31,代码来源:import.php

示例3: isset

<?php

/**
 * Copyright (c) 2012 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');
$cal = isset($_GET['calid']) ? $_GET['calid'] : null;
$event = isset($_GET['eventid']) ? $_GET['eventid'] : null;
if (!is_null($cal)) {
    $calendar = OC_Calendar_App::getCalendar($cal, true);
    if (!$calendar) {
        header('HTTP/1.0 403 Forbidden');
        exit;
    }
    header('Content-Type: text/calendar');
    header('Content-Disposition: inline; filename=' . str_replace(' ', '-', $calendar['displayname']) . '.ics');
    echo OC_Calendar_Export::export($cal, OC_Calendar_Export::CALENDAR);
} elseif (!is_null($event)) {
    $data = OC_Calendar_App::getEventObject($_GET['eventid'], true);
    if (!$data) {
        header('HTTP/1.0 403 Forbidden');
        exit;
    }
    header('Content-Type: text/calendar');
    header('Content-Disposition: inline; filename=' . str_replace(' ', '-', $data['summary']) . '.ics');
    echo OC_Calendar_Export::export($event, OC_Calendar_Export::EVENT);
}
开发者ID:omusico,项目名称:isle-web-framework,代码行数:31,代码来源:export.php

示例4: formatItems

 /**
  * @brief Converts the shared item sources back into the item in the specified format
  * @param array Shared items
  * @param int Format
  * @return ?
  *
  * The items array is a 3-dimensional array with the item_source as the first key and the share id as the second key to an array with the share info.
  * The key/value pairs included in the share info depend on the function originally called:
  * If called by getItem(s)Shared: id, item_type, item, item_source, share_type, share_with, permissions, stime, file_source
  * If called by getItem(s)SharedWith: id, item_type, item, item_source, item_target, share_type, share_with, permissions, stime, file_source, file_target
  * This function allows the backend to control the output of shared items with custom formats.
  * It is only called through calls to the public getItem(s)Shared(With) functions.
  */
 public function formatItems($items, $format, $parameters = null)
 {
     $calendars = array();
     if ($format == self::FORMAT_CALENDAR) {
         foreach ($items as $item) {
             $calendar = OC_Calendar_App::getCalendar($item['item_source'], false);
             if (!$calendar) {
                 continue;
             }
             // TODO: really check $parameters['permissions'] == 'rw'/'r'
             if ($parameters['permissions'] == 'rw') {
                 continue;
                 // TODO
             }
             $calendar['displaynamename'] = $item['item_target'];
             $calendar['permissions'] = $item['permissions'];
             $calendar['calendarid'] = $calendar['id'];
             $calendar['owner'] = $calendar['userid'];
             $calendars[] = $calendar;
         }
     }
     return $calendars;
 }
开发者ID:netcon-source,项目名称:apps,代码行数:36,代码来源:calendar.php

示例5:

<?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.
 */
OCP\JSON::checkLoggedIn();
OCP\JSON::checkAppEnabled('calendar');
$calendarcolor_options = OC_Calendar_Calendar::getCalendarColorOptions();
$calendar = OC_Calendar_App::getCalendar($_GET['calendarid']);
$tmpl = new OCP\Template("calendar", "part.editcalendar");
$tmpl->assign('new', false);
$tmpl->assign('calendarcolor_options', $calendarcolor_options);
$tmpl->assign('calendar', $calendar);
$tmpl->printPage();
开发者ID:noci2012,项目名称:owncloud,代码行数:17,代码来源:edit.form.php

示例6: foreach

} else {
    echo '<ul>';
    foreach ($_['categories'] as $categorie) {
        echo '<li>' . $categorie . '</li>';
    }
    echo '</ul>';
}
?>
			</td>
			<th width="75px">&nbsp;&nbsp;&nbsp;<?php 
echo $l->t("Calendar");
?>
:</th>
			<td>
			<?php 
$calendar = OC_Calendar_App::getCalendar($_['calendar'], false, false);
echo $calendar['displayname'] . ' ' . $l->t('of') . ' ' . $calendar['userid'];
?>
			</td>
			<th width="75px">&nbsp;</th>
			<td>
				<input type="hidden" name="calendar" value="<?php 
echo $_['calendar_options'][0]['id'];
?>
">
			</td>
		</tr>
	</table>
	<hr>
	<table width="100%">
		<tr>
开发者ID:noci2012,项目名称:owncloud,代码行数:31,代码来源:part.showevent.php

示例7: array

} else {
    echo '<select id="category" name="categories[]" multiple="multiple" title="' . $l->t("Select category") . '">';
    echo OCP\html_select_options($_['categories'], $_['categories'], array('combine' => true));
    echo '</select>';
}
?>
			</td>
			<th width="75px">&nbsp;&nbsp;&nbsp;<?php 
echo $l->t("Calendar");
?>
:</th>
			<td>
				<select name="calendar" disabled="disabled">
					<option>
					<?php 
$calendar = OC_Calendar_App::getCalendar($_['calendar']);
echo $calendar['displayname'] . ' ' . $l->t('of') . ' ' . $calendar['userid'];
?>
					</option>
					
				</select>
			</td>
			<th width="75px">&nbsp;</th>
			<td>
				<input type="hidden" name="calendar" value="<?php 
echo $_['calendar_options'][0]['id'];
?>
">
			</td>
		</tr>
	</table>
开发者ID:jaeindia,项目名称:ownCloud-Enhancements,代码行数:31,代码来源:part.showevent.php

示例8: session_write_close

<?php

/**
 * Copyright (c) 2011, 2012 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 'when/When.php';
OCP\JSON::checkLoggedIn();
OCP\JSON::checkAppEnabled('calendar');
session_write_close();
// Look for the calendar id
$calendar_id = OC_Calendar_App::getCalendar($_GET['calendar_id'], false, false);
if ($calendar_id !== false) {
    if (!is_numeric($calendar_id['userid']) && $calendar_id['userid'] != OCP\User::getUser()) {
        OCP\JSON::error();
        exit;
    }
} else {
    $calendar_id = $_GET['calendar_id'];
}
$start = version_compare(PHP_VERSION, '5.3.0', '>=') ? DateTime::createFromFormat('U', $_GET['start']) : new DateTime('@' . $_GET['start']);
$end = version_compare(PHP_VERSION, '5.3.0', '>=') ? DateTime::createFromFormat('U', $_GET['end']) : new DateTime('@' . $_GET['end']);
$events = OC_Calendar_App::getrequestedEvents($_GET['calendar_id'], $start, $end);
$output = array();
foreach ($events as $event) {
    $output = array_merge($output, OC_Calendar_App::generateEventOutput($event, $start, $end));
}
OCP\JSON::encodedPrint(OCP\Util::sanitizeHTML($output));
开发者ID:noci2012,项目名称:owncloud,代码行数:30,代码来源:events.php

示例9: strip_tags

 * This file is licensed under the Affero General Public License version 3 or
 * later.
 * See the COPYING-README file.
 */
OCP\JSON::callCheck();
$id = strip_tags($_GET['id']);
$idtype = strip_tags($_GET['idtype']);
switch ($idtype) {
    case 'calendar':
    case 'event':
        break;
    default:
        OCP\JSON::error(array('message' => 'unexspected parameter'));
        exit;
}
if ($idtype == 'calendar' && !OC_Calendar_App::getCalendar($id)) {
    OCP\JSON::error(array('message' => 'permission denied'));
    exit;
}
if ($idtype == 'event' && !OC_Calendar_App::getEventObject($id)) {
    OCP\JSON::error(array('message' => 'permission denied'));
    exit;
}
$sharewith = $_GET['sharewith'];
$sharetype = strip_tags($_GET['sharetype']);
switch ($sharetype) {
    case 'user':
    case 'group':
    case 'public':
        break;
    default:
开发者ID:noci2012,项目名称:owncloud,代码行数:31,代码来源:unshare.php

示例10: session_write_close

/**
 * Copyright (c) 2011, 2012 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');
session_write_close();
// Look for the calendar id
$calendar_id = null;
if (strval(intval($_GET['calendar_id'])) == strval($_GET['calendar_id'])) {
    // integer for sure.
    $id = intval($_GET['calendar_id']);
    $calendarrow = OC_Calendar_App::getCalendar($id, true, false);
    // Let's at least security check otherwise we might as well use OC_Calendar_Calendar::find())
    if ($calendarrow !== false) {
        $calendar_id = $id;
    } else {
        if (OCP\Share::getItemSharedWithBySource('calendar', $id) === false) {
            OCP\JSON::encodedPrint(array());
            exit;
        }
    }
}
$calendar_id = is_null($calendar_id) ? strip_tags($_GET['calendar_id']) : $calendar_id;
$start = version_compare(PHP_VERSION, '5.3.0', '>=') ? DateTime::createFromFormat('U', $_GET['start']) : new DateTime('@' . $_GET['start']);
$end = version_compare(PHP_VERSION, '5.3.0', '>=') ? DateTime::createFromFormat('U', $_GET['end']) : new DateTime('@' . $_GET['end']);
$events = OC_Calendar_App::getrequestedEvents($calendar_id, $start, $end);
$output = array();
开发者ID:CDN-Sparks,项目名称:owncloud,代码行数:30,代码来源:events.php

示例11: getTasks

 /**
  * @NoAdminRequired
  */
 public function getTasks($listID = 'all', $type = 'all')
 {
     $user_timezone = \OC_Calendar_App::getTimezone();
     if ($listID == 'all') {
         $calendars = \OC_Calendar_Calendar::allCalendars($this->userId, true);
     } else {
         $calendar = \OC_Calendar_App::getCalendar($listID, true, false);
         $calendars = array($calendar);
     }
     $tasks = array();
     $lists = array();
     foreach ($calendars as $calendar) {
         $calendar_entries = \OC_Calendar_Object::all($calendar['id']);
         $tasks_selected = array();
         foreach ($calendar_entries 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, $calendar['id']);
                 switch ($type) {
                     case 'all':
                         $tasks[] = $task_data;
                         break;
                     case 'init':
                         if (!$task_data['completed']) {
                             $tasks[] = $task_data;
                         } else {
                             $tasks_selected[] = $task_data;
                         }
                         break;
                     case 'completed':
                         if ($task_data['completed']) {
                             $tasks[] = $task_data;
                         }
                         break;
                     case 'uncompleted':
                         if (!$task_data['completed']) {
                             $tasks[] = $task_data;
                         }
                         break;
                 }
             } catch (\Exception $e) {
                 \OCP\Util::writeLog('tasks', $e->getMessage(), \OCP\Util::ERROR);
             }
         }
         $nrCompleted = 0;
         $notLoaded = 0;
         usort($tasks_selected, array($this, 'sort_completed'));
         foreach ($tasks_selected as $task_selected) {
             $nrCompleted++;
             if ($nrCompleted > 5) {
                 $notLoaded++;
                 continue;
             }
             $tasks[] = $task_selected;
         }
         $lists[] = array('id' => $calendar['id'], 'notLoaded' => $notLoaded);
     }
     $result = array('data' => array('tasks' => $tasks, 'lists' => $lists));
     $response = new JSONResponse();
     $response->setData($result);
     return $response;
 }
开发者ID:WeatherellTechnology,项目名称:weatherstorm7,代码行数:71,代码来源:taskscontroller.php

示例12:

<?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.
 */
OCP\JSON::checkLoggedIn();
OCP\JSON::checkAppEnabled('calendar');
$calendarcolor_options = OC_Calendar_Calendar::getCalendarColorOptions();
$calendar = OC_Calendar_App::getCalendar($_POST['calendarid'], true, true);
$tmpl = new OCP\Template("calendar", "part.editcalendar");
$tmpl->assign('new', false);
$tmpl->assign('calendarcolor_options', $calendarcolor_options);
$tmpl->assign('calendar', $calendar);
$tmpl->printPage();
开发者ID:enoch85,项目名称:owncloud-testserver,代码行数:17,代码来源:edit.form.php

示例13: array

    }
    if (array_key_exists('weekdays', $repeat)) {
        $repeat_weekdays_ = array();
        $days = OC_Calendar_App::getWeeklyOptions();
        foreach ($repeat['weekdays'] as $weekday) {
            $repeat_weekdays_[] = $days[$weekday];
        }
        $repeat['weekdays'] = $repeat_weekdays_;
    }
} else {
    $repeat['repeat'] = 'doesnotrepeat';
}
if ($access == 'owner') {
    $calendar_options = OC_Calendar_Calendar::allCalendars(OCP\USER::getUser());
} else {
    $calendar_options = array(OC_Calendar_App::getCalendar($data['calendarid'], false));
}
$category_options = OC_Calendar_App::getCategoryOptions();
$repeat_options = OC_Calendar_App::getRepeatOptions();
$repeat_end_options = OC_Calendar_App::getEndOptions();
$repeat_month_options = OC_Calendar_App::getMonthOptions();
$repeat_year_options = OC_Calendar_App::getYearOptions();
$repeat_weekly_options = OC_Calendar_App::getWeeklyOptions();
$repeat_weekofmonth_options = OC_Calendar_App::getWeekofMonth();
$repeat_byyearday_options = OC_Calendar_App::getByYearDayOptions();
$repeat_bymonth_options = OC_Calendar_App::getByMonthOptions();
$repeat_byweekno_options = OC_Calendar_App::getByWeekNoOptions();
$repeat_bymonthday_options = OC_Calendar_App::getByMonthDayOptions();
if ($access == 'owner' || $access == 'rw') {
    $tmpl = new OCP\Template('calendar', 'part.editevent');
} elseif ($access == 'r') {
开发者ID:jaeindia,项目名称:ownCloud-Enhancements,代码行数:31,代码来源:edit.form.php

示例14: catch

<?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.
 */
OCP\JSON::checkLoggedIn();
OCP\JSON::checkAppEnabled('calendar');
OCP\JSON::callCheck();
$calendarid = $_POST['calendarid'];
$calendar = OC_Calendar_App::getCalendar($calendarid, true);
if (!$calendar) {
    OCP\JSON::error(array('message' => 'permission denied'));
    exit;
}
try {
    OC_Calendar_Calendar::setCalendarActive($calendarid, $_POST['active']);
} catch (Exception $e) {
    OCP\JSON::error(array('message' => $e->getMessage()));
    exit;
}
$calendar = OC_Calendar_App::getCalendar($calendarid);
OCP\JSON::success(array('active' => $calendar['active'], 'eventSource' => OC_Calendar_Calendar::getEventSourceInfo($calendar)));
开发者ID:enoch85,项目名称:owncloud-testserver,代码行数:25,代码来源:activation.php

示例15: getAll

 /**
  * get a list of Tasks filtered by listID and type
  * 
  * @param  string $listID
  * @param  string $type
  * @return array
  * @throws \Exception
  */
 public function getAll($listID = 'all', $type = 'all')
 {
     $user_timezone = \OC_Calendar_App::getTimezone();
     if ($listID == 'all') {
         $calendars = \OC_Calendar_Calendar::allCalendars($this->userId, true);
     } else {
         $calendar = \OC_Calendar_App::getCalendar($listID, true, false);
         $calendars = array($calendar);
     }
     $tasks = array();
     $lists = array();
     foreach ($calendars as $calendar) {
         $calendar_entries = \OC_Calendar_Object::all($calendar['id']);
         $tasks_selected = array();
         foreach ($calendar_entries as $task) {
             if ($task['objecttype'] != 'VTODO') {
                 continue;
             }
             if (is_null($task['summary'])) {
                 continue;
             }
             if (!($vtodo = Helper::parseVTODO($task))) {
                 continue;
             }
             $task_data = Helper::arrayForJSON($task['id'], $vtodo, $user_timezone, $calendar['id']);
             switch ($type) {
                 case 'all':
                     $tasks[] = $task_data;
                     break;
                 case 'init':
                     if (!$task_data['completed']) {
                         $tasks[] = $task_data;
                     } else {
                         $tasks_selected[] = $task_data;
                     }
                     break;
                 case 'completed':
                     if ($task_data['completed']) {
                         $tasks[] = $task_data;
                     }
                     break;
                 case 'uncompleted':
                     if (!$task_data['completed']) {
                         $tasks[] = $task_data;
                     }
                     break;
             }
         }
         $nrCompleted = 0;
         $notLoaded = 0;
         usort($tasks_selected, array($this, 'sort_completed'));
         foreach ($tasks_selected as $task_selected) {
             $nrCompleted++;
             if ($nrCompleted > 5) {
                 $notLoaded++;
                 continue;
             }
             $tasks[] = $task_selected;
         }
         $lists[] = array('id' => $calendar['id'], 'notLoaded' => $notLoaded);
     }
     return array('tasks' => $tasks, 'lists' => $lists);
 }
开发者ID:sbambach,项目名称:tasks,代码行数:71,代码来源:tasksservice.php


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