ILIAS  release_8 Revision v8.24
class.ilLPCollectionOfLMChapters.php
Go to the documentation of this file.
1<?php
2
3declare(strict_types=0);
4
5/* Copyright (c) 1998-2010 ILIAS open source, Extended GPL, see docs/LICENSE */
6
13{
14 protected static array $possible_items = array();
15
19 public function getPossibleItems(int $a_ref_id)
20 {
21 if (!isset(self::$possible_items[$a_ref_id])) {
23
24 $items = array();
25
26 // only top-level chapters
27 $tree = new ilTree($obj_id);
28 $tree->setTableNames('lm_tree', 'lm_data');
29 $tree->setTreeTablePK("lm_id");
30 foreach ($tree->getChilds($tree->readRootId()) as $child) {
31 if ($child["type"] == "st") {
33 $obj_id,
34 $child["obj_id"]
35 );
36 $items[$child["obj_id"]] = $child;
37 }
38 }
39
40 self::$possible_items[$a_ref_id] = $items;
41 }
42
43 return self::$possible_items[$a_ref_id];
44 }
45
49 public function getTableGUIData(int $a_parent_ref_id): array
50 {
51 $data = array();
52
53 $parent_type = ilObject::_lookupType($a_parent_ref_id, true);
54
55 foreach ($this->getPossibleItems($a_parent_ref_id) as $item) {
56 $tmp = array();
57 $tmp['id'] = $item['obj_id'];
58 $tmp['ref_id'] = 0;
59 $tmp['title'] = $item['title'];
60 $tmp['type'] = $item['type'];
61 $tmp['status'] = $this->isAssignedEntry($item['obj_id']);
62
63 // #12158
64 $tmp['url'] = ilLink::_getLink(
65 $a_parent_ref_id,
66 $parent_type,
67 [],
68 "_" . $tmp['id']
69 );
70
71 if ($this->mode == ilLPObjSettings::LP_MODE_COLLECTION_TLT) {
72 $tmp['tlt'] = $item['tlt'];
73 }
74
75 $data[] = $tmp;
76 }
77
78 return $data;
79 }
80}
LP collection of learning module chapters.
LP collection base class.
isAssignedEntry(int $a_item_id)
static _getTypicalLearningTimeSeconds(int $a_rbac_id, int $a_obj_id=0)
static _lookupObjectId(int $ref_id)
static _lookupType(int $id, bool $reference=false)
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...