Started to use different icons on time.php page for records with attached files.
[timetracker.git] / WEB-INF / templates / mobile / timer.tpl
1 {include file="time_script.tpl"}
2
3 <p><span id="hour">00</span><span id="separator">:</span><span id="min">00</span>
4
5 <script>
6 var timerID = null;
7 var startDate = null;
8 var endDate = null;
9 var delta = null;
10 var separatorVisible = true;
11
12 function toggleSeparator() {
13   document.getElementById('separator').style.visibility = separatorVisible ? 'hidden' : 'visible';
14   separatorVisible = !separatorVisible;
15 }
16
17 function updateTimer() {
18   if (startDate == null) startDate = new Date();
19   endDate = new Date();
20   delta = new Date(endDate - startDate);
21
22   var hours = delta.getUTCHours();
23   if (hours < 10) hours = '0'+hours;
24   document.getElementById('hour').innerHTML = hours;
25
26   var minutes = delta.getUTCMinutes();
27   if (minutes <  10) minutes = '0'+minutes;
28   document.getElementById('min').innerHTML = minutes;
29
30   // Toggle visibility of separator for 100 ms.
31   toggleSeparator();
32   setTimeout('toggleSeparator()', 100);
33 }
34
35 function startTimer() {
36   if (timerID) return;
37
38   updateTimer();
39   timerID = setInterval('updateTimer()', 1000);
40 }
41
42 function stopTimer() {
43   clearInterval(timerID);
44   timerID = null;
45 }
46 </script>
47
48 {if $uncompleted}
49 <script>
50 startDate = new Date();
51 startDate.setHours({substr($uncompleted['start'], 0, 2)});
52 startDate.setMinutes({substr($uncompleted['start'], 3, 2)});
53 startDate.setSeconds(0);
54 updateTimer();
55 startTimer();
56 </script>
57 {/if}
58
59 {$forms.timeRecordForm.open}
60 <table cellspacing="4" cellpadding="7" border="0">
61 <tr>
62   <td>
63   <table width="100%">
64   <tr>
65     <td valign="top">
66     <table border="0">
67 {if $user->isPluginEnabled('cl')}
68     <tr><td>{$i18n.label.client}:</td></tr>
69     <tr><td>{$forms.timeRecordForm.client.control}</td></tr>
70 {/if}
71 {if $user->isPluginEnabled('iv')}
72     <tr><td><label>{$forms.timeRecordForm.billable.control}{$i18n.form.time.billable}</label></td></tr>
73 {/if}
74 {if ($custom_fields && $custom_fields->fields[0])}
75       <tr><td>{$custom_fields->fields[0]['label']|escape}:</td></tr>
76       <tr><td>{$forms.timeRecordForm.cf_1.control}</td></tr>
77 {/if}
78 {if ($smarty.const.MODE_PROJECTS == $user->tracking_mode || $smarty.const.MODE_PROJECTS_AND_TASKS == $user->tracking_mode)}
79     <tr><td>{$i18n.label.project}:</td></tr>
80     <tr><td>{$forms.timeRecordForm.project.control}</td></tr>
81 {/if}
82 {if ($smarty.const.MODE_PROJECTS_AND_TASKS == $user->tracking_mode)}
83     <tr><td>{$i18n.label.task}:</td></tr>
84     <tr><td>{$forms.timeRecordForm.task.control}</td></tr>
85 {/if}
86     </table>
87     </td>
88   </tr>
89   <tr>
90     <td colspan="2" height="50" align="center">{$forms.timeRecordForm.btn_start.control} {$forms.timeRecordForm.btn_stop.control}</td>
91   </tr>
92   </table>
93   </td>
94 </tr>
95 </table>
96 {$forms.timeRecordForm.close}
97
98 <table cellspacing="3" cellpadding="0" border="0" width="100%">
99 <tr>
100   <td align="center">
101     {if $time_records}
102     <table border="0">
103       <tr>
104         <td align="right">{$i18n.label.day_total}:</td>
105         <td>{$day_total}</td>
106       </tr>
107       <tr>
108         <td align="right">{$i18n.label.week_total}:</td>
109         <td>{$week_total}</td>
110       </tr>
111     </table>
112     {/if}
113   </td>
114 </tr>
115 </table>