Пример #1
0
 public function commitUpdated()
 {
     $this->load->library('form_validation');
     $this->form_validation->set_rules('fromuser', 'Username', 'trim|xss_clean');
     $this->form_validation->set_rules('startdate', 'StartDate', 'trim|required|xss_clean|callback_mysqldateRegex');
     $this->form_validation->set_rules('commands', 'Commands', 'trim|xss_clean');
     $this->form_validation->set_rules('duration', 'Commands', 'trim|xss_clean|numeric');
     $this->form_validation->set_rules('isonetimetask', 'IsOneTimeTask', 'trim|xss_clean');
     $this->form_validation->set_rules('datecreated', 'LastUpdateDate', 'trim|xss_clean|callback_mysqldateRegex');
     if ($this->form_validation->run() == FALSE) {
         $this->load->view('login_view');
     } else {
         $task = new Browsing_Task();
         $session_data = $this->session->userdata('logged_in');
         $username = $session_data['username'];
         $task->setId($this->input->post('id'));
         $task->setFromUser($this->input->post('fromuser'));
         $task->setCommands($this->input->post('commands'));
         $task->setDuration($this->input->post('duration'));
         $task->setCreatedDate($this->input->post('datecreated'));
         $task->setIsOneTimeTask($this->input->post('isonetimetask'));
         $task->setStartDate($this->input->post('startdate'));
         $task->setUsername($username);
         $task->commit();
         redirect('tasks/showtasks', 'refresh');
     }
 }
Пример #2
0
 public function createObjectFromData($row)
 {
     $task = new Browsing_Task();
     $task->setId($row->id);
     $task->setFromUser($row->fromuser);
     $task->setCommands($row->commands);
     $task->setDuration($row->duration);
     $task->setCreatedDate($row->createddate);
     $task->setIsOneTimeTask($row->isonetimetask);
     $task->setStartDate($row->start);
     return $task;
 }