From: Nik Okuntseff Date: Fri, 23 Mar 2018 15:37:45 +0000 (+0000) Subject: Some more refactoring. X-Git-Tag: timetracker_1.19-1~966 X-Git-Url: http://wagnertech.de/git?a=commitdiff_plain;h=a0dd058ab6007cfc6a72713215a7f4abb96f1b45;p=timetracker.git Some more refactoring. --- diff --git a/WEB-INF/templates/footer.tpl b/WEB-INF/templates/footer.tpl index 74eb876f..7cf8ef60 100644 --- a/WEB-INF/templates/footer.tpl +++ b/WEB-INF/templates/footer.tpl @@ -12,7 +12,7 @@
-
 Anuko Time Tracker 1.17.67.4143 | Copyright © Anuko | +  Anuko Time Tracker 1.17.67.4144 | Copyright © Anuko | {$i18n.footer.credits} | {$i18n.footer.license} | {$i18n.footer.improve} diff --git a/cf_custom_field_delete.php b/cf_custom_field_delete.php index caf858a2..f4de4809 100644 --- a/cf_custom_field_delete.php +++ b/cf_custom_field_delete.php @@ -48,7 +48,7 @@ if ($request->isPost()) { header('Location: cf_custom_fields.php'); exit(); } else - $err->add($i18n->getKey('error.db')); + $err->add($i18n->get('error.db')); } if ($request->getParameter('btn_cancel')) { // Cancel button pressed. @@ -58,18 +58,18 @@ if ($request->isPost()) { } else { $field = CustomFields::getField($id); if (false === $field) - $err->add($i18n->getKey('error.db')); + $err->add($i18n->get('error.db')); if ($err->no()) { $form->addInput(array('type'=>'hidden','name'=>'id','value'=>$id)); - $form->addInput(array('type'=>'submit','name'=>'btn_delete','value'=>$i18n->getKey('label.delete'))); - $form->addInput(array('type'=>'submit','name'=>'btn_cancel','value'=>$i18n->getKey('button.cancel'))); + $form->addInput(array('type'=>'submit','name'=>'btn_delete','value'=>$i18n->get('label.delete'))); + $form->addInput(array('type'=>'submit','name'=>'btn_cancel','value'=>$i18n->get('button.cancel'))); } } $smarty->assign('field', $field['label']); $smarty->assign('forms', array($form->getName()=>$form->toArray())); $smarty->assign('onload', 'onLoad="document.fieldDeleteForm.btn_cancel.focus()"'); -$smarty->assign('title', $i18n->getKey('title.cf_delete_custom_field')); +$smarty->assign('title', $i18n->get('title.cf_delete_custom_field')); $smarty->assign('content_page_name', 'cf_custom_field_delete.tpl'); $smarty->display('index.tpl'); diff --git a/cf_custom_field_edit.php b/cf_custom_field_edit.php index 295e4079..32ee3878 100644 --- a/cf_custom_field_edit.php +++ b/cf_custom_field_edit.php @@ -39,7 +39,7 @@ if (!ttAccessAllowed('manage_custom_fields') || !$user->isPluginEnabled('cf')) { $cl_id = $request->getParameter('id'); $field = CustomFields::getField($cl_id); if (false === $field) - $err->add($i18n->getKey('error.db')); + $err->add($i18n->get('error.db')); $form = new Form('fieldForm'); if ($err->no()) { @@ -47,9 +47,9 @@ if ($err->no()) { $form->addInput(array('type'=>'hidden','name'=>'id','value'=>$cl_id)); $form->addInput(array('type'=>'checkbox','name'=>'required','value'=>$field['required'])); $form->addInput(array('type'=>'combobox','name'=>'type','value'=>$field['type'], - 'data'=>array(CustomFields::TYPE_TEXT=>$i18n->getKey('label.type_text'), - CustomFields::TYPE_DROPDOWN=>$i18n->getKey('label.type_dropdown')))); - $form->addInput(array('type'=>'submit','name'=>'btn_save','value'=>$i18n->getKey('button.save'))); + 'data'=>array(CustomFields::TYPE_TEXT=>$i18n->get('label.type_text'), + CustomFields::TYPE_DROPDOWN=>$i18n->get('label.type_dropdown')))); + $form->addInput(array('type'=>'submit','name'=>'btn_save','value'=>$i18n->get('button.save'))); } if ($request->isPost()) { @@ -60,7 +60,7 @@ if ($request->isPost()) { $cl_required = 0; // Validate user input. - if (!ttValidString($cl_name)) $err->add($i18n->getKey('error.field'), $i18n->getKey('label.thing_name')); + if (!ttValidString($cl_name)) $err->add($i18n->get('error.field'), $i18n->get('label.thing_name')); if ($err->no()) { $res = CustomFields::updateField($cl_id, $cl_name, $cl_type, $cl_required); @@ -68,12 +68,12 @@ if ($request->isPost()) { header('Location: cf_custom_fields.php'); exit(); } else - $err->add($i18n->getKey('error.db')); + $err->add($i18n->get('error.db')); } } // isPost $smarty->assign('forms', array($form->getName()=>$form->toArray())); $smarty->assign('onload', 'onLoad="document.fieldForm.name.focus()"'); -$smarty->assign('title', $i18n->getKey('title.cf_edit_custom_field')); +$smarty->assign('title', $i18n->get('title.cf_edit_custom_field')); $smarty->assign('content_page_name', 'cf_custom_field_edit.tpl'); $smarty->display('index.tpl'); diff --git a/cf_custom_fields.php b/cf_custom_fields.php index 539271c5..2b34fb76 100644 --- a/cf_custom_fields.php +++ b/cf_custom_fields.php @@ -45,7 +45,7 @@ if ($request->isPost()) { exit(); } } else { - $form->addInput(array('type'=>'submit','name'=>'btn_add','value'=>$i18n->getKey('button.add'))); + $form->addInput(array('type'=>'submit','name'=>'btn_add','value'=>$i18n->get('button.add'))); $fields = CustomFields::getFields(); // At this time only one custom field is supported. Disable the Add button if we already have one or more custom fields. @@ -55,6 +55,6 @@ if ($request->isPost()) { $smarty->assign('forms', array($form->getName()=>$form->toArray())); $smarty->assign('custom_fields', $fields); -$smarty->assign('title', $i18n->getKey('title.cf_custom_fields')); +$smarty->assign('title', $i18n->get('title.cf_custom_fields')); $smarty->assign('content_page_name', 'cf_custom_fields.tpl'); $smarty->display('index.tpl'); diff --git a/cf_dropdown_option_add.php b/cf_dropdown_option_add.php index f87003d1..b9500833 100644 --- a/cf_dropdown_option_add.php +++ b/cf_dropdown_option_add.php @@ -39,20 +39,20 @@ if (!ttAccessAllowed('manage_custom_fields') || !$user->isPluginEnabled('cf')) { $cl_field_id = $request->getParameter('field_id'); $field = CustomFields::getField($cl_field_id); if (false === $field) - $err->add($i18n->getKey('error.db')); + $err->add($i18n->get('error.db')); $form = new Form('optionAddForm'); if ($err->no()) { $form->addInput(array('type'=>'hidden','name'=>'field_id','value'=>$cl_field_id)); $form->addInput(array('type'=>'text','maxlength'=>'100','name'=>'name','value'=>'')); - $form->addInput(array('type'=>'submit','name'=>'btn_add','value'=>$i18n->getKey('button.add'))); + $form->addInput(array('type'=>'submit','name'=>'btn_add','value'=>$i18n->get('button.add'))); } if ($request->isPost()) { $cl_option_name = trim($request->getParameter('name')); // Validate user input. - if (!ttValidString($cl_option_name)) $err->add($i18n->getKey('error.field'), $i18n->getKey('label.thing_name')); + if (!ttValidString($cl_option_name)) $err->add($i18n->get('error.field'), $i18n->get('label.thing_name')); if ($err->no()) { $res = CustomFields::insertOption($cl_field_id, $cl_option_name); @@ -60,12 +60,12 @@ if ($request->isPost()) { header("Location: cf_dropdown_options.php?field_id=$cl_field_id"); exit(); } else - $err->add($i18n->getKey('error.db')); + $err->add($i18n->get('error.db')); } } // isPost $smarty->assign('forms', array($form->getName()=>$form->toArray())); $smarty->assign('onload', 'onLoad="document.optionAddForm.name.focus()"'); -$smarty->assign('title', $i18n->getKey('title.cf_add_dropdown_option')); +$smarty->assign('title', $i18n->get('title.cf_add_dropdown_option')); $smarty->assign('content_page_name', 'cf_dropdown_option_add.tpl'); $smarty->display('index.tpl'); diff --git a/cf_dropdown_option_delete.php b/cf_dropdown_option_delete.php index f4e44207..0a1f25ba 100644 --- a/cf_dropdown_option_delete.php +++ b/cf_dropdown_option_delete.php @@ -50,7 +50,7 @@ if ($request->isPost()) { header("Location: cf_dropdown_options.php?field_id=$field_id"); exit(); } else - $err->add($i18n->getKey('error.db')); + $err->add($i18n->get('error.db')); } if ($request->getParameter('btn_cancel')) { // Cancel button pressed. @@ -60,18 +60,18 @@ if ($request->isPost()) { } else { $option = CustomFields::getOptionName($cl_id); if (false === $option) - $err->add($i18n->getKey('error.db')); + $err->add($i18n->get('error.db')); if ($err->no()) { $form->addInput(array('type'=>'hidden','name'=>'id','value'=>$cl_id)); - $form->addInput(array('type'=>'submit','name'=>'btn_delete','value'=>$i18n->getKey('label.delete'))); - $form->addInput(array('type'=>'submit','name'=>'btn_cancel','value'=>$i18n->getKey('button.cancel'))); + $form->addInput(array('type'=>'submit','name'=>'btn_delete','value'=>$i18n->get('label.delete'))); + $form->addInput(array('type'=>'submit','name'=>'btn_cancel','value'=>$i18n->get('button.cancel'))); } } $smarty->assign('option', $option); $smarty->assign('forms', array($form->getName()=>$form->toArray())); $smarty->assign('onload', 'onLoad="document.optionDeleteForm.btn_cancel.focus()"'); -$smarty->assign('title', $i18n->getKey('title.cf_delete_dropdown_option')); +$smarty->assign('title', $i18n->get('title.cf_delete_dropdown_option')); $smarty->assign('content_page_name', 'cf_dropdown_option_delete.tpl'); $smarty->display('index.tpl'); diff --git a/cf_dropdown_option_edit.php b/cf_dropdown_option_edit.php index 1013a54a..5fc333d0 100644 --- a/cf_dropdown_option_edit.php +++ b/cf_dropdown_option_edit.php @@ -39,20 +39,20 @@ if (!ttAccessAllowed('manage_custom_fields') || !$user->isPluginEnabled('cf')) { $cl_id = $request->getParameter('id'); $cl_name = CustomFields::getOptionName($cl_id); if (false === $cl_name) - $err->add($i18n->getKey('error.db')); + $err->add($i18n->get('error.db')); $form = new Form('optionEditForm'); if ($err->no()) { $form->addInput(array('type'=>'text','maxlength'=>'100','name'=>'name','value'=>$cl_name)); $form->addInput(array('type'=>'hidden','name'=>'id','value'=>$cl_id)); - $form->addInput(array('type'=>'submit','name'=>'btn_save','value'=>$i18n->getKey('button.save'))); + $form->addInput(array('type'=>'submit','name'=>'btn_save','value'=>$i18n->get('button.save'))); } if ($request->isPost()) { $cl_name = trim($request->getParameter('name')); // Validate user input. - if (!ttValidString($cl_name)) $err->add($i18n->getKey('error.field'), $i18n->getKey('label.thing_name')); + if (!ttValidString($cl_name)) $err->add($i18n->get('error.field'), $i18n->get('label.thing_name')); if ($err->no()) { $res = CustomFields::updateOption($cl_id, $cl_name); @@ -62,12 +62,12 @@ if ($request->isPost()) { header("Location: cf_dropdown_options.php?field_id=$field_id"); exit(); } else - $err->add($i18n->getKey('error.db')); + $err->add($i18n->get('error.db')); } } // isPost $smarty->assign('forms', array($form->getName()=>$form->toArray())); $smarty->assign('onload', 'onLoad="document.optionEditForm.name.focus()"'); -$smarty->assign('title', $i18n->getKey('title.cf_edit_dropdown_option')); +$smarty->assign('title', $i18n->get('title.cf_edit_dropdown_option')); $smarty->assign('content_page_name', 'cf_dropdown_option_edit.tpl'); $smarty->display('index.tpl'); diff --git a/cf_dropdown_options.php b/cf_dropdown_options.php index 3ee5294e..02f59f56 100644 --- a/cf_dropdown_options.php +++ b/cf_dropdown_options.php @@ -39,13 +39,13 @@ if (!ttAccessAllowed('manage_custom_fields') || !$user->isPluginEnabled('cf')) { $field_id = $request->getParameter('field_id'); $options = CustomFields::getOptions($field_id); if (false === $options) - $err->add($i18n->getKey('error.db')); + $err->add($i18n->get('error.db')); $form = new Form('dropdownOptionsForm'); $smarty->assign('forms', array($form->getName()=>$form->toArray())); $smarty->assign('field_id', $field_id); $smarty->assign('options', $options); -$smarty->assign('title', $i18n->getKey('title.cf_dropdown_options')); +$smarty->assign('title', $i18n->get('title.cf_dropdown_options')); $smarty->assign('content_page_name', 'cf_dropdown_options.tpl'); $smarty->display('index.tpl'); diff --git a/charts.php b/charts.php index 9df70d55..69997d87 100644 --- a/charts.php +++ b/charts.php @@ -139,11 +139,11 @@ if ($user->canManageTeam()) { // Chart interval options. $intervals = array(); -$intervals[INTERVAL_THIS_DAY] = $i18n->getKey('dropdown.selected_day'); -$intervals[INTERVAL_THIS_WEEK] = $i18n->getKey('dropdown.selected_week'); -$intervals[INTERVAL_THIS_MONTH] = $i18n->getKey('dropdown.selected_month'); -$intervals[INTERVAL_THIS_YEAR] = $i18n->getKey('dropdown.selected_year'); -$intervals[INTERVAL_ALL_TIME] = $i18n->getKey('dropdown.all_time'); +$intervals[INTERVAL_THIS_DAY] = $i18n->get('dropdown.selected_day'); +$intervals[INTERVAL_THIS_WEEK] = $i18n->get('dropdown.selected_week'); +$intervals[INTERVAL_THIS_MONTH] = $i18n->get('dropdown.selected_month'); +$intervals[INTERVAL_THIS_YEAR] = $i18n->get('dropdown.selected_year'); +$intervals[INTERVAL_ALL_TIME] = $i18n->get('dropdown.all_time'); // Chart interval dropdown. $chart_form->addInput(array('type' => 'combobox', @@ -158,11 +158,11 @@ $chart_selector = (MODE_PROJECTS_AND_TASKS == $user->tracking_mode || $user->isP if ($chart_selector) { $types = array(); if (MODE_PROJECTS == $user->tracking_mode || MODE_PROJECTS_AND_TASKS == $user->tracking_mode) - $types[CHART_PROJECTS] = $i18n->getKey('dropdown.projects'); + $types[CHART_PROJECTS] = $i18n->get('dropdown.projects'); if (MODE_PROJECTS_AND_TASKS == $user->tracking_mode) - $types[CHART_TASKS] = $i18n->getKey('dropdown.tasks'); + $types[CHART_TASKS] = $i18n->get('dropdown.tasks'); if ($user->isPluginEnabled('cl')) - $types[CHART_CLIENTS] = $i18n->getKey('dropdown.clients'); + $types[CHART_CLIENTS] = $i18n->get('dropdown.clients'); // Add chart type dropdown. $chart_form->addInput(array('type' => 'combobox', @@ -223,6 +223,6 @@ $chart->renderEx(array('fileName'=>$file_name,'hideLogo'=>true,'hideTitle'=>true $smarty->assign('img_file_name', $img_ref); $smarty->assign('chart_selector', $chart_selector); $smarty->assign('forms', array($chart_form->getName() => $chart_form->toArray())); -$smarty->assign('title', $i18n->getKey('title.charts')); +$smarty->assign('title', $i18n->get('title.charts')); $smarty->assign('content_page_name', 'charts.tpl'); $smarty->display('index.tpl'); diff --git a/client_add.php b/client_add.php index 8dbb0d86..c0526e51 100644 --- a/client_add.php +++ b/client_add.php @@ -56,13 +56,13 @@ $form->addInput(array('type'=>'textarea','name'=>'address','maxlength'=>'255','s $form->addInput(array('type'=>'floatfield','name'=>'tax','size'=>'10','format'=>'.2','value'=>$cl_tax)); if (MODE_PROJECTS == $user->tracking_mode || MODE_PROJECTS_AND_TASKS == $user->tracking_mode) $form->addInput(array('type'=>'checkboxgroup','name'=>'projects','data'=>$projects,'layout'=>'H','datakeys'=>array('id','name'),'value'=>$cl_projects)); -$form->addInput(array('type'=>'submit','name'=>'btn_submit','value'=>$i18n->getKey('button.add'))); +$form->addInput(array('type'=>'submit','name'=>'btn_submit','value'=>$i18n->get('button.add'))); if ($request->isPost()) { // Validate user input. - if (!ttValidString($cl_name)) $err->add($i18n->getKey('error.field'), $i18n->getKey('label.client_name')); - if (!ttValidString($cl_address, true)) $err->add($i18n->getKey('error.field'), $i18n->getKey('label.client_address')); - if (!ttValidFloat($cl_tax, true)) $err->add($i18n->getKey('error.field'), $i18n->getKey('label.tax')); + if (!ttValidString($cl_name)) $err->add($i18n->get('error.field'), $i18n->get('label.client_name')); + if (!ttValidString($cl_address, true)) $err->add($i18n->get('error.field'), $i18n->get('label.client_address')); + if (!ttValidFloat($cl_tax, true)) $err->add($i18n->get('error.field'), $i18n->get('label.tax')); if ($err->no()) { if (!ttClientHelper::getClientByName($cl_name)) { @@ -76,14 +76,14 @@ if ($request->isPost()) { header('Location: clients.php'); exit(); } else - $err->add($i18n->getKey('error.db')); + $err->add($i18n->get('error.db')); } else - $err->add($i18n->getKey('error.client_exists')); + $err->add($i18n->get('error.client_exists')); } } // isPost $smarty->assign('forms', array($form->getName()=>$form->toArray())); $smarty->assign('onload', 'onLoad="document.clientForm.name.focus()"'); -$smarty->assign('title', $i18n->getKey('title.add_client')); +$smarty->assign('title', $i18n->get('title.add_client')); $smarty->assign('content_page_name', 'client_add.tpl'); $smarty->display('index.tpl'); diff --git a/client_delete.php b/client_delete.php index eae30050..b162ea84 100644 --- a/client_delete.php +++ b/client_delete.php @@ -44,9 +44,9 @@ $client_to_delete = $client['name']; $form = new Form('clientDeleteForm'); $form->addInput(array('type'=>'hidden','name'=>'id','value'=>$id)); $form->addInput(array('type'=>'combobox','name'=>'delete_client_entries', - 'data'=>array('0'=>$i18n->getKey('dropdown.do_not_delete'),'1'=>$i18n->getKey('dropdown.delete')))); -$form->addInput(array('type'=>'submit','name'=>'btn_delete','value'=>$i18n->getKey('label.delete'))); -$form->addInput(array('type'=>'submit','name'=>'btn_cancel','value'=>$i18n->getKey('button.cancel'))); + 'data'=>array('0'=>$i18n->get('dropdown.do_not_delete'),'1'=>$i18n->get('dropdown.delete')))); +$form->addInput(array('type'=>'submit','name'=>'btn_delete','value'=>$i18n->get('label.delete'))); +$form->addInput(array('type'=>'submit','name'=>'btn_cancel','value'=>$i18n->get('button.cancel'))); if ($request->isPost()) { if(ttClientHelper::getClient($id)) { @@ -55,10 +55,10 @@ if ($request->isPost()) { header('Location: clients.php'); exit(); } else - $err->add($i18n->getKey('error.db')); + $err->add($i18n->get('error.db')); } } else - $err->add($i18n->getKey('error.db')); + $err->add($i18n->get('error.db')); if ($request->getParameter('btn_cancel')) { header('Location: clients.php'); @@ -68,6 +68,6 @@ if ($request->isPost()) { $smarty->assign('client_to_delete', $client_to_delete); $smarty->assign('forms', array($form->getName()=>$form->toArray())); -$smarty->assign('title', $i18n->getKey('title.delete_client')); +$smarty->assign('title', $i18n->get('title.delete_client')); $smarty->assign('content_page_name', 'client_delete.tpl'); $smarty->display('index.tpl'); diff --git a/client_edit.php b/client_edit.php index 3099e888..05203237 100644 --- a/client_edit.php +++ b/client_edit.php @@ -65,17 +65,17 @@ $form->addInput(array('type'=>'text','name'=>'name','maxlength'=>'100','style'=> $form->addInput(array('type'=>'textarea','name'=>'address','maxlength'=>'255','style'=>'width: 350px; height: 80px;','value'=>$cl_address)); $form->addInput(array('type'=>'floatfield','name'=>'tax','size'=>'10','format'=>'.2','value'=>$cl_tax)); $form->addInput(array('type'=>'combobox','name'=>'status','value'=>$cl_status, - 'data'=>array(ACTIVE=>$i18n->getKey('dropdown.status_active'),INACTIVE=>$i18n->getKey('dropdown.status_inactive')))); + 'data'=>array(ACTIVE=>$i18n->get('dropdown.status_active'),INACTIVE=>$i18n->get('dropdown.status_inactive')))); if (MODE_PROJECTS == $user->tracking_mode || MODE_PROJECTS_AND_TASKS == $user->tracking_mode) $form->addInput(array('type'=>'checkboxgroup','name'=>'projects','data'=>$projects,'datakeys'=>array('id','name'),'layout'=>'H','value'=>$cl_projects)); -$form->addInput(array('type'=>'submit','name'=>'btn_save','value'=>$i18n->getKey('button.save'))); -$form->addInput(array('type'=>'submit','name'=>'btn_copy','value'=>$i18n->getKey('button.copy'))); +$form->addInput(array('type'=>'submit','name'=>'btn_save','value'=>$i18n->get('button.save'))); +$form->addInput(array('type'=>'submit','name'=>'btn_copy','value'=>$i18n->get('button.copy'))); if ($request->isPost()) { // Validate user input. - if (!ttValidString($cl_name)) $err->add($i18n->getKey('error.field'), $i18n->getKey('label.client_name')); - if (!ttValidString($cl_address, true)) $err->add($i18n->getKey('error.field'), $i18n->getKey('label.client_address')); - if (!ttValidFloat($cl_tax, true)) $err->add($i18n->getKey('error.field'), $i18n->getKey('label.tax')); + if (!ttValidString($cl_name)) $err->add($i18n->get('error.field'), $i18n->get('label.client_name')); + if (!ttValidString($cl_address, true)) $err->add($i18n->get('error.field'), $i18n->get('label.client_address')); + if (!ttValidFloat($cl_tax, true)) $err->add($i18n->get('error.field'), $i18n->get('label.tax')); if ($err->no()) { if ($request->getParameter('btn_save')) { @@ -91,9 +91,9 @@ if ($request->isPost()) { header('Location: clients.php'); exit(); } else - $err->add($i18n->getKey('error.db')); + $err->add($i18n->get('error.db')); } else - $err->add($i18n->getKey('error.client_exists')); + $err->add($i18n->get('error.client_exists')); } if ($request->getParameter('btn_copy')) { @@ -108,14 +108,14 @@ if ($request->isPost()) { header('Location: clients.php'); exit(); } else - $err->add($i18n->getKey('error.db')); + $err->add($i18n->get('error.db')); } else - $err->add($i18n->getKey('error.client_exists')); + $err->add($i18n->get('error.client_exists')); } } } // isPost $smarty->assign('forms', array($form->getName()=>$form->toArray())); -$smarty->assign('title', $i18n->getKey('title.edit_client')); +$smarty->assign('title', $i18n->get('title.edit_client')); $smarty->assign('content_page_name', 'client_edit.tpl'); $smarty->display('index.tpl');