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


PHP vcalendar::setProperty方法代码示例

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


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

示例1: row2array

 private static function row2array($row, $timezone, $hostname, $uid, $namespace_id)
 {
     $v = new vcalendar();
     $v->setConfig('unique_id', $hostname);
     $v->setProperty('method', 'PUBLISH');
     $v->setProperty("x-wr-calname", "AnimexxCal");
     $v->setProperty("X-WR-CALDESC", "Animexx Calendar");
     $v->setProperty("X-WR-TIMEZONE", $timezone);
     if ($row["adjust"]) {
         $start = datetime_convert('UTC', date_default_timezone_get(), $row["start"]);
         $finish = datetime_convert('UTC', date_default_timezone_get(), $row["finish"]);
     } else {
         $start = $row["start"];
         $finish = $row["finish"];
     }
     $allday = strpos($start, "00:00:00") !== false && strpos($finish, "00:00:00") !== false;
     /*
     
     if ($allday) {
     	$dat = Datetime::createFromFormat("Y-m-d H:i:s", $finish_tmp);
     	$dat->sub(new DateInterval("P1D"));
     	$finish = datetime_convert("UTC", date_default_timezone_get(), $dat->format("Y-m-d H:i:s"));
     	var_dump($finish);
     }
     */
     $subject = substr(preg_replace("/\\[[^\\]]*\\]/", "", $row["desc"]), 0, 100);
     $description = preg_replace("/\\[[^\\]]*\\]/", "", $row["desc"]);
     $vevent = dav_create_vevent(wdcal_mySql2icalTime($row["start"]), wdcal_mySql2icalTime($row["finish"]), false);
     $vevent->setLocation(icalendar_sanitize_string($row["location"]));
     $vevent->setSummary(icalendar_sanitize_string($subject));
     $vevent->setDescription(icalendar_sanitize_string($description));
     $v->setComponent($vevent);
     $ical = $v->createCalendar();
     return array("uid" => $uid, "namespace" => CALDAV_NAMESPACE_FRIENDICA_NATIVE, "namespace_id" => $namespace_id, "date" => $row["edited"], "data_uri" => "friendica-" . $namespace_id . "-" . $row["id"] . "@" . $hostname, "data_subject" => $subject, "data_location" => $row["location"], "data_description" => $description, "data_start" => $start, "data_end" => $finish, "data_allday" => $allday, "data_type" => $row["type"], "ical" => $ical, "ical_size" => strlen($ical), "ical_etag" => md5($ical));
 }
开发者ID:robhell,项目名称:friendica-addons,代码行数:35,代码来源:virtual_cal_source_friendica.inc.php

示例2: ical

 public function ical($params)
 {
     $this->setView('ical.php');
     $official = isset($params['official']);
     $group_name = isset($params['group']) ? $params['group'] : null;
     $event_model = new Event_Model();
     $events = $event_model->getUpcoming($group_name, $official, false);
     // Creation of the iCal content
     $cache_entry = 'ical-' . (isset($group_name) ? $group_name : '') . '-' . ($official ? 'official' : 'non-official');
     $content = Cache::read($cache_entry);
     if (!$content) {
         require_once APP_DIR . 'classes/class.iCalcreator.php';
         $cal = new vcalendar();
         $cal->setConfig('unique_id', $_SERVER['SERVER_NAME'] . $_SERVER['REQUEST_URI']);
         $cal->setProperty('method', 'PUBLISH');
         $cal->setProperty('x-wr-calname', $official ? __('EVENTS_TITLE_OFFICIAL') : __('EVENTS_TITLE_NONOFFICIAL'));
         $cal->setProperty('X-WR-CALDESC', '');
         $cal->setProperty('X-WR-TIMEZONE', date('e'));
         foreach ($events as $event) {
             $vevent = new vevent();
             $vevent->setProperty('dtstart', array('year' => (int) date('Y', $event['date_start']), 'month' => (int) date('n', $event['date_start']), 'day' => (int) date('j', $event['date_start']), 'hour' => (int) date('G', $event['date_start']), 'min' => (int) date('i', $event['date_start']), 'sec' => (int) date('s', $event['date_start'])));
             $vevent->setProperty('dtend', array('year' => (int) date('Y', $event['date_end']), 'month' => (int) date('n', $event['date_end']), 'day' => (int) date('j', $event['date_end']), 'hour' => (int) date('G', $event['date_end']), 'min' => (int) date('i', $event['date_end']), 'sec' => (int) date('s', $event['date_end'])));
             $vevent->setProperty('summary', $event['title']);
             $vevent->setProperty('description', $event['message']);
             $cal->setComponent($vevent);
         }
         $content = $cal->createCalendar();
         Cache::write($cache_entry, $content, 2 * 3600);
     }
     $this->set('content', $content);
 }
