Ejemplo n.º 1
0
 public function saveSortingObject()
 {
     if (isset($_POST['position']["lobj"])) {
         $lobj = $_POST['position']["lobj"];
         unset($_POST['position']["lobj"]);
         $objective_order = array();
         foreach ($lobj as $objective_id => $materials) {
             $objective_order[$objective_id] = $materials[0];
             unset($lobj[$objective_id][0]);
         }
         // objective order
         include_once "Modules/Course/classes/class.ilCourseObjective.php";
         asort($objective_order);
         $pos = 0;
         foreach (array_keys($objective_order) as $objective_id) {
             $obj = new ilCourseObjective($this->object, $objective_id);
             $obj->writePosition(++$pos);
         }
         // material order
         include_once "Modules/Course/classes/class.ilCourseObjectiveMaterials.php";
         foreach ($lobj as $objective_id => $materials) {
             $objmat = new ilCourseObjectiveMaterials($objective_id);
             asort($materials);
             $pos = 0;
             foreach (array_keys($materials) as $ass_id) {
                 $objmat->writePosition($ass_id, ++$pos);
             }
         }
     }
     return parent::saveSortingObject();
 }