ILIAS  trunk Revision v11.0_alpha-3011-gc6b235a2e85
ILIAS\Tracking\View\DataRetrieval\DataRetrieval Class Reference
+ Inheritance diagram for ILIAS\Tracking\View\DataRetrieval\DataRetrieval:
+ Collaboration diagram for ILIAS\Tracking\View\DataRetrieval\DataRetrieval:

Public Member Functions

 __construct (protected ilDBInterface $db, protected InfoFactoryInterface $info_factory)
 
 retrieveViewInfo (FilterInterface $filter)
 
 retrieveViewInfo (FilterInterface $filter)
 

Protected Member Functions

 collectLPDataWithIlTryQuery (array $user_obj_id_mappings, bool $only_data_of_objects_with_lp_enabled=true)
 
 isPercentageAvailable (int $lp_mode)
 

Protected Attributes

const KEY_OBJ_ID = "obj_id"
 
const KEY_USR_ID = "usr_id"
 
const KEY_OBJ_TITLE = "title"
 
const KEY_OBJ_DESCRIPTION = "description"
 
const KEY_OBJ_TYPE = "type"
 
const KEY_LP_STATUS = "status"
 
const KEY_LP_MODE = "lp_mode"
 
const KEY_LP_SPENT_SECONDS = "spent_seconds"
 
const KEY_LP_VISITS = "visits"
 
const KEY_LP_READ_COUNT = "read_count"
 
const KEY_LP_PERCENTAGE = "percentage"
 
const KEY_LP_STATUS_CHANGED = "status_changed"
 

Detailed Description

Definition at line 36 of file DataRetrieval.php.

Constructor & Destructor Documentation

◆ __construct()

ILIAS\Tracking\View\DataRetrieval\DataRetrieval::__construct ( protected ilDBInterface  $db,
protected InfoFactoryInterface  $info_factory 
)

Definition at line 51 of file DataRetrieval.php.

54 {
55 }

Member Function Documentation

◆ collectLPDataWithIlTryQuery()

ILIAS\Tracking\View\DataRetrieval\DataRetrieval::collectLPDataWithIlTryQuery ( array  $user_obj_id_mappings,
bool  $only_data_of_objects_with_lp_enabled = true 
)
protected

Definition at line 126 of file DataRetrieval.php.

129 : array {
130 $data = [];
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);
134 $new_data = [];
135 switch ($lp_mode) {
138 $usr_id,
139 0,
140 $obj_ids
141 );
142 break;
145 $usr_id,
146 0,
147 $obj_ids
148 );
149 break;
153 if ($usr_id) {
155 $usr_id,
156 0,
157 $obj_ids
158 );
159 }
160 break;
163 if ($only_data_of_objects_with_lp_enabled) {
164 break;
165 }
166 // no break
167 default:
169 $usr_id,
170 $obj_ids
171 );
172 break;
173 }
174 foreach ($new_data as $new) {
175 $new[self::KEY_LP_MODE] = $lp_mode;
176 $new[self::KEY_USR_ID] = $usr_id;
177 $data[] = $new;
178 }
179 }
180 }
181 return $data;
182 }
static getSCOsStatusForUser(int $a_user_id, int $a_parent_obj_id, array $a_sco_ids)
static getObjectivesStatusForUser(int $a_user_id, int $a_obj_id, array $a_objective_ids)
static getSubItemsStatusForUser(int $a_user_id, int $a_parent_obj_id, array $a_item_ids)
Get subitems status.
static getObjectsStatusForUser(int $a_user_id, array $obj_refs)

References $data, ilTrQuery\getObjectivesStatusForUser(), ilTrQuery\getObjectsStatusForUser(), ilTrQuery\getSCOsStatusForUser(), ilTrQuery\getSubItemsStatusForUser(), ilLPObjSettings\LP_MODE_COLLECTION_MANUAL, ilLPObjSettings\LP_MODE_COLLECTION_MOBS, ilLPObjSettings\LP_MODE_COLLECTION_TLT, ilLPObjSettings\LP_MODE_DEACTIVATED, ilLPObjSettings\LP_MODE_OBJECTIVES, ilLPObjSettings\LP_MODE_SCORM, and ilLPObjSettings\LP_MODE_UNDEFINED.

+ Here is the call graph for this function:

◆ isPercentageAvailable()

ILIAS\Tracking\View\DataRetrieval\DataRetrieval::isPercentageAvailable ( int  $lp_mode)
protected

Definition at line 184 of file DataRetrieval.php.

186 : bool {
187 if (in_array(
188 $lp_mode,
189 [
203 ]
204 )) {
205 return true;
206 }
207 return false;
208 }
const LP_MODE_CMIX_COMPL_OR_PASSED_WITH_FAILED

◆ retrieveViewInfo()

ILIAS\Tracking\View\DataRetrieval\DataRetrieval::retrieveViewInfo ( FilterInterface  $filter)

