5 require_once
"Services/Tracking/classes/collection/class.ilLPCollection.php";
25 $objDefinition = $DIC[
'objDefinition'];
27 $cache_idx = $a_ref_id .
"__" . $a_full_data;
29 if (!isset(self::$possible_items[$cache_idx])) {
30 $all_possible = array();
32 if (!
$tree->isDeleted($a_ref_id)) {
33 include_once
'Services/Repository/classes/class.ilRepositoryObjectPluginSlot.php';
38 $node =
$tree->getNodeData($a_ref_id);
41 foreach (
$data as $node) {
43 $item_ref_id = $node[
'child'];
45 $item_ref_id = $node[
'ref_id'];
49 if ($item_ref_id == $a_ref_id ||
54 switch ($node[
'type']) {
71 $all_possible[] = $item_ref_id;
73 $all_possible[$item_ref_id] = array(
74 'ref_id' => $item_ref_id,
75 'obj_id' => $node[
'obj_id'],
76 'title' => $node[
'title'],
77 'description' => $node[
'description'],
78 'type' => $node[
'type']
84 case $objDefinition->isPluginTypeName($node[
'type']):
91 $all_possible[] = $item_ref_id;
93 $all_possible[$item_ref_id] = array(
94 'ref_id' => $item_ref_id,
95 'obj_id' => $node[
'obj_id'],
96 'title' => $node[
'title'],
97 'description' => $node[
'description'],
98 'type' => $node[
'type']
107 self::$possible_items[$cache_idx] = $all_possible;
110 return self::$possible_items[$cache_idx];
120 if ($a_item_type ==
'tst') {
124 if ($olp->isAnonymized()) {
133 parent::cloneCollection($a_target_id, $a_copy_id);
135 include_once(
'Services/CopyWizard/classes/class.ilCopyWizardOptions.php');
137 $mappings = $cwo->getMappings();
140 $target_collection =
new static($target_obj_id,
$this->mode);
144 $target_item_ids = array();
145 foreach ($group[
"items"] as $item) {
146 if (!isset($mappings[$item])
or !$mappings[$item]) {
150 $target_item_ids[] = $mappings[$item];
154 if ($grouping_id &&
sizeof($target_item_ids) > 1) {
156 $num_obligatory = min(
sizeof($target_item_ids), $group[
"num_obligatory"]);
158 $target_collection->createNewGrouping($target_item_ids, $num_obligatory);
161 foreach ($target_item_ids as $item_id) {
173 protected function read($a_obj_id)
177 $ilDB = $DIC[
'ilDB'];
182 $ref_id = end($ref_ids);
185 $res =
$ilDB->query(
"SELECT utc.item_id, obd.type" .
186 " FROM ut_lp_collections utc" .
187 " JOIN object_reference obr ON item_id = ref_id" .
188 " JOIN object_data obd ON obr.obj_id = obd.obj_id" .
189 " WHERE utc.obj_id = " .
$ilDB->quote($a_obj_id,
"integer") .
190 " AND active = " .
$ilDB->quote(1,
"integer") .
193 if (in_array(
$row->item_id, $possible) &&
208 $ilDB = $DIC[
'ilDB'];
215 $query =
"INSERT INTO ut_lp_collections" .
216 " (obj_id, lpmode, item_id, grouping_id, num_obligatory, active)" .
217 " VALUES (" .
$ilDB->quote($this->obj_id,
"integer") .
218 ", " .
$ilDB->quote($this->mode,
"integer") .
219 ", " .
$ilDB->quote($a_item_id,
"integer") .
220 ", " .
$ilDB->quote(0,
"integer") .
221 ", " .
$ilDB->quote(0,
"integer") .
222 ", " .
$ilDB->quote(1,
"integer") .
225 $this->items[] = $a_item_id;
234 $ilDB = $DIC[
'ilDB'];
236 $query =
"DELETE FROM ut_lp_collections " .
237 " WHERE obj_id = " .
$ilDB->quote($this->obj_id,
"integer") .
238 " AND item_id = " .
$ilDB->quote($a_item_id,
"integer") .
239 " AND grouping_id = " .
$ilDB->quote(0,
"integer");
253 $ilDB = $DIC[
'ilDB'];
255 $query =
"SELECT item_id FROM ut_lp_collections" .
256 " WHERE obj_id = " .
$ilDB->quote($a_obj_id,
"integer") .
257 " AND grouping_id > " .
$ilDB->quote(0,
"integer");
259 return $res->numRows() ? true :
false;
266 $ilDB = $DIC[
'ilDB'];
268 $grouping_ids = array();
270 $query =
"SELECT grouping_id FROM ut_lp_collections" .
271 " WHERE obj_id = " .
$ilDB->quote($this->obj_id,
"integer") .
272 " AND " .
$ilDB->in(
"item_id", $a_item_ids,
false,
"integer") .
273 " AND grouping_id > " .
$ilDB->quote(0,
"integer");
276 $grouping_ids[] =
$row->grouping_id;
279 return $grouping_ids;
286 $ilDB = $DIC[
'ilDB'];
288 parent::deactivateEntries($a_item_ids);
292 $query =
"UPDATE ut_lp_collections" .
293 " SET active = " .
$ilDB->quote(0,
"integer") .
294 " WHERE " .
$ilDB->in(
"grouping_id", $grouping_ids,
false,
"integer") .
295 " AND obj_id = " .
$ilDB->quote($this->obj_id,
"integer");
304 $ilDB = $DIC[
'ilDB'];
306 parent::activateEntries($a_item_ids);
310 $query =
"UPDATE ut_lp_collections" .
311 " SET active = " .
$ilDB->quote(1,
"integer") .
312 " WHERE " .
$ilDB->in(
"grouping_id", $grouping_ids,
false,
"integer") .
313 " AND obj_id = " .
$ilDB->quote($this->obj_id,
"integer");
322 $ilDB = $DIC[
'ilDB'];
326 $all_item_ids = array();
330 $query =
"SELECT item_id FROM ut_lp_collections" .
331 " WHERE obj_id = " .
$ilDB->quote($this->obj_id,
"integer") .
332 " AND " .
$ilDB->in(
"grouping_id", $grouping_ids,
false,
"integer");
335 $all_item_ids[] =
$row->item_id;
338 $all_item_ids = array_unique(array_merge($all_item_ids, $a_item_ids));
343 $query =
"SELECT MAX(grouping_id) grp FROM ut_lp_collections" .
344 " WHERE obj_id = " .
$ilDB->quote($this->obj_id,
"integer") .
351 $query =
"UPDATE ut_lp_collections SET" .
352 " grouping_id = " .
$ilDB->quote($grp_id,
"integer") .
353 ", num_obligatory = " .
$ilDB->quote($a_num_obligatory,
"integer") .
354 ", active = " .
$ilDB->quote(1,
"integer") .
355 " WHERE obj_id = " .
$ilDB->quote($this->obj_id,
"integer") .
356 " AND " .
$ilDB->in(
"item_id", $all_item_ids,
false,
"integer");
366 $ilDB = $DIC[
'ilDB'];
370 $query =
"UPDATE ut_lp_collections" .
371 " SET grouping_id = " .
$ilDB->quote(0,
"integer") .
372 ", num_obligatory = " .
$ilDB->quote(0,
"integer") .
373 " WHERE obj_id = " .
$ilDB->quote($this->obj_id,
"integer") .
374 " AND " .
$ilDB->in(
"grouping_id", $grouping_ids,
false,
"integer");
382 $ilDB = $DIC[
'ilDB'];
384 foreach ($a_obl as $grouping_id => $num) {
385 $query =
"SELECT count(obj_id) num FROM ut_lp_collections" .
386 " WHERE obj_id = " .
$ilDB->quote($this->obj_id,
"integer") .
387 " AND grouping_id = " .
$ilDB->quote($grouping_id,
'integer') .
391 if ($num <= 0 || $num >=
$row->num) {
396 foreach ($a_obl as $grouping_id => $num) {
397 $query =
"UPDATE ut_lp_collections" .
398 " SET num_obligatory = " .
$ilDB->quote($num,
"integer") .
399 " WHERE obj_id = " .
$ilDB->quote($this->obj_id,
"integer") .
400 " AND grouping_id = " .
$ilDB->quote($grouping_id,
"integer");
416 foreach (
$items as $item_id => $item) {
417 if (in_array($item_id, $done)) {
424 $table_item[
'grouped'] = array();
426 if (count((array) $grouped_items[
'items']) > 1) {
427 foreach ($grouped_items[
'items'] as $grouped_item_id) {
428 if ($grouped_item_id == $item_id ||
429 !is_array(
$items[$grouped_item_id])) {
434 $table_item[
'num_obligatory'] = $grouped_items[
'num_obligatory'];
435 $table_item[
'grouping_id'] = $grouped_items[
'grouping_id'];
437 $done[] = $grouped_item_id;
441 $data[] = $table_item;
449 $table_item = $a_item;
450 $table_item[
'id'] = $a_id;
454 $table_item[
'mode_id'] = $olp->getCurrentMode();
455 $table_item[
'mode'] = $olp->getModeText($table_item[
'mode_id']);
456 $table_item[
'anonymized'] = $olp->isAnonymized();
465 $ilDB = $DIC[
'ilDB'];
469 $query =
"SELECT grouping_id FROM ut_lp_collections" .
470 " WHERE obj_id = " .
$ilDB->quote($this->obj_id,
"integer") .
471 " AND item_id = " .
$ilDB->quote($item_id,
"integer");
474 $grouping_id =
$row->grouping_id;
475 if ($grouping_id > 0) {
476 $query =
"SELECT item_id, num_obligatory FROM ut_lp_collections" .
477 " WHERE obj_id = " .
$ilDB->quote($this->obj_id,
"integer") .
478 " AND grouping_id = " .
$ilDB->quote($grouping_id,
"integer");
482 $items[
'num_obligatory'] =
$row->num_obligatory;
483 $items[
'grouping_id'] = $grouping_id;
494 $ilDB = $DIC[
'ilDB'];
498 $query =
" SELECT * FROM ut_lp_collections" .
499 " WHERE obj_id = " .
$ilDB->quote($this->obj_id,
"integer") .
500 " AND active = " .
$ilDB->quote(1,
"integer");
506 $grouped[
$row->grouping_id][
'items'][] =
$row->item_id;
507 $grouped[
$row->grouping_id][
'num_obligatory'] =
$row->num_obligatory;
releaseGrouping(array $a_item_ids)
static isTypePluginWithLP($a_type, $a_active_status=true)
Check whether a repository type is a plugin which has active learning progress.
cloneCollection($a_target_id, $a_copy_id)
getGroupingIds(array $a_item_ids)
getGroupedItemsForLPStatus()
getTableGUIData($a_parent_ref_id)
saveObligatoryMaterials(array $a_obl)
createNewGrouping(array $a_item_ids, $a_num_obligatory=1)
static _getAllReferences($a_id)
get all reference ids of object
LP collection of repository objects.
static _getInstance($a_copy_id)
Get instance of copy wizard options.
foreach($_POST as $key=> $value) $res
static _lookupObjId($a_id)
static hasGroupedItems($a_obj_id)
deactivateEntries(array $a_item_ids)
static _lookupType($a_id, $a_reference=false)
lookup object type
LP collection base class.
activateEntries(array $a_item_ids)
parseTableGUIItem($a_id, array $a_item)
isAssignedEntry($a_item_id)
static getInstance($a_obj_id)
getPossibleItems($a_ref_id, $a_full_data=false)
getTableGUItemGroup($item_id)
validateEntry($a_item_ref_id, $a_item_type=null)