public function exercise_get($id = null) { $user = new User($this->user_id); $exercise = new Exercise(); $exercise->where('id', $id); $exercise->get(); $logs = $exercise->exerciselog; $logs->get(); $response = array(); foreach ($logs as $log) { array_push($response, $log->getData()); } $this->response($response); }
public function find() { $this->load->library('table'); $this->load->helper('form'); if ($this->input->post()) { $search = $this->input->post('search'); // TODO do not get the current users's exercises $exercises = new Exercise(); $exercises->or_like('name', $search); $exercises->or_like('description', $search); $exercises->get(); foreach ($exercises as $ex) { $data['exercises'][$ex->id] = array('id' => $ex->id, 'name' => $ex->name, 'description' => $ex->description); } } // Load Page $data['title'] = 'Find Exercises'; $data['content'] = 'exercises/find'; $this->load->view('master', $data); }