ILIAS  release_5-3 Revision v5.3.23-19-g915713cf615
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
4include_once('./Services/Table/classes/class.ilTable2GUI.php');
13{
15 protected $material_items;
16
17 public function __construct($a_parent_obj, $a_parent_cmd)
18 {
19 global $ilCtrl, $lng, $tree;
20
21 $this->setId("sess_materials_" . $a_parent_obj->object->getId());
22
23 parent::__construct($a_parent_obj, $a_parent_cmd);
24
25 $this->parent_ref_id = $tree->getParentId($a_parent_obj->object->getRefId());
26
27 //$this->setEnableNumInfo(false);
28 //$this->setLimit(100);
29 $this->setRowTemplate("tpl.session_materials_row.html", "Modules/Session");
30
31 $this->setFormName('materials');
32 $this->setFormAction($ilCtrl->getFormAction($a_parent_obj, $a_parent_cmd));
33 $this->addCommandButton("saveMaterials", $lng->txt("save"));
34
35 $this->addColumn("", "f", 1);
36 $this->addColumn($lng->txt("crs_materials"), "object", "90%");
37 $this->addColumn($lng->txt("status"), "active", 5);
38 $this->setSelectAllCheckbox('items');
39
40 $this->lng->loadLanguageModule('sess');
41 }
42
46 public function getDataFromDb()
47 {
48 global $tree, $objDefinition;
49
50
51 $nodes = $tree->getSubTree($tree->getNodeData($this->parent_ref_id));
52 $materials = array();
53
54 foreach ($nodes as $node) {
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 continue;
60 }
61
62 if ($node['type'] == 'rolf') {
63 continue;
64 }
65
66 $node["sorthash"] = (int) (!in_array($node['ref_id'], $this->getMaterialItems())) . $node["title"];
67 $materials[] = $node;
68 }
69
70 $materials = ilUtil::sortArray($materials, "sorthash", "ASC");
71 $this->setData($materials);
72 }
73
77 protected function fillRow($a_set)
78 {
79 $this->tpl->setVariable('TYPE_IMG', ilObject::_getIcon('', 'tiny', $a_set['type']));
80 $this->tpl->setVariable('IMG_ALT', $this->lng->txt('obj_' . $a_set['type']));
81
82 $this->tpl->setVariable("VAL_POSTNAME", "items");
83 $this->tpl->setVariable("VAL_ID", $a_set['ref_id']);
84
85 if (in_array($a_set['ref_id'], $this->getMaterialItems())) {
86 $this->tpl->setVariable("VAL_CHECKED", "checked");
87 }
88
89 $this->tpl->setVariable("COLL_TITLE", $a_set['title']);
90
91 if (strlen($a_set['description'])) {
92 $this->tpl->setVariable("COLL_DESC", $a_set['description']);
93 }
94 $this->tpl->setVariable("ASSIGNED_IMG_OK", in_array($a_set['ref_id'], $this->getMaterialItems()) ?
95 ilUtil::getImagePath('icon_ok.svg') :
96 ilUtil::getImagePath('icon_not_ok.svg'));
97
98 $this->tpl->setVariable(
99 'ASSIGNED_STATUS',
100 in_array($a_set['ref_id'], $this->getMaterialItems()) ?
101 $this->lng->txt('sess_material_assigned') :
102 $this->lng->txt('sess_material_not_assigned')
103 );
104
105 include_once('./Services/Tree/classes/class.ilPathGUI.php');
106 $path = new ilPathGUI();
107 $path->enableDisplayCut(true);
108 $path->enableTextOnly(false);
109 $this->tpl->setVariable("COLL_PATH", $path->getPath($this->getContainerRefId(), $a_set['ref_id']));
110 }
111
116 public function setMaterialItems($a_set)
117 {
118 $this->material_items = $a_set;
119 }
120
125 public function getMaterialItems()
126 {
128 }
129
134 public function setContainerRefId($a_set)
135 {
136 $this->container_ref_id = $a_set;
137 }
138
143 public function getContainerRefId()
144 {
146 }
147}
An exception for terminatinating execution or to throw for unit testing.
static _getIcon( $a_obj_id="", $a_size="big", $a_type="", $a_offline=false)
Get icon for repository item.
Creates a path for a start and endnode.
setContainerRefId($a_set)
Set Mcontainer ref id.
__construct($a_parent_obj, $a_parent_cmd)
Constructor.
getDataFromDb()
Get data and put it into an array.
fillRow($a_set)
Fill a single data row.
Class ilTable2GUI.
setData($a_data)
set table data @access public
setRowTemplate($a_template, $a_template_dir="")
Set row template.
setSelectAllCheckbox($a_select_all_checkbox)
Set the name of the checkbox that should be toggled with a select all button.
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.
setId($a_val)
Set id.
setFormName($a_formname="")
Set Form name.
setFormAction($a_form_action, $a_multipart=false)
Set Form action parameter.
addCommandButton($a_cmd, $a_text, $a_onclick='', $a_id="", $a_class=null)
Add Command button.
static sortArray( $array, $a_array_sortby, $a_array_sortorder=0, $a_numeric=false, $a_keep_keys=false)
sortArray
static getImagePath($img, $module_path="", $mode="output", $offline=false)
get image path (for images located in a template directory)
global $ilCtrl
Definition: ilias.php:18