开发者ID:hugonicolas,项目名称:Site,代码行数:31,代码来源:Event.php

示例3: create

 function create($name, $description = '', $tz = 'US/Pacific')
 {
     $v = new vcalendar();
     $v->setConfig('unique_id', $name . '.' . 'yourdomain.com');
     $v->setProperty('method', 'PUBLISH');
     $v->setProperty('x-wr-calname', $name . ' Calendar');
     $v->setProperty("X-WR-CALDESC", $description);
     $v->setProperty("X-WR-TIMEZONE", $tz);
     $this->calendar = $v;
 }
开发者ID:josephbergdoll,项目名称:berrics,代码行数:10,代码来源:ICalHelper.php

示例4: 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();
 }
开发者ID:julienV,项目名称:Joomla-Tracks,代码行数:53,代码来源:view.ical.php

示例5: export

 public function export(array $arguments, array $params = array())
 {
     $c = new vcalendar();
     $c->setProperty('calscale', 'GREGORIAN');
     $c->setProperty('method', 'PUBLISH');
     // if no post id are specified do not export those properties
     // as they would create a new calendar in outlook.
     // a user reported this in AIOEC-982 and said this would fix it
     if (true === $arguments['do_not_export_as_calendar']) {
         $c->setProperty('X-WR-CALNAME', get_bloginfo('name'));
         $c->setProperty('X-WR-CALDESC', get_bloginfo('description'));
     }
     $c->setProperty('X-FROM-URL', home_url());
     // Timezone setup
     $tz = $this->_registry->get('date.timezone')->get_default_timezone();
     if ($tz) {
         $c->setProperty('X-WR-TIMEZONE', $tz);
         $tz_xprops = array('X-LIC-LOCATION' => $tz);
         iCalUtilityFunctions::createTimezone($c, $tz, $tz_xprops);
     }
     $this->_taxonomy_model = $this->_registry->get('model.taxonomy');
     $post_ids = array();
     foreach ($arguments['events'] as $event) {
         $post_ids[] = $event->get('post_id');
     }
     $this->_taxonomy_model->update_meta($post_ids);
     foreach ($arguments['events'] as $event) {
         $c = $this->_insert_event_in_calendar($event, $c, true, $params);
     }
     $str = ltrim($c->createCalendar());
     return $str;
 }
开发者ID:newmight2015,项目名称:psmpsm,代码行数:32,代码来源:ics.php

