diff options
author | Friendika <info@friendika.com> | 2011-06-06 19:59:20 -0700 |
---|---|---|
committer | Friendika <info@friendika.com> | 2011-06-06 19:59:20 -0700 |
commit | 452245d9883c29640fb1bd3a9e0d7cefaed77f23 (patch) | |
tree | 22a9f019beec486eda510b21cbe3430b5826845d /mod | |
parent | c0094aa4f865defe8be63963b32f69d05e258f48 (diff) | |
download | volse-hubzilla-452245d9883c29640fb1bd3a9e0d7cefaed77f23.tar.gz volse-hubzilla-452245d9883c29640fb1bd3a9e0d7cefaed77f23.tar.bz2 volse-hubzilla-452245d9883c29640fb1bd3a9e0d7cefaed77f23.zip |
more events framework
Diffstat (limited to 'mod')
-rw-r--r-- | mod/events.php | 68 |
1 files changed, 68 insertions, 0 deletions
diff --git a/mod/events.php b/mod/events.php index 73328b959..cca0f2074 100644 --- a/mod/events.php +++ b/mod/events.php @@ -82,3 +82,71 @@ function events_post(&$a) { } + +function events_content(&$a) { + + if(! local_user()) { + notice( t('Permission denied.') . EOL); + return; + } + + $mode = 'view'; + $y = 0; + $m = 0; + + if($a->argc > 1) { + if($a->argc > 2 && $a->argv[1] == 'event') { + $mode = 'edit'; + $event_id = intval($a->argv[2]); + } + if($a->argv[1] === 'new') { + $mode = 'new'; + $event_id = 0; + } + if($a->argc > 2 && intval($a->argv[1]) && intval($a->argv[2])) { + $mode = 'view'; + $y = intval($a->argv[1]); + $m = intval($a->argv[2]); + } + } + + if($mode == 'view') { + $thisyear = datetime_convert('UTC',date_default_timezone_get(),'now','Y'); + $thismonth = datetime_convert('UTC',date_default_timezone_get(),'now','m'); + if(! $y) + $y = intval($thisyear); + if(! $m) + $m = intval($thismonth); + + + $o .= cal($y,$m,false); + + return $o; + } + + if($mode === 'edit' || $mode === 'new') { + $tpl = get_markup_template('event_form.tpl'); + + $year = datetime_convert('UTC', date_default_timezone_get(), 'now', 'Y'); + + + $o .= replace_macros($tpl,array( + '$post' => $a->get_baseurl() . '/events', + '$e_text' => t('Event details'), + '$s_text' => t('Starting date/time:'), + '$s_dsel' => datesel('start',$year+5,$year,false,$year,0,0), + '$s_tsel' => timesel('start',0,0), + '$f_text' => t('Finish date/time:'), + '$f_dsel' => datesel('start',$year+5,$year,false,$year,0,0), + '$f_tsel' => timesel('start',0,0), + '$d_text' => t('Description:'), + '$d_orig' => '', + '$l_text' => t('Location:'), + '$l_orig' => '', + '$submit' => t('Submit') + + )); + + return $o; + } +}
\ No newline at end of file |