]> git.mxchange.org Git - friendica.git/blob - mod/localtime.php
add timezone convert module, several other minor or in progress fixes
[friendica.git] / mod / localtime.php
1 <?php
2
3 require_once('include/datetime.php');
4
5
6 function localtime_post(&$a) {
7
8         $t = $_REQUEST['time'];
9         if(! $t)
10                 $t = 'now';
11
12         $bd_format = t('l F d, Y \@ g:i A') ; // Friday January 18, 2011 @ 8 AM
13
14         if($_POST['timezone'])
15                 $a->data['mod-localtime'] = datetime_convert('UTC',$_POST['timezone'],$t,$bd_format);
16
17 }
18
19 function localtime_content(&$a) {
20         $t = $_REQUEST['time'];
21         if(! $t)
22                 $t = 'now';
23
24         $o .= '<h3>' . t('Time Conversion') . '</h3>';
25
26         $o .= '<p>' . t('Friendika provides this service for sharing events with other networks and friends in unknown timezones.') . '</p>';
27
28
29         if(x($a->data,'mod-localtime'))
30                 $o .= '<p>' . sprintf( t('Converted localtime: %s'),$a->data['mod-localtime']) . '</p>';
31
32         $o .= '<p>' . sprintf( t('UTC time: %s'), $t) . '</p>';
33
34         $o .= '<form action ="' . $a->get_baseurl() . '/localtime?f=&time=' . $t . '" method="post" >';
35
36         $o .= '<p>' . t('Please select your timezone:') . '</p>'; 
37
38         $o .= select_timezone();
39
40         $o .= '<input type="submit" name="submit" value="' . t('Submit') . '" /></form>';
41
42         return $o;
43
44 }