19 declare(strict_types=0);
53 protected InfoFactoryInterface $info_factory
63 $user_obj_id_mappings = [];
64 foreach ($user_ids as $usr_id) {
65 foreach ($object_ids as $obj_id) {
67 $lp_mode = $olp->getCurrentMode();
68 $user_obj_id_mappings[$usr_id][$lp_mode][] = $obj_id;
73 $user_obj_id_mappings,
80 foreach (
$data as $entry) {
81 $obj_id = (
int) $entry[self::KEY_OBJ_ID];
82 $usr_id = (
int) $entry[self::KEY_USR_ID];
83 $obj_title = (string) $entry[self::KEY_OBJ_TITLE];
84 $percentage = (
int) $entry[self::KEY_LP_PERCENTAGE];
86 $lp_status = (
int) $entry[self::KEY_LP_STATUS];
87 $obj_type = (string) $entry[self::KEY_OBJ_TYPE];
88 $lp_mode = (
int) $entry[self::KEY_LP_MODE];
89 $spent_seconds = (
int) $entry[self::KEY_LP_SPENT_SECONDS];
91 $visits = (
int) $entry[self::KEY_LP_VISITS];
92 $read_count = (
int) $entry[self::KEY_LP_READ_COUNT];
93 $lp_info = $this->info_factory->lp(
105 $object_info = $this->info_factory->objectData(
111 $lp_infos[] = $lp_info;
112 $object_infos[] = $object_info;
113 $combined_infos[] = $this->info_factory->combined(
119 return $this->info_factory->view(
120 $this->info_factory->iterator()->objectData(...$object_infos),
121 $this->info_factory->iterator()->lp(...$lp_infos),
122 $this->info_factory->iterator()->combined(...$combined_infos)
127 array $user_obj_id_mappings,
128 bool $only_data_of_objects_with_lp_enabled =
true 131 foreach ($user_obj_id_mappings as $usr_id => $mode_mapping) {
132 foreach ($mode_mapping as $lp_mode => $obj_ids) {
133 $obj_ids = array_flip($obj_ids);
163 if ($only_data_of_objects_with_lp_enabled) {
174 foreach ($new_data as $new) {
175 $new[self::KEY_LP_MODE] = $lp_mode;
176 $new[self::KEY_USR_ID] = $usr_id;
const LP_MODE_CMIX_COMPLETED
retrieveViewInfo(FilterInterface $filter)
const LP_MODE_CMIX_COMPLETED_OR_PASSED
static getSubItemsStatusForUser(int $a_user_id, int $a_parent_obj_id, array $a_item_ids)
Get subitems status.
const LP_MODE_CMIX_PASSED_WITH_FAILED
static getObjectivesStatusForUser(int $a_user_id, int $a_obj_id, array $a_objective_ids)
const KEY_OBJ_DESCRIPTION
isPercentageAvailable(int $lp_mode)
const LP_MODE_CMIX_PASSED
static getSCOsStatusForUser(int $a_user_id, int $a_parent_obj_id, array $a_sco_ids)
const LP_MODE_COLLECTION_MANUAL
const LP_MODE_COLLECTION_TLT
const KEY_LP_STATUS_CHANGED
const LP_MODE_CMIX_COMPL_WITH_FAILED
const LP_MODE_VISITED_PAGES
const LP_MODE_TEST_PASSED
__construct(protected ilDBInterface $db, protected InfoFactoryInterface $info_factory)
collectLPDataWithIlTryQuery(array $user_obj_id_mappings, bool $only_data_of_objects_with_lp_enabled=true)
static _lookupDescription(int $obj_id)
static getObjectsStatusForUser(int $a_user_id, array $obj_refs)
const LP_MODE_DEACTIVATED
const LP_MODE_COLLECTION_MOBS
const LP_MODE_CMIX_COMPL_OR_PASSED_WITH_FAILED
collectOnlyDataOfObjectsWithLPEnabled()
const LP_MODE_LTI_OUTCOME
static getInstance(int $obj_id)
const KEY_LP_SPENT_SECONDS