function getItems(array $a_user_fields, array $a_privary_fields = null) { include_once "./Services/Tracking/classes/class.ilTrQuery.php"; $collection = ilTrQuery::getObjectIds($this->obj_id, $this->ref_id, true); if ($collection["object_ids"]) { // we need these for the timing warnings $this->ref_ids = $collection["ref_ids"]; // only if object is [part of] course/group $check_agreement = false; if ($this->in_course) { // privacy (if course agreement is activated) include_once "Services/PrivacySecurity/classes/class.ilPrivacySettings.php"; $privacy = ilPrivacySettings::_getInstance(); if ($privacy->courseConfirmationRequired()) { $check_agreement = $this->in_course; } } else { if ($this->in_group) { // privacy (if group agreement is activated) include_once "Services/PrivacySecurity/classes/class.ilPrivacySettings.php"; $privacy = ilPrivacySettings::_getInstance(); if ($privacy->groupConfirmationRequired()) { $check_agreement = $this->in_group; } } } $data = ilTrQuery::getUserObjectMatrix($this->ref_id, $collection["object_ids"], $this->filter["name"], $a_user_fields, $a_privary_fields, $check_agreement); if ($collection["objectives_parent_id"] && $data["users"]) { // sub-items: learning objectives $objectives = ilTrQuery::getUserObjectiveMatrix($collection["objectives_parent_id"], $data["users"]); $this->objective_ids = array(); foreach ($objectives as $user_id => $objectives) { if (isset($data["set"][$user_id])) { foreach ($objectives as $objective_id => $status) { $obj_id = "objtv_" . $objective_id; $data["set"][$user_id][$obj_id] = $status; if (!in_array($obj_id, $this->objective_ids)) { $this->objective_ids[$objective_id] = ilCourseObjective::lookupObjectiveTitle($objective_id); } } } } } // sub-items: SCOs if ($collection["scorm"] && $data["set"]) { $this->sco_ids = array(); foreach (array_keys($data["set"]) as $user_id) { foreach ($collection["scorm"]["scos"] as $sco) { if (!in_array($sco, $this->sco_ids)) { $this->sco_ids[$sco] = $collection["scorm"]["scos_title"][$sco]; } // alex, 5 Nov 2011: we got users being in failed and in // completed status, I changed the setting in: first check failed // then check completed since failed should superseed completed // (before completed has been checked before failed) $status = ilLPStatus::LP_STATUS_NOT_ATTEMPTED_NUM; if (in_array($user_id, $collection["scorm"]["failed"][$sco])) { $status = ilLPStatus::LP_STATUS_FAILED_NUM; } else { if (in_array($user_id, $collection["scorm"]["completed"][$sco])) { $status = ilLPStatus::LP_STATUS_COMPLETED_NUM; } else { if (in_array($user_id, $collection["scorm"]["in_progress"][$sco])) { $status = ilLPStatus::LP_STATUS_IN_PROGRESS_NUM; } } } $obj_id = "objsco_" . $sco; $data["set"][$user_id][$obj_id] = $status; } } } // sub-items: generic, e.g. lm chapter if ($collection["subitems"] && $data["set"]) { foreach (array_keys($data["set"]) as $user_id) { foreach ($collection["subitems"]["items"] as $item_id) { $this->subitem_ids[$item_id] = $collection["subitems"]["item_titles"][$item_id]; $status = ilLPStatus::LP_STATUS_NOT_ATTEMPTED_NUM; if (in_array($user_id, $collection["subitems"]["completed"][$item_id])) { $status = ilLPStatus::LP_STATUS_COMPLETED_NUM; } else { if (is_array($collection["subitems"]["in_progress"]) && in_array($user_id, $collection["subitems"]["in_progress"][$item_id])) { $status = ilLPStatus::LP_STATUS_IN_PROGRESS_NUM; } } $obj_id = "objsub_" . $item_id; $data["set"][$user_id][$obj_id] = $status; } } } // percentage export if ($data["set"]) { $this->perc_map = array(); foreach ($data["set"] as $row) { foreach ($row as $column => $value) { if (substr($column, -5) == "_perc") { if ((int) $value > 0) { $obj_id = explode("_", $column); $obj_id = (int) $obj_id[1]; $this->perc_map[$obj_id] = true; } } } } } $this->setMaxCount($data["cnt"]); $this->setData($data["set"]); return $collection["object_ids"]; } return false; }
function getItems() { global $lng, $tree; // $this->determineOffsetAndOrder(); include_once "./Services/Tracking/classes/class.ilTrQuery.php"; $collection = ilTrQuery::getObjectIds($this->obj_id, $this->ref_id, true); if ($collection["object_ids"]) { // we need these for the timing warnings $this->ref_ids = $collection["ref_ids"]; $data = ilTrQuery::getUserObjectMatrix($this->ref_id, $collection["object_ids"], $this->filter["name"]); if ($collection["objectives_parent_id"] && $data["users"]) { $objectives = ilTrQuery::getUserObjectiveMatrix($collection["objectives_parent_id"], $data["users"]); if ($objectives["cnt"]) { $this->objective_ids = array(); $objective_columns = array(); foreach ($objectives["set"] as $row) { if (isset($data["set"][$row["usr_id"]])) { $obj_id = "objtv_" . $row["obj_id"]; $data["set"][$row["usr_id"]]["objects"][$obj_id] = array("status" => $row["status"]); if (!in_array($obj_id, $this->objective_ids)) { $this->objective_ids[$obj_id] = $row["title"]; } } } } } if ($collection["scorm"] && $data["set"]) { $this->sco_ids = array(); foreach (array_keys($data["set"]) as $user_id) { foreach ($collection["scorm"]["scos"] as $sco) { if (!in_array($sco, $this->sco_ids)) { $this->sco_ids[$sco] = $collection["scorm"]["scos_title"][$sco]; } // alex, 5 Nov 2011: we got users being in failed and in // completed status, I changed the setting in: first check failed // then check completed since failed should superseed completed // (before completed has been checked before failed) $status = LP_STATUS_NOT_ATTEMPTED_NUM; if (in_array($user_id, $collection["scorm"]["failed"][$sco])) { $status = LP_STATUS_FAILED_NUM; } else { if (in_array($user_id, $collection["scorm"]["completed"][$sco])) { $status = LP_STATUS_COMPLETED_NUM; } else { if (in_array($user_id, $collection["scorm"]["in_progress"][$sco])) { $status = LP_STATUS_IN_PROGRESS_NUM; } } } $obj_id = "objsco_" . $sco; $data["set"][$user_id]["objects"][$obj_id] = array("status" => $status); } } } $this->setMaxCount($data["cnt"]); $this->setData($data["set"]); //var_dump($this->sco_ids); return $collection["object_ids"]; } return false; }