ILIAS  release_6 Revision v6.24-5-g0c8bfefb3b8
class.ilLPCollectionSettingsTableGUI.php
Go to the documentation of this file.
1<?php
2/* Copyright (c) 1998-2009 ILIAS open source, Extended GPL, see docs/LICENSE */
3
4include_once './Services/Table/classes/class.ilTable2GUI.php';
5require_once('./Services/Repository/classes/class.ilObjectPlugin.php');
6
14{
15 private $node_id;
16 private $mode;
17
23 public function __construct($a_parent_obj, $a_parent_cmd = "", $a_node_id, $a_mode)
24 {
25 parent::__construct($a_parent_obj, $a_parent_cmd);
26 $this->setId('lpobjs_' . $this->getNode());
27
28 $this->setShowRowsSelector(false);
29
30 $this->node_id = $a_node_id;
31 $this->mode = $a_mode;
32 }
33
38 public function getNode()
39 {
40 return $this->node_id;
41 }
42
43 public function getMode()
44 {
45 return $this->mode;
46 }
47
51 public function parse(ilLPCollection $a_collection)
52 {
53 $this->setData($a_collection->getTableGUIData($this->getNode()));
54 $this->initTable();
55
56 // grouping actions
59 $this->addMultiCommand('releaseMaterials', $this->lng->txt('trac_release_materials'));
60
61 foreach ($this->row_data as $item) {
62 if ($item["grouped"]) {
63 $this->addCommandButton('saveObligatoryMaterials', $this->lng->txt('trac_group_materials_save'));
64 break;
65 }
66 }
67 }
68 }
69
74 protected function fillRow($a_set)
75 {
76 global $DIC;
77
78 $objDefinition = $DIC['objDefinition'];
79 $ilAccess = $DIC['ilAccess'];
80
81 include_once './Services/Link/classes/class.ilLink.php';
82
83 $this->tpl->setCurrentBlock('item_row');
84 $this->tpl->setVariable('ITEM_ID', $a_set['id']);
85 $this->tpl->setVariable('COLL_TITLE', $a_set['title']);
86 $this->tpl->setVariable('COLL_DESC', $a_set['description']);
87
88 if ($objDefinition->isPluginTypeName($a_set["type"])) {
89 $alt = ilObjectPlugin::lookupTxtById($a_set['type'], "obj_" . $a_set['type']);
90 } else {
91 $alt = $this->lng->txt('obj_' . $a_set['type']);
92 }
93 $this->tpl->setVariable('ALT_IMG', $alt);
94 $this->tpl->setVariable(
95 'TYPE_IMG',
96 ilObject::_getIcon(
97 $a_set['obj_id'],
98 'tiny',
99 $a_set['type']
100 )
101 );
102
103 if (
106 if ($a_set['ref_id']) {
107 $this->tpl->setVariable('COLL_LINK', ilLink::_getLink($a_set['ref_id'], $a_set['type']));
108 $this->tpl->setVariable('COLL_FRAME', ilFrameTargetInfo::_getFrame('MainContent', $a_set['type']));
109
110 include_once './Services/Tree/classes/class.ilPathGUI.php';
111 $path = new ilPathGUI();
112 $this->tpl->setVariable('COLL_PATH', $this->lng->txt('path') . ': ' . $path->getPath($this->getNode(), $a_set['ref_id']));
113
114 $mode_suffix = '';
115 if (
116 $a_set['grouped'] ||
117 $a_set['group_item']) {
118 // #14941
119 $mode_suffix = '_INLINE';
120
121 if (!$a_set['group_item']) {
122 $this->tpl->setVariable("COLL_MODE", "");
123 }
124 }
125 include_once './Services/Tracking/classes/class.ilLearningProgressAccess.php';
126 if (ilLearningProgressAccess::checkPermission('edit_learning_progress', $a_set['ref_id'])) {
127 $lp_settings_link = ilLink::_getLink($a_set['ref_id'], $a_set['type'], array('gotolp' => 1));
128 $a_set["mode"] = '<a href="' . $lp_settings_link . '">' . $a_set['mode'] . '</a>'; // :TODO: il_ItemAlertProperty?
129 }
130
131 $mode = $a_set['mode_id'];
133 $this->tpl->setVariable("COLL_MODE" . $mode_suffix, $a_set['mode']);
134 } else {
135 $this->tpl->setVariable("COLL_MODE" . $mode_suffix, "");
136 $this->tpl->setVariable("COLL_MODE_DEACTIVATED" . $mode_suffix, $a_set['mode']);
137 }
138 if ($a_set["anonymized"]) {
139 $this->tpl->setVariable("ANONYMIZED" . $mode_suffix, $this->lng->txt('trac_anonymized_info_short'));
140 }
141
142 if ($mode_suffix) {
143 $this->tpl->setVariable("COLL_MODE_LABEL", $this->lng->txt("trac_mode"));
144 }
145 }
146 } else {
147 $this->tpl->setVariable('COLL_LINK', $a_set['url']);
148
150 // handle tlt settings
151 $this->tpl->setCurrentBlock("tlt");
152 $this->tpl->setVariable("TXT_MONTH", $this->lng->txt('md_months'));
153 $this->tpl->setVariable("TXT_DAYS", $this->lng->txt('md_days'));
154 $this->tpl->setVariable("TXT_TIME", $this->lng->txt('md_time'));
155 $this->tpl->setVariable("TLT_HINT", '(hh:mm)');
156
157 // seconds to units
158 $mon = floor($a_set["tlt"] / (60 * 60 * 24 * 30));
159 $tlt = $a_set["tlt"] % (60 * 60 * 24 * 30);
160 $day = floor($tlt / (60 * 60 * 24));
161 $tlt = $tlt % (60 * 60 * 24);
162 $hr = floor($tlt / (60 * 60));
163 $tlt = $tlt % (60 * 60);
164 $min = floor($tlt / 60);
165
166 $options = array();
167 for ($i = 0;$i <= 24;$i++) {
168 $options[$i] = sprintf('%02d', $i);
169 }
170 $this->tpl->setVariable(
171 "SEL_MONTHS",
172 ilUtil::formSelect($mon, 'tlt[' . $a_set['id'] . '][mo]', $options, false, true)
173 );
174
175 for ($i = 0;$i <= 31;$i++) {
176 $options[$i] = sprintf('%02d', $i);
177 }
178 $this->tpl->setVariable(
179 "SEL_DAYS",
180 ilUtil::formSelect($day, 'tlt[' . $a_set['id'] . '][d]', $options, false, true)
181 );
182
183 $this->tpl->setVariable("SEL_TLT", ilUtil::makeTimeSelect(
184 'tlt[' . $a_set['id'] . ']',
185 true,
186 $hr,
187 $min,
188 null,
189 false
190 ));
191
192 $this->tpl->parseCurrentBlock();
193 }
194 }
195
196 // Assigned ?
197 $this->tpl->setVariable(
198 "ASSIGNED_IMG_OK",
199 $a_set['status']
200 ? ilUtil::getImagePath('icon_ok.svg')
201 : ilUtil::getImagePath('icon_not_ok.svg')
202 );
203 $this->tpl->setVariable(
204 "ASSIGNED_STATUS",
205 $a_set['status']
206 ? $this->lng->txt('trac_assigned')
207 : $this->lng->txt('trac_not_assigned')
208 );
209 $this->tpl->parseCurrentBlock();
210
211
212 // Parse grouped items
213 foreach ((array) $a_set['grouped'] as $item) {
214 $item['group_item'] = true;
215 $this->fillRow($item);
216 }
217
218 // show num obligatory info
219 if (
220 is_array($a_set) &&
221 array_key_exists('grouped', $a_set) &&
222 count($a_set['grouped'])
223 ) {
224 $this->tpl->setCurrentBlock('num_passed_items');
225 $this->tpl->setVariable('MIN_PASSED_TXT', $this->lng->txt('trac_min_passed'));
226 $this->tpl->setVariable('NUM_OBLIGATORY', $a_set['num_obligatory']);
227 $this->tpl->setVariable('GRP_ID', $a_set['grouping_id']);
228 $this->tpl->parseCurrentBlock();
229 }
230 }
231
232 protected function initTable()
233 {
234 global $DIC;
235
236 $ilCtrl = $DIC['ilCtrl'];
237
238 $this->setFormAction($ilCtrl->getFormAction($this->getParentObject()));
239 switch ($this->getMode()) {
242 $this->setRowTemplate('tpl.lp_collection_row.html', 'Services/Tracking');
243 $this->setTitle($this->lng->txt('trac_lp_determination'));
244 $this->setDescription($this->lng->txt('trac_lp_determination_info_crs'));
245 break;
246
248 $this->setRowTemplate('tpl.lp_collection_row.html', 'Services/Tracking');
249 $this->setTitle($this->lng->txt('trac_lp_determination_tutor'));
250 $this->setDescription($this->lng->txt('trac_lp_determination_info_crs_tutor'));
251 break;
252
254 $this->setRowTemplate('tpl.lp_collection_scorm_row.html', 'Services/Tracking');
255 $this->setTitle($this->lng->txt('trac_lp_determination'));
256 $this->setDescription($this->lng->txt('trac_lp_determination_info_sco'));
257 break;
258
260 $this->setRowTemplate('tpl.lp_collection_subitem_row.html', 'Services/Tracking');
261 $this->setTitle($this->lng->txt('trac_lp_determination'));
262 $this->setDescription($this->lng->txt('trac_lp_determination_info_crs'));
263 $this->lng->loadLanguageModule("meta");
264
265 $this->addCommandButton('updateTLT', $this->lng->txt('save'));
266 break;
267
269 $this->setRowTemplate('tpl.lp_collection_subitem_row.html', 'Services/Tracking');
270 $this->setTitle($this->lng->txt('trac_lp_determination'));
271 $this->setDescription($this->lng->txt('trac_lp_determination_info_mob'));
272 break;
273 }
274
275 $this->addColumn('', '', '1px');
276 $this->addColumn($this->lng->txt('item'), 'title', '50%');
277
278 if ($this->getMode() != ilLPObjSettings::LP_MODE_SCORM &&
282 $this->addColumn($this->lng->txt('trac_mode'), 'mode');
283 } elseif ($this->getMode() == ilLPObjSettings::LP_MODE_COLLECTION_TLT) {
284 $this->addColumn($this->lng->txt('meta_typical_learning_time'), 'tlt');
285 }
286
288 $this->addMultiCommand('assign', $this->lng->txt('trac_collection_assign'));
289 $this->addMultiCommand('deassign', $this->lng->txt('trac_collection_deassign'));
290 $this->addColumn($this->lng->txt('trac_determines_learning_progress'), 'status');
291 } else {
292 $this->addMultiCommand('assign', $this->lng->txt('trac_manual_display'));
293 $this->addMultiCommand('deassign', $this->lng->txt('trac_manual_no_display'));
294 $this->addColumn($this->lng->txt('trac_manual_is_displayed'), 'status');
295 }
296
297 $this->enable('select_all');
298 $this->setSelectAllCheckbox('item_ids');
299
301 $this->addMultiCommand('groupMaterials', $this->lng->txt('trac_group_materials'));
302 }
303 }
304}
An exception for terminatinating execution or to throw for unit testing.
static _getFrame($a_class, $a_type='')
Get content frame name.
parse(ilLPCollection $a_collection)
Read and parse items.
__construct($a_parent_obj, $a_parent_cmd="", $a_node_id, $a_mode)
Constructor.
getNode()
Get node id of current learning progress item.
LP collection base class.
static checkPermission($a_permission, $a_ref_id, $a_user_id=null)
wrapper for rbac access checks
static lookupTxtById($plugin_id, $lang_var)
static _lookupObjId($a_id)
Creates a path for a start and endnode.
Class ilTable2GUI.
setShowRowsSelector($a_value)
Toggle rows-per-page selector.
setTitle($a_title, $a_icon=0, $a_icon_alt=0)
Set title and title icon.
setSelectAllCheckbox($a_select_all_checkbox, $a_select_all_on_top=false)
Set the name of the checkbox that should be toggled with a select all button.
setData($a_data)
set table data @access public
setRowTemplate($a_template, $a_template_dir="")
Set row template.
addMultiCommand($a_cmd, $a_text)
Add Command 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.
setDescription($a_val)
Set description.
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.
enable($a_module_name)
enables particular modules of table
static formSelect( $selected, $varname, $options, $multiple=false, $direct_text=false, $size="0", $style_class="", $attribs="", $disabled=false)
Builds a select form field with options and shows the selected option first.
static getImagePath($img, $module_path="", $mode="output", $offline=false)
get image path (for images located in a template directory)
static makeTimeSelect($prefix, $short=true, $hour="", $minute="", $second="", $a_use_default=true, $a_further_options=array())
Creates a combination of HTML selects for time inputs.
global $ilCtrl
Definition: ilias.php:18
$i
Definition: metadata.php:24
__construct(Container $dic, ilPlugin $plugin)
@inheritDoc
$DIC
Definition: xapitoken.php:46