Renamed quota files for naming consistency.
authorNik Okuntseff <support@anuko.com>
Fri, 22 Jul 2016 16:34:10 +0000 (16:34 +0000)
committerNik Okuntseff <support@anuko.com>
Fri, 22 Jul 2016 16:34:10 +0000 (16:34 +0000)
WEB-INF/templates/cf_monthly_quota.tpl [deleted file]
WEB-INF/templates/footer.tpl
WEB-INF/templates/profile_edit.tpl
WEB-INF/templates/quotas.tpl [new file with mode: 0644]
cf_monthly_quota.php [deleted file]
quotas.php [new file with mode: 0644]

diff --git a/WEB-INF/templates/cf_monthly_quota.tpl b/WEB-INF/templates/cf_monthly_quota.tpl
deleted file mode 100644 (file)
index d8a59ce..0000000
+++ /dev/null
@@ -1,59 +0,0 @@
-{$forms.monthlyQuotaForm.open}
-<div style="padding: 0 0 10 0">
-    <table border="0" class="divider">
-        <tr>
-            <td align="center">
-                <table>
-                    <tr>
-                        <td>{$i18n.form.quota.workdayHours}</td>
-                        <td>{$forms.monthlyQuotaForm.dailyWorkingHours.control}</td>
-                        <td><input type="submit" name="dailyHours" value="{$i18n.button.save}"></td>
-                    </tr>
-                </table>
-            </td>
-        </tr>        
-    </table>
-</div>
-<table>
-    <tr>
-        <td>{$i18n.form.quota.year}:</td>
-        <td>{$forms.monthlyQuotaForm.years.control}</td>
-    </tr>
-    <tr>
-        <td colspan="2">
-            <table> 
-            <tr>
-                <td class="tableHeader">{$i18n.form.quota.month}</td>
-                <td class="tableHeader">{$i18n.form.quota.quota}</td>
-            </tr>
- {foreach $months as $month}
-                <tr>
-                    <td>{$month}</td>
-                    <td>{$forms.monthlyQuotaForm.$month.control}</td>
-                </tr>
- {/foreach}     
-                <tr>
-                    <td colspan="2" style="text-align:center;">
-                        <input type="submit" name="quotas" value="{$i18n.button.save}*">
-                    </td>
-                </tr>
-            </table>
-        </td>
-    </tr>
-</table>
-<div>* - {$i18n.form.quota.hint}</div>
-{$forms.monthlyQuotaForm.close}
-<script>
-function yearChange(value){
-    var url = window.location.href;
-    
-    if (url.indexOf('?') > 0){
-        var parameter = url.substring(url.indexOf('?') + 1, url.length);
-        url = url.replace(parameter, 'year=' + value);
-    } else {
-        url = '?year=' + value;
-    }
-    
-    window.location = url;
-}
-</script>
\ No newline at end of file
index 85abb80..473df20 100644 (file)
@@ -12,7 +12,7 @@
       <br>
       <table cellspacing="0" cellpadding="4" width="100%" border="0">
         <tr>
-          <td align="center">&nbsp;Anuko Time Tracker 1.9.27.3513 | Copyright &copy; <a href="https://www.anuko.com/lp/tt_3.htm" target="_blank">Anuko</a> |
+          <td align="center">&nbsp;Anuko Time Tracker 1.9.27.3514 | Copyright &copy; <a href="https://www.anuko.com/lp/tt_3.htm" target="_blank">Anuko</a> |
             <a href="https://www.anuko.com/lp/tt_4.htm" target="_blank">{$i18n.footer.credits}</a> |
             <a href="https://www.anuko.com/lp/tt_5.htm" target="_blank">{$i18n.footer.license}</a> |
             <a href="https://www.anuko.com/lp/tt_7.htm" target="_blank">{$i18n.footer.improve}</a>
