ILIAS  trunk Revision v11.0_alpha-1753-gb21ca8c4367
All Data Structures Namespaces Files Functions Variables Enumerations Enumerator Modules Pages
class.ilLPCollectionOfLMChapters.php
Go to the documentation of this file.
1 <?php
2 
19 declare(strict_types=0);
20 
27 {
28  protected static array $possible_items = array();
29 
33  public function getPossibleItems(int $a_ref_id)
34  {
35  if (!isset(self::$possible_items[$a_ref_id])) {
37 
38  $items = array();
39 
40  // only top-level chapters
41  $tree = new ilTree($obj_id);
42  $tree->setTableNames('lm_tree', 'lm_data');
43  $tree->setTreeTablePK("lm_id");
44  foreach ($tree->getChilds($tree->readRootId()) as $child) {
45  if ($child["type"] == "st") {
47  $child["type"],
48  $obj_id,
49  $child["obj_id"]
50  );
51  $items[$child["obj_id"]] = $child;
52  }
53  }
54 
55  self::$possible_items[$a_ref_id] = $items;
56  }
57 
58  return self::$possible_items[$a_ref_id];
59  }
60 
64  public function getTableGUIData(int $a_parent_ref_id): array
65  {
66  $data = array();
67 
68  $parent_type = ilObject::_lookupType($a_parent_ref_id, true);
69 
70  foreach ($this->getPossibleItems($a_parent_ref_id) as $item) {
71  $tmp = array();
72  $tmp['id'] = $item['obj_id'];
73  $tmp['ref_id'] = 0;
74  $tmp['title'] = $item['title'];
75  $tmp['type'] = $item['type'];
76  $tmp['status'] = $this->isAssignedEntry($item['obj_id']);
77 
78  // #12158
79  $tmp['url'] = ilLink::_getLink(
80  $a_parent_ref_id,
81  $parent_type,
82  [],
83  "_" . $tmp['id']
84  );
85 
86  if ($this->mode == ilLPObjSettings::LP_MODE_COLLECTION_TLT) {
87  $tmp['tlt'] = $item['tlt'];
88  }
89 
90  $data[] = $tmp;
91  }
92 
93  return $data;
94  }
95 }
LP collection of learning module chapters.
isAssignedEntry(int $a_item_id)
static _lookupObjectId(int $ref_id)
LP collection base class.
static _getTypicalLearningTime(string $type, int $obj_id, int $sub_id=0)
static _lookupType(int $id, bool $reference=false)