Beispiel #1
0
 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);
     }
 }
Beispiel #2
0
 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}");
 }
Beispiel #3
0
 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');
 }