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


PHP OC_Calendar_App类代码示例

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


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

示例1: createReminder

 /**
  * create reminder for task
  * @param  int    $taskID
  * @param  string $type
  * @param  mixed  $action
  * @param  mixed  $date
  * @param  bool   $invert
  * @param  string $related
  * @param  mixed  $week
  * @param  mixed  $day
  * @param  mixed  $hour
  * @param  mixed  $minute
  * @param  mixed  $second
  * @return bool
  * @throws \Exception
  */
 public function createReminder($taskID, $type, $action, $date, $invert, $related = null, $week, $day, $hour, $minute, $second)
 {
     $types = array('DATE-TIME', 'DURATION');
     $vcalendar = \OC_Calendar_App::getVCalendar($taskID);
     $vtodo = $vcalendar->VTODO;
     $valarm = $vtodo->VALARM;
     if (in_array($type, $types)) {
         if ($valarm == null) {
             $valarm = $vcalendar->createComponent('VALARM');
             $valarm->ACTION = $action;
             $valarm->DESCRIPTION = 'Default Event Notification';
             $vtodo->add($valarm);
         } else {
             unset($valarm->TRIGGER);
         }
         $string = '';
         if ($type == 'DATE-TIME') {
             $string = $this->createReminderDateTime($date);
         } elseif ($type == 'DURATION') {
             $string = $this->createReminderDuration($week, $day, $hour, $minute, $second, $invert);
         }
         if ($related == 'END') {
             $valarm->add('TRIGGER', $string, array('VALUE' => $type, 'RELATED' => $related));
         } else {
             $valarm->add('TRIGGER', $string, array('VALUE' => $type));
         }
     } else {
         unset($vtodo->VALARM);
     }
     return $this->helper->editVCalendar($vcalendar, $taskID);
 }
开发者ID:hesaid,项目名称:tasks-1,代码行数:47,代码来源:reminderservice.php

示例2: index

 /**
  * @NoAdminRequired
  * @NoCSRFRequired
  */
 public function index()
 {
     if (defined('DEBUG') && DEBUG) {
         \OCP\Util::addScript('tasks', 'vendor/angularjs/angular');
         \OCP\Util::addScript('tasks', 'vendor/angularjs/angular-route');
         \OCP\Util::addScript('tasks', 'vendor/angularjs/angular-animate');
         \OCP\Util::addScript('tasks', 'vendor/momentjs/moment');
         \OCP\Util::addScript('tasks', 'vendor/bootstrap/ui-bootstrap-custom-tpls-0.10.0');
     } else {
         \OCP\Util::addScript('tasks', 'vendor/angularjs/angular.min');
         \OCP\Util::addScript('tasks', 'vendor/angularjs/angular-route.min');
         \OCP\Util::addScript('tasks', 'vendor/angularjs/angular-animate.min');
         \OCP\Util::addScript('tasks', 'vendor/momentjs/moment.min');
         \OCP\Util::addScript('tasks', 'vendor/bootstrap/ui-bootstrap-custom-tpls-0.10.0.min');
     }
     \OCP\Util::addScript('tasks', 'public/app');
     \OCP\Util::addScript('tasks', 'vendor/appframework/app');
     \OCP\Util::addScript('tasks', 'vendor/timepicker/jquery.ui.timepicker');
     \OCP\Util::addStyle('tasks', 'style');
     \OCP\Util::addStyle('tasks', 'vendor/bootstrap/bootstrap');
     $date = new \DateTimeZone(\OC_Calendar_App::getTimezone());
     $day = new \DateTime('today', $date);
     $day = $day->format('d');
     // TODO: Make a HTMLTemplateResponse class
     $response = new TemplateResponse('tasks', 'main');
     $response->setParams(array('DOM' => $day));
     return $response;
 }
开发者ID:msbt,项目名称:tasks,代码行数:32,代码来源:pagecontroller.php

示例3: deleteComment

 /**
  * delete comment of task by id
  * @param  int   $taskID
  * @param  int   $commentID
  * @return bool
  * @throws \Exception
  */
 public function deleteComment($taskID, $commentID)
 {
     $vcalendar = \OC_Calendar_App::getVCalendar($taskID);
     $vtodo = $vcalendar->VTODO;
     $commentIndex = $this->getCommentById($vtodo, $commentID);
     $comment = $vtodo->children[$commentIndex];
     if ($comment['X-OC-USERID']->getValue() == $this->userId) {
         unset($vtodo->children[$commentIndex]);
         return $this->helper->editVCalendar($vcalendar, $taskID);
     } else {
         throw new \Exception('Not allowed.');
     }
 }
