ILIAS  Release_4_4_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->node_id = $a_node_id;
28  $this->mode = $a_mode;
29  }
30 
35  public function getNode()
36  {
37  return $this->node_id;
38  }
39 
40  public function getMode()
41  {
42  return $this->mode;
43  }
44 
48  public function parse(ilLPCollection $a_collection)
49  {
50  $this->setData($a_collection->getTableGUIData($this->getNode()));
51  $this->initTable();
52 
53  // grouping actions
56  {
57  $this->addMultiCommand('releaseMaterials', $this->lng->txt('trac_release_materials'));
58 
59  foreach($this->row_data as $item)
60  {
61  if($item["grouped"])
62  {
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 $objDefinition;
77 
78  include_once './Services/Link/classes/class.ilLink.php';
79 
80  $this->tpl->setCurrentBlock('item_row');
81  $this->tpl->setVariable('ITEM_ID', $a_set['id']);
82  $this->tpl->setVariable('COLL_TITLE', $a_set['title']);
83  $this->tpl->setVariable('COLL_DESC',$a_set['description']);
84 
86  {
87  $this->tpl->setVariable('TYPE_IMG', ilUtil::getImagePath('icon_sco_s.png'));
88  $this->tpl->setVariable('ALT_IMG', $this->lng->txt('obj_sco'));
89  }
90  else
91  {
92  if($objDefinition->isPluginTypeName($a_set["type"]))
93  {
94  $alt = ilPlugin::lookupTxt("rep_robj", $a_set['type'], "obj_".$a_set['type']);
95  }
96  else
97  {
98  $alt = $this->lng->txt('obj_' . $a_set['type']);
99  }
100  $this->tpl->setVariable('ALT_IMG', $alt);
101  $this->tpl->setVariable('TYPE_IMG', ilObject::_getIcon("", "tiny", $a_set['type']));
102 
105  {
106  $this->tpl->setVariable('COLL_LINK', ilLink::_getLink($a_set['ref_id'], $a_set['type']));
107  $this->tpl->setVariable('COLL_FRAME', ilFrameTargetInfo::_getFrame('MainContent', $a_set['type']));
108 
109  include_once './Services/Tree/classes/class.ilPathGUI.php';
110  $path = new ilPathGUI();
111  $this->tpl->setVariable('COLL_PATH', $this->lng->txt('path').': '.$path->getPath($this->getNode(),$a_set['ref_id']));
112 
113  $mode = $a_set['mode_id'];
115  {
116  $this->tpl->setVariable("COLL_MODE", $a_set['mode']);
117  }
118  else
119  {
120  $this->tpl->setVariable("COLL_MODE", "");
121  $this->tpl->setVariable("COLL_MODE_DEACTIVATED", $a_set['mode']);
122  }
123  if($a_set["anonymized"])
124  {
125  $this->tpl->setVariable("ANONYMIZED", $this->lng->txt('trac_anonymized_info_short'));
126  }
127  }
128  else
129  {
130  $this->tpl->setVariable('COLL_LINK', $a_set['url']);
131 
133  {
134  // handle tlt settings
135  $this->tpl->setCurrentBlock("tlt");
136  $this->tpl->setVariable("TXT_MONTH",$this->lng->txt('md_months'));
137  $this->tpl->setVariable("TXT_DAYS",$this->lng->txt('md_days'));
138  $this->tpl->setVariable("TXT_TIME",$this->lng->txt('md_time'));
139  $this->tpl->setVariable("TLT_HINT", '(hh:mm)');
140 
141  // seconds to units
142  $mon = floor($a_set["tlt"]/(60*60*24*30));
143  $tlt = $a_set["tlt"]%(60*60*24*30);
144  $day = floor($tlt/(60*60*24));
145  $tlt = $tlt%(60*60*24);
146  $hr = floor($tlt/(60*60));
147  $tlt = $tlt%(60*60);
148  $min = floor($tlt/60);
149 
150  $options = array();
151  for($i = 0;$i <= 24;$i++)
152  {
153  $options[$i] = sprintf('%02d',$i);
154  }
155  $this->tpl->setVariable("SEL_MONTHS",
156  ilUtil::formSelect($mon,'tlt['.$a_set['id'].'][mo]',$options,false,true));
157 
158  for($i = 0;$i <= 31;$i++)
159  {
160  $options[$i] = sprintf('%02d',$i);
161  }
162  $this->tpl->setVariable("SEL_DAYS",
163  ilUtil::formSelect($day,'tlt['.$a_set['id'].'][d]',$options,false,true));
164 
165  $this->tpl->setVariable("SEL_TLT",ilUtil::makeTimeSelect('tlt['.$a_set['id'].']',
166  true,$hr,$min,null,false));
167 
168  $this->tpl->parseCurrentBlock();
169  }
170  }
171  }
172 
173  // Assigned ?
174  $this->tpl->setVariable("ASSIGNED_IMG_OK", $a_set['status']
175  ? ilUtil::getImagePath('icon_ok.png')
176  : ilUtil::getImagePath('icon_not_ok.png')
177  );
178  $this->tpl->setVariable("ASSIGNED_STATUS", $a_set['status']
179  ? $this->lng->txt('trac_assigned')
180  : $this->lng->txt('trac_not_assigned')
181  );
182  $this->tpl->parseCurrentBlock();
183 
184 
185  // Parse grouped items
186  foreach((array) $a_set['grouped'] as $item)
187  {
188  $this->fillRow($item);
189  }
190 
191  // show num obligatory info
192  if(count($a_set['grouped']))
193  {
194  $this->tpl->setCurrentBlock('num_passed_items');
195  $this->tpl->setVariable('MIN_PASSED_TXT', $this->lng->txt('trac_min_passed'));
196  $this->tpl->setVariable('NUM_OBLIGATORY', $a_set['num_obligatory']);
197  $this->tpl->setVariable('GRP_ID', $a_set['grouping_id']);
198  $this->tpl->parseCurrentBlock();
199  }
200  }
201 
202  protected function initTable()
203  {
204  global $ilCtrl;
205 
206  $this->setFormAction($ilCtrl->getFormAction($this->getParentObject()));
207  switch($this->getMode())
208  {
211  $this->setRowTemplate('tpl.lp_collection_row.html', 'Services/Tracking');
212  $this->setTitle($this->lng->txt('trac_lp_determination'));
213  $this->setDescription($this->lng->txt('trac_lp_determination_info_crs'));
214  break;
215 
217  $this->setRowTemplate('tpl.lp_collection_row.html', 'Services/Tracking');
218  $this->setTitle($this->lng->txt('trac_lp_determination_tutor'));
219  $this->setDescription($this->lng->txt('trac_lp_determination_info_crs_tutor'));
220  break;
221 
223  $this->setRowTemplate('tpl.lp_collection_scorm_row.html', 'Services/Tracking');
224  $this->setTitle($this->lng->txt('trac_lp_determination'));
225  $this->setDescription($this->lng->txt('trac_lp_determination_info_sco'));
226  break;
227 
229  $this->setRowTemplate('tpl.lp_collection_subitem_row.html', 'Services/Tracking');
230  $this->setTitle($this->lng->txt('trac_lp_determination'));
231  $this->setDescription($this->lng->txt('trac_lp_determination_info_crs'));
232  $this->lng->loadLanguageModule("meta");
233 
234  $this->addCommandButton('updateTLT', $this->lng->txt('save'));
235  break;
236  }
237 
238  $this->addColumn('','','1px');
239  $this->addColumn($this->lng->txt('item'), 'title', '50%');
240 
241  if($this->getMode() != ilLPObjSettings::LP_MODE_SCORM &&
244  {
245  $this->addColumn($this->lng->txt('trac_mode'), 'mode');
246  }
248  {
249  $this->addColumn($this->lng->txt('meta_typical_learning_time'), 'tlt');
250  }
251 
253  {
254  $this->addMultiCommand('assign', $this->lng->txt('trac_collection_assign'));
255  $this->addMultiCommand('deassign', $this->lng->txt('trac_collection_deassign'));
256  $this->addColumn($this->lng->txt('trac_determines_learning_progress'), 'status');
257  }
258  else
259  {
260  $this->addMultiCommand('assign', $this->lng->txt('trac_manual_display'));
261  $this->addMultiCommand('deassign', $this->lng->txt('trac_manual_no_display'));
262  $this->addColumn($this->lng->txt('trac_manual_is_displayed'), 'status');
263  }
264 
265  $this->enable('select_all');
266  $this->setSelectAllCheckbox('item_ids');
267 
269  {
270  $this->addMultiCommand('groupMaterials', $this->lng->txt('trac_group_materials'));
271  }
272  }
273 }
274 
275 ?>