-
Notifications
You must be signed in to change notification settings - Fork 0
/
callib.php
89 lines (73 loc) · 2.81 KB
/
callib.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
<?php
/*
* tngCalendar - An addon calendar for TNG
* http://siege.org/projects/tngCalendar/
*
* @author CJ Niemira <siege (at) siege (dot) org>
* @copyright 2006,2008
* @license GPL
* @version 2.0
*/
/*
********************** DO NOT EDIT BELOW THIS LINE ***************************
*/
function event_defaults ($data, $event) {
global $text, $tngdomain;
$type = array_key_exists('display', $data)
? $data['display']
: $text[$event . 'date'];
$date = array_key_exists($event . 'date', $data)
? $data[$event . 'date']
: $data['eventdate'];
$datetr = array_key_exists($event . 'datetr', $data)
? $data[$event . 'datetr']
: $data['eventdatetr'];
$location = array_key_exists($event . 'place', $text)
? $text[$event . 'place']
: $type . ' ' . $text['place'];
$place = array_key_exists($event . 'place', $data)
? $data[$event . 'place']
: $data['eventplace'];
$dtstart = date('Ymd', strtotime($datetr));
$dtend = date('Ymd', strtotime($datetr . ' + 1 day'));
if (array_key_exists('personID', $data)) {
$link = $tngdomain . 'getperson.php?personID=' . $data['personID'] . '&tree=' . $data['gedcom'];
} elseif (array_key_exists('familyID', $data)) {
$link = $tngdomain . 'familygroup.php?familyID=' . $data['familyID'] . '&tree=' . $data['gedcom'];
} else {
$link = $tngdomain . 'getperson.php?personID=' . $data['persfamID'] . '&tree=' . $data['gedcom'];
}
return array($type, $date, $datetr, $location, $place, $dtstart, $dtend, $link);
}
function hvevent ($name, $data, $event = null) {
global $text;
list ($type, $date, $datetr, $location, $place, $dtstart, $dtend, $link) = event_defaults($data, $event);
return sprintf('<table class="calTip">
<tr>
<td valign="top" class="fieldnameback"><span class="fieldname">%s</span></td>
<td valign="top" class="databack"><span class="normal"><span class="summary"><a href="%s" class="url">%s - %s</a></span></span></td>
</tr>
<tr>
<td valign="top" class="fieldnameback"><span class="fieldname">%s</span></td>
<td valign="top" class="databack"><span class="normal"><abbr class="dtstart" title="VALUE=DATE:%s">%s</abbr><abbr class="dtend" title="VALUE=DATE:%s"> </abbr><abbr class="rrule" title="FREQ=YEARLY"> </abbr></span>
</td>
<tr>
<td valign="top" class="fieldnameback"><span class="fieldname">%s</span></td>
<td valign="top" class="databack"><span class="normal location">%s</span>
</td>
</tr>
</table>', $text['event'], $link, $name, $type, $text['date'], $dtstart, $date, $dtend, $location, $place);
}
function vevent ($name, $data, $event = null) {
list ($type, $date, $datetr, $location, $place, $dtstart, $dtend, $link) = event_defaults($data, $event);
return sprintf('
BEGIN:VEVENT
URL:%s
SUMMARY:%s - %s
DTSTART;VALUE=DATE:%s
DTEND;VALUE=DATE:%s
RRULE:FREQ=YEARLY
LOCATION:%s
END:VEVENT', $link, $name, $type, $dtstart, $dtend, $place);
}
?>