/** * save position * * @access protected * @return */ protected function saveSorting() { global $ilAccess, $ilErr, $ilObjDataCache; asort($_POST['position'], SORT_NUMERIC); $counter = 1; foreach ($_POST['position'] as $objective_id => $position) { include_once './Modules/Course/classes/class.ilCourseObjective.php'; $objective = new ilCourseObjective($this->getParentObject(), $objective_id); $objective->writePosition($counter++); } ilUtil::sendSuccess($this->lng->txt('crs_objective_saved_sorting')); $this->listObjectives(); }
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(); }
/** * save position * * @access protected * @return */ protected function saveSorting() { global $ilAccess, $ilErr, $ilObjDataCache; if (!$ilAccess->checkAccess("write", '', $this->course_obj->getRefId())) { $this->ilErr->raiseError($this->lng->txt("msg_no_perm_write"), $this->ilErr->MESSAGE); } asort($_POST['position'], SORT_NUMERIC); $counter = 1; foreach ($_POST['position'] as $objective_id => $position) { $objective = new ilCourseObjective($this->course_obj, $objective_id); $objective->writePosition($counter++); } ilUtil::sendSuccess($this->lng->txt('crs_objective_saved_sorting')); $this->listObjectives(); }