ILIAS  release_5-1 Revision 5.0.0-5477-g43f3e3fab5f
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';
5
13{
14 private $node_id;
15 private $mode;
16
22 public function __construct($a_parent_obj, $a_parent_cmd = "", $a_node_id, $a_mode)
23 {
24 parent::__construct($a_parent_obj, $a_parent_cmd);
25 $this->setId('lpobjs_'.$this->getNode());
26
27 $this->setShowRowsSelector(false);
28
29 $this->node_id = $a_node_id;
30 $this->mode = $a_mode;
31 }
32
37 public function getNode()
38 {
39 return $this->node_id;
40 }
41
42 public function getMode()
43 {
44 return $this->mode;
45 }
46
50 public function parse(ilLPCollection $a_collection)
51 {
52 $this->setData($a_collection->getTableGUIData($this->getNode()));
53 $this->initTable();
54
55 // grouping actions
58 {
59 $this->addMultiCommand('releaseMaterials', $this->lng->txt('trac_release_materials'));
60
61 foreach($this->row_data as $item)
62 {
63 if($item["grouped"])
64 {
65 $this->addCommandButton('saveObligatoryMaterials', $this->lng->txt('trac_group_materials_save'));
66 break;
67 }
68 }
69 }
70 }
71
76 protected function fillRow($a_set)
77 {
78 global $objDefinition, $ilAccess;
79
80 include_once './Services/Link/classes/class.ilLink.php';
81
82 $this->tpl->setCurrentBlock('item_row');
83 $this->tpl->setVariable('ITEM_ID', $a_set['id']);
84 $this->tpl->setVariable('COLL_TITLE', $a_set['title']);
85 $this->tpl->setVariable('COLL_DESC',$a_set['description']);
86
87 if($objDefinition->isPluginTypeName($a_set["type"]))
88 {
89 $alt = ilPlugin::lookupTxt("rep_robj", $a_set['type'], "obj_".$a_set['type']);
90 }
91 else
92 {
93 $alt = $this->lng->txt('obj_' . $a_set['type']);
94 }
95 $this->tpl->setVariable('ALT_IMG', $alt);
96 $this->tpl->setVariable('TYPE_IMG', ilObject::_getIcon("", "tiny", $a_set['type']));
97
100 {
101 if($a_set['ref_id'])
102 {
103 $this->tpl->setVariable('COLL_LINK', ilLink::_getLink($a_set['ref_id'], $a_set['type']));
104 $this->tpl->setVariable('COLL_FRAME', ilFrameTargetInfo::_getFrame('MainContent', $a_set['type']));
105
106 include_once './Services/Tree/classes/class.ilPathGUI.php';
107 $path = new ilPathGUI();
108 $this->tpl->setVariable('COLL_PATH', $this->lng->txt('path').': '.$path->getPath($this->getNode(),$a_set['ref_id']));
109
110 $mode_suffix = '';
111 if($a_set['grouped'] ||
112 $a_set['group_item'])
113 {
114 // #14941
115 $mode_suffix = '_INLINE';
116
117 if(!$a_set['group_item'])
118 {
119 $this->tpl->setVariable("COLL_MODE", "");
120 }
121 }
122 include_once './Services/Tracking/classes/class.ilLearningProgressAccess.php';
123 if(ilLearningProgressAccess::checkPermission('edit_learning_progress', $a_set['ref_id']))
124 {
125 $lp_settings_link = ilLink::_getLink($a_set['ref_id'], $a_set['type'], array('gotolp'=>1));
126 $a_set["mode"] = '<a href="'.$lp_settings_link.'">'.$a_set['mode'].'</a>'; // :TODO: il_ItemAlertProperty?
127 }
128
129 $mode = $a_set['mode_id'];
131 {
132 $this->tpl->setVariable("COLL_MODE".$mode_suffix, $a_set['mode']);
133 }
134 else
135 {
136 $this->tpl->setVariable("COLL_MODE".$mode_suffix, "");
137 $this->tpl->setVariable("COLL_MODE_DEACTIVATED".$mode_suffix, $a_set['mode']);
138 }
139 if($a_set["anonymized"])
140 {
141 $this->tpl->setVariable("ANONYMIZED".$mode_suffix, $this->lng->txt('trac_anonymized_info_short'));
142 }
143
144 if($mode_suffix)
145 {
146 $this->tpl->setVariable("COLL_MODE_LABEL", $this->lng->txt("trac_mode"));
147 }
148 }
149 }
150 else
151 {
152 $this->tpl->setVariable('COLL_LINK', $a_set['url']);
153
155 {
156 // handle tlt settings
157 $this->tpl->setCurrentBlock("tlt");
158 $this->tpl->setVariable("TXT_MONTH",$this->lng->txt('md_months'));
159 $this->tpl->setVariable("TXT_DAYS",$this->lng->txt('md_days'));
160 $this->tpl->setVariable("TXT_TIME",$this->lng->txt('md_time'));
161 $this->tpl->setVariable("TLT_HINT", '(hh:mm)');
162
163 // seconds to units
164 $mon = floor($a_set["tlt"]/(60*60*24*30));
165 $tlt = $a_set["tlt"]%(60*60*24*30);
166 $day = floor($tlt/(60*60*24));
167 $tlt = $tlt%(60*60*24);
168 $hr = floor($tlt/(60*60));
169 $tlt = $tlt%(60*60);
170 $min = floor($tlt/60);
171
172 $options = array();
173 for($i = 0;$i <= 24;$i++)
174 {
175 $options[$i] = sprintf('%02d',$i);
176 }
177 $this->tpl->setVariable("SEL_MONTHS",
178 ilUtil::formSelect($mon,'tlt['.$a_set['id'].'][mo]',$options,false,true));
179
180 for($i = 0;$i <= 31;$i++)
181 {
182 $options[$i] = sprintf('%02d',$i);
183 }
184 $this->tpl->setVariable("SEL_DAYS",
185 ilUtil::formSelect($day,'tlt['.$a_set['id'].'][d]',$options,false,true));
186
187 $this->tpl->setVariable("SEL_TLT",ilUtil::makeTimeSelect('tlt['.$a_set['id'].']',
188 true,$hr,$min,null,false));
189
190 $this->tpl->parseCurrentBlock();
191 }
192 }
193
194 // Assigned ?
195 $this->tpl->setVariable("ASSIGNED_IMG_OK", $a_set['status']
196 ? ilUtil::getImagePath('icon_ok.svg')
197 : ilUtil::getImagePath('icon_not_ok.svg')
198 );
199 $this->tpl->setVariable("ASSIGNED_STATUS", $a_set['status']
200 ? $this->lng->txt('trac_assigned')
201 : $this->lng->txt('trac_not_assigned')
202 );
203 $this->tpl->parseCurrentBlock();
204
205
206 // Parse grouped items
207 foreach((array) $a_set['grouped'] as $item)
208 {
209 $item['group_item'] = true;
210 $this->fillRow($item);
211 }
212
213 // show num obligatory info
214 if(count($a_set['grouped']))
215 {
216 $this->tpl->setCurrentBlock('num_passed_items');
217 $this->tpl->setVariable('MIN_PASSED_TXT', $this->lng->txt('trac_min_passed'));
218 $this->tpl->setVariable('NUM_OBLIGATORY', $a_set['num_obligatory']);
219 $this->tpl->setVariable('GRP_ID', $a_set['grouping_id']);
220 $this->tpl->parseCurrentBlock();
221 }
222 }
223
224 protected function initTable()
225 {
226 global $ilCtrl;
227
228 $this->setFormAction($ilCtrl->getFormAction($this->getParentObject()));
229 switch($this->getMode())
230 {
233 $this->setRowTemplate('tpl.lp_collection_row.html', 'Services/Tracking');
234 $this->setTitle($this->lng->txt('trac_lp_determination'));
235 $this->setDescription($this->lng->txt('trac_lp_determination_info_crs'));
236 break;
237
239 $this->setRowTemplate('tpl.lp_collection_row.html', 'Services/Tracking');
240 $this->setTitle($this->lng->txt('trac_lp_determination_tutor'));
241 $this->setDescription($this->lng->txt('trac_lp_determination_info_crs_tutor'));
242 break;
243
245 $this->setRowTemplate('tpl.lp_collection_scorm_row.html', 'Services/Tracking');
246 $this->setTitle($this->lng->txt('trac_lp_determination'));
247 $this->setDescription($this->lng->txt('trac_lp_determination_info_sco'));
248 break;
249
251 $this->setRowTemplate('tpl.lp_collection_subitem_row.html', 'Services/Tracking');
252 $this->setTitle($this->lng->txt('trac_lp_determination'));
253 $this->setDescription($this->lng->txt('trac_lp_determination_info_crs'));
254 $this->lng->loadLanguageModule("meta");
255
256 $this->addCommandButton('updateTLT', $this->lng->txt('save'));
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_mob'));
263 break;
264 }
265
266 $this->addColumn('','','1px');
267 $this->addColumn($this->lng->txt('item'), 'title', '50%');
268
273 {
274 $this->addColumn($this->lng->txt('trac_mode'), 'mode');
275 }
277 {
278 $this->addColumn($this->lng->txt('meta_typical_learning_time'), 'tlt');
279 }
280
282 {
283 $this->addMultiCommand('assign', $this->lng->txt('trac_collection_assign'));
284 $this->addMultiCommand('deassign', $this->lng->txt('trac_collection_deassign'));
285 $this->addColumn($this->lng->txt('trac_determines_learning_progress'), 'status');
286 }
287 else
288 {
289 $this->addMultiCommand('assign', $this->lng->txt('trac_manual_display'));
290 $this->addMultiCommand('deassign', $this->lng->txt('trac_manual_no_display'));
291 $this->addColumn($this->lng->txt('trac_manual_is_displayed'), 'status');
292 }
293
294 $this->enable('select_all');
295 $this->setSelectAllCheckbox('item_ids');
296
298 {
299 $this->addMultiCommand('groupMaterials', $this->lng->txt('trac_group_materials'));
300 }
301 }
302}
303
304?>
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 _lookupObjId($a_id)
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.
static lookupTxt($a_mod_prefix, $a_pl_id, $a_lang_var)
Lookup language text.
Class ilTable2GUI.
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.
setShowRowsSelector($a_value)
Toggle rows-per-page selector.
setTitle($a_title, $a_icon=0, $a_icon_alt=0)
Set title and title icon.
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.
setSelectAllCheckbox($a_select_all_checkbox)
Set the name of the checkbox that should be toggled with a select all button.
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
$path
Definition: index.php:22
if(!is_array($argv)) $options