开发者ID:hesaid,项目名称:tasks-1,代码行数:20,代码来源:commentsservice.php

示例4: 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

示例5: 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

示例6: getACL

 /**
  * Returns a list of ACE's for this node.
  *
  * Each ACE has the following properties:
  *   * 'privilege', a string such as {DAV:}read or {DAV:}write. These are
  *     currently the only supported privileges
  *   * 'principal', a url to the principal who owns the node
  *   * 'protected' (optional), indicating that this ACE is not allowed to
  *      be updated.
  *
  * @return array
  */
 public function getACL()
 {
     $readprincipal = $this->getOwner();
     $writeprincipal = $this->getOwner();
     $uid = OC_Calendar_Calendar::extractUserID($this->getOwner());
     if ($uid != OCP\USER::getUser()) {
         $object = OC_VObject::parse($this->objectData['calendardata']);
         $sharedCalendar = OCP\Share::getItemSharedWithBySource('calendar', $this->calendarInfo['id']);
         $sharedAccessClassPermissions = OC_Calendar_App::getAccessClassPermissions($object->VEVENT->CLASS->value);
         if ($sharedCalendar && $sharedCalendar['permissions'] & OCP\PERMISSION_READ && $sharedAccessClassPermissions & OCP\PERMISSION_READ) {
             $readprincipal = 'principals/' . OCP\USER::getUser();
         }
         if ($sharedCalendar && $sharedCalendar['permissions'] & OCP\PERMISSION_UPDATE && $sharedAccessClassPermissions & OCP\PERMISSION_UPDATE) {
             $writeprincipal = 'principals/' . OCP\USER::getUser();
         }
     }
     return array(array('privilege' => '{DAV:}read', 'principal' => $readprincipal, 'protected' => true), array('privilege' => '{DAV:}write', 'principal' => $writeprincipal, 'protected' => true), array('privilege' => '{DAV:}read', 'principal' => $readprincipal . '/calendar-proxy-write', 'protected' => true), array('privilege' => '{DAV:}write', 'principal' => $writeprincipal . '/calendar-proxy-write', 'protected' => true), array('privilege' => '{DAV:}read', 'principal' => $readprincipal . '/calendar-proxy-read', 'protected' => true));
 }
开发者ID:CDN-Sparks,项目名称:owncloud,代码行数:30,代码来源:object.php

示例7: 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

示例8: 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

示例9: updateVCalendarFromRequest

 public static function updateVCalendarFromRequest($request, $vcalendar)
 {
     $vtodo = $vcalendar->VTODO;
     $vtodo->setDateTime('LAST-MODIFIED', 'now', \Sabre\VObject\Property\DateTime::UTC);
     $vtodo->setDateTime('DTSTAMP', 'now', \Sabre\VObject\Property\DateTime::UTC);
     $vtodo->setString('SUMMARY', $request['summary']);
     $vtodo->setString('LOCATION', $request['location']);
     $vtodo->setString('DESCRIPTION', $request['description']);
     $vtodo->setString('CATEGORIES', $request["categories"]);
     $vtodo->setString('PRIORITY', $request['priority']);
     $vtodo->setString('PERCENT-COMPLETE', $request['complete']);
     $due = $request['due'];
     if ($due) {
         $timezone = \OC_Calendar_App::getTimezone();
         $timezone = new \DateTimeZone($timezone);
         $due = new \DateTime($due, $timezone);
         $vtodo->setDateTime('DUE', $due);
     } else {
         unset($vtodo->DUE);
     }
     $start = $request['start'];
     if ($start) {
         $timezone = \OC_Calendar_App::getTimezone();
         $timezone = new \DateTimeZone($timezone);
         $start = new \DateTime($start, $timezone);
         $vtodo->setDateTime('DTSTART', $start);
     } else {
         unset($vtodo->DTSTART);
     }
     return $vcalendar;
 }
开发者ID:WeatherellTechnology,项目名称:weatherstorm7,代码行数:31,代码来源:helper.php

示例10: getUserTimezone

 /**
  * Cache the user timezone to avoid multiple requests (it looks like it
  * uses a DB call in config to return this)
  *
  * @staticvar null $timezone
  * @return DateTimeZone
  */
 public static function getUserTimezone()
 {
     static $timezone = null;
     if ($timezone === null) {
         $timezone = new \DateTimeZone(\OC_Calendar_App::getTimezone());
     }
     return $timezone;
 }
开发者ID:enoch85,项目名称:owncloud-testserver,代码行数:15,代码来源:event.php

示例11: setComplete

 public static function setComplete($vtodo, $percent_complete, $completed)
 {
     if (!empty($percent_complete)) {
         $vtodo->setString('PERCENT-COMPLETE', $percent_complete);
     } else {
         $vtodo->__unset('PERCENT-COMPLETE');
     }
     if ($percent_complete == 100) {
         if (!$completed) {
             $completed = 'now';
         }
     } else {
         $completed = null;
     }
     if ($completed) {
         $timezone = OC_Calendar_App::getTimezone();
         $timezone = new DateTimeZone($timezone);
         $completed = new DateTime($completed, $timezone);
         $vtodo->setDateTime('COMPLETED', $completed);
         OCP\Util::emitHook('OC_Task', 'taskCompleted', $vtodo);
     } else {
         unset($vtodo->COMPLETED);
     }
 }
开发者ID:CDN-Sparks,项目名称:owncloud,代码行数:24,代码来源:app.php

示例12: 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

示例13: DateInterval

 * See the COPYING-README file.
 */
OCP\JSON::checkLoggedIn();
$id = $_POST['id'];
$access = OC_Calendar_App::getaccess($id, OC_Calendar_App::EVENT);
if ($access != 'owner' && $access != 'rw') {
    OCP\JSON::error(array('message' => 'permission denied'));
    exit;
}
$vcalendar = OC_Calendar_App::getVCalendar($id, false, false);
$vevent = $vcalendar->VEVENT;
$allday = $_POST['allDay'];
$delta = new DateInterval('P0D');
$delta->d = $_POST['dayDelta'];
$delta->i = $_POST['minuteDelta'];
OC_Calendar_App::isNotModified($vevent, $_POST['lastmodified']);
$dtstart = $vevent->DTSTART;
$dtend = OC_Calendar_Object::getDTEndFromVEvent($vevent);
$start_type = $dtstart->getDateType();
$end_type = $dtend->getDateType();
if ($allday && $start_type != Sabre_VObject_Property_DateTime::DATE) {
    $start_type = $end_type = Sabre_VObject_Property_DateTime::DATE;
    $dtend->setDateTime($dtend->getDateTime()->modify('+1 day'), $end_type);
}
if (!$allday && $start_type == Sabre_VObject_Property_DateTime::DATE) {
    $start_type = $end_type = Sabre_VObject_Property_DateTime::LOCALTZ;
}
$dtstart->setDateTime($dtstart->getDateTime()->add($delta), $start_type);
$dtend->setDateTime($dtend->getDateTime()->add($delta), $end_type);
unset($vevent->DURATION);
$vevent->setDateTime('LAST-MODIFIED', 'now', Sabre_VObject_Property_DateTime::UTC);
开发者ID:jaeindia,项目名称:ownCloud-Enhancements,代码行数:31,代码来源:move.php

示例14: 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

示例15: addslashes

				var missing_field_dberror = '<?php 
echo addslashes($l->t('There was a database fail'));
?>
';
				var totalurl = '<?php 
echo OCP\Util::linkToRemote('caldav');
?>
calendars';
				var firstDay = '<?php 
echo OCP\Config::getUserValue(OCP\USER::getUser(), 'calendar', 'firstday', 'mo') == 'mo' ? '1' : '0';
?>
';
				$(document).ready(function() {
				<?php 
if (array_key_exists('showevent', $_)) {
    $data = OC_Calendar_App::getEventObject($_['showevent']);
    $date = substr($data['startdate'], 0, 10);
    list($year, $month, $day) = explode('-', $date);
    echo '$(\'#calendar_holder\').fullCalendar(\'gotoDate\', ' . $year . ', ' . --$month . ', ' . $day . ');';
    echo '$(\'#dialog_holder\').load(OC.filePath(\'calendar\', \'ajax\', \'editeventform.php\') + \'?id=\' +  ' . $_['showevent'] . ' , Calendar.UI.startEventDialog);';
}
?>
				});
				</script>
				<div id="controls">
					<div>
						<form>
							<div id="view">
								<input type="button" value="<?php 
echo $l->t('Week');
?>
开发者ID:jaeindia,项目名称:ownCloud-Enhancements,代码行数:31,代码来源:calendar.php


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