protected function checkObjectives() { include_once "Modules/Course/classes/class.ilObjCourse.php"; if (ilObjCourse::_lookupViewMode($this->obj_id) == IL_CRS_VIEW_OBJECTIVE) { return true; } return false; }
protected function forwardToTimingsView() { global $tree; if (!($crs_ref = $tree->checkForParentType($this->ref_id, 'crs'))) { return false; } include_once './Modules/Course/classes/class.ilObjCourse.php'; if (!$this->ctrl->getCmd() and ilObjCourse::_lookupViewMode(ilObject::_lookupObjId($crs_ref)) == ilContainer::VIEW_TIMING) { if (!isset($_SESSION['crs_timings'])) { $_SESSION['crs_timings'] = true; } if ($_SESSION['crs_timings'] == true) { include_once './Modules/Course/classes/class.ilCourseContentGUI.php'; $course_content_obj = new ilCourseContentGUI($this); $this->ctrl->setCmdClass(get_class($course_content_obj)); $this->ctrl->setCmd('editUserTimings'); $this->ctrl->forwardCommand($course_content_obj); return true; } } $_SESSION['crs_timings'] = false; return false; }
/** * translate view mode * @param int $a_obj_id * @param int $a_view_mode * @param int $a_ref_id * @return int */ protected static function translateViewMode($a_obj_id, $a_view_mode, $a_ref_id = null) { global $tree; if (!$a_view_mode) { $a_view_mode = ilContainer::VIEW_DEFAULT; } // view mode is inherit => check for parent course if ($a_view_mode == ilContainer::VIEW_INHERIT) { if (!$a_ref_id) { $ref = ilObject::_getAllReferences($a_obj_id); $a_ref_id = end($ref); } $crs_ref = $tree->checkForParentType($a_ref_id, 'crs'); if (!$crs_ref) { return ilContainer::VIEW_DEFAULT; } include_once './Modules/Course/classes/class.ilObjCourse.php'; $view_mode = ilObjCourse::_lookupViewMode(ilObject::_lookupObjId($crs_ref)); // validate course view mode if (!in_array($view_mode, array(ilContainer::VIEW_SESSIONS, ilContainer::VIEW_BY_TYPE, ilContainer::VIEW_SIMPLE))) { return ilContainer::VIEW_DEFAULT; } return $view_mode; } return $a_view_mode; }
/** * We need a static version of this, e.g. in folders of the course */ static function _modifyItemGUI($a_item_list_gui, $a_cmd_class, $a_item_data, $a_show_path, $a_abo_status, $a_course_ref_id, $a_course_obj_id, $a_parent_ref_id = 0) { global $lng, $ilAccess; // this is set for folders within the course if ($a_parent_ref_id == 0) { $a_parent_ref_id = $a_course_ref_id; } // Special handling for tests in courses with learning objectives if ($a_item_data['type'] == 'tst' and ilObjCourse::_lookupViewMode($a_course_obj_id) == ilContainer::VIEW_OBJECTIVE) { $a_item_list_gui->addCommandLinkParameter(array('crs_show_result' => $a_course_ref_id)); } $a_item_list_gui->enableSubscribe($a_abo_status); $is_tutor = $ilAccess->checkAccess('write', '', $a_course_ref_id, 'crs', $a_course_obj_id); if ($a_show_path and $is_tutor) { $a_item_list_gui->addCustomProperty($lng->txt('path'), ilContainer::_buildPath($a_item_data['ref_id'], $a_course_ref_id), false, true); } }
function _checkObjectives($a_obj_id) { global $ilDB, $ilObjDataCache; // Return deactivate for course with objective view if ($ilObjDataCache->lookupType($a_obj_id) == 'crs') { include_once 'Modules/Course/classes/class.ilObjCourse.php'; if (ilObjCourse::_lookupViewMode($a_obj_id) == IL_CRS_VIEW_OBJECTIVE) { return true; } } return false; }
protected function getCoursesOfUser($a_user_id, $a_add_path = false) { global $tree; // see ilPDSelectedItemsBlockGUI include_once 'Modules/Course/classes/class.ilObjCourseAccess.php'; include_once 'Services/Membership/classes/class.ilParticipants.php'; $items = ilParticipants::_getMembershipByType($a_user_id, 'crs'); $repo_title = $tree->getNodeData(ROOT_FOLDER_ID); $repo_title = $repo_title["title"]; if ($repo_title == "ILIAS") { $repo_title = $this->lng->txt("repository"); } $references = $lp_obj_refs = array(); foreach ($items as $obj_id) { $ref_id = ilObject::_getAllReferences($obj_id); if (is_array($ref_id) && count($ref_id)) { $ref_id = array_pop($ref_id); if (!$tree->isDeleted($ref_id)) { $visible = false; $active = ilObjCourseAccess::_isActivated($obj_id, $visible, false); if ($active && $visible) { $references[$ref_id] = array('ref_id' => $ref_id, 'obj_id' => $obj_id, 'title' => ilObject::_lookupTitle($obj_id)); if ($a_add_path) { $path = array(); foreach ($tree->getPathFull($ref_id) as $item) { $path[] = $item["title"]; } // top level comes first if (sizeof($path) == 2) { $path[0] = 0; } else { $path[0] = 1; } $references[$ref_id]["path_sort"] = implode("__", $path); array_shift($path); array_pop($path); if (!sizeof($path)) { array_unshift($path, $repo_title); } $references[$ref_id]["path"] = implode(" › ", $path); } $lp_obj_refs[$obj_id] = $ref_id; } } } } // get lp data for valid courses if (sizeof($lp_obj_refs)) { // listing the objectives should NOT depend on any LP status / setting include_once 'Modules/Course/classes/class.ilObjCourse.php'; foreach ($lp_obj_refs as $obj_id => $ref_id) { // only if set in DB (default mode is not relevant if (ilObjCourse::_lookupViewMode($obj_id) == IL_CRS_VIEW_OBJECTIVE) { $references[$ref_id]["objectives"] = $this->parseObjectives($obj_id, $a_user_id); } } // LP must be active, personal and not anonymized include_once "Services/Tracking/classes/class.ilObjUserTracking.php"; if (ilObjUserTracking::_enabledLearningProgress() && ilObjUserTracking::_enabledUserRelatedData() && ilObjUserTracking::_hasLearningProgressLearner()) { // see ilLPProgressTableGUI include_once "Services/Tracking/classes/class.ilTrQuery.php"; include_once "Services/Tracking/classes/class.ilLPStatusFactory.php"; $lp_data = ilTrQuery::getObjectsStatusForUser($a_user_id, $lp_obj_refs); foreach ($lp_data as $item) { $ref_id = $item["ref_ids"]; $references[$ref_id]["lp_status"] = $item["status"]; } } } return $references; }