/** * Creates a new hotspot on the screen * @param $screen */ private function add_hotspot($screen) { $this->load->library('form_validation'); $this->form_validation->set_rules('time', 'Time', 'trim|xss_clean'); $this->form_validation->set_rules('begin_x', 'Begin X', 'trim|xss_clean'); $this->form_validation->set_rules('begin_y', 'Begin Y', 'trim|xss_clean'); $this->form_validation->set_rules('end_x', 'End X', 'trim|xss_clean'); $this->form_validation->set_rules('end_y', 'End Y', 'trim|xss_clean'); $this->form_validation->set_rules('link_to', 'Link To', 'trim|xss_clean'); if ($this->form_validation->run() == FALSE) { json_error('There was a problem with your submission: ' . validation_errors(' ', ' ')); } else { $hotspot_id = $this->Hotspot->add(array('screen_id' => $screen->id, 'ordering' => $this->Hotspot->get_max_ordering_for_screen($screen->id) + 1, 'creator_id' => get_user_id(), 'time' => $this->post('time', TRUE), 'begin_x' => $this->post('begin_x', TRUE), 'begin_y' => $this->post('begin_y', TRUE), 'end_x' => $this->post('end_x', TRUE), 'end_y' => $this->post('end_y', TRUE), 'link_to' => $this->post('link_to', TRUE))); activity_add_hotspot_screen($hotspot_id); $hotspot = decorate_hotspot($this->Hotspot->load($hotspot_id)); $this->response($hotspot); } }
function decorate_hotspots($objects) { $updated = array(); foreach ($objects as $object) { $updated[] = decorate_hotspot($object); } return $updated; }
protected function decorate_object($object) { return decorate_hotspot($object); }