ILIAS  release_5-4 Revision v5.4.26-12-gabc799a52e6
class.ilLPCollectionOfLMChapters.php
Go to the documentation of this file.
1<?php
2
3/* Copyright (c) 1998-2010 ILIAS open source, Extended GPL, see docs/LICENSE */
4
5require_once "Services/Tracking/classes/collection/class.ilLPCollection.php";
6
17{
18 protected static $possible_items = array();
19
20 public function getPossibleItems($a_ref_id)
21 {
22 if (!isset(self::$possible_items[$a_ref_id])) {
24
25 $items = array();
26
27 // only top-level chapters
28
29 include_once "Services/MetaData/classes/class.ilMDEducational.php";
30 $tree = new ilTree($obj_id);
31 $tree->setTableNames('lm_tree', 'lm_data');
32 $tree->setTreeTablePK("lm_id");
33 foreach ($tree->getChilds($tree->readRootId()) as $child) {
34 if ($child["type"] == "st") {
35 $child["tlt"] = ilMDEducational::_getTypicalLearningTimeSeconds($obj_id, $child["obj_id"]);
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
46
47 //
48 // TABLE GUI
49 //
50
51 public function getTableGUIData($a_parent_ref_id)
52 {
53 $data = array();
54
55 $parent_type = ilObject::_lookupType($a_parent_ref_id, true);
56 include_once './Services/Link/classes/class.ilLink.php';
57
58 foreach ($this->getPossibleItems($a_parent_ref_id) as $item) {
59 $tmp = array();
60 $tmp['id'] = $item['obj_id'];
61 $tmp['ref_id'] = 0;
62 $tmp['title'] = $item['title'];
63 $tmp['type'] = $item['type'];
64 $tmp['status'] = $this->isAssignedEntry($item['obj_id']);
65
66 // #12158
67 $tmp['url'] = ilLink::_getLink($a_parent_ref_id, $parent_type, null, "_" . $tmp['id']);
68
69 if ($this->mode == ilLPObjSettings::LP_MODE_COLLECTION_TLT) {
70 $tmp['tlt'] = $item['tlt'];
71 }
72
73 $data[] = $tmp;
74 }
75
76 return $data;
77 }
78}
An exception for terminatinating execution or to throw for unit testing.
LP collection of learning module chapters.
LP collection base class.
isAssignedEntry($a_item_id)
static _getTypicalLearningTimeSeconds($a_rbac_id, $a_obj_id=0)
static _lookupObjectId($a_ref_id)
lookup object id
static _lookupType($a_id, $a_reference=false)
lookup object type
Tree class data representation in hierachical trees using the Nested Set Model with Gaps by Joe Celco...
$data
Definition: bench.php:6