ILIAS  Release_5_0_x_branch Revision 61816
 All Data Structures Namespaces Files Functions Variables Groups Pages
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 
5 require_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]))
23  {
25 
26  $items = array();
27 
28  // only top-level chapters
29 
30  include_once "Services/MetaData/classes/class.ilMDEducational.php";
31  $tree = new ilTree($obj_id);
32  $tree->setTableNames('lm_tree','lm_data');
33  $tree->setTreeTablePK("lm_id");
34  foreach ($tree->getChilds($tree->readRootId()) as $child)
35  {
36  if($child["type"] == "st")
37  {
38  $child["tlt"] = ilMDEducational::_getTypicalLearningTimeSeconds($obj_id, $child["obj_id"]);
39  $items[$child["obj_id"]] = $child;
40  }
41  }
42 
43  self::$possible_items[$a_ref_id] = $items;
44  }
45 
46  return self::$possible_items[$a_ref_id];
47  }
48 
49 
50  //
51  // TABLE GUI
52  //
53 
54  public function getTableGUIData($a_parent_ref_id)
55  {
56  $data = array();
57 
58  $parent_type = ilObject::_lookupType($a_parent_ref_id, true);
59  include_once './Services/Link/classes/class.ilLink.php';
60 
61  foreach ($this->getPossibleItems($a_parent_ref_id) as $item)
62  {
63  $tmp = array();
64  $tmp['id'] = $item['obj_id'];
65  $tmp['ref_id'] = 0;
66  $tmp['title'] = $item['title'];
67  $tmp['type'] = $item['type'];
68  $tmp['status'] = $this->isAssignedEntry($item['obj_id']);
69 
70  // #12158
71  $tmp['url'] = ilLink::_getLink($a_parent_ref_id, $parent_type, null, "_".$tmp['id']);
72 
74  {
75  $tmp['tlt'] = $item['tlt'];
76  }
77 
78  $data[] = $tmp;
79  }
80 
81  return $data;
82  }
83 }
84 
85 ?>