From e4145deeb7a72ac321113fde672e1b499ecb0d2d Mon Sep 17 00:00:00 2001 From: Mario Vavti Date: Wed, 18 Nov 2015 23:50:42 +0100 Subject: some events refacturing --- mod/events.php | 29 ++++++++++++++--------------- 1 file changed, 14 insertions(+), 15 deletions(-) (limited to 'mod') diff --git a/mod/events.php b/mod/events.php index d76602a33..230e386ce 100755 --- a/mod/events.php +++ b/mod/events.php @@ -288,14 +288,9 @@ function events_content(&$a) { )); $o =""; - // tabs $channel = $a->get_channel(); - $tabs = profile_tabs($a, True, $channel['channel_address']); - - - $mode = 'view'; $y = 0; $m = 0; @@ -378,10 +373,10 @@ function events_content(&$a) { if (argv(1) === 'json'){ - if (x($_GET,'start')) $start = date("Y-m-d h:i:s", $_GET['start']); - if (x($_GET,'end')) $finish = date("Y-m-d h:i:s", $_GET['end']); + if (x($_GET,'start')) $start = $_GET['start']; + if (x($_GET,'end')) $finish = $_GET['end']; } - + $start = datetime_convert('UTC','UTC',$start); $finish = datetime_convert('UTC','UTC',$finish); @@ -413,18 +408,21 @@ function events_content(&$a) { $r = q("SELECT event.*, item.plink, item.item_flags, item.author_xchan, item.owner_xchan from event left join item on event_hash = resource_id - where resource_type = 'event' and event.uid = %d $ignored - AND (( `adjust` = 0 AND ( `finish` >= '%s' or nofinish = 1 ) AND `start` <= '%s' ) - OR ( `adjust` = 1 AND ( `finish` >= '%s' or nofinish = 1 ) AND `start` <= '%s' )) ", + where resource_type = 'event' and event.uid = %d $ignored + AND (( adjust = 0 AND ( finish >= '%s' or nofinish = 1 ) AND start <= '%s' ) + OR ( adjust = 1 AND ( finish >= '%s' or nofinish = 1 ) AND start <= '%s' )) ", intval(local_channel()), dbesc($start), dbesc($finish), dbesc($adjust_start), dbesc($adjust_finish) ); + } + + $links = array(); if($r && ! $export) { @@ -500,7 +498,7 @@ function events_content(&$a) { } } - + if($export) { header('Content-type: text/calendar'); header('content-disposition: attachment; filename="' . t('calendar') . '-' . $channel['channel_address'] . '.ics"' ); @@ -522,16 +520,17 @@ function events_content(&$a) { $o = replace_macros($tpl, array( '$baseurl' => $a->get_baseurl(), - '$tabs' => $tabs, '$title' => t('Events'), - '$new_event'=> array($a->get_baseurl().'/events/new',t('Create New Event'),'',''), + '$new_event'=> array($a->get_baseurl().'/events/new',t('New Event'),'',''), '$previus' => array($a->get_baseurl()."/events/$prevyear/$prevmonth",t('Previous'),'',''), '$next' => array($a->get_baseurl()."/events/$nextyear/$nextmonth",t('Next'),'',''), '$export' => array($a->get_baseurl()."/events/$y/$m/export",t('Export'),'',''), '$calendar' => cal($y,$m,$links, ' eventcal'), '$events' => $events, '$upload' => t('Import'), - '$submit' => t('Submit') + '$submit' => t('Submit'), + '$prev' => t('Previous'), + '$next' => t('Next'), )); if (x($_GET,'id')){ echo $o; killme(); } -- cgit v1.2.3