]> CyberLeo.Net >> Repos - SourceForge/phpwiki.git/blob - themes/default/templates/userprefs.tmpl
Calculate and display the user's time for confirmation.
[SourceForge/phpwiki.git] / themes / default / templates / userprefs.tmpl
1 <?php // -*-html-*- ?>
2 <!-- $Id: userprefs.tmpl,v 1.11 2002-02-03 17:50:23 carstenklapp Exp $ -->
3 <?php
4
5 /**
6  * Variation of stdlib/TimezoneOffset.
7  */
8 function hTimezoneOffset ($h, $use_colon = true) {
9     $secs = $h*60*60;
10     if ($secs < 0) {
11         $sign = '-';
12         $secs = -$secs;
13     }
14     else {
15         $sign = '+';
16     }
17     $colon = $use_colon ? ':' : '';
18     $mins = intval(($secs + 30) / 60);
19     return sprintf("%s%02d%s%02d",
20                    $sign, $mins / 60, $colon, $mins % 60);
21 }
22
23 /**
24  * Default to server's timezone if user's pref not chosen yet.
25  */
26 if ($PreftimeOffset = $request->getPref('timeOffset'))
27     $defaultOffset = $PreftimeOffset;
28 else
29     $defaultOffset = TimezoneOffset(false, true);
30
31 $yourTime = date('D, j M Y H:i:s ', time() + PrefTimezoneOffset()) . $defaultOffset;
32
33 /**
34  * Generate the popup menu.
35  */
36 $select = HTML();
37 for ($z = -14; $z < 12; $z++) {
38     $tz_val = hTimezoneOffset($z, false);
39     $tz_string = hTimezoneOffset($z);
40
41     $selected = $defaultOffset == $tz_val ? array('selected' => 'selected') : array();
42     $select->pushContent(HTML::option(array_merge(array('value' => $tz_val),
43                                                   $selected),
44                                       $tz_string));
45     $z = $z-0.5;
46 }
47
48 $TimeZoneSelect = HTML("GMT ", HTML::select(array('name' => "pref[timeOffset]"), $select));
49
50
51 ?>
52 <form action="<?=WikiURL($page)?>" method="post">
53   <input type="hidden" name="pagename" value="<?=$request->getArg('pagename')?>" />
54   <blockquote>
55   <table>
56     <tr>
57       <td colspan="2"><h2><?=_("Edit Area Size")?></h2></td>
58     </tr><tr>
59       <td align="right"><?=_("Height")?></td>
60       <td>
61         <input type="text" name="pref[editHeight]" size="4"
62                value="<?=$request->getPref('editHeight')?>" />
63       </td>
64     </tr>
65     <tr>
66       <td align="right"><?=_("Width")?></td>
67       <td>
68         <input type="text" name="pref[editWidth]" size="4"
69                value="<?=$request->getPref('editWidth')?>" />
70       </td>
71     </tr>
72
73     <tr>
74       <td colspan="2"><h2><?=_("Time Zone")?></h2></td>
75     </tr><tr>
76       <td align="right"><?=_("Server time:")?></td>
77       <td><?= Rfc2822DateTime() ?></td>
78     </tr><tr>
79       <td align="right"><?=_("Your time:")?></td>
80       <td><?= $yourTime ?></td>
81     </tr><tr>
82       <td></td>
83       <td>
84         <?= $TimeZoneSelect ?>
85       </td>
86     </tr><tr>
87       <!--until timezone functions have been fully debugged-->
88       <td></td><td><small>Times converted to your zone will be marked with an asterisk&nbsp;(*).</small></td>
89     </tr>
90   </table>
91   </blockquote>
92   <hr />
93   <?=Button("submit:", _("Update Preferences"))?>
94 </form>