index 8c8e27a..49b610e 100644 (file)
@@ -194,7 +194,7 @@ function handlePluginCheckboxes() {
           </tr>
           <tr>
             <td align="right" nowrap>{$forms.profileForm.monthly_quota.control}</td>
-            <td><label for="monthly_quota">{$i18n.label.monthly_quotas}</label> <span id="monthly_quota_config"><a href="cf_monthly_quota.php">{$i18n.label.configure}</a></span></td>
+            <td><label for="monthly_quota">{$i18n.label.monthly_quotas}</label> <span id="monthly_quota_config"><a href="quotas.php">{$i18n.label.configure}</a></span></td>
           </tr>
 {/if}
 
diff --git a/WEB-INF/templates/quotas.tpl b/WEB-INF/templates/quotas.tpl
new file mode 100644 (file)
index 0000000..d8a59ce
--- /dev/null
@@ -0,0 +1,59 @@
+{$forms.monthlyQuotaForm.open}
+<div style="padding: 0 0 10 0">
+    <table border="0" class="divider">
+        <tr>
+            <td align="center">
+                <table>
+                    <tr>
+                        <td>{$i18n.form.quota.workdayHours}</td>
+                        <td>{$forms.monthlyQuotaForm.dailyWorkingHours.control}</td>
+                        <td><input type="submit" name="dailyHours" value="{$i18n.button.save}"></td>
+                    </tr>
+                </table>
+            </td>
+        </tr>        
+    </table>
+</div>
+<table>
+    <tr>
+        <td>{$i18n.form.quota.year}:</td>
+        <td>{$forms.monthlyQuotaForm.years.control}</td>
+    </tr>
+    <tr>
+        <td colspan="2">
+            <table> 
+            <tr>
+                <td class="tableHeader">{$i18n.form.quota.month}</td>
+                <td class="tableHeader">{$i18n.form.quota.quota}</td>
+            </tr>
+ {foreach $months as $month}
+                <tr>
+                    <td>{$month}</td>
+                    <td>{$forms.monthlyQuotaForm.$month.control}</td>
+                </tr>
+ {/foreach}     
+                <tr>
+                    <td colspan="2" style="text-align:center;">
+                        <input type="submit" name="quotas" value="{$i18n.button.save}*">
+                    </td>
+                </tr>
+            </table>
+        </td>
+    </tr>
+</table>
+<div>* - {$i18n.form.quota.hint}</div>
+{$forms.monthlyQuotaForm.close}
+<script>
+function yearChange(value){
+    var url = window.location.href;
+    
+    if (url.indexOf('?') > 0){
+        var parameter = url.substring(url.indexOf('?') + 1, url.length);
+        url = url.replace(parameter, 'year=' + value);
+    } else {
+        url = '?year=' + value;
+    }
+    
+    window.location = url;
+}
+</script>
\ No newline at end of file
diff --git a/cf_monthly_quota.php b/cf_monthly_quota.php
deleted file mode 100644 (file)
index 0518c57..0000000
+++ /dev/null
@@ -1,88 +0,0 @@
-<?php
-
-require_once('initialize.php');
-require_once('plugins/MonthlyQuota.class.php');
-import('form.Form');
-import('WEB-INF/lib/ttTeamHelper');
-
-// Access check.
-if (!ttAccessCheck(right_manage_team)) {
-  header('Location: access_denied.php');
-  exit();
-}
-
-// fallback values
-$yearStart = 2015;
-$yearEnd = 2030;
-
-if (defined('MONTHLY_QUOTA_YEAR_START')){
-  $yearStart = (int)MONTHLY_QUOTA_YEAR_START;
-}
-if (defined('MONTHLY_QUOTA_YEAR_END')){
-  $yearEnd = (int)MONTHLY_QUOTA_YEAR_END;
-}
-
-// create values for dropdown
-$years = array();
-for ($i=$yearStart; $i <= $yearEnd; $i++) {
-  array_push($years, array('id'=>$i, 'name'=>$i));
-}
-
-// get selected year from url parameters
-$selectedYear = $request->getParameter("year");
-if (!$selectedYear or !ttValidInteger($selectedYear)){
-  $selectedYear = date("Y");
-} else {
-  $selectedYear = intval($selectedYear);
-}
-
-// months are zero indexed
-$months = $i18n->monthNames;
-
-$quota = new MonthlyQuota();
-
-if ($request->isPost()){
-  $res = false;
-  // if user pressed save fpr monthly quotas
-  if ($_POST["quotas"]){
-    $postedYear = $request->getParameter("years");
-    $selectedYear = intval($postedYear);
-    for ($i=0; $i < count($months); $i++){
-      $res = $quota->update($postedYear, $i+1, $request->getParameter($months[$i]));
-    }
-  }
-  // if user saved required working hours for a day
-  if ($_POST["dailyHours"]){
-    $hours = $request->getParameter("dailyWorkingHours");
-    $teamDetails = ttTeamHelper::getTeamDetails($quota->usersTeamId);
-    $res = ttTeamHelper::update($quota->usersTeamId, array('name'=>$teamDetails['team_name'], 
-                                                           'workday_hours'=>$hours));
-  }
-  if ($res) {
-    header('Location: profile_edit.php');
-    exit();
-  } else {
-    $err->add($i18n->getKey('error.db'));
-  }
-}
-
-// returns months where January is month 1, not 0
-$monthsData = $quota->get($selectedYear);
-
-$form = new Form('monthlyQuotaForm');
-
-$form->addInput(array('type'=>'combobox', 'name'=>'years', 'data'=>$years, 'datakeys'=>array('id', 'name'), 'value'=>$selectedYear, 'onchange'=>'yearChange(this.value);'));
-for ($i=0; $i < count($months); $i++) { 
-  $value = "";
-  if (array_key_exists($i+1, $monthsData)){
-    $value = $monthsData[$i+1];
-  }
-  $name = $months[$i];
-  $form->addInput(array('type'=>'text', 'name'=>$name, 'maxlength'=>3, 'value'=> $value, 'style'=>'width:50px'));
-}
-$form->addInput(array('type'=>'text', 'name'=>'dailyWorkingHours', 'value'=>$quota->getDailyWorkingHours(), 'style'=>'width:50px'));
-$smarty->assign('months', $months);
-$smarty->assign('forms', array($form->getName()=>$form->toArray()));
-$smarty->assign('title', $i18n->getKey('title.monthly_quotas'));
-$smarty->assign('content_page_name', 'cf_monthly_quota.tpl');
-$smarty->display('index.tpl');
diff --git a/quotas.php b/quotas.php
new file mode 100644 (file)
index 0000000..f648f9d
--- /dev/null
@@ -0,0 +1,88 @@
+<?php
+
+require_once('initialize.php');
+require_once('plugins/MonthlyQuota.class.php');
+import('form.Form');
+import('WEB-INF/lib/ttTeamHelper');
+
+// Access check.
+if (!ttAccessCheck(right_manage_team)) {
+  header('Location: access_denied.php');
+  exit();
+}
+
+// fallback values
+$yearStart = 2015;
+$yearEnd = 2030;
+
+if (defined('MONTHLY_QUOTA_YEAR_START')){
+  $yearStart = (int)MONTHLY_QUOTA_YEAR_START;
+}
+if (defined('MONTHLY_QUOTA_YEAR_END')){
+  $yearEnd = (int)MONTHLY_QUOTA_YEAR_END;
+}
+
+// create values for dropdown
+$years = array();
+for ($i=$yearStart; $i <= $yearEnd; $i++) {
+  array_push($years, array('id'=>$i, 'name'=>$i));
+}
+
+// get selected year from url parameters
+$selectedYear = $request->getParameter("year");
+if (!$selectedYear or !ttValidInteger($selectedYear)){
+  $selectedYear = date("Y");
+} else {
+  $selectedYear = intval($selectedYear);
+}
+
+// months are zero indexed
+$months = $i18n->monthNames;
+
+$quota = new MonthlyQuota();
+
+if ($request->isPost()){
+  $res = false;
+  // if user pressed save fpr monthly quotas
+  if ($_POST["quotas"]){
+    $postedYear = $request->getParameter("years");
+    $selectedYear = intval($postedYear);
+    for ($i=0; $i < count($months); $i++){
+      $res = $quota->update($postedYear, $i+1, $request->getParameter($months[$i]));
+    }
+  }
+  // if user saved required working hours for a day
+  if ($_POST["dailyHours"]){
+    $hours = $request->getParameter("dailyWorkingHours");
+    $teamDetails = ttTeamHelper::getTeamDetails($quota->usersTeamId);
+    $res = ttTeamHelper::update($quota->usersTeamId, array('name'=>$teamDetails['team_name'], 
+                                                           'workday_hours'=>$hours));
+  }
+  if ($res) {
+    header('Location: profile_edit.php');
+    exit();
+  } else {
+    $err->add($i18n->getKey('error.db'));
+  }
+}
+
+// returns months where January is month 1, not 0
+$monthsData = $quota->get($selectedYear);
+
+$form = new Form('monthlyQuotaForm');
+
+$form->addInput(array('type'=>'combobox', 'name'=>'years', 'data'=>$years, 'datakeys'=>array('id', 'name'), 'value'=>$selectedYear, 'onchange'=>'yearChange(this.value);'));
+for ($i=0; $i < count($months); $i++) { 
+  $value = "";
+  if (array_key_exists($i+1, $monthsData)){
+    $value = $monthsData[$i+1];
+  }
+  $name = $months[$i];
+  $form->addInput(array('type'=>'text', 'name'=>$name, 'maxlength'=>3, 'value'=> $value, 'style'=>'width:50px'));
+}
+$form->addInput(array('type'=>'text', 'name'=>'dailyWorkingHours', 'value'=>$quota->getDailyWorkingHours(), 'style'=>'width:50px'));
+$smarty->assign('months', $months);
+$smarty->assign('forms', array($form->getName()=>$form->toArray()));
+$smarty->assign('title', $i18n->getKey('title.monthly_quotas'));
+$smarty->assign('content_page_name', 'quotas.tpl');
+$smarty->display('index.tpl');