ILIAS  Release_5_0_x_branch Revision 61816
 All Data Structures Namespaces Files Functions Variables Groups Pages
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 
4 include_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;
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 
88  {
89  $this->tpl->setVariable('TYPE_IMG', ilUtil::getImagePath('icon_sco.svg'));
90  $this->tpl->setVariable('ALT_IMG', $this->lng->txt('obj_sco'));
91  }
92  else
93  {
94  if($objDefinition->isPluginTypeName($a_set["type"]))
95  {
96  $alt = ilPlugin::lookupTxt("rep_robj", $a_set['type'], "obj_".$a_set['type']);
97  }
98  else
99  {
100  $alt = $this->lng->txt('obj_' . $a_set['type']);
101  }
102  $this->tpl->setVariable('ALT_IMG', $alt);
103  $this->tpl->setVariable('TYPE_IMG', ilObject::_getIcon("", "tiny", $a_set['type']));
104 
107  {
108  $this->tpl->setVariable('COLL_LINK', ilLink::_getLink($a_set['ref_id'], $a_set['type']));
109  $this->tpl->setVariable('COLL_FRAME', ilFrameTargetInfo::_getFrame('MainContent', $a_set['type']));
110 
111  include_once './Services/Tree/classes/class.ilPathGUI.php';
112  $path = new ilPathGUI();
113  $this->tpl->setVariable('COLL_PATH', $this->lng->txt('path').': '.$path->getPath($this->getNode(),$a_set['ref_id']));
114 
115  $mode_suffix = '';
116  if($a_set['grouped'] ||
117  $a_set['group_item'])
118  {
119  // #14941
120  $mode_suffix = '_INLINE';
121 
122  if(!$a_set['group_item'])
123  {
124  $this->tpl->setVariable("COLL_MODE", "");
125  }
126  }
127 
128  $mode = $a_set['mode_id'];
130  {
131  $this->tpl->setVariable("COLL_MODE".$mode_suffix, $a_set['mode']);
132  }
133  else
134  {
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  {
140  $this->tpl->setVariable("ANONYMIZED".$mode_suffix, $this->lng->txt('trac_anonymized_info_short'));
141  }
142 
143  if($mode_suffix)
144  {
145  $this->tpl->setVariable("COLL_MODE_LABEL", $this->lng->txt("trac_mode"));
146  }
147  }
148  else
149  {
150  $this->tpl->setVariable('COLL_LINK', $a_set['url']);
151 
153  {
154  // handle tlt settings
155  $this->tpl->setCurrentBlock("tlt");
156  $this->tpl->setVariable("TXT_MONTH",$this->lng->txt('md_months'));
157  $this->tpl->setVariable("TXT_DAYS",$this->lng->txt('md_days'));
158  $this->tpl->setVariable("TXT_TIME",$this->lng->txt('md_time'));
159  $this->tpl->setVariable("TLT_HINT", '(hh:mm)');
160 
161  // seconds to units
162  $mon = floor($a_set["tlt"]/(60*60*24*30));
163  $tlt = $a_set["tlt"]%(60*60*24*30);
164  $day = floor($tlt/(60*60*24));
165  $tlt = $tlt%(60*60*24);
166  $hr = floor($tlt/(60*60));
167  $tlt = $tlt%(60*60);
168  $min = floor($tlt/60);
169 
170  $options = array();
171  for($i = 0;$i <= 24;$i++)
172  {
173  $options[$i] = sprintf('%02d',$i);
174  }
175  $this->tpl->setVariable("SEL_MONTHS",
176  ilUtil::formSelect($mon,'tlt['.$a_set['id'].'][mo]',$options,false,true));
177 
178  for($i = 0;$i <= 31;$i++)
179  {
180  $options[$i] = sprintf('%02d',$i);
181  }
182  $this->tpl->setVariable("SEL_DAYS",
183  ilUtil::formSelect($day,'tlt['.$a_set['id'].'][d]',$options,false,true));
184 
185  $this->tpl->setVariable("SEL_TLT",ilUtil::makeTimeSelect('tlt['.$a_set['id'].']',
186  true,$hr,$min,null,false));
187 
188  $this->tpl->parseCurrentBlock();
189  }
190  }
191  }
192 
193  // Assigned ?
194  $this->tpl->setVariable("ASSIGNED_IMG_OK", $a_set['status']
195  ? ilUtil::getImagePath('icon_ok.svg')
196  : ilUtil::getImagePath('icon_not_ok.svg')
197  );
198  $this->tpl->setVariable("ASSIGNED_STATUS", $a_set['status']
199  ? $this->lng->txt('trac_assigned')
200  : $this->lng->txt('trac_not_assigned')
201  );
202  $this->tpl->parseCurrentBlock();
203 
204 
205  // Parse grouped items
206  foreach((array) $a_set['grouped'] as $item)
207  {
208  $item['group_item'] = true;
209  $this->fillRow($item);
210  }
211 
212  // show num obligatory info
213  if(count($a_set['grouped']))
214  {
215  $this->tpl->setCurrentBlock('num_passed_items');
216  $this->tpl->setVariable('MIN_PASSED_TXT', $this->lng->txt('trac_min_passed'));
217  $this->tpl->setVariable('NUM_OBLIGATORY', $a_set['num_obligatory']);
218  $this->tpl->setVariable('GRP_ID', $a_set['grouping_id']);
219  $this->tpl->parseCurrentBlock();
220  }
221  }
222 
223  protected function initTable()
224  {
225  global $ilCtrl;
226 
227  $this->setFormAction($ilCtrl->getFormAction($this->getParentObject()));
228  switch($this->getMode())
229  {
232  $this->setRowTemplate('tpl.lp_collection_row.html', 'Services/Tracking');
233  $this->setTitle($this->lng->txt('trac_lp_determination'));
234  $this->setDescription($this->lng->txt('trac_lp_determination_info_crs'));
235  break;
236 
238  $this->setRowTemplate('tpl.lp_collection_row.html', 'Services/Tracking');
239  $this->setTitle($this->lng->txt('trac_lp_determination_tutor'));
240  $this->setDescription($this->lng->txt('trac_lp_determination_info_crs_tutor'));
241  break;
242 
244  $this->setRowTemplate('tpl.lp_collection_scorm_row.html', 'Services/Tracking');
245  $this->setTitle($this->lng->txt('trac_lp_determination'));
246  $this->setDescription($this->lng->txt('trac_lp_determination_info_sco'));
247  break;
248 
250  $this->setRowTemplate('tpl.lp_collection_subitem_row.html', 'Services/Tracking');
251  $this->setTitle($this->lng->txt('trac_lp_determination'));
252  $this->setDescription($this->lng->txt('trac_lp_determination_info_crs'));
253  $this->lng->loadLanguageModule("meta");
254 
255  $this->addCommandButton('updateTLT', $this->lng->txt('save'));
256  break;
257  }
258 
259  $this->addColumn('','','1px');
260  $this->addColumn($this->lng->txt('item'), 'title', '50%');
261 
262  if($this->getMode() != ilLPObjSettings::LP_MODE_SCORM &&
265  {
266  $this->addColumn($this->lng->txt('trac_mode'), 'mode');
267  }
269  {
270  $this->addColumn($this->lng->txt('meta_typical_learning_time'), 'tlt');
271  }
272 
274  {
275  $this->addMultiCommand('assign', $this->lng->txt('trac_collection_assign'));
276  $this->addMultiCommand('deassign', $this->lng->txt('trac_collection_deassign'));
277  $this->addColumn($this->lng->txt('trac_determines_learning_progress'), 'status');
278  }
279  else
280  {
281  $this->addMultiCommand('assign', $this->lng->txt('trac_manual_display'));
282  $this->addMultiCommand('deassign', $this->lng->txt('trac_manual_no_display'));
283  $this->addColumn($this->lng->txt('trac_manual_is_displayed'), 'status');
284  }
285 
286  $this->enable('select_all');
287  $this->setSelectAllCheckbox('item_ids');
288 
290  {
291  $this->addMultiCommand('groupMaterials', $this->lng->txt('trac_group_materials'));
292  }
293  }
294 }
295 
296 ?>