public function getExercises() { $ex = new Dase_DBO_Exercise($this->db); $ex->creator_eid = $this->eid; $ex->orderBy('title'); $this->exercises = $ex->findAll(1); return $this->exercises; }
public function getExercises() { $ex = new Dase_DBO_Exercise($this->db); $ex->exercise_set_id = $this->id; $ex->orderBy('sort_order_in_set'); foreach ($ex->findAll(1) as $e) { $this->exercises[] = $e; } return $this->exercises; }
public function deleteExercise($r) { $set = new Dase_DBO_ExerciseSet($this->db); $set->load($r->get('id')); if ($this->user->eid == $set->creator_eid) { $exer = new Dase_DBO_Exercise($this->db); $exer->load($r->get('exercise_id')); if ($exer->exercise_set_id = $set->id) { $exer->exercise_set_id = 0; $exer->update(); $r->renderResponse('removed exercise'); } } else { $r->renderError(401); } }
public function postToExerciseSorter($r) { $set = new Dase_DBO_ExerciseSet($this->db); $set->load($r->get('id')); $sorted = $r->get('sorted_exercises'); $exer_array = explode('|', $sorted); $i = 0; foreach ($exer_array as $ex) { $i++; $e = new Dase_DBO_Exercise($this->db); $e->load($ex); $e->sort_order_in_set = $i; $e->update(); } $r->renderRedirect("admin/set/{$set->id}"); }
public function deleteExercise($r) { $e = new Dase_DBO_Exercise($this->db); $e->load($r->get('id')); $title = $e->title; //overload delete $e->delete(); $r->renderResponse('success'); }