示例6: array

 /**
  * Creates a new iCalendar resource
  * 
  * Property keys can be lowercase
  *
  * Returns generated guid, FALSE on error. $generated will be filled with
  * new generated resource (iCalComponent object)
  */
 function new_resource($properties, &$generated, $tz, $reminders = array())
 {
     $properties = array_change_key_case($properties, CASE_UPPER);
     $contents = '';
     $ical = new vcalendar($this->config);
     // Default CALSCALE in standard
     $ical->setProperty('calscale', 'GREGORIAN');
     $allday = isset($properties['ALLDAY']) && $properties['ALLDAY'] == 'true';
     if ($allday) {
         // Discard timezone
         $tz = $this->CI->timezonemanager->getTz('UTC');
     }
     // Add VTIMEZONE
     $this->add_vtimezone($ical, $tz->getName());
     $vevent =& $ical->newComponent('vevent');
     $now = $this->CI->dates->datetime2idt();
     $uid = $this->generate_guid();
     $vevent->setProperty('CREATED', $now);
     $vevent->setProperty('LAST-MODIFIED', $now);
     $vevent->setProperty('DTSTAMP', $now);
     $vevent->setProperty('UID', $uid);
     $vevent->setProperty('SEQUENCE', '0');
     // RFC5545, 3.8.7.4
     $vevent->setProperty('SUMMARY', $properties['SUMMARY']);
     // Rest of properties
     $add_prop = array('DTSTART', 'DTEND', 'DESCRIPTION', 'LOCATION', 'DURATION', 'RRULE', 'TRANSP', 'CLASS');
     foreach ($add_prop as $p) {
         if (isset($properties[$p]) && !empty($properties[$p])) {
             $params = FALSE;
             // Generate DTSTART/DTEND
             if ($p == 'DTSTART' || $p == 'DTEND') {
                 if ($tz->getName() != 'UTC') {
                     $params = array('TZID' => $tz->getName());
                 }
                 $properties[$p] = $this->CI->dates->datetime2idt($properties[$p], $tz);
                 // All day: use parameter VALUE=DATE
                 if ($allday) {
                     $params['VALUE'] = 'DATE';
                 }
             }
             $vevent->setProperty($p, $properties[$p], $params);
         }
     }
     // VALARM components (reminders)
     $vevent = $this->set_valarms($vevent, $reminders);
     $generated = $ical;
     return $uid;
 }
开发者ID:julien2512,项目名称:agendav,代码行数:56,代码来源:Icshelper.php

示例7: 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());
 }
开发者ID:adisonc,项目名称:MaineLearning,代码行数:62,代码来源:schedules.class.php

示例8: nl2br

$e->setProperty('duration', 0, 0, 3);
// 3 hours
$e->setProperty('description', 'x-mas evening - diner');
// describe the event
$e->setProperty('location', 'Home');
// locate the event
/* alt. production */
// $v->returnCalendar();                       // generate and redirect output to user browser
/* alt. dev. and test */
echo nl2br($v->createCalendar());
// generate and get output in string, for testing?
echo "<br />\n\n";
/* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -  */
$v = new vcalendar(array('unique_id' => 'kigkonsult.se'));
// initiate new CALENDAR
$v->setProperty('X-WR-CALNAME', 'Sample calendar');
// set some X-properties, name, content.. .
$v->setProperty('X-WR-CALDESC', 'Description of the calendar');
$v->setProperty('X-WR-TIMEZONE', 'Europe/Stockholm');
$e =& $v->newComponent('vevent');
// initiate a new EVENT
$e->setProperty('categories', 'FAMILY');
// catagorize
$e->setProperty('dtstart', 2007, 12, 24, 19, 30, 00);
// 24 dec 2007 19.30
$e->setProperty('duration', 0, 0, 3);
// 3 hours
$e->setProperty('description', 'x-mas evening - diner');
// describe the event
$e->setProperty('location', 'Home');
// locate the event
开发者ID:BGCX067,项目名称:fajr-git,代码行数:31,代码来源:samples.php