Implements ILIAS\Tracking\View\DataRetrieval\DataRetrievalInterface.

Definition at line 57 of file DataRetrieval.php.

59 : ViewInterface {
60 $object_ids = $filter->getObjectIds();
61 $user_ids = $filter->getUserIds();
62
63 $user_obj_id_mappings = [];
64 foreach ($user_ids as $usr_id) {
65 foreach ($object_ids as $obj_id) {
66 $olp = ilObjectLP::getInstance($obj_id);
67 $lp_mode = $olp->getCurrentMode();
68 $user_obj_id_mappings[$usr_id][$lp_mode][] = $obj_id;
69 }
70 }
71
73 $user_obj_id_mappings,
75 );
76
77 $object_infos = [];
78 $lp_infos = [];
79 $combined_infos = [];
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];
85 $obj_description = ilObject::_lookupDescription($obj_id);
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];
90 $status_changed = new ilDateTime($entry[self::KEY_LP_STATUS_CHANGED], IL_CAL_DATETIME);
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(
94 $usr_id,
95 $obj_id,
96 $lp_status,
97 $percentage,
98 $lp_mode,
99 $spent_seconds,
100 $status_changed,
101 $visits,
102 $read_count,
103 $this->isPercentageAvailable($lp_mode)
104 );
105 $object_info = $this->info_factory->objectData(
106 $obj_id,
107 $obj_title,
108 $obj_description,
109 $obj_type,
110 );
111 $lp_infos[] = $lp_info;
112 $object_infos[] = $object_info;
113 $combined_infos[] = $this->info_factory->combined(
114 $lp_info,
115 $object_info
116 );
117 }
118
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)
123 );
124 }
collectLPDataWithIlTryQuery(array $user_obj_id_mappings, bool $only_data_of_objects_with_lp_enabled=true)
const IL_CAL_DATETIME
@classDescription Date and time handling
static getInstance(int $obj_id)
static _lookupDescription(int $obj_id)

References ilObjectLP\getInstance().

+ Here is the call graph for this function:

Field Documentation

◆ KEY_LP_MODE

const ILIAS\Tracking\View\DataRetrieval\DataRetrieval::KEY_LP_MODE = "lp_mode"
protected

Definition at line 44 of file DataRetrieval.php.

◆ KEY_LP_PERCENTAGE

const ILIAS\Tracking\View\DataRetrieval\DataRetrieval::KEY_LP_PERCENTAGE = "percentage"
protected

Definition at line 48 of file DataRetrieval.php.

◆ KEY_LP_READ_COUNT

const ILIAS\Tracking\View\DataRetrieval\DataRetrieval::KEY_LP_READ_COUNT = "read_count"
protected

Definition at line 47 of file DataRetrieval.php.

◆ KEY_LP_SPENT_SECONDS

const ILIAS\Tracking\View\DataRetrieval\DataRetrieval::KEY_LP_SPENT_SECONDS = "spent_seconds"
protected

Definition at line 45 of file DataRetrieval.php.

◆ KEY_LP_STATUS

const ILIAS\Tracking\View\DataRetrieval\DataRetrieval::KEY_LP_STATUS = "status"
protected

Definition at line 43 of file DataRetrieval.php.

◆ KEY_LP_STATUS_CHANGED

const ILIAS\Tracking\View\DataRetrieval\DataRetrieval::KEY_LP_STATUS_CHANGED = "status_changed"
protected

Definition at line 49 of file DataRetrieval.php.

◆ KEY_LP_VISITS

const ILIAS\Tracking\View\DataRetrieval\DataRetrieval::KEY_LP_VISITS = "visits"
protected

Definition at line 46 of file DataRetrieval.php.

◆ KEY_OBJ_DESCRIPTION

const ILIAS\Tracking\View\DataRetrieval\DataRetrieval::KEY_OBJ_DESCRIPTION = "description"
protected

Definition at line 41 of file DataRetrieval.php.

◆ KEY_OBJ_ID

const ILIAS\Tracking\View\DataRetrieval\DataRetrieval::KEY_OBJ_ID = "obj_id"
protected

Definition at line 38 of file DataRetrieval.php.

◆ KEY_OBJ_TITLE

const ILIAS\Tracking\View\DataRetrieval\DataRetrieval::KEY_OBJ_TITLE = "title"
protected

Definition at line 40 of file DataRetrieval.php.

◆ KEY_OBJ_TYPE

const ILIAS\Tracking\View\DataRetrieval\DataRetrieval::KEY_OBJ_TYPE = "type"
protected

Definition at line 42 of file DataRetrieval.php.

◆ KEY_USR_ID

const ILIAS\Tracking\View\DataRetrieval\DataRetrieval::KEY_USR_ID = "usr_id"
protected

Definition at line 39 of file DataRetrieval.php.


The documentation for this class was generated from the following file: