本文整理汇总了PHP中vcalendar::returnCalendar方法的典型用法代码示例。如果您正苦于以下问题:PHP vcalendar::returnCalendar方法的具体用法?PHP vcalendar::returnCalendar怎么用?PHP vcalendar::returnCalendar使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类vcalendar
的用法示例。
在下文中一共展示了vcalendar::returnCalendar方法的12个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: display
function display($tpl = null)
{
$mainframe = JFactory::getApplication();
$option = JRequest::getCmd('option');
$model = $this->getModel();
$results = $model->getResults(JRequest::getVar('p', 0, '', 'int'));
$project = $model->getProject(JRequest::getVar('p', 0, '', 'int'));
$document = JFactory::getDocument();
$v = new vcalendar();
// initiate new CALENDAR
$v->setConfig('project' . $project->id, $mainframe->getCfg('live_site'));
// config with site domain
$v->setProperty('X-WR-CALNAME', $project->name);
// set some X-properties, name, content.. .
$v->setProperty('X-WR-CALDESC', JText::_('COM_TRACKS_Project_calendar'));
$v->setConfig("filename", 'project_' . $project->id . '.ics');
foreach ((array) $results as $result) {
if (!ereg('([0-9]{4})-([0-9]{1,2})-([0-9]{1,2}) ([0-9]{1,2}):([0-9]{1,2}):([0-9]{1,2})', $result->start_date, $start_date)) {
continue;
}
$e = new vevent();
// initiate a new EVENT
$e->setProperty('categories', $project->name);
// catagorize
$e->setProperty('dtstart', $start_date[1], $start_date[2], $start_date[3], $start_date[4], $start_date[5], $start_date[6]);
if (ereg('([0-9]{4})-([0-9]{1,2})-([0-9]{1,2}) ([0-9]{1,2}):([0-9]{1,2}):([0-9]{1,2})', $result->end_date, $end_date)) {
$e->setProperty('dtend', $end_date[1], $end_date[2], $end_date[3], $end_date[4], $end_date[5], $end_date[6]);
}
$description = array();
$description[] = $result->round_name;
if ($result->winner && $result->winner->last_name) {
$winner = JText::_('COM_TRACKS_Winner') . $result->winner->first_name . ' ' . $result->winner->last_name;
if ($result->winner->team_name) {
$winner .= ' (' . $result->winner->team_name . ')';
}
$description[] = $winner;
}
$description = implode('\\n', $description);
$e->setProperty('description', $description);
// describe the event
$e->setProperty('location', $result->round_name);
// locate the event
$v->addComponent($e);
// add component to calendar
}
/* alt. production */
// $v->returnCalendar(); // generate and redirect output to user browser
/* alt. dev. and test */
$str = $v->createCalendar();
// generate and get output in string, for testing?
// echo $str;return;
$v->returnCalendar();
}
示例2: exportar
function exportar($aObj = array(), $directo_a_browser = 1)
{
if (is_array($aObj)) {
$v = new vcalendar();
$v->setConfig('DIRECTORY', sfConfig::get('sf_cache_dir'));
foreach ($aObj as $link_evento) {
if ($link_evento->getEvento()) {
$e = new vevent();
$e->setProperty('DESCRIPTION', '');
$e->setProperty('SUMMARY', $link_evento->getEvento()->getTitulo());
$e->setProperty('class', 'PUBLIC');
$aFechaInicio = getdate(strtotime($link_evento->getEvento()->getFechaInicio()));
$e->setProperty('dtstart', $aFechaInicio['year'], $aFechaInicio['mon'], $aFechaInicio['mday'], $aFechaInicio['hours'], $aFechaInicio['minutes'], 0);
$aFechaFin = getdate(strtotime($link_evento->getEvento()->getFechaFin()));
$e->setProperty('dtend', $aFechaFin['year'], $aFechaFin['mon'], $aFechaFin['mday'], $aFechaFin['hours'], $aFechaFin['minutes'], 0);
$e->setProperty('dtstamp', gmdate('Ymd\\THi00\\Z'));
if ($link_evento->getEvento()->getFrecuencia()) {
$freq = $this->aFreq[$link_evento->getEvento()->getFrecuencia()];
$interval = $link_evento->getEvento()->getFrecuenciaIntervalo();
$aRrule = array();
$aRrule['FREQ'] = $freq;
$aRrule['INTERVAL'] = $interval;
if ($freq == "WEEKLY") {
$aRrule['BYDAY'] = array_chunk(explode(",", $link_evento->getEvento()->getRecurrenciaDiasIcal()), 1);
}
if ($link_evento->getEvento()->getRecurrenciaFin() != "") {
if (is_numeric($link_evento->getEvento()->getRecurrenciaFin())) {
$aRrule['COUNT'] = $link_evento->getEvento()->getRecurrenciaFin();
} else {
$aRrule['UNTIL'] = gmdate('Ymd\\THi00\\Z', strtotime($link_evento->getEvento()->getRecurrenciaFin()));
}
}
$e->setProperty('rrule', $aRrule);
}
$v->addComponent($e);
}
}
if ($directo_a_browser == 1) {
$v->returnCalendar();
} else {
$v->saveCalendar();
return $v->getConfig('filename');
}
} else {
$error = 'No envío un array para la exportación';
throw new Exception($error);
}
}
示例3: export
/**
* Export the Event with calendar and stop excuting script
*
* @return null
*/
function export()
{
global $_CONFIG;
//create new calendar
$objVCalendar = new \vcalendar();
$objVCalendar->setConfig('unique_id', $_CONFIG['coreGlobalPageTitle']);
$objVCalendar->setConfig('filename', urlencode($this->title) . '.ics');
// set Your unique id
//$v->setProperty('X-WR-CALNAME', 'Calendar Sample');
//$v->setProperty('X-WR-CALDESC', 'Calendar Description');
//$v->setProperty('X-WR-TIMEZONE', 'America/Los_Angeles');
$objVCalendar->setProperty('X-MS-OLK-FORCEINSPECTOROPEN', 'TRUE');
$objVCalendar->setProperty('METHOD', 'PUBLISH');
// create an event calendar component
$objVEvent = new \vevent();
// start
$startYear = date("Y", $this->startDate);
$startMonth = date("m", $this->startDate);
$startDay = date("d", $this->startDate);
$startHour = date("H", $this->startDate);
$startMinute = date("i", $this->startDate);
$objVEvent->setProperty('dtstart', array('year' => $startYear, 'month' => $startMonth, 'day' => $startDay, 'hour' => $startHour, 'min' => $startMinute, 'sec' => 0));
// end
$endYear = date("Y", $this->endDate);
$endMonth = date("m", $this->endDate);
$endDay = date("d", $this->endDate);
$endHour = date("H", $this->endDate);
$endMinute = date("i", $this->endDate);
$objVEvent->setProperty('dtend', array('year' => $endYear, 'month' => $endMonth, 'day' => $endDay, 'hour' => $endHour, 'min' => $endMinute, 'sec' => 0));
// place
if (!empty($this->place)) {
$objVEvent->setProperty('location', html_entity_decode($this->place, ENT_QUOTES, CONTREXX_CHARSET));
}
// title
$objVEvent->setProperty('summary', html_entity_decode($this->title, ENT_QUOTES, CONTREXX_CHARSET));
// description
$objVEvent->setProperty('description', html_entity_decode(strip_tags($this->description), ENT_QUOTES, CONTREXX_CHARSET));
// organizer
$objVEvent->setProperty('organizer', $_CONFIG['coreGlobalPageTitle'] . ' <' . $_CONFIG['coreAdminEmail'] . '>');
// comment
//$objVEvent->setProperty( 'comment', 'This is a comment' );
// attendee
//$objVEvent->setProperty( 'attendee', 'attendee1@icaldomain.net' );
// ressourcen
//$objVEvent->setProperty( 'resources', 'COMPUTER PROJECTOR' );
// series type
//$objVEvent->setProperty( 'rrule', array( 'FREQ' => 'WEEKLY', 'count' => 4));// weekly, four occasions
// add event to calendar
$objVCalendar->setComponent($objVEvent);
$objVCalendar->returnCalendar();
exit;
}
示例4: list
}
} else {
list($y2, $m2, $d2, $h2, $M2, $s2) = preg_split('/[\\s:-]/', $event['end_date']);
}
$vevent->setProperty('dtend', array('year' => $y2, 'month' => $m2, 'day' => $d2, 'hour' => $h2, 'min' => $M2, 'sec' => $s2));
//$vevent->setProperty( 'LOCATION', get_lang('Unknown') ); // property name - case independent
$vevent->setProperty('description', api_convert_encoding($event['description'], 'UTF-8', $charset));
//$vevent->setProperty( 'comment', 'This is a comment' );
//$user = api_get_user_info($event['user']);
//$vevent->setProperty('organizer',$user['mail']);
//$vevent->setProperty('attendee',$user['mail']);
//$vevent->setProperty( 'rrule', array( 'FREQ' => 'WEEKLY', 'count' => 4));// occurs also four next weeks
$ical->setConfig('filename', $y . $m . $d . $h . $M . $s . '-' . rand(1, 1000) . '.ics');
$ical->setComponent($vevent);
// add event to calendar
$ical->returnCalendar();
break;
case 'course':
$vevent->setProperty('summary', api_convert_encoding($event['title'], 'UTF-8', $charset));
if (empty($event['start_date'])) {
header('location:' . Security::remove_XSS($_SERVER['HTTP_REFERER']));
}
list($y, $m, $d, $h, $M, $s) = preg_split('/[\\s:-]/', $event['start_date']);
$vevent->setProperty('dtstart', array('year' => $y, 'month' => $m, 'day' => $d, 'hour' => $h, 'min' => $M, 'sec' => $s));
if (empty($event['end_date'])) {
$y2 = $y;
$m2 = $m;
$d2 = $d;
$h2 = $h;
$M2 = $M + 15;
$s2 = $s;
示例5: display
function display($tpl = null)
{
// Get a reference of the page instance in joomla
$document = JFactory::getDocument();
$model = $this->getModel();
$project =& $model->getProject();
$config = $model->getTemplateConfig($this->getName());
if (isset($project)) {
$this->assignRef('project', $project);
$this->assignRef('overallconfig', $model->getOverallConfig());
$this->assignRef('config', $this->overallconfig);
$this->assignRef('teams', $model->getTeamsIndexedByPtid());
$this->assignRef('matches', $model->getMatches($config));
}
// load a class that handles ical formats.
require_once JLG_PATH_SITE . DS . 'helpers' . DS . 'iCalcreator.class.php';
// create a new calendar instance
$v = new vcalendar();
foreach ($this->matches as $match) {
$hometeam = $this->teams[$match->projectteam1_id];
$home = sprintf('%s', $hometeam->name);
$guestteam = $this->teams[$match->projectteam2_id];
$guest = sprintf('%s', $guestteam->name);
$summary = $project->name . ': ' . $home . ' - ' . $guest;
// check if match gots a date, if not it will not be included
// in ical
if (!strstr($match->match_date, "0000-00-00")) {
$syear = JHTML::date($match->match_date, "%Y");
$sday = JHTML::date($match->match_date, "%d");
$smonth = JHTML::date($match->match_date, "%m");
$shour = JHTML::date($match->match_date, "%H");
$smin = JHTML::date($match->match_date, "%M");
//$start = JHTML::date($match->match_date, "%Y-%m-%d %H:%M:%S" );
$start = strftime("%Y-%m-%d %H:%M:%S", strtotime($match->match_date));
$start_oldphpversion = array('year' => $syear, 'month' => $smonth, 'day' => $sday, 'hour' => $shour, 'min' => $smin, 'sec' => 0);
$time_to_ellapse = $project->halftime * ($project->game_parts - 1) + $project->game_regular_time;
$endtime = JoomleagueHelper::getTimestamp($match->match_date) + $time_to_ellapse * 60;
$year = JHTML::date($endtime, "%Y");
$day = JHTML::date($endtime, "%d");
$month = JHTML::date($endtime, "%m");
$hour = JHTML::date($endtime, "%H");
$min = JHTML::date($endtime, "%M");
//$end = JHTML::date($endtime, "%Y-%m-%d %H:%M:%S" );
$end = strftime("%Y-%m-%d %H:%M:%S", $endtime);
$end_oldphpversion = array('year' => $year, 'month' => $month, 'day' => $day, 'hour' => $hour, 'min' => $min, 'sec' => 0);
// check if exist a playground in match or team or club
if ($match->playground_id != "") {
$stringlocation = $match->playground_address . ", " . $match->playground_zipcode . " " . $match->playground_city;
$stringname = $match->playground_name;
} else {
if ($match->team_playground_id != "") {
$stringlocation = $match->team_playground_address . ", " . $match->team_playground_zipcode . " " . $match->team_playground_city;
$stringname = $match->team_playground_name;
} elseif ($match->club_playground_id != "") {
$stringlocation = $match->club_playground_address . ", " . $match->club_playground_zipcode . " " . $match->club_playground_city;
$stringname = $match->club_playground_name;
}
}
$location = $stringlocation;
//if someone want to insert more in description here is the place
$description = $stringname;
// create an event and insert it in calendar
$vevent = new vevent();
$vevent->setProperty("dtstart", $start, array("TZID" => $project->timezone));
$vevent->setProperty("dtend", $end, array("TZID" => $project->timezone));
$vevent->setProperty('LOCATION', $location);
$vevent->setProperty('summary', $summary);
$vevent->setProperty('description', $description);
$v->setComponent($vevent);
}
}
$v->returnCalendar();
// exit before display
// parent::display( $tpl );
}
示例6: generateIcal
/**
* Generate ical file content
*
* @param $who user ID
* @param $who_group group ID
*
* @return icalendar string
**/
static function generateIcal($who, $who_group)
{
global $CFG_GLPI, $LANG;
if ($who == 0 && $who_group == 0) {
return false;
}
include_once GLPI_ROOT . "/lib/icalcreator/iCalcreator.class.php";
$v = new vcalendar();
if (!empty($CFG_GLPI["version"])) {
$v->setConfig('unique_id', "GLPI-Planning-" . trim($CFG_GLPI["version"]));
} else {
$v->setConfig('unique_id', "GLPI-Planning-UnknownVersion");
}
$v->setConfig('filename', "glpi.ics");
$v->setProperty("method", "PUBLISH");
$v->setProperty("version", "2.0");
$v->setProperty("x-wr-calname", "GLPI-" . $who . "-" . $who_group);
$v->setProperty("calscale", "GREGORIAN");
$interv = array();
$begin = time() - MONTH_TIMESTAMP * 12;
$end = time() + MONTH_TIMESTAMP * 12;
$begin = date("Y-m-d H:i:s", $begin);
$end = date("Y-m-d H:i:s", $end);
// ---------------Tracking
$interv = TicketPlanning::populatePlanning(array('who' => $who, 'who_group' => $who_group, 'begin' => $begin, 'end' => $end));
// ---------------Reminder
$data = Reminder::populatePlanning(array('who' => $who, 'who_group' => $who_group, 'begin' => $begin, 'end' => $end));
$interv = array_merge($interv, $data);
// ---------------Plugin
$data = doHookFunction("planning_populate", array("begin" => $begin, "end" => $end, "who" => $who, "who_group" => $who_group));
if (isset($data["items"]) && count($data["items"])) {
$interv = array_merge($data["items"], $interv);
}
if (count($interv) > 0) {
foreach ($interv as $key => $val) {
$vevent = new vevent();
//initiate EVENT
if (isset($val["tickettasks_id"])) {
$vevent->setProperty("uid", "Job#" . $val["tickettasks_id"]);
} else {
if (isset($val["reminders_id"])) {
$vevent->setProperty("uid", "Event#" . $val["reminders_id"]);
} else {
if (isset($val['planningID'])) {
// Specify the ID (for plugins)
$vevent->setProperty("uid", "Plugin#" . $val['planningID']);
} else {
$vevent->setProperty("uid", "Plugin#" . $key);
}
}
}
$vevent->setProperty("dstamp", $val["begin"]);
$vevent->setProperty("dtstart", $val["begin"]);
$vevent->setProperty("dtend", $val["end"]);
if (isset($val["tickets_id"])) {
$vevent->setProperty("summary", $LANG['planning'][8] . " # " . $val["tickets_id"] . " " . $LANG['document'][14] . " # " . $val["device"]);
} else {
if (isset($val["name"])) {
$vevent->setProperty("summary", $val["name"]);
}
}
if (isset($val["content"])) {
$vevent->setProperty("description", html_clean($val["content"]));
} else {
if (isset($val["name"])) {
$vevent->setProperty("description", $val["name"]);
}
}
if (isset($val["tickets_id"])) {
$vevent->setProperty("url", $CFG_GLPI["url_base"] . "/index.php?redirect=tracking_" . $val["tickets_id"]);
}
$v->setComponent($vevent);
}
}
$v->sort();
//$v->parse();
return $v->returnCalendar();
}
示例7: generateIcal
/**
* Export an event as iCalendar (ics)
*/
public function generateIcal($eventID)
{
$ical = new \vcalendar();
$ical->setConfig('ical_' . $this->id);
$ical->setProperty('method', 'PUBLISH');
$ical->setProperty("X-WR-TIMEZONE", $GLOBALS['TL_CONFIG']['timeZone']);
$time = time();
// Get event
$objEvent = \CalendarEventsModel::findByPk($eventID);
$vevent = new \vevent();
if ($objEvent->addTime) {
$vevent->setProperty('dtstart', array('year' => date('Y', $objEvent->startTime), 'month' => date('m', $objEvent->startTime), 'day' => date('d', $objEvent->startTime), 'hour' => date('H', $objEvent->startTime), 'min' => date('i', $objEvent->startTime), 'sec' => 0));
$vevent->setProperty('dtend', array('year' => date('Y', $objEvent->endTime), 'month' => date('m', $objEvent->endTime), 'day' => date('d', $objEvent->endTime), 'hour' => date('H', $objEvent->endTime), 'min' => date('i', $objEvent->endTime), 'sec' => 0));
} else {
$vevent->setProperty('dtstart', date('Ymd', $objEvent->startDate), array('VALUE' => 'DATE'));
if (!strlen($objEvent->endDate) || $objEvent->endDate == 0) {
$vevent->setProperty('dtend', date('Ymd', $objEvent->startDate + 24 * 60 * 60), array('VALUE' => 'DATE'));
} else {
$vevent->setProperty('dtend', date('Ymd', $objEvent->endDate + 24 * 60 * 60), array('VALUE' => 'DATE'));
}
}
$vevent->setProperty('summary', $objEvent->title, ENT_QUOTES, 'UTF-8');
$vevent->setProperty('description', strip_tags($objEvent->details ? $objEvent->details : $objEvent->teaser));
if ($objEvent->recurring) {
$count = 0;
$arrRepeat = deserialize($objEvent->repeatEach);
$arg = $arrRepeat['value'];
$unit = $arrRepeat['unit'];
if ($arg == 1) {
$unit = substr($unit, 0, -1);
}
$strtotime = '+ ' . $arg . ' ' . $unit;
$newstart = strtotime($strtotime, $objEvent->startTime);
$newend = strtotime($strtotime, $objEvent->endTime);
$freq = 'YEARLY';
switch ($arrRepeat['unit']) {
case 'days':
$freq = 'DAILY';
break;
case 'weeks':
$freq = 'WEEKLY';
break;
case 'months':
$freq = 'MONTHLY';
break;
case 'years':
$freq = 'YEARLY';
break;
}
$rrule = array('FREQ' => $freq);
if ($objEvent->recurrences > 0) {
$rrule['count'] = $objEvent->recurrences;
}
if ($arg > 1) {
$rrule['INTERVAL'] = $arg;
}
$vevent->setProperty('rrule', $rrule);
}
/*
* begin module event_recurrences handling
*/
if ($objEvent->repeatExecptions) {
$arrSkipDates = deserialize($objEvent->repeatExecptions);
foreach ($arrSkipDates as $skipDate) {
$exTStamp = strtotime($skipDate);
$exdate = array(array(date('Y', $exTStamp), date('m', $exTStamp), date('d', $exTStamp), date('H', $objEvent->startTime), date('i', $objEvent->startTime), date('s', $objEvent->startTime)));
$vevent->setProperty('exdate', $exdate);
}
}
/*
* end module event_recurrences handling
*/
$ical->setComponent($vevent);
$ical->setConfig("FILENAME", urlencode($objEvent->title) . ".ics");
$ical->returnCalendar();
}
示例8: toICS
/**
* toICS()
*
* Outputs group schedules in ICS format
*/
function toICS()
{
require_once BPSP_PLUGIN_DIR . '/schedules/iCalcreator.class.php';
global $bp;
define('ICAL_LANG', get_bloginfo('language'));
$cal = new vcalendar();
$cal->setConfig('unique_id', str_replace('http://', '', get_bloginfo('siteurl')));
$cal->setConfig('filename', $bp->groups->current_group->slug);
$cal->setProperty('X-WR-CALNAME', __('Calendar for: ', 'bpsp') . $bp->groups->current_group->name);
$cal->setProperty('X-WR-CALDESC', $bp->groups->current_group->description);
$cal->setProperty('X-WR-TIMEZONE', get_option('timezone_string'));
$schedules = $this->has_schedules();
$assignments = BPSP_Assignments::has_assignments();
$entries = array_merge($assignments, $schedules);
foreach ($entries as $entry) {
setup_postdata($entry);
$e = new vevent();
if ($entry->post_type == "schedule") {
$date = getdate(strtotime($entry->start_date));
} elseif ($entry->post_type == "assignment") {
$date = getdate(strtotime($entry->post_date));
}
$dtstart['year'] = $date['year'];
$dtstart['month'] = $date['mon'];
$dtstart['day'] = $date['mday'];
$dtstart['hour'] = $date['hours'];
$dtstart['min'] = $date['minutes'];
$dtstart['sec'] = $date['seconds'];
$e->setProperty('dtstart', $dtstart);
$e->setProperty('description', get_the_content() . "\n\n" . $entry->permalink);
if (!empty($entry->location)) {
$e->setProperty('location', $entry->location);
}
if ($entry->post_type == "assignment") {
$entry->end_date = $entry->due_date;
}
// make assignments compatible with schedule parser
if (!empty($entry->end_date)) {
$date = getdate(strtotime($entry->end_date));
$dtend['year'] = $date['year'];
$dtend['month'] = $date['mon'];
$dtend['day'] = $date['mday'];
$dtend['hour'] = $date['hours'];
$dtend['min'] = $date['minutes'];
$dtend['sec'] = $date['seconds'];
$e->setProperty('dtend', $dtend);
} else {
$e->setProperty('duration', 0, 1, 0);
}
// Assume it's an one day event
$e->setProperty('summary', get_the_title($entry->ID));
$e->setProperty('status', 'CONFIRMED');
$cal->setComponent($e);
}
header("HTTP/1.1 200 OK");
die($cal->returnCalendar());
}
示例9: icalendar
//.........这里部分代码省略.........
$extras = array();
$edits = array();
if (!empty($odata)) {
$query = ee()->db->query("SELECT *\n\t\t\t\t\t FROM\texp_calendar_events_occurrences\n\t\t\t\t\t WHERE\tevent_id = " . ee()->db->escape_str($id));
foreach ($query->result_array() as $row) {
//fix blank times
$row['start_time'] = $row['start_time'] == 0 ? '0000' : $row['start_time'];
$row['end_time'] = $row['end_time'] == 0 ? '2400' : $row['end_time'];
//looks like an edited occurrence
//edits without rules arent really edits.
if ($row['event_id'] != $row['entry_id'] and empty($rules)) {
$edits[] = $row;
} else {
$extras[] = $row;
}
}
}
if (!empty($exdata)) {
$E->setProperty('exdate', $exdata);
}
if ($description != '') {
$E->setProperty('description', $description);
}
if ($location != '') {
$E->setProperty('location', $location);
}
$E->setProperty("uid", $this->make_uid() . '@' . $host);
$ICAL->setComponent($E);
//--------------------------------------------
// remove rules for subsequent items
//--------------------------------------------
while ($E->deleteProperty("RRULE")) {
continue;
}
//edits must come right after
if (!empty($edits)) {
foreach ($edits as $edit) {
$edit_date = array("year" => $edit['start_year'], "month" => $edit['start_month'], "day" => $edit['start_day'], "hour" => substr($edit['start_time'], 0, 2), "min" => substr($edit['start_time'], 2, 2));
//if this is all day we need to add the dates as params to the dstart and end items
if ($this->_is_all_day(substr($edit['start_time'], 0, 2), substr($edit['start_time'], 2, 2), substr($edit['end_time'], 0, 2), substr($edit['end_time'], 2, 2))) {
$E->setProperty("dtstart", array('year' => $edit['start_year'], 'month' => $edit['start_month'], 'day' => $edit['start_day']), array('VALUE' => 'DATE'));
//--------------------------------------------
// we need CDT so we can add a day
// gcal, and ical are ok with this being the same day
// stupid damned outlook barfs, hence the +1
// the +1 doesnt affect g/ical
//--------------------------------------------
if (!isset($this->CDT) or !is_object($this->CDT)) {
$this->load_calendar_datetime();
}
$this->CDT->change_date($edit['end_year'], $edit['end_month'], $edit['end_day']);
$this->CDT->add_day();
$E->setProperty("dtend", array('year' => $this->CDT->year, 'month' => $this->CDT->month, 'day' => $this->CDT->day), array('VALUE' => 'DATE'));
} else {
$E->setProperty('dtstart', $edit_date['year'], $edit_date['month'], $edit_date['day'], $edit_date['hour'], $edit_date['min'], 00);
$E->setProperty('dtend', $edit['end_year'], $edit['end_month'], $edit['end_day'], substr($edit['end_time'], 0, 2), substr($edit['end_time'], 2, 2), 00);
}
$E->setProperty("RECURRENCE-ID", $edit_date);
$E->setProperty("uid", $this->make_uid() . '@' . $host);
$ICAL->setComponent($E);
}
//cleanup
$E->deleteProperty("RECURRENCE-ID");
$E->setProperty('dtstart', $start_year, $start_month, $start_day, $start_hour, $start_minute, 00);
$E->setProperty('dtend', $end_year, $end_month, $end_day, $end_hour, $end_minute, 00);
}
// these random ass add-in dates are non-standard to most cal creation
// and need to be treated seperately as lumping don't work, dog
if (!empty($extras)) {
foreach ($extras as $extra) {
//if this is all day we need to add the dates as params to the dstart and end items
if ($this->_is_all_day(substr($extra['start_time'], 0, 2), substr($extra['start_time'], 2, 2), substr($extra['end_time'], 0, 2), substr($extra['end_time'], 2, 2))) {
$E->setProperty("dtstart", array('year' => $extra['start_year'], 'month' => $extra['start_month'], 'day' => $extra['start_day']), array('VALUE' => 'DATE'));
//--------------------------------------------
// we need CDT so we can add a day
// gcal, and ical are ok with this being the same day
// stupid damned outlook barfs, hence the +1
// the +1 doesnt affect g/ical
//--------------------------------------------
if (!isset($this->CDT) or !is_object($this->CDT)) {
$this->load_calendar_datetime();
}
$this->CDT->change_date($extra['end_year'], $extra['end_month'], $extra['end_day']);
$this->CDT->add_day();
$E->setProperty("dtend", array('year' => $this->CDT->year, 'month' => $this->CDT->month, 'day' => $this->CDT->day), array('VALUE' => 'DATE'));
} else {
$E->setProperty('dtstart', $extra['start_year'], $extra['start_month'], $extra['start_day'], substr($extra['start_time'], 0, 2), substr($extra['start_time'], 2, 2), 00);
$E->setProperty('dtend', $extra['end_year'], $extra['end_month'], $extra['end_day'], substr($extra['end_time'], 0, 2), substr($extra['end_time'], 2, 2), 00);
}
$E->setProperty("uid", $this->make_uid() . '@' . $host);
$ICAL->setComponent($E);
}
//clean in case we need to add more later
$E->setProperty('dtstart', $start_year, $start_month, $start_day, $start_hour, $start_minute, 00);
$E->setProperty('dtend', $end_year, $end_month, $end_day, $end_hour, $end_minute, 00);
}
}
//return $ICAL->createCalendar();
return $ICAL->returnCalendar();
}
示例10: getIcal
/**
* Export all tasks of a user via iCal
*
* @param int $user User ID
* @param bool $show_long
* @return bool
*/
function getIcal($user, $show_long = true)
{
$user = (int) $user;
$show_long = (bool) $show_long;
$username = $_SESSION["username"];
$project = new project();
$myprojects = $project->getMyProjects($user);
$tasks = array();
if (!empty($myprojects)) {
foreach ($myprojects as $proj) {
$task = $this->getAllMyProjectTasks($proj["ID"], 10000);
if (!empty($task)) {
array_push($tasks, $task);
}
}
}
$etasks = reduceArray($tasks);
require "class.ical.php";
$heute = date("d-m-y");
$cal = new vcalendar();
$fname = "tasks_" . $username . ".ics";
$cal->setConfig('directory', CL_ROOT . '/files/' . CL_CONFIG . '/ics');
$cal->setConfig('filename', $fname);
$cal->setConfig('unique_id', '');
$cal->setProperty('X-WR-CALNAME', "Collabtive Aufgaben für " . $username);
$cal->setProperty('X-WR-CALDESC', '');
$cal->setProperty('CALSCALE', 'GREGORIAN');
$cal->setProperty('METHOD', 'PUBLISH');
foreach ($etasks as $etask) {
// split date in Y / M / D / h / min / sek variables
$jahr = date("Y", $etask["start"]);
$monat = date("m", $etask["start"]);
$tag = date("d", $etask["start"]);
$std = date("h", $etask["start"]);
$min = date("i", $etask["start"]);
$sek = date("s", $etask["start"]);
// split date in Y / M / D / h / min / sek variables
$ejahr = date("Y", $etask['end']);
$emonat = date("m", $etask['end']);
$etag = date("d", $etask['end']);
$estd = date("h", $etask['end']);
$emin = date("i", $etask['end']);
$esek = date("s", $etask['end']);
$e = new vevent();
$e->setProperty('categories', $etask['list']);
if ($show_long) {
// if we have a task lasting 10 month, normally it will be displayed every day within this time span.
$e->setProperty('dtstart', $jahr, $monat, $tag, $std, $min);
// 24 dec 2007 19.30
} else {
// if the show_long flag is set, it will only be shown at the due date
$e->setProperty('dtstart', $ejahr, $emonat, $etag, $estd, $emin);
}
$e->setProperty('due', $ejahr, $emonat, $etag, $estd, $emin);
// 24 dec 2007 19.30
$e->setProperty('dtend', $ejahr, $emonat, $etag, $estd, $emin);
$e->setProperty('description', $etask["text"]);
$e->setProperty('status', "NEEDS-ACTION");
// $e->setProperty('comment' , $etask[text]);
$e->setProperty('summary', $etask["title"]);
$e->setProperty('location', 'Work');
$cal->setComponent($e);
}
$cal->returnCalendar();
return true;
}
示例11: intval
$double_time = true;
}
$dtstart['hour'] = intval(strtok(":Hh"));
$a = intval(strtok(":Hh-"));
$b = intval(strtok(":Hh-"));
if ($b === false) {
if ($double_time) {
$dtend['hour'] = $a;
} else {
$dtstart['min'] = $a;
}
} else {
$dtstart['min'] = $a;
$dtend['hour'] = $b;
$dtend['min'] = intval(strtok(":Hh-"));
}
if (!$double_time) {
$dtend['hour'] = $dtstart['hour'] + 1;
$dtend['min'] = $dtstart['min'];
}
$vevent->setProperty('dtstart', $dtstart);
$vevent->setProperty('dtend', $dtend);
$vevent->setProperty('summary', $_SESSION["sondagetitre"]);
$v->setComponent($vevent);
// add event to calendar
$v->setConfig("language", "fr");
$v->setConfig("directory", "export");
$v->setConfig("filename", $_SESSION["numsondage"] . ".ics");
// set file name
$v->returnCalendar();
示例12: vcalendar
<?php
/**
* Create a ical for the upcoming recordings
*
* @license GPL
*
* @package MythWeb
* @subpackage TV
*
**/
$calendar = new vcalendar();
$calendar->setConfig($_SERVER['SERVER_SIGNATURE'], $_SERVER['HTTP_HOST']);
$calendar->setProperty('method', 'PUBLISH');
foreach ($all_shows as $show) {
$event = new vevent();
$event->setProperty('dtstart', array('year' => date('Y', $show->starttime), 'month' => date('m', $show->starttime), 'day' => date('d', $show->starttime), 'hour' => date('H', $show->starttime), 'min' => date('i', $show->starttime), 'sec' => date('s', $show->starttime)));
$event->setProperty('dtend', array('year' => date('Y', $show->endtime), 'month' => date('m', $show->endtime), 'day' => date('d', $show->endtime), 'hour' => date('H', $show->endtime), 'min' => date('i', $show->endtime), 'sec' => date('s', $show->endtime)));
$event->setProperty('summary', $show->title . ($show->subtitle ? ' - ' . $show->subtitle : ''));
$event->setProperty('description', $show->description . "\n\n" . preg_replace('/([A-Z]+)/', ' $1', $show->recstatus));
$event->setProperty('location', $show->channel->callsign);
$calendar->setComponent($event);
}
$calendar->returnCalendar();