root/contributed_modules/modules/customcontexts/page.customcontextstimes.php

Revision 5055, 1.7 kB (checked in by p_lindheimer, 1 year ago)

move custom context from #1447 to contributed module repository

Line 
1 <?php /* $Id: page.customcontextstimes.php $ */
2 //
3 //This program is free software; you can redistribute it and/or
4 //modify it under the terms of the GNU General Public License
5 //as published by the Free Software Foundation; either version 2
6 //of the License, or (at your option) any later version.
7 //
8 //This program is distributed in the hope that it will be useful,
9 //but WITHOUT ANY WARRANTY; without even the implied warranty of
10 //MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
11 //GNU General Public License for more details.
12
13 $dispnum = 'customcontextstimes'; //used for switch on config.php
14
15 ?>
16
17
18 <div class="rnav">
19 <?php 
20 $contextstimes = customcontexts_gettimegroups();
21 drawListMenu($contextstimes, $skip, $type, $display, $extdisplay, _("Time Group"));
22 ?>
23 </div>
24
25 <div class="rnav" style="margin:15px 10px; padding: 5px; background: #e0e0ff; border: #2E78A7 solid 1px;">
26         <?php echo _("Server time:")?> <span id="idTime">00:00:00</span>
27 </div>
28
29 <script>
30 var hour = <?php $l = localtime(); echo $l[2]?>;
31 var min = <?php $l = localtime(); echo $l[1]?>;
32 var sec = <?php $l = localtime(); echo $l[0]?>;
33
34 //custom contexts stole this from timeconditions
35 //who stole it from http://www.aspfaq.com/show.asp?id=2300
36 function PadDigits(n, totalDigits)
37 {
38         n = n.toString();
39         var pd = '';
40         if (totalDigits > n.length)
41         {
42                 for (i=0; i < (totalDigits-n.length); i++)
43                 {
44                         pd += '0';
45                 }
46         }
47         return pd + n.toString();
48 }
49
50 function updateTime()
51 {
52         sec++;
53         if (sec==60)
54         {
55                 min++;
56                 sec = 0;
57         }       
58                 
59         if (min==60)
60         {
61                 hour++;
62                 min = 0;
63         }
64
65         if (hour==24)
66         {
67                 hour = 0;
68         }
69         
70         document.getElementById("idTime").innerHTML = PadDigits(hour,2)+":"+PadDigits(min,2)+":"+PadDigits(sec,2);
71         setTimeout('updateTime()',1000);
72 }
73
74 updateTime();
75 </script>
Note: See TracBrowser for help on using the browser.
Donate



Support
Download
Develop
Forums
News
Documentation
Paid Support
About

Paid Ads