示例9: array

        $event = get_entity($filter);
        if (elgg_instanceof($event, 'object', 'event_calendar')) {
            $events = array(array('event' => $event));
        }
        break;
}
if (!$events) {
    register_error(elgg_echo('event_calendar:no_events_found'));
    forward(REFERER);
}
$events = event_calendar_flatten_event_structure($events);
$timezone = date_default_timezone_get();
//get_plugin_setting('timezone', 'event_connector');
$config = array('UNIQUE_ID' => elgg_get_site_url(), 'FILENAME' => 'Calendar.ics', 'TZID' => $timezone);
$v = new vcalendar($config);
$v->setProperty('method', 'PUBLISH');
$v->setProperty("X-WR-TIMEZONE", date_default_timezone_get());
$v->setProperty("calscale", "GREGORIAN");
$v->setProperty("version", "2.0");
$v->setProperty("X-WR-CALNAME", elgg_get_logged_in_user_entity()->username . "Calendar");
iCalUtilityFunctions::createTimezone($v, $timezone);
foreach ($events as $event) {
    //set default beginning and ending time
    $hb = 8;
    $he = 18;
    $mb = $me = $sb = $se = 0;
    if ($event->start_time) {
        $hb = (int) ($event->start_time / 60);
        $mb = $event->start_time % 60;
    }
    if ($event->end_time) {
开发者ID:iionly,项目名称:event_calendar,代码行数:31,代码来源:export.php

示例10: generateIcal

 /**
  *  Generate ical file content
  *
  * @param $who             user ID
  * @param $who_group       group ID
  * @param $limititemtype   itemtype only display this itemtype (default '')
  *
  * @return icalendar string
  **/
 static function generateIcal($who, $who_group, $limititemtype = '')
 {
     global $CFG_GLPI;
     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");
     }
     $tz = date_default_timezone_get();
     $v->setConfig('TZID', $tz);
     $v->setProperty("method", "PUBLISH");
     $v->setProperty("version", "2.0");
     $v->setProperty("X-WR-TIMEZONE", $tz);
     $xprops = array("X-LIC-LOCATION" => $tz);
     iCalUtilityFunctions::createTimezone($v, $tz, $xprops);
     $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);
     $params = array('who' => $who, 'who_group' => $who_group, 'begin' => $begin, 'end' => $end);
     $interv = array();
     if (empty($limititemtype)) {
         foreach ($CFG_GLPI['planning_types'] as $itemtype) {
             $interv = array_merge($interv, $itemtype::populatePlanning($params));
         }
     } else {
         $interv = $limititemtype::populatePlanning($params);
     }
     if (count($interv) > 0) {
         foreach ($interv as $key => $val) {
             $vevent = new vevent();
             //initiate EVENT
             if (isset($val['itemtype'])) {
                 if (isset($val[getForeignKeyFieldForItemType($val['itemtype'])])) {
                     $vevent->setProperty("uid", $val['itemtype'] . "#" . $val[getForeignKeyFieldForItemType($val['itemtype'])]);
                 } else {
                     $vevent->setProperty("uid", "Other#" . $key);
                 }
             } else {
                 $vevent->setProperty("uid", "Other#" . $key);
             }
             $vevent->setProperty("dstamp", $val["begin"]);
             $vevent->setProperty("dtstart", $val["begin"]);
             $vevent->setProperty("dtend", $val["end"]);
             if (isset($val["tickets_id"])) {
                 $vevent->setProperty("summary", sprintf(__('Ticket #%1$s %2$s'), $val["tickets_id"], $val["name"]));
             } else {
                 if (isset($val["name"])) {
                     $vevent->setProperty("summary", $val["name"]);
                 }
             }
             if (isset($val["content"])) {
                 $text = $val["content"];
                 // be sure to replace nl by \r\n
                 $text = preg_replace("/<br( [^>]*)?" . ">/i", "\r\n", $text);
                 $text = Html::clean($text);
                 $vevent->setProperty("description", $text);
             } else {
                 if (isset($val["name"])) {
                     $text = $val["name"];
                     // be sure to replace nl by \r\n
                     $text = preg_replace("/<br( [^>]*)?" . ">/i", "\r\n", $text);
                     $text = Html::clean($text);
                     $vevent->setProperty("description", $text);
                 }
             }
             if (isset($val["url"])) {
                 $vevent->setProperty("url", $val["url"]);
             }
             $v->setComponent($vevent);
         }
     }
     $v->sort();
     //       $v->parse();
     return $v->returnCalendar();
 }
开发者ID:geldarr,项目名称:hack-space,代码行数:93,代码来源:planning.class.php

