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';
36 $data = $tree->getRbacSubTreeInfo($a_ref_id);
38 $node = $tree->getNodeData($a_ref_id);
39 $data = $tree->getSubTree($node);
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']) {
74 $all_possible[] = $item_ref_id;
76 $all_possible[$item_ref_id] = array(
77 'ref_id' => $item_ref_id,
78 'obj_id' => $node[
'obj_id'],
79 'title' => $node[
'title'],
80 'description' => $node[
'description'],
81 'type' => $node[
'type']
87 case $objDefinition->isPluginTypeName($node[
'type']):
94 $all_possible[] = $item_ref_id;
96 $all_possible[$item_ref_id] = array(
97 'ref_id' => $item_ref_id,
98 'obj_id' => $node[
'obj_id'],
99 'title' => $node[
'title'],
100 'description' => $node[
'description'],
101 'type' => $node[
'type']
110 self::$possible_items[$cache_idx] = $all_possible;
113 return self::$possible_items[$cache_idx];
123 if ($a_item_type ==
'tst') {
127 if ($olp->isAnonymized()) {
136 parent::cloneCollection($a_target_id, $a_copy_id);
138 include_once(
'Services/CopyWizard/classes/class.ilCopyWizardOptions.php');
140 $mappings = $cwo->getMappings();
143 $target_collection =
new static($target_obj_id,
$this->mode);
147 $target_item_ids = array();
148 foreach ($group[
"items"] as $item) {
149 if (!isset($mappings[$item]) or !$mappings[$item]) {
153 $target_item_ids[] = $mappings[$item];
157 if ($grouping_id &&
sizeof($target_item_ids) > 1) {
159 $num_obligatory = min(
sizeof($target_item_ids), $group[
"num_obligatory"]);
161 $target_collection->createNewGrouping($target_item_ids, $num_obligatory);
164 foreach ($target_item_ids as $item_id) {
176 protected function read($a_obj_id)
180 $ilDB = $DIC[
'ilDB'];
185 $ref_id = end($ref_ids);
188 $res =
$ilDB->query(
"SELECT utc.item_id, obd.type" .
189 " FROM ut_lp_collections utc" .
190 " JOIN object_reference obr ON item_id = ref_id" .
191 " JOIN object_data obd ON obr.obj_id = obd.obj_id" .
192 " WHERE utc.obj_id = " .
$ilDB->quote($a_obj_id,
"integer") .
193 " AND active = " .
$ilDB->quote(1,
"integer") .
196 if (in_array($row->item_id, $possible) &&
211 $ilDB = $DIC[
'ilDB'];
218 $query =
"INSERT INTO ut_lp_collections" .
219 " (obj_id, lpmode, item_id, grouping_id, num_obligatory, active)" .
220 " VALUES (" .
$ilDB->quote($this->obj_id,
"integer") .
221 ", " .
$ilDB->quote($this->mode,
"integer") .
222 ", " .
$ilDB->quote($a_item_id,
"integer") .
223 ", " .
$ilDB->quote(0,
"integer") .
224 ", " .
$ilDB->quote(0,
"integer") .
225 ", " .
$ilDB->quote(1,
"integer") .
228 $this->items[] = $a_item_id;
237 $ilDB = $DIC[
'ilDB'];
239 $query =
"DELETE FROM ut_lp_collections " .
240 " WHERE obj_id = " .
$ilDB->quote($this->obj_id,
"integer") .
241 " AND item_id = " .
$ilDB->quote($a_item_id,
"integer") .
242 " AND grouping_id = " .
$ilDB->quote(0,
"integer");
256 $ilDB = $DIC[
'ilDB'];
258 $query =
"SELECT item_id FROM ut_lp_collections" .
259 " WHERE obj_id = " .
$ilDB->quote($a_obj_id,
"integer") .
260 " AND grouping_id > " .
$ilDB->quote(0,
"integer");
262 return $res->numRows() ? true :
false;
269 $ilDB = $DIC[
'ilDB'];
271 $grouping_ids = array();
273 $query =
"SELECT grouping_id FROM ut_lp_collections" .
274 " WHERE obj_id = " .
$ilDB->quote($this->obj_id,
"integer") .
275 " AND " .
$ilDB->in(
"item_id", $a_item_ids,
false,
"integer") .
276 " AND grouping_id > " .
$ilDB->quote(0,
"integer");
279 $grouping_ids[] = $row->grouping_id;
282 return $grouping_ids;
289 $ilDB = $DIC[
'ilDB'];
291 parent::deactivateEntries($a_item_ids);
295 $query =
"UPDATE ut_lp_collections" .
296 " SET active = " .
$ilDB->quote(0,
"integer") .
297 " WHERE " .
$ilDB->in(
"grouping_id", $grouping_ids,
false,
"integer") .
298 " AND obj_id = " .
$ilDB->quote($this->obj_id,
"integer");
307 $ilDB = $DIC[
'ilDB'];
309 parent::activateEntries($a_item_ids);
313 $query =
"UPDATE ut_lp_collections" .
314 " SET active = " .
$ilDB->quote(1,
"integer") .
315 " WHERE " .
$ilDB->in(
"grouping_id", $grouping_ids,
false,
"integer") .
316 " AND obj_id = " .
$ilDB->quote($this->obj_id,
"integer");
325 $ilDB = $DIC[
'ilDB'];
329 $all_item_ids = array();
333 $query =
"SELECT item_id FROM ut_lp_collections" .
334 " WHERE obj_id = " .
$ilDB->quote($this->obj_id,
"integer") .
335 " AND " .
$ilDB->in(
"grouping_id", $grouping_ids,
false,
"integer");
338 $all_item_ids[] = $row->item_id;
341 $all_item_ids = array_unique(array_merge($all_item_ids, $a_item_ids));
346 $query =
"SELECT MAX(grouping_id) grp FROM ut_lp_collections" .
347 " WHERE obj_id = " .
$ilDB->quote($this->obj_id,
"integer") .
354 $query =
"UPDATE ut_lp_collections SET" .
355 " grouping_id = " .
$ilDB->quote($grp_id,
"integer") .
356 ", num_obligatory = " .
$ilDB->quote($a_num_obligatory,
"integer") .
357 ", active = " .
$ilDB->quote(1,
"integer") .
358 " WHERE obj_id = " .
$ilDB->quote($this->obj_id,
"integer") .
359 " AND " .
$ilDB->in(
"item_id", $all_item_ids,
false,
"integer");
369 $ilDB = $DIC[
'ilDB'];
373 $query =
"UPDATE ut_lp_collections" .
374 " SET grouping_id = " .
$ilDB->quote(0,
"integer") .
375 ", num_obligatory = " .
$ilDB->quote(0,
"integer") .
376 " WHERE obj_id = " .
$ilDB->quote($this->obj_id,
"integer") .
377 " AND " .
$ilDB->in(
"grouping_id", $grouping_ids,
false,
"integer");
385 $ilDB = $DIC[
'ilDB'];
387 foreach ($a_obl as $grouping_id => $num) {
388 $query =
"SELECT count(obj_id) num FROM ut_lp_collections" .
389 " WHERE obj_id = " .
$ilDB->quote($this->obj_id,
"integer") .
390 " AND grouping_id = " .
$ilDB->quote($grouping_id,
'integer') .
394 if ($num <= 0 || $num >= $row->num) {
399 foreach ($a_obl as $grouping_id => $num) {
400 $query =
"UPDATE ut_lp_collections" .
401 " SET num_obligatory = " .
$ilDB->quote($num,
"integer") .
402 " WHERE obj_id = " .
$ilDB->quote($this->obj_id,
"integer") .
403 " AND grouping_id = " .
$ilDB->quote($grouping_id,
"integer");
419 foreach (
$items as $item_id => $item) {
420 if (in_array($item_id, $done)) {
427 $table_item[
'grouped'] = array();
429 if (count((array) $grouped_items[
'items']) > 1) {
430 foreach ($grouped_items[
'items'] as $grouped_item_id) {
431 if ($grouped_item_id == $item_id ||
432 !is_array(
$items[$grouped_item_id])) {
437 $table_item[
'num_obligatory'] = $grouped_items[
'num_obligatory'];
438 $table_item[
'grouping_id'] = $grouped_items[
'grouping_id'];
440 $done[] = $grouped_item_id;
444 $data[] = $table_item;
452 $table_item = $a_item;
453 $table_item[
'id'] = $a_id;
457 $table_item[
'mode_id'] = $olp->getCurrentMode();
458 $table_item[
'mode'] = $olp->getModeText($table_item[
'mode_id']);
459 $table_item[
'anonymized'] = $olp->isAnonymized();
468 $ilDB = $DIC[
'ilDB'];
472 $query =
"SELECT grouping_id FROM ut_lp_collections" .
473 " WHERE obj_id = " .
$ilDB->quote($this->obj_id,
"integer") .
474 " AND item_id = " .
$ilDB->quote($item_id,
"integer");
477 $grouping_id = $row->grouping_id;
478 if ($grouping_id > 0) {
479 $query =
"SELECT item_id, num_obligatory FROM ut_lp_collections" .
480 " WHERE obj_id = " .
$ilDB->quote($this->obj_id,
"integer") .
481 " AND grouping_id = " .
$ilDB->quote($grouping_id,
"integer");
484 $items[
'items'][] = $row->item_id;
485 $items[
'num_obligatory'] = $row->num_obligatory;
486 $items[
'grouping_id'] = $grouping_id;
497 $ilDB = $DIC[
'ilDB'];
501 $query =
" SELECT * FROM ut_lp_collections" .
502 " WHERE obj_id = " .
$ilDB->quote($this->obj_id,
"integer") .
503 " AND active = " .
$ilDB->quote(1,
"integer");
508 if (in_array($row->item_id,
$items)) {
509 $grouped[$row->grouping_id][
'items'][] = $row->item_id;
510 $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)