/** * create timer */ public function mainReaction() { $date = VarDte::sanitize($_POST['date'], $err); $start = VarTim::sanitize($_POST['start_time'], $err); $stop = VarTim::sanitize($_POST['stop_time'], $err); $spent = VarDur::sanitize($_POST['spent'], $err); $this->data = new TimerModel(); $this->data->set('task_id', $_POST['id']); if ($start) { $this->data->set('start', $_POST['date'] . ' ' . $_POST['start_time']); } if ($stop) { $this->data->set('stop', $_POST['date'] . ' ' . $_POST['stop_time']); } if ($spent) { $this->data->set('spent', $_POST['spent']); } /* echo '<pre>'; print_r($_POST); echo "\n\n"; echo "date : $date\n"; echo "start : $start : ".$this->data->get('start')."\n"; echo "stop : $stop : ".$this->data->get('stop')."\n"; echo "spent: $spent\n"; echo '</pre>'; */ $this->data->setCheck(); if ($this->data->check()) { $this->data->connectDb(); $this->data->set('manual', 1); $this->data->insert(); } /* echo $this->data; exit; */ echo '<script type="text/javascript">'; echo "reloadList(); window.setTimeout('\$.fn.colorbox.close()',1000);"; echo '</script>'; echo '<p class="empty">' . TR::html('message', 'time_added') . '</p>'; return false; }