示例11: vcalendar

 function _get_events_url(&$events, $url, $date)
 {
     $v = new vcalendar();
     $v->setConfig('unique_id', 'barchat');
     $v->setProperty('method', 'PUBLISH');
     $v->setProperty("x-wr-calname", "Calendar Sample");
     $v->setProperty("X-WR-CALDESC", "Calendar Description");
     $v->setProperty("X-WR-TIMEZONE", "America/New_York");
     $v->setConfig('url', $url);
     try {
         $v->parse();
     } catch (exception $e) {
     }
     $v->sort();
     $m = $date->format('n');
     $d = $date->format('j');
     $y = $date->format('Y');
     $eventArray = $v->selectComponents($y, $m, 1, $y, $m, 31);
     foreach ((array) $eventArray as $yearkey => $yeararray) {
         foreach ((array) $yeararray as $monthkey => $montharray) {
             foreach ((array) $montharray as $daykey => $dayarray) {
                 foreach ((array) $dayarray as $eventnumber => $event) {
                     //echo "{$y}-{$m}-{$daykey} [{$eventnumber}]: ";
                     $time = $event->dtstart['value'];
                     $tz = $event->dtstart['params']['TZID'] == '' ? 'America/New_York' : $event->dtstart['params']['TZID'];
                     if ($time['tz'] == 'Z') {
                         $tz = 'GMT';
                     }
                     if (isset($event->dtstart['params']['VALUE']) && $event->dtstart['params']['VALUE'] == 'DATE') {
                         $allday = new DateTime("{$time['year']}-{$time['month']}-{$time['day']}", new DateTimeZone($tz));
                         $allday->setTimezone(new DateTimeZone('America/New_York'));
                         $d = sprintf('%04d-%02d-%02d', $y, $m, $daykey);
                         if (!is_array($events[$d])) {
                             $events[$d] = array();
                         }
                         $alldayint = intval($allday->format('U'));
                         while (isset($events[$d][$alldayint])) {
                             $alldayint++;
                         }
                         $events[$d][$alldayint] = '<span class="calendartime">All Day</span> ' . trim($event->summary['value']);
                         //var_dump(date('r', $allday) . ' = ' . $allday);
                         //var_dump($event->summary['value']);
                     } else {
                         if (isset($event->xprop['X-CURRENT-DTSTART'])) {
                             $dt = new DateTime($event->xprop['X-CURRENT-DTSTART']['value'], new DateTimeZone($tz));
                         } else {
                             $dt = new DateTime("{$time['year']}-{$time['month']}-{$time['day']} {$time['hour']}:{$time['min']}:{$time['sec']}", new DateTimeZone($tz));
                         }
                         $dt->setTimezone(new DateTimeZone('America/New_York'));
                         if (isset($event->xprop['X-CURRENT-DTEND'])) {
                             $dte = new DateTime($event->xprop['X-CURRENT-DTEND']['value'], new DateTimeZone($tz));
                         } else {
                             $timee = $event->dtstart['value'];
                             $dte = new DateTime("{$timee['year']}-{$timee['month']}-{$timee['day']} {$timee['hour']}:{$timee['min']}:{$timee['sec']}", new DateTimeZone($tz));
                         }
                         $dte->setTimezone(new DateTimeZone('America/New_York'));
                         if (!is_array($events[$d])) {
                             $events[$d] = array();
                         }
                         $d = sprintf('%04d-%02d-%02d', $y, $m, $daykey);
                         $daytime = $dt->format('U');
                         while (isset($events[$d][$daytime])) {
                             $daytime++;
                         }
                         if ($dt->format('g:ia') != $dte->format('g:ia')) {
                             $events[$d][$daytime] = '<span class="calendartime">' . $dt->format('g:ia') . ' - ' . $dte->format('g:ia') . '</span> ' . trim($event->summary['value']);
                         } else {
                             $events[$d][$daytime] = '<span class="calendartime">' . $dt->format('g:ia') . '</span> ' . trim($event->summary['value']);
                         }
                         //var_dump($event->dtstart);
                         //var_dump($event->summary['value']);
                         //var_dump($dt->format('r'));
                         //var_dump($event);
                     }
                 }
             }
         }
     }
 }
开发者ID:amitchouhan004,项目名称:barchat,代码行数:79,代码来源:calendar.php

示例12: csv2iCal


