friendica/include/event.php

59 lines
1.5 KiB
PHP
Raw Normal View History

2011-05-28 06:01:30 +02:00
<?php
function format_event_html($ev) {
2011-06-07 05:17:36 +02:00
require_once('include/bbcode.php');
2011-05-28 06:01:30 +02:00
if(! ((is_array($ev)) && count($ev)))
return '';
$o = '<div class="vevent">';
2011-06-07 05:17:36 +02:00
$o .= '<p class="description">' . bbcode($ev['desc']) . '</p>';
2011-05-28 06:01:30 +02:00
$o .= '<p>' . t('Starts:') . ' <abbr class="dtstart" title="'
. datetime_convert('UTC','UTC',$ev['start'], $ev['adjust'] ? ATOM_TIME : 'Y-m-d\TH:i:s' )
2011-05-28 06:01:30 +02:00
. '" >'
2011-06-07 07:27:38 +02:00
. (($ev['adjust']) ? datetime_convert('UTC', date_default_timezone_get(),
$ev['start'] /*, format */ )
: datetime_convert('UTC', 'UTC',
$ev['start'] /*, format */ ))
2011-05-28 06:01:30 +02:00
. '</abbr></p>';
2011-06-08 05:10:43 +02:00
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' )
2011-06-08 05:10:43 +02:00
. '" >'
. (($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>';
2011-05-28 06:01:30 +02:00
$o .= '</div>';
2011-06-08 05:10:43 +02:00
return $o;
}
function sort_by_date($a) {
usort($a,'ev_compare');
return $a;
2011-06-06 08:10:07 +02:00
}
2011-06-08 05:10:43 +02:00
function ev_compare($a,$b) {
2011-06-06 08:10:07 +02:00
2011-06-08 05:10:43 +02:00
$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);
}