ILIAS  Release_5_0_x_branch Revision 61816
 All Data Structures Namespaces Files Functions Variables Groups Pages
class.ilSessionMaterialsTableGUI.php
Go to the documentation of this file.
1 <?php
2 /* Copyright (c) 1998-2010 ILIAS open source, Extended GPL, see docs/LICENSE */
3 
4 include_once('./Services/Table/classes/class.ilTable2GUI.php');
13 {
14 
15  protected $container_ref_id;
16  protected $material_items;
17 
18  function __construct($a_parent_obj, $a_parent_cmd)
19  {
20  global $ilCtrl, $lng, $tree;
21 
22  $this->setId("sess_materials_".$a_parent_obj->object->getId());
23 
24  parent::__construct($a_parent_obj, $a_parent_cmd);
25 
26  $this->parent_ref_id = $tree->getParentId($a_parent_obj->object->getRefId());
27 
28  //$this->setEnableNumInfo(false);
29  //$this->setLimit(100);
30  $this->setRowTemplate("tpl.session_materials_row.html","Modules/Session");
31 
32  $this->setFormName('materials');
33  $this->setFormAction($ilCtrl->getFormAction($a_parent_obj,$a_parent_cmd));
34  $this->addCommandButton("saveMaterials", $lng->txt("save"));
35 
36  $this->addColumn("", "f", 1);
37  $this->addColumn($lng->txt("crs_materials"), "object", "90%" );
38  $this->addColumn($lng->txt("status"), "active", 5);
39  $this->setSelectAllCheckbox('items');
40  }
41 
45  function getDataFromDb()
46  {
47  global $tree, $objDefinition;
48 
49 
50  $nodes = $tree->getSubTree($tree->getNodeData($this->parent_ref_id));
51  $materials = array();
52 
53  foreach($nodes as $node)
54  {
55  // No side blocks here
56  if ($node['child'] == $this->parent_ref_id ||
57  $objDefinition->isSideBlock($node['type']) ||
58  in_array($node['type'], array('sess', 'itgr', 'rolf')))
59  {
60  continue;
61  }
62 
63  if($node['type'] == 'rolf')
64  {
65  continue;
66  }
67 
68  $node["sorthash"] = (int)(!in_array($node['ref_id'],$this->getMaterialItems())).$node["title"];
69  $materials[] = $node;
70  }
71 
72  $materials = ilUtil::sortArray($materials, "sorthash", "ASC");
73  $this->setData($materials);
74  }
75 
79  protected function fillRow($a_set)
80  {
81  $this->tpl->setVariable('TYPE_IMG', ilObject::_getIcon('', 'tiny', $a_set['type']));
82  $this->tpl->setVariable('IMG_ALT',$this->lng->txt('obj_'.$a_set['type']));
83 
84  $this->tpl->setVariable("VAL_POSTNAME","items");
85  $this->tpl->setVariable("VAL_ID",$a_set['ref_id']);
86 
87  if(in_array($a_set['ref_id'],$this->getMaterialItems()))
88  {
89  $this->tpl->setVariable("VAL_CHECKED","checked");
90  }
91 
92  $this->tpl->setVariable("COLL_TITLE",$a_set['title']);
93 
94  if(strlen($a_set['description']))
95  {
96  $this->tpl->setVariable("COLL_DESC",$a_set['description']);
97  }
98  $this->tpl->setVariable("ASSIGNED_IMG_OK",in_array($a_set['ref_id'],$this->getMaterialItems()) ?
99  ilUtil::getImagePath('icon_ok.svg') :
100  ilUtil::getImagePath('icon_not_ok.svg'));
101  $this->tpl->setVariable("ASSIGNED_STATUS",$this->lng->txt('event_material_assigned'));
102 
103  include_once('./Services/Tree/classes/class.ilPathGUI.php');
104  $path = new ilPathGUI();
105  $path->enableDisplayCut(true);
106  $path->enableTextOnly(false);
107  $this->tpl->setVariable("COLL_PATH",$path->getPath($this->getContainerRefId(), $a_set['ref_id']));
108  }
109 
114  public function setMaterialItems($a_set)
115  {
116  $this->material_items = $a_set;
117  }
118 
123  public function getMaterialItems()
124  {
125  return $this->material_items;
126  }
127 
132  public function setContainerRefId($a_set)
133  {
134  $this->container_ref_id = $a_set;
135  }
136 
141  public function getContainerRefId()
142  {
144  }
145 
146 }