From: Nik Okuntseff Date: Fri, 22 Jul 2016 16:34:10 +0000 (+0000) Subject: Renamed quota files for naming consistency. X-Git-Tag: timetracker_1.19-1~1675 X-Git-Url: http://wagnertech.de/git?a=commitdiff_plain;h=c304a055bafbb8db6b94dbf538c4c74e88952189;p=timetracker.git Renamed quota files for naming consistency. --- diff --git a/WEB-INF/templates/cf_monthly_quota.tpl b/WEB-INF/templates/cf_monthly_quota.tpl deleted file mode 100644 index d8a59cef..00000000 --- a/WEB-INF/templates/cf_monthly_quota.tpl +++ /dev/null @@ -1,59 +0,0 @@ -{$forms.monthlyQuotaForm.open} -
- - - - -
- - - - - - -
{$i18n.form.quota.workdayHours}{$forms.monthlyQuotaForm.dailyWorkingHours.control}
-
-
- - - - - - - - -
{$i18n.form.quota.year}:{$forms.monthlyQuotaForm.years.control}
- - - - - - {foreach $months as $month} - - - - - {/foreach} - - - -
{$i18n.form.quota.month}{$i18n.form.quota.quota}
{$month}{$forms.monthlyQuotaForm.$month.control}
- -
-
-
* - {$i18n.form.quota.hint}
-{$forms.monthlyQuotaForm.close} - \ No newline at end of file diff --git a/WEB-INF/templates/footer.tpl b/WEB-INF/templates/footer.tpl index 85abb80a..473df20c 100644 --- a/WEB-INF/templates/footer.tpl +++ b/WEB-INF/templates/footer.tpl @@ -12,7 +12,7 @@
- - + {/if} diff --git a/WEB-INF/templates/quotas.tpl b/WEB-INF/templates/quotas.tpl new file mode 100644 index 00000000..d8a59cef --- /dev/null +++ b/WEB-INF/templates/quotas.tpl @@ -0,0 +1,59 @@ +{$forms.monthlyQuotaForm.open} +
+
 Anuko Time Tracker 1.9.27.3513 | Copyright © Anuko | +  Anuko Time Tracker 1.9.27.3514 | Copyright © Anuko | {$i18n.footer.credits} | {$i18n.footer.license} | {$i18n.footer.improve} diff --git a/WEB-INF/templates/profile_edit.tpl b/WEB-INF/templates/profile_edit.tpl index 8c8e27ae..49b610eb 100644 --- a/WEB-INF/templates/profile_edit.tpl +++ b/WEB-INF/templates/profile_edit.tpl @@ -194,7 +194,7 @@ function handlePluginCheckboxes() {
{$forms.profileForm.monthly_quota.control} {$i18n.label.configure} {$i18n.label.configure}
+ + + +
+ + + + + + +
{$i18n.form.quota.workdayHours}{$forms.monthlyQuotaForm.dailyWorkingHours.control}
+
+ + + + + + + + + +
{$i18n.form.quota.year}:{$forms.monthlyQuotaForm.years.control}
+ + + + + + {foreach $months as $month} + + + + + {/foreach} + + + +
{$i18n.form.quota.month}{$i18n.form.quota.quota}
{$month}{$forms.monthlyQuotaForm.$month.control}
+ +
+
+
* - {$i18n.form.quota.hint}
+{$forms.monthlyQuotaForm.close} + \ No newline at end of file diff --git a/cf_monthly_quota.php b/cf_monthly_quota.php deleted file mode 100644 index 0518c57e..00000000 --- a/cf_monthly_quota.php +++ /dev/null @@ -1,88 +0,0 @@ -$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 index 00000000..f648f9d2 --- /dev/null +++ b/quotas.php @@ -0,0 +1,88 @@ +$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');