initial commit
This commit is contained in:
commit
d206c242ca
5 changed files with 282 additions and 0 deletions
43
chch_ical2mediawiki.php
Normal file
43
chch_ical2mediawiki.php
Normal file
|
@ -0,0 +1,43 @@
|
|||
<?php
|
||||
$ical_file=$argv[1];
|
||||
$backward_seconds=60*60*6;
|
||||
$preview_seconds=60*60*24*60;
|
||||
?>
|
||||
{| class="wikitable"
|
||||
|-
|
||||
! scope="col" rowspan="2"| Datum
|
||||
! scope="col"| Titel
|
||||
! scope="col"| Ort
|
||||
|-
|
||||
! scope="col" colspan="2"| Beschreibung
|
||||
|-
|
||||
<?php
|
||||
require_once __DIR__ . '/icalparser/src/IcalParser.php';
|
||||
require_once __DIR__ . '/icalparser/src/Recurrence.php';
|
||||
require_once __DIR__ . '/icalparser/src/Freq.php';
|
||||
$cal = new \om\IcalParser();
|
||||
$results = $cal->parseFile("$ical_file");
|
||||
|
||||
foreach ($cal->getSortedEvents() as $r) {
|
||||
if($r['DTEND']->getTimestamp()>(time()-$backward_seconds) and $r['DTSTART']->getTimestamp()<(time()+$preview_seconds)) {
|
||||
if($r['DTSTART']->format('d.m.Y')!=$r['DTEND']->format('d.m.Y') and $r['DTEND']->format('H:i')=="00:00") {
|
||||
$chch_end_date=date('d.m.Y' ,$r['DTEND']->getTimestamp()-1);
|
||||
$chch_end_time="23:59";
|
||||
} else {
|
||||
$chch_end_date=$r['DTEND']->format('d.m.Y');
|
||||
$chch_end_time=$r['DTEND']->format('H:i');
|
||||
}
|
||||
echo sprintf('|rowspan="2" style="text-align:center;"|%s %s<br>-<br>%s %s' . PHP_EOL .
|
||||
'|\'\'\'%s\'\'\'' . PHP_EOL .
|
||||
'|%s ' . PHP_EOL .
|
||||
'|-' . PHP_EOL .
|
||||
'|colspan="2"|%s ' . PHP_EOL .
|
||||
'|-' . PHP_EOL,
|
||||
$r['DTSTART']->format('d.m.Y'), $r['DTSTART']->format('H:i'), $chch_end_date, $chch_end_time,
|
||||
$r['SUMMARY'],
|
||||
$r['LOCATION'],
|
||||
$r['DESCRIPTION']);
|
||||
}
|
||||
}
|
||||
?>
|
||||
|}
|
Loading…
Add table
Add a link
Reference in a new issue