public function addMark() { if (!($jsonData = $this->input->post('jsonData'))) { die('null'); } $this->load->model('assessment'); $this->load->model('script'); $this->load->library('json'); $decoded = $this->json->decode($jsonData); $assessment = new Assessment(); $assessment->setKey($decoded->script); $assessment->set('marker', $this->session->userdata($this->_sessionAuthVar)); $assessment->set('markData', $jsonData); $assessment->set('targets', serialize($decoded->targets)); $assessment->set('generalComment', $decoded->generalComment); $assessment->set('status', Assessment::UNPAID); if ($assessment->create()) { $this->_flexResult(I_FlexMarksIn::SAVE_SUCCESSFUL); } else { $this->_flexResult(I_FlexIO::ERROR); } }