From 9f51233451ad6392b61083cf61f5670bcce9d935 Mon Sep 17 00:00:00 2001 From: Friendika Date: Mon, 6 Jun 2011 20:17:36 -0700 Subject: [PATCH] event listings --- include/datetime.php | 4 ++-- include/event.php | 6 ++++-- mod/events.php | 19 ++++++++++++++++++- view/theme/duepuntozero/style.css | 3 +++ 4 files changed, 27 insertions(+), 5 deletions(-) diff --git a/include/datetime.php b/include/datetime.php index 67c4f42fa..8f2ec311a 100644 --- a/include/datetime.php +++ b/include/datetime.php @@ -276,7 +276,7 @@ function get_first_dim($y,$m) { if(! function_exists('cal')) { -function cal($y = 0,$m = 0, $links = false) { +function cal($y = 0,$m = 0, $links = false, $class='') { // month table - start at 1 to match human usage. @@ -306,7 +306,7 @@ function cal($y = 0,$m = 0, $links = false) { $tddate = intval(datetime_convert('UTC',date_default_timezone_get(),'now','j')); $str_month = day_translate($mtab[$m]); - $o = ''; + $o = '
'; $o .= ""; for($a = 0; $a < 7; $a ++) $o .= ''; diff --git a/include/event.php b/include/event.php index 21817086f..ecaa9213a 100644 --- a/include/event.php +++ b/include/event.php @@ -3,12 +3,14 @@ function format_event_html($ev) { + require_once('include/bbcode.php'); + if(! ((is_array($ev)) && count($ev))) return ''; $o = '
'; - $o .= '

' . $ev['desc'] . '

'; + $o .= '

' . bbcode($ev['desc']) . '

'; $o .= '

' . t('Starts: ') . '' - . $ev['location'] + . bbcode($ev['location']) . '

'; $o .= '
'; diff --git a/mod/events.php b/mod/events.php index cca0f2074..d280bc1ed 100644 --- a/mod/events.php +++ b/mod/events.php @@ -90,6 +90,8 @@ function events_content(&$a) { return; } + $o .= '

' . t('Events') . '

'; + $mode = 'view'; $y = 0; $m = 0; @@ -119,7 +121,22 @@ function events_content(&$a) { $m = intval($thismonth); - $o .= cal($y,$m,false); + $o .= cal($y,$m,false, ' eventcal'); + + $dim = get_dim($y,$m); + $start = sprintf('%d-%d-%d %d:%d:%d',$y,$m,1,0,0,0); + $finish = sprintf('%d-%d-%d %d:%d:%d',$y,$m,$dim,23,59,59); + + + $r = q("SELECT * FROM `event` WHERE `start` >= '%s' AND `finish` <= '%s' AND `uid` = %d ", + dbesc($start), + dbesc($finish), + intval(local_user()) + ); + + if(count($r)) + foreach($r as $rr) + $o .= format_event_html($rr); return $o; } diff --git a/view/theme/duepuntozero/style.css b/view/theme/duepuntozero/style.css index 2aa0eb2e9..f837112b6 100644 --- a/view/theme/duepuntozero/style.css +++ b/view/theme/duepuntozero/style.css @@ -2223,6 +2223,9 @@ a.mail-list-link { cursor: pointer; } +.eventcal { + font-size: 24px; +} .calendar { font-family: Courier, monospace;
$str_month $y
' . mb_substr(day_translate($dn[$a]),0,3,'UTF-8') . '