aboutsummaryrefslogtreecommitdiffstats
path: root/include/event.php
blob: 33970efff9cc44e696695e50f9e3ddf5886abf7d (plain) (blame)
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
<?php


function format_event_html($ev) {

	require_once('include/bbcode.php');

	if(! ((is_array($ev)) && count($ev)))
		return '';

	$o = '<div class="vevent">';

	$o .= '<p class="description">' . bbcode($ev['desc']) .  '</p>';

	$o .= '<p>' . t('Starts:') . ' <abbr class="dtstart" title="'
		. datetime_convert('UTC','UTC',$ev['start'], $ev['adjust'] ? ATOM_TIME : 'Y-m-d\TH:i:s' )
		. '" >' 
		. (($ev['adjust']) ? datetime_convert('UTC', date_default_timezone_get(), 
			$ev['start'] /*, format */ )
			:  datetime_convert('UTC', 'UTC', 
			$ev['start'] /*, format */ ))
		. '</abbr></p>';

	if(! $ev['nofinish'])
		$o .= '<p>' . t('Finishes:') . ' <abbr class="dtend" title="'
			. datetime_convert('UTC','UTC',$ev['finish'], $ev['adjust'] ? ATOM_TIME : 'Y-m-d\TH:i:s' )
			. '" >' 
			. (($ev['adjust']) ? datetime_convert('UTC', date_default_timezone_get(), 
				$ev['finish'] /*, format */ )
				:  datetime_convert('UTC', 'UTC', 
				$ev['finish'] /*, format */ ))
			. '</abbr></p>';

	if(strlen($ev['location']))
		$o .= '<p> ' . t('Location:') . '<span class="location">' 
			. bbcode($ev['location']) 
			. '</span></p>';

	$o .= '</div>';

	return $o;
}



function sort_by_date($a) {

	usort($a,'ev_compare');
	return $a;
}


function ev_compare($a,$b) {

	$date_a = (($a['adjust']) ? datetime_convert('UTC',date_default_timezone_get(),$a['start']) : $a['start']);
	$date_b = (($b['adjust']) ? datetime_convert('UTC',date_default_timezone_get(),$b['start']) : $b['start']);
	
	return strcmp($date_a,$date_b);
}