//.........这里部分代码省略.........
                     $this->log->flush();
                 }
                 return FALSE;
             }
         } else {
             if (FALSE === $calendar->setConfig('directory', $outputFileParts['dirname'])) {
                 if ($this->log) {
                     $this->log->log("ERROR 6, INPUT FILE:'{$inputdirFile}'  iCalcreator: invalid directory: '" . $outputFileParts['dirname'] . "'", PEAR_LOG_ERR);
                     $this->log->log(number_format(microtime(TRUE) - $timeexec['start'], 5) . ' sec', PEAR_LOG_DEBUG);
                     $this->log->flush();
                 }
                 return FALSE;
             }
             if (FALSE === $calendar->setConfig('filename', $outputFileParts['basename'])) {
                 if ($this->log) {
                     $this->log->log("ERROR 7, INPUT FILE:'{$inputdirFile}' iCalcreator: invalid filename: '" . $outputFileParts['basename'] . "'", PEAR_LOG_ERR);
                     $this->log->log(number_format(microtime(TRUE) - $timeexec['start'], 5) . ' sec', PEAR_LOG_DEBUG);
                     $this->log->flush();
                 }
                 return FALSE;
             }
         }
     }
     $timeexec['fileOk'] = microtime(TRUE);
     /** info rows */
     $actrow = 0;
     for ($row = $actrow; $row < $cntrows; $row++) {
         if (empty($rows[$row]) || 1 >= count($rows[$row]) || '' >= $rows[$row][1] || 'iCal' == substr($rows[$row][0], 0, 4) || 'kigkonsult.se' == $rows[$row][0]) {
             continue;
         } elseif ('TYPE' == strtoupper($rows[$row][0])) {
             $actrow = $row;
             break;
         } elseif ('CALSCALE' == strtoupper($rows[$row][0])) {
             $calendar->setProperty('CALSCALE', $rows[$row][1]);
         } elseif ('METHOD' == strtoupper($rows[$row][0])) {
             $calendar->setProperty('METHOD', $rows[$row][1]);
         } elseif ('X-' == substr($rows[$row][0], 0, 2)) {
             $calendar->setProperty($rows[$row][0], $rows[$row][1]);
         } elseif (2 >= count($rows[$row])) {
             continue;
         } else {
             $actrow = $row;
             break;
         }
     }
     $timeexec['infoOk'] = microtime(TRUE);
     $cntprops = 0;
     $proporder = array();
     /** fix opt. vtimezone */
     if ($actrow < $cntrows && (in_array('tzid', $rows[$actrow]) || in_array('TZID', $rows[$actrow]))) {
         foreach ($rows[$actrow] as $key => $header) {
             $header = strtoupper($header);
             if (isset($conf[$header])) {
                 $proporder[$conf[$header]] = $key;
                 // check map of userfriendly name to iCal property name
                 if ($this->log) {
                     $this->log->log("header row ix:{$key} => {$header}, replaced by " . $conf[$header], PEAR_LOG_DEBUG);
                 }
             } else {
                 $proporder[$header] = $key;
             }
         }
         if ($this->log) {
             $this->log->log("comp proporder=" . implode(',', array_flip($proporder)), PEAR_LOG_DEBUG);
         }
         $allowedProps = array('VTIMEZONE' => array('TZID', 'LAST-MODIFIED', 'TZURL'), 'STANDARD' => array('DTSTART', 'TZOFFSETTO', 'TZOFFSETFROM', 'COMMENT', 'RDATE', 'RRULE', 'TZNAME'), 'DAYLIGHT' => array('DTSTART', 'TZOFFSETTO', 'TZOFFSETFROM', 'COMMENT', 'RDATE', 'RRULE', 'TZNAME'));
开发者ID:andyUA,项目名称:kabmin-new,代码行数:67,代码来源:iCalcnv.class.php

示例13: 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();
 }
开发者ID:ryukansent,项目名称:Thesis-SideB,代码行数:86,代码来源:planning.class.php

示例14: 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();
 }
开发者ID:heimrichhannot,项目名称:contao-share,代码行数:79,代码来源:Share.php

示例15: 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;
 }
开发者ID:Setrino,项目名称:collabtive,代码行数:73,代码来源:class.task.php


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