2 // +----------------------------------------------------------------------+
 
   3 // | Anuko Time Tracker
 
   4 // +----------------------------------------------------------------------+
 
   5 // | Copyright (c) Anuko International Ltd. (https://www.anuko.com)
 
   6 // +----------------------------------------------------------------------+
 
   7 // | LIBERAL FREEWARE LICENSE: This source code document may be used
 
   8 // | by anyone for any purpose, and freely redistributed alone or in
 
   9 // | combination with other software, provided that the license is obeyed.
 
  11 // | There are only two ways to violate the license:
 
  13 // | 1. To redistribute this code in source form, with the copyright
 
  14 // |    notice or license removed or altered. (Distributing in compiled
 
  15 // |    forms without embedded copyright notices is permitted).
 
  17 // | 2. To redistribute modified versions of this code in *any* form
 
  18 // |    that bears insufficient indications that the modifications are
 
  19 // |    not the work of the original author(s).
 
  21 // | This license applies to this document only, not any other software
 
  22 // | that it may be combined with.
 
  24 // +----------------------------------------------------------------------+
 
  26 // | https://www.anuko.com/time_tracker/credits.htm
 
  27 // +----------------------------------------------------------------------+
 
  29 require_once('initialize.php');
 
  30 import('ttConfigHelper');
 
  34 if (!ttAccessAllowed('manage_basic_settings')) {
 
  35   header('Location: access_denied.php');
 
  38 // End of access checks.
 
  40 $config = $user->getConfigHelper();
 
  42 if ($request->isPost()) {
 
  43   $cl_time_note_on_separate_row = $request->getParameter('time_note_on_separate_row');
 
  44   $cl_report_note_on_separate_row = $request->getParameter('report_note_on_separate_row');
 
  46   $cl_time_note_on_separate_row = $config->getDefinedValue('time_note_on_separate_row');
 
  47   $cl_report_note_on_separate_row = $config->getDefinedValue('report_note_on_separate_row');
 
  50 $form = new Form('displayOptionsForm');
 
  53 // $form->addInput(array('type'=>'checkbox','name'=>'time_client','value'=>$cl_time_client));
 
  54 // $form->addInput(array('type'=>'checkbox','name'=>'time_cf_1','value'=>$cl_time_cf_1));
 
  55 // $form->addInput(array('type'=>'checkbox','name'=>'time_project','value'=>$cl_time_project));
 
  56 // $form->addInput(array('type'=>'checkbox','name'=>'time_task','value'=>$cl_time_task));
 
  57 // $form->addInput(array('type'=>'checkbox','name'=>'time_start','value'=>$cl_time_start));
 
  58 // $form->addInput(array('type'=>'checkbox','name'=>'time_finish','value'=>$cl_time_finish));
 
  59 // $form->addInput(array('type'=>'checkbox','name'=>'time_duration','value'=>$cl_time_duration));
 
  60 // $form->addInput(array('type'=>'checkbox','name'=>'time_note','value'=>$cl_time_note));
 
  61 $form->addInput(array('type'=>'checkbox','name'=>'time_note_on_separate_row','value'=>$cl_time_note_on_separate_row));
 
  62 // TODO: consider adding other fields (timesheet, work_units, invoice, approved, cost, paid)?
 
  65 $form->addInput(array('type'=>'checkbox','name'=>'report_note_on_separate_row','value'=>$cl_report_note_on_separate_row));
 
  66 // TODO: add PDF break controller here.
 
  68 $form->addInput(array('type'=>'submit','name'=>'btn_save','value'=>$i18n->get('button.save')));
 
  70 if ($request->isPost()){
 
  73     $config->setDefinedValue('time_note_on_separate_row', $cl_time_note_on_separate_row);
 
  74     $config->setDefinedValue('report_note_on_separate_row', $cl_report_note_on_separate_row);
 
  75     if ($user->updateGroup(array('config' => $config->getConfig()))) {
 
  76       header('Location: success.php');
 
  79       $err->add($i18n->get('error.db'));
 
  83 $smarty->assign('forms', array($form->getName()=>$form->toArray()));
 
  84 $smarty->assign('title', $i18n->get('title.display_options'));
 
  85 $smarty->assign('content_page_name', 'display_options.tpl');
 
  86 $smarty->display('index.tpl');