ILIAS  trunk Revision v13.0_alpha-62-g3b72d83f2e5
class.ilLPCollectionOfLMChapters.php
Go to the documentation of this file.
1<?php
2
19declare(strict_types=0);
20
22{
23 protected static array $possible_items = array();
24
28 public function getPossibleItems(int $a_ref_id)
29 {
30 if (!isset(self::$possible_items[$a_ref_id])) {
32
33 $items = array();
34
35 // only top-level chapters
36 $tree = new ilTree($obj_id);
37 $tree->setTableNames('lm_tree', 'lm_data');
38 $tree->setTreeTablePK("lm_id");
39 foreach ($tree->getChilds($tree->readRootId()) as $child) {
40 if ($child["type"] == "st") {
42 $child["type"],
43 $obj_id,
44 $child["obj_id"]
45 );
46 $items[$child["obj_id"]] = $child;
47 }
48 }
49
50 self::$possible_items[$a_ref_id] = $items;
51 }
52
53 return self::$possible_items[$a_ref_id];
54 }
55
59 public function getTableGUIData(int $a_parent_ref_id): array
60 {
61 $data = array();
62
63 foreach ($this->getPossibleItems($a_parent_ref_id) as $item) {
64 $tmp = array();
65 $tmp['id'] = $item['obj_id'];
66 $tmp['ref_id'] = 0;
67 $tmp['title'] = $item['title'];
68 $tmp['type'] = $item['type'];
69 $tmp['status'] = $this->isAssignedEntry($item['obj_id']);
70
71 // #12158
72 $tmp['url'] = ilLink::_getLink(
73 null,
74 'st',
75 [],
76 $tmp['id'] . '_' . $a_parent_ref_id
77 );
78
79 if ($this->mode == ilLPObjSettings::LP_MODE_COLLECTION_TLT) {
80 $tmp['tlt'] = $item['tlt'];
81 }
82
83 $data[] = $tmp;
84 }
85
86 return $data;
87 }
88}
isAssignedEntry(int $a_item_id)
const int LP_MODE_COLLECTION_TLT
static _getTypicalLearningTime(string $type, int $obj_id, int $sub_id=0)
static _lookupObjectId(int $ref_id)
Tree class data representation in hierachical trees using the Nested Set Model with Gaps by Joe Celco...
$data
Definition: storeScorm.php:45