ILIAS  release_5-1 Revision 5.0.0-5477-g43f3e3fab5
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 }
addCommandButton($a_cmd, $a_text, $a_onclick='', $a_id="", $a_class=null)
Add Command button.
Creates a path for a start and endnode.
static _getIcon($a_obj_id="", $a_size="big", $a_type="", $a_offline=false)
Get icon for repository item.
setFormName($a_formname)
Set Form name.
static sortArray($array, $a_array_sortby, $a_array_sortorder=0, $a_numeric=false, $a_keep_keys=false)
sortArray
setId($a_val)
Set id.
setContainerRefId($a_set)
Set Mcontainer ref id.
global $ilCtrl
Definition: ilias.php:18
Class ilTable2GUI.
static getImagePath($img, $module_path="", $mode="output", $offline=false)
get image path (for images located in a template directory)
__construct($a_parent_obj, $a_parent_cmd)
getDataFromDb()
Get data and put it into an array.
setRowTemplate($a_template, $a_template_dir="")
Set row template.
setFormAction($a_form_action, $a_multipart=false)
Set Form action parameter.
fillRow($a_set)
Fill a single data row.
global $lng
Definition: privfeed.php:40
$path
Definition: index.php:22
setSelectAllCheckbox($a_select_all_checkbox)
Set the name of the checkbox that should be toggled with a select all button.
setMaterialItems($a_set)
Set Material Items.
addColumn($a_text, $a_sort_field="", $a_width="", $a_is_checkbox_action_column=false, $a_class="", $a_tooltip="", $a_tooltip_with_html=false)
Add a column to the header.