function __construct()
 {
     parent::__construct();
     $this->valid_parameters = array(RFC2445_XNAME => RFC2445_OPTIONAL);
     // The exception to the rule: this is not a static value, so we
     // generate it on-the-fly here. Guaranteed to be different for
     // each instance of this property, too. Nice.
     $this->val_default = Bennu::generate_guid();
 }
示例#2
0
foreach ($entries as $key => $event) {
    $ev = new iCalendar_event();
    $ev->add_property('uid', $event->id . '@' . $hostaddress);
    $ev->add_property('summary', $event->rname . '/' . $event->uname);
    $ev->add_property('description', clean_param($event->note, PARAM_NOTAGS));
    $ev->add_property('class', 'PUBLIC');
    // PUBLIC / PRIVATE / CONFIDENTIAL
    $ev->add_property('created', Bennu::timestamp_to_datetime($event->creation));
    //$ev->add_property('last-modified', Bennu::timestamp_to_datetime($event->creation));
    $ev->add_property('dtstamp', Bennu::timestamp_to_datetime());
    // now
    $ev->add_property('dtstart', Bennu::timestamp_to_datetime($event->termin));
    // when event starts
    if ($event->time > 0) {
        //dtend is better than duration, because it works in Microsoft Outlook and works better in Korganizer
        $ev->add_property('dtend', Bennu::timestamp_to_datetime($event->termin + $event->time));
    }
    //following part in  ical export (export_execute.php) is done if courseid is stored in event
    //I can always get a course Id
    $cm = get_coursemodule_from_id('resop', $resopInCourseId, 0, false, MUST_EXIST);
    $course = get_course($cm->course);
    $coursecontext = context_course::instance($course->id);
    $ev->add_property('categories', format_string($course->shortname, true, array('context' => $coursecontext)));
    $ical->add_component($ev);
}
/*
var_dump($cm);
echo "<br><br>";
var_dump($course);
echo "<br><br>";
var_dump($coursecontext);
示例#3
0
$ical = new iCalendar();
$ical->add_property('method', 'PUBLISH');
foreach ($events as $event) {
    $ev = new iCalendar_event();
    $ev->add_property('summary', $event->name);
    $ev->add_property('description', $event->description);
    $ev->add_property('class', 'PUBLIC');
    // PUBLIC / PRIVATE / CONFIDENTIAL
    $ev->add_property('last-modified', Bennu::timestamp_to_datetime($event->timemodified));
    $ev->add_property('dtstamp', Bennu::timestamp_to_datetime());
    // now
    $ev->add_property('dtstart', Bennu::timestamp_to_datetime($event->timestart));
    // when event starts
    if ($event->timeduration > 0) {
        //dtend is better than duration, because it works in Microsoft Outlook and works better in Korganizer
        $ev->add_property('dtend', Bennu::timestamp_to_datetime($event->timestart + $event->timeduration));
    }
    if ($event->courseid != 0) {
        $ev->add_property('categories', $courses[$event->courseid]->shortname);
    }
    $ical->add_component($ev);
}
$serialized = $ical->serialize();
if (empty($serialized)) {
    // TODO
    die('bad serialization');
}
//IE compatibility HACK!
if (ini_get('zlib.output_compression')) {
    ini_set('zlib.output_compression', 'Off');
}
示例#4
0
    $ev->add_property('description', clean_param($event->description, PARAM_NOTAGS));
    $ev->add_property('class', 'PUBLIC');
    // PUBLIC / PRIVATE / CONFIDENTIAL
    $ev->add_property('last-modified', Bennu::timestamp_to_datetime($event->timemodified));
    $ev->add_property('dtstamp', Bennu::timestamp_to_datetime());
    // now
    if ($event->timeduration > 0) {
        //dtend is better than duration, because it works in Microsoft Outlook and works better in Korganizer
        $ev->add_property('dtstart', Bennu::timestamp_to_datetime($event->timestart));
        // when event starts.
        $ev->add_property('dtend', Bennu::timestamp_to_datetime($event->timestart + $event->timeduration));
    } else {
        // When no duration is present, ie an all day event, VALUE should be date instead of time and dtend = dtstart + 1 day.
        $ev->add_property('dtstart', Bennu::timestamp_to_date($event->timestart), array('value' => 'DATE'));
        // All day event.
        $ev->add_property('dtend', Bennu::timestamp_to_date($event->timestart + DAYSECS), array('value' => 'DATE'));
        // All day event.
    }
    if ($event->courseid != 0) {
        $coursecontext = context_course::instance($event->courseid);
        $ev->add_property('categories', format_string($courses[$event->courseid]->shortname, true, array('context' => $coursecontext)));
    }
    $ical->add_component($ev);
}
$serialized = $ical->serialize();
if (empty($serialized)) {
    // TODO
    die('bad serialization');
}
$filename = 'icalexport.ics';
header('Last-Modified: ' . gmdate('D, d M Y H:i:s', time()) . ' GMT');