function getItems() { $obj_ids = $this->obj_ids; if (!$obj_ids && !$this->details) { // restrict courses/groups to objects where current user is member $membership_ids = null; if ($this->filter["type"] == "crs" || $this->filter["type"] == "grp") { include_once "Services/Membership/classes/class.ilParticipants.php"; $membership_ids = ilParticipants::_getMembershipByType($this->tracked_user->getId(), $this->filter["type"]); } if ($membership_ids === null || sizeof($membership_ids)) { $obj_ids = $this->searchObjects($this->getCurrentFilter(true), "read", $membership_ids); } } if ($obj_ids) { include_once "./Services/Tracking/classes/class.ilTrQuery.php"; switch ($this->mode) { case LP_MODE_SCORM: $data = ilTrQuery::getSCOsStatusForUser($this->tracked_user->getId(), $this->parent_obj_id, $obj_ids); break; case LP_MODE_OBJECTIVES: $data = ilTrQuery::getObjectivesStatusForUser($this->tracked_user->getId(), $obj_ids); break; default: $data = ilTrQuery::getObjectsStatusForUser($this->tracked_user->getId(), $obj_ids); foreach ($data as $idx => $item) { if (!$item["status"] && !$this->filter["status"]) { unset($data[$idx]); } else { $data[$idx]["offline"] = ilLearningProgressBaseGUI::isObjectOffline($item["obj_id"], $item["type"]); } } break; } $this->setData($data); } }
/** * Build summary item rows for given object and filter(s * * @param int $a_object_id * @param int $a_ref_id */ function getItems($a_object_id, $a_ref_id) { global $lng; include_once "./Services/Tracking/classes/class.ilTrQuery.php"; $preselected_obj_ids = $filter = NULL; if ($this->is_root) { // using search to get all relevant objects // #8498/#8499: restrict to objects with at least "edit_learning_progress" access $preselected_obj_ids = $this->searchObjects($this->getCurrentFilter(true), "edit_learning_progress"); } else { // using summary filters $filter = $this->getCurrentFilter(); } $data = ilTrQuery::getObjectsSummaryForObject($a_object_id, $a_ref_id, ilUtil::stripSlashes($this->getOrderField()), ilUtil::stripSlashes($this->getOrderDirection()), ilUtil::stripSlashes($this->getOffset()), ilUtil::stripSlashes($this->getLimit()), $filter, $this->getSelectedColumns(), $preselected_obj_ids); // build status to image map include_once "./Services/Tracking/classes/class.ilLearningProgressBaseGUI.php"; include_once "./Services/Tracking/classes/class.ilLPStatus.php"; $valid_status = array(ilLPStatus::LP_STATUS_NOT_ATTEMPTED_NUM, ilLPStatus::LP_STATUS_IN_PROGRESS_NUM, ilLPStatus::LP_STATUS_COMPLETED_NUM, ilLPStatus::LP_STATUS_FAILED_NUM); $status_map = array(); foreach ($valid_status as $status) { $path = ilLearningProgressBaseGUI::_getImagePathForStatus($status); $text = ilLearningProgressBaseGUI::_getStatusText($status); $status_map[$status] = ilUtil::img($path, $text); } // language map $lng->loadLanguageModule("meta"); $languages = array(); foreach ($lng->getInstalledLanguages() as $lang_key) { $languages[$lang_key] = $lng->txt("meta_l_" . $lang_key); } $rows = array(); foreach ($data["set"] as $idx => $result) { // sessions have no title if ($result["title"] == "" && $result["type"] == "sess") { include_once "Modules/Session/classes/class.ilObjSession.php"; $sess = new ilObjSession($result["obj_id"], false); $data["set"][$idx]["title"] = $sess->getFirstAppointment()->appointmentToString(); } $data["set"][$idx]["offline"] = ilLearningProgressBaseGUI::isObjectOffline($result["obj_id"], $result["type"]); // percentages $users_no = $result["user_total"]; $data["set"][$idx]["country"] = $this->getItemsPercentages($result["country"], $users_no); $data["set"][$idx]["gender"] = $this->getItemsPercentages($result["gender"], $users_no, array("m" => $lng->txt("gender_m"), "f" => $lng->txt("gender_f"))); $data["set"][$idx]["city"] = $this->getItemsPercentages($result["city"], $users_no); $data["set"][$idx]["sel_country"] = $this->getItemsPercentages($result["sel_country"], $users_no, $this->getSelCountryCodes()); $data["set"][$idx]["mark"] = $this->getItemsPercentages($result["mark"], $users_no); $data["set"][$idx]["language"] = $this->getItemsPercentages($result["language"], $users_no, $languages); // if we encounter any invalid status codes, e.g. null, map them to not attempted instead foreach ($result["status"] as $status_code => $status_counter) { // null is cast to "" if ($status_code === "" || !in_array($status_code, $valid_status)) { $result["status"][ilLPStatus::LP_STATUS_NOT_ATTEMPTED_NUM] += $status_counter; unset($result["status"][$status_code]); } } $data["set"][$idx]["status"] = $this->getItemsPercentagesStatus($result["status"], $users_no, $status_map); if (!$this->isPercentageAvailable($result["obj_id"])) { $data["set"][$idx]["percentage_avg"] = NULL; } } $this->setMaxCount($data["cnt"]); $this->setData($data["set"]); }