From: Nik Okuntseff Date: Fri, 23 Mar 2018 16:09:47 +0000 (+0000) Subject: Some more refactoring. X-Git-Tag: timetracker_1.19-1~965 X-Git-Url: http://wagnertech.de/git?a=commitdiff_plain;h=a62e4bdd1bc89ea4f3cf29507399b5b8f229597a;p=timetracker.git Some more refactoring. --- diff --git a/clients.php b/clients.php index f02d4b95..89b5c4a3 100644 --- a/clients.php +++ b/clients.php @@ -38,6 +38,6 @@ if (!ttAccessAllowed('manage_clients') || !$user->isPluginEnabled('cl')) { $smarty->assign('active_clients', ttTeamHelper::getActiveClients($user->team_id, true)); $smarty->assign('inactive_clients', ttTeamHelper::getInactiveClients($user->team_id, true)); -$smarty->assign('title', $i18n->getKey('title.clients')); +$smarty->assign('title', $i18n->get('title.clients')); $smarty->assign('content_page_name', 'clients.tpl'); $smarty->display('index.tpl'); diff --git a/expense_delete.php b/expense_delete.php index d5b4e8d2..06c9690b 100644 --- a/expense_delete.php +++ b/expense_delete.php @@ -41,7 +41,7 @@ $cl_id = $request->getParameter('id'); $expense_item = ttExpenseHelper::getItem($cl_id, $user->getActiveUser()); // Prohibit deleting invoiced records. -if ($expense_item['invoice_id']) die($i18n->getKey('error.sys')); +if ($expense_item['invoice_id']) die($i18n->get('error.sys')); if ($request->isPost()) { if ($request->getParameter('delete_button')) { // Delete button pressed. @@ -49,7 +49,7 @@ if ($request->isPost()) { // Determine if it is okay to delete the record. $item_date = new DateAndTime(DB_DATEFORMAT, $expense_item['date']); if ($user->isDateLocked($item_date)) - $err->add($i18n->getKey('error.range_locked')); + $err->add($i18n->get('error.range_locked')); if ($err->no()) { // Mark the record as deleted. @@ -57,7 +57,7 @@ if ($request->isPost()) { header('Location: expenses.php'); exit(); } else - $err->add($i18n->getKey('error.db')); + $err->add($i18n->get('error.db')); } } if ($request->getParameter('cancel_button')) { // Cancel button pressed. @@ -68,11 +68,11 @@ if ($request->isPost()) { $form = new Form('expenseItemForm'); $form->addInput(array('type'=>'hidden','name'=>'id','value'=>$cl_id)); -$form->addInput(array('type'=>'submit','name'=>'delete_button','value'=>$i18n->getKey('label.delete'))); -$form->addInput(array('type'=>'submit','name'=>'cancel_button','value'=>$i18n->getKey('button.cancel'))); +$form->addInput(array('type'=>'submit','name'=>'delete_button','value'=>$i18n->get('label.delete'))); +$form->addInput(array('type'=>'submit','name'=>'cancel_button','value'=>$i18n->get('button.cancel'))); $smarty->assign('expense_item', $expense_item); $smarty->assign('forms', array($form->getName() => $form->toArray())); -$smarty->assign('title', $i18n->getKey('title.delete_expense')); +$smarty->assign('title', $i18n->get('title.delete_expense')); $smarty->assign('content_page_name', 'expense_delete.tpl'); $smarty->display('index.tpl'); diff --git a/expense_edit.php b/expense_edit.php index dbd14d96..9ea7c649 100644 --- a/expense_edit.php +++ b/expense_edit.php @@ -44,7 +44,7 @@ $cl_id = $request->getParameter('id'); $expense_item = ttExpenseHelper::getItem($cl_id, $user->getActiveUser()); // Prohibit editing invoiced items. -if ($expense_item['invoice_id']) die($i18n->getKey('error.sys')); +if ($expense_item['invoice_id']) die($i18n->get('error.sys')); $item_date = new DateAndTime(DB_DATEFORMAT, $expense_item['date']); @@ -80,7 +80,7 @@ if (MODE_TIME == $user->tracking_mode && $user->isPluginEnabled('cl')) { 'value'=>$cl_client, 'data'=>$active_clients, 'datakeys'=>array('id', 'name'), - 'empty'=>array(''=>$i18n->getKey('dropdown.select')))); + 'empty'=>array(''=>$i18n->get('dropdown.select')))); // Note: in other modes the client list is filtered to relevant clients only. See below. } @@ -93,7 +93,7 @@ if (MODE_PROJECTS == $user->tracking_mode || MODE_PROJECTS_AND_TASKS == $user->t 'value'=>$cl_project, 'data'=>$project_list, 'datakeys'=>array('id','name'), - 'empty'=>array(''=>$i18n->getKey('dropdown.select')))); + 'empty'=>array(''=>$i18n->get('dropdown.select')))); // Dropdown for clients if the clients plugin is enabled. if ($user->isPluginEnabled('cl')) { @@ -119,7 +119,7 @@ if (MODE_PROJECTS == $user->tracking_mode || MODE_PROJECTS_AND_TASKS == $user->t 'value'=>$cl_client, 'data'=>$client_list, 'datakeys'=>array('id', 'name'), - 'empty'=>array(''=>$i18n->getKey('dropdown.select')))); + 'empty'=>array(''=>$i18n->get('dropdown.select')))); } } // If predefined expenses are configured, add controls to select an expense and quantity. @@ -132,7 +132,7 @@ if ($predefined_expenses) { 'value'=>$cl_predefined_expense, 'data'=>$predefined_expenses, 'datakeys'=>array('id', 'name'), - 'empty'=>array(''=>$i18n->getKey('dropdown.select')))); + 'empty'=>array(''=>$i18n->get('dropdown.select')))); $form->addInput(array('type'=>'text','onchange'=>'recalculateCost();','maxlength'=>'40','name'=>'quantity','style'=>'width: 100px;','value'=>$cl_quantity)); } $form->addInput(array('type'=>'textarea','maxlength'=>'800','name'=>'item_name','style'=>'width: 250px; height:'.NOTE_INPUT_HEIGHT.'px;','value'=>$cl_item_name)); @@ -143,20 +143,20 @@ $form->addInput(array('type'=>'datefield','name'=>'date','maxlength'=>'20','valu // Hidden control for record id. $form->addInput(array('type'=>'hidden','name'=>'id','value'=>$cl_id)); $form->addInput(array('type'=>'hidden','name'=>'browser_today','value'=>'')); // User current date, which gets filled in on btn_save or btn_copy click. -$form->addInput(array('type'=>'submit','name'=>'btn_save','onclick'=>'browser_today.value=get_date()','value'=>$i18n->getKey('button.save'))); -$form->addInput(array('type'=>'submit','name'=>'btn_copy','onclick'=>'browser_today.value=get_date()','value'=>$i18n->getKey('button.copy'))); -$form->addInput(array('type'=>'submit','name'=>'btn_delete','value'=>$i18n->getKey('label.delete'))); +$form->addInput(array('type'=>'submit','name'=>'btn_save','onclick'=>'browser_today.value=get_date()','value'=>$i18n->get('button.save'))); +$form->addInput(array('type'=>'submit','name'=>'btn_copy','onclick'=>'browser_today.value=get_date()','value'=>$i18n->get('button.copy'))); +$form->addInput(array('type'=>'submit','name'=>'btn_delete','value'=>$i18n->get('label.delete'))); if ($request->isPost()) { // Validate user input. if ($user->isPluginEnabled('cl') && $user->isPluginEnabled('cm') && !$cl_client) - $err->add($i18n->getKey('error.client')); + $err->add($i18n->get('error.client')); if (MODE_PROJECTS == $user->tracking_mode || MODE_PROJECTS_AND_TASKS == $user->tracking_mode) { - if (!$cl_project) $err->add($i18n->getKey('error.project')); + if (!$cl_project) $err->add($i18n->get('error.project')); } - if (!ttValidString($cl_item_name)) $err->add($i18n->getKey('error.field'), $i18n->getKey('label.item')); - if (!ttValidFloat($cl_cost)) $err->add($i18n->getKey('error.field'), $i18n->getKey('label.cost')); - if (!ttValidDate($cl_date)) $err->add($i18n->getKey('error.field'), $i18n->getKey('label.date')); + if (!ttValidString($cl_item_name)) $err->add($i18n->get('error.field'), $i18n->get('label.item')); + if (!ttValidFloat($cl_cost)) $err->add($i18n->get('error.field'), $i18n->get('label.cost')); + if (!ttValidDate($cl_date)) $err->add($i18n->get('error.field'), $i18n->get('label.date')); // This is a new date for the expense item. $new_date = new DateAndTime($user->date_format, $cl_date); @@ -165,7 +165,7 @@ if ($request->isPost()) { if (!$user->future_entries) { $browser_today = new DateAndTime(DB_DATEFORMAT, $request->getParameter('browser_today', null)); if ($new_date->after($browser_today)) - $err->add($i18n->getKey('error.future_date')); + $err->add($i18n->get('error.future_date')); } // Save record. @@ -177,11 +177,11 @@ if ($request->isPost()) { // Now, step by step. // 1) Prohibit saving locked entries in any form. if ($user->isDateLocked($item_date)) - $err->add($i18n->getKey('error.range_locked')); + $err->add($i18n->get('error.range_locked')); // 2) Prohibit saving unlocked entries into locked range. if ($err->no() && $user->isDateLocked($new_date)) - $err->add($i18n->getKey('error.range_locked')); + $err->add($i18n->get('error.range_locked')); // Now, an update. if ($err->no()) { @@ -197,7 +197,7 @@ if ($request->isPost()) { if ($request->getParameter('btn_copy')) { // We need to prohibit saving into locked interval. if ($user->isDateLocked($new_date)) - $err->add($i18n->getKey('error.range_locked')); + $err->add($i18n->get('error.range_locked')); // Now, a new insert. if ($err->no()) { @@ -206,7 +206,7 @@ if ($request->isPost()) { header('Location: expenses.php?date='.$new_date->toString(DB_DATEFORMAT)); exit(); } else - $err->add($i18n->getKey('error.db')); + $err->add($i18n->get('error.db')); } } @@ -221,6 +221,6 @@ $smarty->assign('client_list', $client_list); $smarty->assign('project_list', $project_list); $smarty->assign('task_list', $task_list); $smarty->assign('forms', array($form->getName()=>$form->toArray())); -$smarty->assign('title', $i18n->getKey('title.edit_expense')); +$smarty->assign('title', $i18n->get('title.edit_expense')); $smarty->assign('content_page_name', 'expense_edit.tpl'); $smarty->display('index.tpl'); diff --git a/expenses.php b/expenses.php index ca681d41..bb769481 100644 --- a/expenses.php +++ b/expenses.php @@ -84,7 +84,7 @@ if (MODE_TIME == $user->tracking_mode && $user->isPluginEnabled('cl')) { 'value'=>$cl_client, 'data'=>$active_clients, 'datakeys'=>array('id', 'name'), - 'empty'=>array(''=>$i18n->getKey('dropdown.select')))); + 'empty'=>array(''=>$i18n->get('dropdown.select')))); // Note: in other modes the client list is filtered to relevant clients only. See below. } @@ -98,7 +98,7 @@ if (MODE_PROJECTS == $user->tracking_mode || MODE_PROJECTS_AND_TASKS == $user->t 'value'=>$cl_project, 'data'=>$project_list, 'datakeys'=>array('id','name'), - 'empty'=>array(''=>$i18n->getKey('dropdown.select')))); + 'empty'=>array(''=>$i18n->get('dropdown.select')))); // Dropdown for clients if the clients plugin is enabled. if ($user->isPluginEnabled('cl')) { @@ -124,7 +124,7 @@ if (MODE_PROJECTS == $user->tracking_mode || MODE_PROJECTS_AND_TASKS == $user->t 'value'=>$cl_client, 'data'=>$client_list, 'datakeys'=>array('id', 'name'), - 'empty'=>array(''=>$i18n->getKey('dropdown.select')))); + 'empty'=>array(''=>$i18n->get('dropdown.select')))); } } // If predefined expenses are configured, add controls to select an expense and quantity. @@ -137,38 +137,38 @@ if ($predefined_expenses) { 'value'=>$cl_predefined_expense, 'data'=>$predefined_expenses, 'datakeys'=>array('id', 'name'), - 'empty'=>array(''=>$i18n->getKey('dropdown.select')))); + 'empty'=>array(''=>$i18n->get('dropdown.select')))); $form->addInput(array('type'=>'text','onchange'=>'recalculateCost();','maxlength'=>'40','name'=>'quantity','style'=>'width: 100px;','value'=>$cl_quantity)); } $form->addInput(array('type'=>'textarea','maxlength'=>'800','name'=>'item_name','style'=>'width: 250px; height:'.NOTE_INPUT_HEIGHT.'px;','value'=>$cl_item_name)); $form->addInput(array('type'=>'text','maxlength'=>'40','name'=>'cost','style'=>'width: 100px;','value'=>$cl_cost)); $form->addInput(array('type'=>'calendar','name'=>'date','highlight'=>'expenses','value'=>$cl_date)); // calendar $form->addInput(array('type'=>'hidden','name'=>'browser_today','value'=>'')); // User current date, which gets filled in on btn_submit click. -$form->addInput(array('type'=>'submit','name'=>'btn_submit','onclick'=>'browser_today.value=get_date()','value'=>$i18n->getKey('button.submit'))); +$form->addInput(array('type'=>'submit','name'=>'btn_submit','onclick'=>'browser_today.value=get_date()','value'=>$i18n->get('button.submit'))); // Submit. if ($request->isPost()) { if ($request->getParameter('btn_submit')) { // Validate user input. if ($user->isPluginEnabled('cl') && $user->isPluginEnabled('cm') && !$cl_client) - $err->add($i18n->getKey('error.client')); + $err->add($i18n->get('error.client')); if (MODE_PROJECTS == $user->tracking_mode || MODE_PROJECTS_AND_TASKS == $user->tracking_mode) { - if (!$cl_project) $err->add($i18n->getKey('error.project')); + if (!$cl_project) $err->add($i18n->get('error.project')); } - if (!ttValidString($cl_item_name)) $err->add($i18n->getKey('error.field'), $i18n->getKey('label.comment')); - if (!ttValidFloat($cl_cost)) $err->add($i18n->getKey('error.field'), $i18n->getKey('label.cost')); + if (!ttValidString($cl_item_name)) $err->add($i18n->get('error.field'), $i18n->get('label.comment')); + if (!ttValidFloat($cl_cost)) $err->add($i18n->get('error.field'), $i18n->get('label.cost')); // Prohibit creating entries in future. if (!$user->future_entries) { $browser_today = new DateAndTime(DB_DATEFORMAT, $request->getParameter('browser_today', null)); if ($selected_date->after($browser_today)) - $err->add($i18n->getKey('error.future_date')); + $err->add($i18n->get('error.future_date')); } // Finished validating input data. // Prohibit creating entries in locked range. if ($user->isDateLocked($selected_date)) - $err->add($i18n->getKey('error.range_locked')); + $err->add($i18n->get('error.range_locked')); // Insert record. if ($err->no()) { @@ -177,7 +177,7 @@ if ($request->isPost()) { header('Location: expenses.php'); exit(); } else - $err->add($i18n->getKey('error.db')); + $err->add($i18n->get('error.db')); } } elseif ($request->getParameter('onBehalfUser')) { if($user->canManageTeam()) { @@ -201,6 +201,6 @@ $smarty->assign('client_list', $client_list); $smarty->assign('project_list', $project_list); $smarty->assign('forms', array($form->getName()=>$form->toArray())); $smarty->assign('timestring', $selected_date->toString($user->date_format)); -$smarty->assign('title', $i18n->getKey('title.expenses')); +$smarty->assign('title', $i18n->get('title.expenses')); $smarty->assign('content_page_name', 'expenses.tpl'); $smarty->display('index.tpl'); diff --git a/export.php b/export.php index 7ccce330..4f1a571a 100644 --- a/export.php +++ b/export.php @@ -37,13 +37,13 @@ if (!ttAccessAllowed('export_data')) { } $cl_compression = $request->getParameter('compression'); -$compressors = array('' => $i18n->getKey('form.export.compression_none')); +$compressors = array('' => $i18n->get('form.export.compression_none')); if (function_exists('bzcompress')) - $compressors['bzip'] = $i18n->getKey('form.export.compression_bzip'); + $compressors['bzip'] = $i18n->get('form.export.compression_bzip'); $form = new Form('exportForm'); $form->addInput(array('type'=>'combobox','name'=>'compression','value'=>$cl_compression,'data'=>$compressors)); -$form->addInput(array('type'=>'submit','name'=>'btn_submit','value'=>$i18n->getKey('button.export'))); +$form->addInput(array('type'=>'submit','name'=>'btn_submit','value'=>$i18n->get('button.export'))); if ($request->isPost()) { @@ -74,10 +74,10 @@ if ($request->isPost()) { } exit; } else - $err->add($i18n->getKey('error.sys')); + $err->add($i18n->get('error.sys')); } // isPost $smarty->assign('forms', array($form->getName()=>$form->toArray())); -$smarty->assign('title', $i18n->getKey('title.export')); +$smarty->assign('title', $i18n->get('title.export')); $smarty->assign('content_page_name', 'export.tpl'); $smarty->display('index.tpl'); diff --git a/import.php b/import.php index dd30ad3a..f822cb79 100644 --- a/import.php +++ b/import.php @@ -39,16 +39,16 @@ if (!ttAccessAllowed('administer_site')) { $form = new Form('importForm'); $form->addInput(array('type'=>'upload','name'=>'xmlfile','value'=>'browse','maxsize'=>67108864)); // 64 MB file upload limit. // Note: for the above limit to work make sure to set upload_max_filesize and post_max_size in php.ini to at least 64M. -$form->addInput(array('type'=>'submit','name'=>'btn_submit','value'=>$i18n->getKey('button.import'))); +$form->addInput(array('type'=>'submit','name'=>'btn_submit','value'=>$i18n->get('button.import'))); if ($request->isPost()) { $import = new ttImportHelper($err); $import->importXml(); - if ($err->no()) $msg->add($i18n->getKey('form.import.success')); + if ($err->no()) $msg->add($i18n->get('form.import.success')); } // isPost $smarty->assign('forms', array($form->getName()=>$form->toArray()) ); -$smarty->assign('title', $i18n->getKey('title.import')); +$smarty->assign('title', $i18n->get('title.import')); $smarty->assign('content_page_name', 'import.tpl'); $smarty->display('index.tpl'); diff --git a/invoice_add.php b/invoice_add.php index 01b77615..ed0a8c52 100644 --- a/invoice_add.php +++ b/invoice_add.php @@ -52,33 +52,33 @@ $form->addInput(array('type'=>'datefield','name'=>'date','size'=>'20','value'=>$ // Dropdown for clients if the clients plugin is enabled. if ($user->isPluginEnabled('cl')) { $clients = ttTeamHelper::getActiveClients($user->team_id); - $form->addInput(array('type'=>'combobox','name'=>'client','style'=>'width: 250px;','data'=>$clients,'datakeys'=>array('id','name'),'value'=>$cl_client,'empty'=>array(''=>$i18n->getKey('dropdown.select')))); + $form->addInput(array('type'=>'combobox','name'=>'client','style'=>'width: 250px;','data'=>$clients,'datakeys'=>array('id','name'),'value'=>$cl_client,'empty'=>array(''=>$i18n->get('dropdown.select')))); } // Dropdown for projects. if (MODE_PROJECTS == $user->tracking_mode || MODE_PROJECTS_AND_TASKS == $user->tracking_mode) { $projects = ttTeamHelper::getActiveProjects($user->team_id); - $form->addInput(array('type'=>'combobox','name'=>'project','style'=>'width: 250px;','data'=>$projects,'datakeys'=>array('id','name'),'value'=>$cl_project,'empty'=>array(''=>$i18n->getKey('dropdown.all')))); + $form->addInput(array('type'=>'combobox','name'=>'project','style'=>'width: 250px;','data'=>$projects,'datakeys'=>array('id','name'),'value'=>$cl_project,'empty'=>array(''=>$i18n->get('dropdown.all')))); } $form->addInput(array('type'=>'text','maxlength'=>'100','name'=>'number','style'=>'width: 250px;','value'=>$cl_number)); $form->addInput(array('type'=>'datefield','maxlength'=>'20','name'=>'start','value'=>$cl_start)); $form->addInput(array('type'=>'datefield','maxlength'=>'20','name'=>'finish','value'=>$cl_finish)); -$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_number)) $err->add($i18n->getKey('error.field'), $i18n->getKey('form.invoice.number')); - if (!ttValidDate($cl_date)) $err->add($i18n->getKey('error.field'), $i18n->getKey('label.date')); - if (!$cl_client) $err->add($i18n->getKey('error.client')); - if (!ttValidDate($cl_start)) $err->add($i18n->getKey('error.field'), $i18n->getKey('label.start_date')); - if (!ttValidDate($cl_finish)) $err->add($i18n->getKey('error.field'), $i18n->getKey('label.end_date')); + if (!ttValidString($cl_number)) $err->add($i18n->get('error.field'), $i18n->get('form.invoice.number')); + if (!ttValidDate($cl_date)) $err->add($i18n->get('error.field'), $i18n->get('label.date')); + if (!$cl_client) $err->add($i18n->get('error.client')); + if (!ttValidDate($cl_start)) $err->add($i18n->get('error.field'), $i18n->get('label.start_date')); + if (!ttValidDate($cl_finish)) $err->add($i18n->get('error.field'), $i18n->get('label.end_date')); $fields = array('date'=>$cl_date,'name'=>$cl_number,'client_id'=>$cl_client,'project_id'=>$cl_project,'start_date'=>$cl_start,'end_date'=>$cl_finish); if ($err->no()) { if (ttInvoiceHelper::getInvoiceByName($cl_number)) - $err->add($i18n->getKey('error.invoice_exists')); + $err->add($i18n->get('error.invoice_exists')); if (!ttInvoiceHelper::invoiceableItemsExist($fields)) - $err->add($i18n->getKey('error.no_invoiceable_items')); + $err->add($i18n->get('error.no_invoiceable_items')); } if ($err->no()) { @@ -87,13 +87,13 @@ if ($request->isPost()) { header('Location: invoices.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.invoiceForm.number.focus()"'); -$smarty->assign('title', $i18n->getKey('title.add_invoice')); +$smarty->assign('title', $i18n->get('title.add_invoice')); $smarty->assign('content_page_name', 'invoice_add.tpl'); $smarty->display('index.tpl'); diff --git a/invoice_delete.php b/invoice_delete.php index 6fd8270d..29160ba5 100644 --- a/invoice_delete.php +++ b/invoice_delete.php @@ -44,10 +44,10 @@ $form = new Form('invoiceDeleteForm'); $form->addInput(array('type'=>'hidden','name'=>'id','value'=>$cl_invoice_id)); $form->addInput(array('type'=>'combobox', 'name'=>'delete_invoice_entries', - 'data'=>array('0'=>$i18n->getKey('dropdown.do_not_delete'),'1'=>$i18n->getKey('dropdown.delete')), + 'data'=>array('0'=>$i18n->get('dropdown.do_not_delete'),'1'=>$i18n->get('dropdown.delete')), )); -$form->addInput(array('type'=>'submit','name'=>'btn_delete','value'=>$i18n->getKey('label.delete'),'onclick'=>'return confirm_deleting_entries();')); -$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'),'onclick'=>'return confirm_deleting_entries();')); +$form->addInput(array('type'=>'submit','name'=>'btn_cancel','value'=>$i18n->get('button.cancel'))); if ($request->isPost()) { if ($request->getParameter('btn_delete')) { @@ -56,9 +56,9 @@ if ($request->isPost()) { header('Location: invoices.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')); } elseif ($request->getParameter('btn_cancel')) { header('Location: invoices.php'); exit(); @@ -68,6 +68,6 @@ if ($request->isPost()) { $smarty->assign('invoice_to_delete', $invoice_to_delete); $smarty->assign('forms', array($form->getName()=>$form->toArray())); $smarty->assign('onload', 'onLoad="document.invoiceDeleteForm.btn_cancel.focus()"'); -$smarty->assign('title', $i18n->getKey('title.delete_invoice')); +$smarty->assign('title', $i18n->get('title.delete_invoice')); $smarty->assign('content_page_name', 'invoice_delete.tpl'); $smarty->display('index.tpl'); diff --git a/invoice_send.php b/invoice_send.php index 48bc14f0..2c0894a3 100644 --- a/invoice_send.php +++ b/invoice_send.php @@ -43,7 +43,7 @@ $sc = new ttSysConfig($user->id); // Security check. if (!$cl_invoice_id || !$invoice) - die ($i18n->getKey('error.sys')); + die ($i18n->get('error.sys')); if ($request->isPost()) { $cl_receiver = trim($request->getParameter('receiver')); @@ -53,7 +53,7 @@ if ($request->isPost()) { } else { $cl_receiver = $sc->getValue(SYSC_LAST_INVOICE_EMAIL); $cl_cc = $sc->getValue(SYSC_LAST_INVOICE_CC); - $cl_subject = $i18n->getKey('title.invoice').' '.$invoice['name'].', '.$user->team; + $cl_subject = $i18n->get('title.invoice').' '.$invoice['name'].', '.$user->team; } $form = new Form('mailForm'); @@ -62,14 +62,14 @@ $form->addInput(array('type'=>'text','name'=>'receiver','style'=>'width: 300px;' $form->addInput(array('type'=>'text','name'=>'cc','style'=>'width: 300px;','value'=>$cl_cc)); $form->addInput(array('type'=>'text','name'=>'subject','style'=>'width: 300px;','value'=>$cl_subject)); $form->addInput(array('type'=>'textarea','name'=>'comment','maxlength'=>'250','style'=>'width: 300px; height: 60px;')); -$form->addInput(array('type'=>'submit','name'=>'btn_send','value'=>$i18n->getKey('button.send'))); +$form->addInput(array('type'=>'submit','name'=>'btn_send','value'=>$i18n->get('button.send'))); if ($request->isPost()) { // Validate user input. - if (!ttValidEmailList($cl_receiver)) $err->add($i18n->getKey('error.field'), $i18n->getKey('form.mail.to')); - if (!ttValidEmailList($cl_cc, true)) $err->add($i18n->getKey('error.field'), $i18n->getKey('label.cc')); - if (!ttValidString($cl_subject)) $err->add($i18n->getKey('error.field'), $i18n->getKey('label.subject')); - if (!ttValidString($cl_comment, true)) $err->add($i18n->getKey('error.field'), $i18n->getKey('label.comment')); + if (!ttValidEmailList($cl_receiver)) $err->add($i18n->get('error.field'), $i18n->get('form.mail.to')); + if (!ttValidEmailList($cl_cc, true)) $err->add($i18n->get('error.field'), $i18n->get('label.cc')); + if (!ttValidString($cl_subject)) $err->add($i18n->get('error.field'), $i18n->get('label.subject')); + if (!ttValidString($cl_comment, true)) $err->add($i18n->get('error.field'), $i18n->get('label.comment')); if ($err->no()) { // Save last invoice emails for future use. @@ -90,9 +90,9 @@ if ($request->isPost()) { $mailer->setReceiverBCC($user->bcc_email); $mailer->setMailMode(MAIL_MODE); if ($mailer->send($cl_subject, $body)) - $msg->add($i18n->getKey('form.mail.invoice_sent')); + $msg->add($i18n->get('form.mail.invoice_sent')); else - $err->add($i18n->getKey('error.mail_send')); + $err->add($i18n->get('error.mail_send')); } } // isPost @@ -106,7 +106,7 @@ if (function_exists('imap_mime_header_decode')) { } } -$smarty->assign('title', $i18n->getKey('title.send_invoice')); +$smarty->assign('title', $i18n->get('title.send_invoice')); $smarty->assign('forms', array($form->getName()=>$form->toArray())); $smarty->assign('onload', 'onLoad="document.mailForm.'.($cl_receiver?'comment':'receiver').'.focus()"'); $smarty->assign('content_page_name', 'mail.tpl'); diff --git a/invoice_view.php b/invoice_view.php index 4a6027a5..3715b80a 100644 --- a/invoice_view.php +++ b/invoice_view.php @@ -90,12 +90,12 @@ $form = new Form('invoiceForm'); $form->addInput(array('type'=>'hidden','name'=>'id','value'=>$cl_id)); // invoiceForm only contains controls for "Mark paid" block below invoice table. if ($user->isPluginEnabled('ps')) { - $mark_paid_action_options = array('1'=>$i18n->getKey('dropdown.paid'),'2'=>$i18n->getKey('dropdown.not_paid')); + $mark_paid_action_options = array('1'=>$i18n->get('dropdown.paid'),'2'=>$i18n->get('dropdown.not_paid')); $form->addInput(array('type'=>'combobox', 'name'=>'mark_paid_action_options', 'data'=>$mark_paid_action_options, 'value'=>$cl_mark_paid_action_option)); - $form->addInput(array('type'=>'submit','name'=>'btn_mark_paid','value'=>$i18n->getKey('button.submit'))); + $form->addInput(array('type'=>'submit','name'=>'btn_mark_paid','value'=>$i18n->get('button.submit'))); } if ($request->isPost()) { @@ -120,6 +120,6 @@ $smarty->assign('client_name', $client['name']); $smarty->assign('client_address', $client['address']); $smarty->assign('invoice_items', $invoice_items); $smarty->assign('colspan', $colspan); -$smarty->assign('title', $i18n->getKey('title.view_invoice')); +$smarty->assign('title', $i18n->get('title.view_invoice')); $smarty->assign('content_page_name', 'invoice_view.tpl'); $smarty->display('index.tpl'); diff --git a/invoices.php b/invoices.php index 0617a44f..a03579b0 100644 --- a/invoices.php +++ b/invoices.php @@ -39,6 +39,6 @@ if (!(ttAccessAllowed('manage_invoices') || ttAccessAllowed('view_own_invoices') $invoices = ttTeamHelper::getActiveInvoices(); $smarty->assign('invoices', $invoices); -$smarty->assign('title', $i18n->getKey('title.invoices')); +$smarty->assign('title', $i18n->get('title.invoices')); $smarty->assign('content_page_name', 'invoices.tpl'); $smarty->display('index.tpl'); diff --git a/locking.php b/locking.php index 1f9530c9..8a6f4304 100644 --- a/locking.php +++ b/locking.php @@ -40,11 +40,11 @@ $cl_lock_spec = $request->isPost() ? $request->getParameter('lock_spec') : $user $form = new Form('lockingForm'); $form->addInput(array('type'=>'text','maxlength'=>'100','name'=>'lock_spec','style'=>'width: 250px;','value'=>$cl_lock_spec)); -$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()) { // Validate user input. - if (!ttValidCronSpec($cl_lock_spec)) $err->add($i18n->getKey('error.field'), $i18n->getKey('label.schedule')); + if (!ttValidCronSpec($cl_lock_spec)) $err->add($i18n->get('error.field'), $i18n->get('label.schedule')); if ($err->no()) { if (ttTeamHelper::update($user->team_id, array( @@ -53,12 +53,12 @@ if ($request->isPost()) { header('Location: profile_edit.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('title', $i18n->getKey('title.locking')); +$smarty->assign('title', $i18n->get('title.locking')); $smarty->assign('content_page_name', 'locking.tpl'); $smarty->display('index.tpl'); diff --git a/login.php b/login.php index 538147b0..e246e0a5 100644 --- a/login.php +++ b/login.php @@ -39,12 +39,12 @@ $form = new Form('loginForm'); $form->addInput(array('type'=>'text','size'=>'25','maxlength'=>'100','name'=>'login','style'=>'width: 220px;','value'=>$cl_login)); $form->addInput(array('type'=>'password','size'=>'25','maxlength'=>'50','name'=>'password','style'=>'width: 220px;','value'=>$cl_password)); $form->addInput(array('type'=>'hidden','name'=>'browser_today','value'=>'')); // User current date, which gets filled in on btn_login click. -$form->addInput(array('type'=>'submit','name'=>'btn_login','onclick'=>'browser_today.value=get_date()','value'=>$i18n->getKey('button.login'))); +$form->addInput(array('type'=>'submit','name'=>'btn_login','onclick'=>'browser_today.value=get_date()','value'=>$i18n->get('button.login'))); if ($request->isPost()) { // Validate user input. - if (!ttValidString($cl_login)) $err->add($i18n->getKey('error.field'), $i18n->getKey('label.login')); - if (!ttValidString($cl_password)) $err->add($i18n->getKey('error.field'), $i18n->getKey('label.password')); + if (!ttValidString($cl_login)) $err->add($i18n->get('error.field'), $i18n->get('label.login')); + if (!ttValidString($cl_password)) $err->add($i18n->get('error.field'), $i18n->get('label.password')); if ($err->no()) { // Use the "limit" plugin if we have one. Ignore include errors. @@ -71,12 +71,12 @@ if ($request->isPost()) { } exit(); } else - $err->add($i18n->getKey('error.auth')); + $err->add($i18n->get('error.auth')); } } // isPost if(!isTrue(MULTITEAM_MODE) && !ttGroupHelper::getTopGroups()) - $err->add($i18n->getKey('error.no_teams')); + $err->add($i18n->get('error.no_teams')); // Determine whether to show login hint. It is currently used only for Windows LDAP authentication. $show_hint = ('ad' == $GLOBALS['AUTH_MODULE_PARAMS']['type']); @@ -84,7 +84,7 @@ $show_hint = ('ad' == $GLOBALS['AUTH_MODULE_PARAMS']['type']); $smarty->assign('forms', array($form->getName()=>$form->toArray())); $smarty->assign('show_hint', $show_hint); $smarty->assign('onload', 'onLoad="document.loginForm.'.(!$cl_login?'login':'password').'.focus()"'); -$smarty->assign('title', $i18n->getKey('title.login')); +$smarty->assign('title', $i18n->get('title.login')); $smarty->assign('content_page_name', 'login.tpl'); -$smarty->assign('about_text', $i18n->getKey('form.login.about')); +$smarty->assign('about_text', $i18n->get('form.login.about')); $smarty->display('index.tpl'); diff --git a/mobile/access_denied.php b/mobile/access_denied.php index b0bc0028..6e7174a2 100644 --- a/mobile/access_denied.php +++ b/mobile/access_denied.php @@ -28,9 +28,9 @@ require_once('../initialize.php'); -$err->add($i18n->getKey('error.access_denied')); +$err->add($i18n->get('error.access_denied')); if ($auth->isAuthenticated()) $smarty->assign('authenticated', true); // Used in header.tpl for menu display. -$smarty->assign('title', $i18n->getKey('label.error')); +$smarty->assign('title', $i18n->get('label.error')); $smarty->assign('content_page_name', 'mobile/access_denied.tpl'); $smarty->display('mobile/index.tpl'); diff --git a/mobile/client_add.php b/mobile/client_add.php index 71f51ca1..134819bb 100644 --- a/mobile/client_add.php +++ b/mobile/client_add.php @@ -56,13 +56,13 @@ $form->addInput(array('type'=>'textarea','name'=>'address','maxlength'=>'255','c $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', 'mobile/client_add.tpl'); $smarty->display('mobile/index.tpl'); diff --git a/mobile/client_delete.php b/mobile/client_delete.php index b57e581d..e23cd026 100644 --- a/mobile/client_delete.php +++ b/mobile/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', 'mobile/client_delete.tpl'); $smarty->display('mobile/index.tpl'); diff --git a/mobile/client_edit.php b/mobile/client_edit.php index fc220369..e4bc9b22 100644 --- a/mobile/client_edit.php +++ b/mobile/client_edit.php @@ -65,18 +65,18 @@ $form->addInput(array('type'=>'text','name'=>'name','maxlength'=>'100','value'=> $form->addInput(array('type'=>'textarea','name'=>'address','maxlength'=>'255','class'=>'mobile-textarea','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_delete','value'=>$i18n->getKey('label.delete'))); +$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'))); +$form->addInput(array('type'=>'submit','name'=>'btn_delete','value'=>$i18n->get('label.delete'))); 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')) { @@ -92,9 +92,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')) { @@ -109,9 +109,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_delete')) { @@ -122,6 +122,6 @@ if ($request->isPost()) { } // 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', 'mobile/client_edit.tpl'); $smarty->display('mobile/index.tpl'); diff --git a/mobile/clients.php b/mobile/clients.php index aa6e6ad3..d1a49f1e 100644 --- a/mobile/clients.php +++ b/mobile/clients.php @@ -38,6 +38,6 @@ if (!ttAccessAllowed('manage_clients') || !$user->isPluginEnabled('cl')) { $smarty->assign('active_clients', ttTeamHelper::getActiveClients($user->team_id, true)); $smarty->assign('inactive_clients', ttTeamHelper::getInactiveClients($user->team_id, true)); -$smarty->assign('title', $i18n->getKey('title.clients')); +$smarty->assign('title', $i18n->get('title.clients')); $smarty->assign('content_page_name', 'mobile/clients.tpl'); $smarty->display('mobile/index.tpl');