ILIAS  Release_4_2_x_branch Revision 61807
 All Data Structures Namespaces Files Functions Variables Groups Pages
class.ilCourseContentGUI.php
Go to the documentation of this file.
1 <?php
2 /* Copyright (c) 1998-2010 ILIAS open source, Extended GPL, see docs/LICENSE */
3 
17 {
21 
22  var $tpl;
23  var $ctrl;
24  var $lng;
25  var $tabs_gui;
26 
31  function ilCourseContentGUI(&$container_gui_obj)
32  {
33  global $tpl,$ilCtrl,$lng,$ilObjDataCache,$ilTabs;
34 
35  $this->tpl =& $tpl;
36  $this->ctrl =& $ilCtrl;
37  $this->lng =& $lng;
38  $this->lng->loadLanguageModule('crs');
39  $this->tabs_gui =& $ilTabs;
40 
41  $this->container_gui =& $container_gui_obj;
42  $this->container_obj =& $this->container_gui->object;
43 
44  $this->__initCourseObject();
45  }
46 
47  function &executeCommand()
48  {
49  global $ilAccess, $ilErr, $ilTabs, $ilCtrl;
50 
51  if(!$ilAccess->checkAccess('read','',$this->container_obj->getRefId()))
52  {
53  $ilErr->raiseError($this->lng->txt('msg_no_perm_read'),$ilErr->WARNING);
54  }
55 
56  // Handle timings view
57  $_SESSION['crs_timings'] = true;
58 
59  $this->__setSubTabs();
60  $this->tabs_gui->setTabActive('view_content');
61  $cmd = $this->ctrl->getCmd();
62 
63  switch($this->ctrl->getNextClass($this))
64  {
65  case 'ilcourseitemadministrationgui':
66 
67  include_once 'Modules/Course/classes/class.ilCourseItemAdministrationGUI.php';
68  $this->tabs_gui->clearSubTabs();
69  $this->ctrl->setReturn($this,'view');
70 
71  $item_adm_gui = new ilCourseItemAdministrationGUI($this->container_obj,(int) $_REQUEST['item_id']);
72  $this->ctrl->forwardCommand($item_adm_gui);
73  break;
74 
75  case 'ilcoursearchivesgui':
76  $this->__forwardToArchivesGUI();
77  break;
78 
79  case 'ilcourseobjectivepresentationgui':
80  $this->view(); // forwarding moved to getCenterColumnHTML()
81  break;
82 
83  case "ilcolumngui":
84  $ilCtrl->saveParameterByClass("ilcolumngui", "col_return");
85  $ilTabs->setSubTabActive("crs_content");
86  $this->view();
87  break;
88 
89  default:
90  if(!$this->__checkStartObjects())
91  {
92  $this->showStartObjects();
93  break;
94  }
95 
96  // forward if archives enabled and not tutor
97  if(!$this->is_tutor = $ilAccess->checkAccess('write','',$this->course_obj->getRefId()) and
98  $this->course_obj->isArchived())
99  {
100  $this->__forwardToArchivesGUI();
101  break;
102  }
103 
104  // forward to objective presentation
105  if((!$this->is_tutor and
106  $this->container_obj->getType() == 'crs' and
107  $this->container_obj->enabledObjectiveView()) ||
108  $_GET["col_return"] == "objectives")
109  {
110  $this->use_objective_presentation = true;
111  $this->view();
112  //$this->__forwardToObjectivePresentation();
113  break;
114  }
115 
116 
117  if(!$cmd)
118  {
119  $cmd = $this->__getDefaultCommand();
120  }
121  $this->$cmd();
122  break;
123  }
124  }
125 
127  {
128  global $ilAccess;
129 
130  // edit timings if panel is on
131  if($_SESSION['crs_timings_panel'][$this->course_obj->getId()])
132  {
133  return 'editTimings';
134  }
135  if($ilAccess->checkAccess('write','',$this->container_obj->getRefId()))
136  {
137  return 'view';
138  }
139  if($this->container_obj->getType() == 'crs' and
140  $this->course_obj->getViewMode() == IL_CRS_VIEW_TIMING)
141  {
142  return 'editUserTimings';
143  }
144  return 'view';
145  }
146 
148  {
149  include_once 'Modules/Course/classes/class.ilCourseObjectivePresentationGUI.php';
150 
151  $this->ctrl->setReturn($this,'');
152  $objectives_gui = new ilCourseObjectivePresentationGUI($this->container_gui);
153 
154  if(!$this->ctrl->getNextClass())
155  {
156  $this->ctrl->setCmdClass(get_class($objectives_gui));
157  }
158  $this->ctrl->forwardCommand($objectives_gui);
159  return true;
160  }
161 
163  {
164  include_once 'Modules/Course/classes/class.ilCourseArchivesGUI.php';
165 
166  $this->ctrl->setReturn($this,'');
167  $archives_gui = new ilCourseArchivesGUI($this->container_gui);
168  $this->ctrl->forwardCommand($archives_gui);
169 
170  $this->tabs_gui->setTabActive('view_content');
171  $this->tabs_gui->setSubTabActive('crs_archives');
172 
173  return true;
174  }
175 
177  {
178  include_once './Modules/Course/classes/class.ilCourseStart.php';
179 
180  global $ilAccess,$ilUser;
181 
182  if($ilAccess->checkAccess('write','',$this->course_obj->getRefId()))
183  {
184  return true;
185  }
186  $this->start_obj = new ilCourseStart($this->course_obj->getRefId(),$this->course_obj->getId());
187  if(count($this->start_obj->getStartObjects()) and !$this->start_obj->allFullfilled($ilUser->getId()))
188  {
189  return false;
190  }
191  return true;
192  }
193 
194  function showStartObjects()
195  {
196  include_once './Modules/Course/classes/class.ilCourseLMHistory.php';
197  include_once './Services/Repository/classes/class.ilRepositoryExplorer.php';
198  include_once './classes/class.ilLink.php';
199 
200  global $rbacsystem,$ilias,$ilUser,$ilAccess,$ilObjDataCache;
201 
202  $this->tabs_gui->setSubTabActive('crs_content');
203 
204  $this->tpl->addBlockFile("ADM_CONTENT", "adm_content", "tpl.crs_start_view.html",'Modules/Course');
205  $this->tpl->setVariable("INFO_STRING",$this->lng->txt('crs_info_start'));
206  $this->tpl->setVariable("TBL_TITLE_START",$this->lng->txt('crs_table_start_objects'));
207  $this->tpl->setVariable("HEADER_NR",$this->lng->txt('crs_nr'));
208  $this->tpl->setVariable("HEADER_DESC",$this->lng->txt('description'));
209  $this->tpl->setVariable("HEADER_EDITED",$this->lng->txt('crs_objective_accomplished'));
210 
211 
212  $lm_continue =& new ilCourseLMHistory($this->course_obj->getRefId(),$ilUser->getId());
213  $continue_data = $lm_continue->getLMHistory();
214 
215  $counter = 0;
216  foreach($this->start_obj->getStartObjects() as $start)
217  {
218  $obj_id = $ilObjDataCache->lookupObjId($start['item_ref_id']);
219  $ref_id = $start['item_ref_id'];
220  $type = $ilObjDataCache->lookupType($obj_id);
221 
223 
224  $obj_link = ilLink::_getLink($ref_id,$type);
226  $obj_frame = $obj_frame ? $obj_frame : '';
227 
228  // Tmp fix for tests
229  $obj_frame = $type == 'tst' ? '' : $obj_frame;
230 
231  $contentObj = false;
232 
233  if($ilAccess->checkAccess('read','',$ref_id))
234  {
235  $this->tpl->setCurrentBlock("start_read");
236  $this->tpl->setVariable("READ_TITLE_START",$ilObjDataCache->lookupTitle($obj_id));
237  $this->tpl->setVariable("READ_TARGET_START",$obj_frame);
238  $this->tpl->setVariable("READ_LINK_START", $obj_link.'&crs_show_result='.$this->course_obj->getRefId());
239  $this->tpl->parseCurrentBlock();
240  }
241  else
242  {
243  $this->tpl->setCurrentBlock("start_visible");
244  $this->tpl->setVariable("VISIBLE_LINK_START",$ilObjDataCache->lookupTitle($obj_id));
245  $this->tpl->parseCurrentBlock();
246  }
247 
248  // CONTINUE LINK
249  if(isset($continue_data[$ref_id]))
250  {
251  $this->tpl->setCurrentBlock("link");
252  $this->tpl->setVariable("LINK_HREF",ilLink::_getLink($ref_id,'',array('obj_id',
253  $continue_data[$ref_id]['lm_page_id'])));
254  #$this->tpl->setVariable("CONTINUE_LINK_TARGET",$target);
255  $this->tpl->setVariable("LINK_NAME",$this->lng->txt('continue_work'));
256  $this->tpl->parseCurrentBlock();
257  }
258 
259  // add to desktop link
260  if(!$ilUser->isDesktopItem($ref_id,$type) and
261  $this->course_obj->getAboStatus())
262  {
263  if ($ilAccess->checkAccess('read','',$ref_id))
264  {
265  $this->tpl->setCurrentBlock("link");
266  $this->ctrl->setParameterByClass(get_class($this->container_gui),'item_ref_id',$ref_id);
267  $this->ctrl->setParameterByClass(get_class($this->container_gui),'item_id',$ref_id);
268  $this->ctrl->setParameterByClass(get_class($this->container_gui),'type',$type);
269 
270  $this->tpl->setVariable("LINK_HREF",$this->ctrl->getLinkTarget($this->container_gui,'addToDesk'));
271  $this->tpl->setVariable("LINK_NAME", $this->lng->txt("to_desktop"));
272  $this->tpl->parseCurrentBlock();
273  }
274  }
275  elseif($this->course_obj->getAboStatus())
276  {
277  $this->tpl->setCurrentBlock("link");
278  $this->ctrl->setParameterByClass(get_class($this->container_gui),'item_ref_id',$ref_id);
279  $this->ctrl->setParameterByClass(get_class($this->container_gui),'item_id',$ref_id);
280  $this->ctrl->setParameterByClass(get_class($this->container_gui),'type',$type);
281 
282  $this->tpl->setVariable("LINK_HREF",$this->ctrl->getLinkTarget($this->container_gui,'removeFromDesk'));
283  $this->tpl->setVariable("LINK_NAME", $this->lng->txt("unsubscribe"));
284  $this->tpl->parseCurrentBlock();
285  }
286 
287 
288  // Description
289  if(strlen($ilObjDataCache->lookupDescription($obj_id)))
290  {
291  $this->tpl->setCurrentBlock("start_description");
292  $this->tpl->setVariable("DESCRIPTION_START",$ilObjDataCache->lookupDescription($obj_id));
293  $this->tpl->parseCurrentBlock();
294  }
295 
296 
297  if($this->start_obj->isFullfilled($ilUser->getId(),$ref_id))
298  {
299  $accomplished = 'accomplished';
300  }
301  else
302  {
303  $accomplished = 'not_accomplished';
304  }
305  $this->tpl->setCurrentBlock("start_row");
306  $this->tpl->setVariable("EDITED_IMG",ilUtil::getImagePath('crs_'.$accomplished.'.gif'));
307  $this->tpl->setVariable("EDITED_ALT",$this->lng->txt('crs_objective_'.$accomplished));
308  $this->tpl->setVariable("ROW_CLASS",'option_value');
309  $this->tpl->setVariable("ROW_CLASS_CENTER",'option_value_center');
310  $this->tpl->setVariable("OBJ_NR_START",++$counter.'.');
311  $this->tpl->parseCurrentBlock();
312  }
313  return true;
314  }
315 
319  function view()
320  {
321  // BEGIN ChangeEvent: record read event.
322  require_once('Services/Tracking/classes/class.ilChangeEvent.php');
323  global $ilUser;
324  $obj_id = ilObject::_lookupObjId($this->container_obj->getRefId());
326  $this->container_obj->getType(), $this->container_obj->getRefId(),
327  $obj_id, $ilUser->getId());
328  // END ChangeEvent: record read event.
329 
330  $this->getCenterColumnHTML();
331 
332  if (!$this->no_right_column)
333  {
334  $this->tpl->setRightContent($this->getRightColumnHTML());
335  }
336  }
337 
342  {
343  global $ilUser, $lng, $ilCtrl, $ilAccess;
344 
345  if ($ilCtrl->getNextClass() == "ilcourseobjectivepresentationgui")
346  {
347  $ilCtrl->setParameterByClass("ilcolumngui", "col_return", "objectives");
348  }
349  $ilCtrl->saveParameterByClass("ilcolumngui", "col_return");
350 
351  $obj_id = ilObject::_lookupObjId($this->container_obj->getRefId());
352  $obj_type = ilObject::_lookupType($obj_id);
353 
354  include_once("Services/Block/classes/class.ilColumnGUI.php");
355  $column_gui = new ilColumnGUI($obj_type, IL_COL_RIGHT);
356 
357  if ($column_gui->getScreenMode() == IL_SCREEN_FULL)
358  {
359  return "";
360  }
361 
362  $this->setColumnSettings($column_gui);
363 
364  if ($ilCtrl->getNextClass() == "ilcolumngui" &&
365  $column_gui->getCmdSide() == IL_COL_RIGHT &&
366  $column_gui->getScreenMode() == IL_SCREEN_SIDE)
367  {
368 
369  $html = $ilCtrl->forwardCommand($column_gui);
370  }
371  else
372  {
373  if (!$ilCtrl->isAsynch())
374  {
375  $html = $ilCtrl->getHTML($column_gui);
376  }
377  }
378 
379  return $html;
380  }
381 
386  {
387  global $ilCtrl, $tpl;
388 
389  $this->tabs_gui->setSubTabActive('crs_content');
390 
391  $ilCtrl->saveParameterByClass("ilcolumngui", "col_return");
392 
393  if ($this->use_objective_presentation)
394  {
395  return $this->__forwardToObjectivePresentation();
396  }
397  switch ($ilCtrl->getNextClass())
398  {
399  case "ilcolumngui":
400 
401  if ($_GET["col_return"] == "objectives")
402  {
403  $ilCtrl->setParameter($this, "col_return", "objectives");
404  $ilCtrl->setReturn($this, "view");
405  }
406  else
407  {
408  $this->tabs_gui->setSubTabActive('crs_content');
409  $ilCtrl->setReturn($this, "view");
410  }
411  $tpl->setContent($this->__forwardToColumnGUI());
412  return;
413 
414  case "ilcourseobjectivepresentationgui":
415  return $this->__forwardToObjectivePresentation();
416  }
417 
418  $this->getDefaultView();
419  $this->no_right_column = true; // workaround
420  }
421 
422  function getDefaultView()
423  {
424  if($_SESSION['crs_timings_panel'][$this->course_obj->getId()])
425  {
426  return $this->editTimings();
427  }
428 
429  global $rbacsystem;
430 
431  include_once 'Services/Object/classes/class.ilObjectListGUIFactory.php';
432 
433  //$this->tpl->addBlockFile("ADM_CONTENT", "adm_content", "tpl.container_page.html",
434  // "Services/Container");
435 
436  //$this->container_gui->showPossibleSubObjects();
437 
438  // Feedback
439  $this->__showFeedBack();
440 
441  // Event
442 
443  #$this->container_gui->renderContainer();
444  $this->container_gui->showAdministrationPanel($this->tpl);
445  }
446 
447  function setColumnSettings($column_gui)
448  {
449  global $ilAccess, $lng;
450 
451  $column_gui->setRepositoryMode(true);
452  $column_gui->setEnableEdit(false);
453  $column_gui->setBlockProperty("news", "title",
454  $lng->txt("crs_news"));
455 
456  $grouped_items = array();
457  foreach($this->course_obj->items_obj->items as $item)
458  {
459  $grouped_items[$item["type"]][] = $item;
460  }
461 
462  $column_gui->setRepositoryItems($grouped_items);
463  if ($ilAccess->checkAccess("write", "", $this->container_obj->getRefId()))
464  {
465  $column_gui->setEnableEdit(true);
466  }
467 
468  // Allow movement of blocks for tutors
469  if ($this->is_tutor &&
470  $this->container_gui->isActiveAdministrationPanel())
471  {
472  $column_gui->setEnableMovement(true);
473  }
474 
475  // Configure Settings, if administration panel is on
476  if ($this->is_tutor)
477  {
478  $column_gui->setBlockProperty("news", "settings", true);
479  //$column_gui->setBlockProperty("news", "public_notifications_option", true);
480  $column_gui->setBlockProperty("news", "default_visibility_option", true);
481  $column_gui->setBlockProperty("news", "hide_news_block_option", true);
482  }
483 
484  if ($this->container_gui->isActiveAdministrationPanel())
485  {
486  $column_gui->setAdminCommands(true);
487  }
488  }
489 
490 
495  {
496  global $ilCtrl, $ilAccess;
497 
498  include_once("Services/Block/classes/class.ilColumnGUI.php");
499 
500  // this gets us the subitems we need in setColumnSettings()
501  $this->course_obj->initCourseItemObject($this->container_obj->getRefId());
502 
503  $obj_id = ilObject::_lookupObjId($this->container_obj->getRefId());
504  $obj_type = ilObject::_lookupType($obj_id);
505 
506  if (!$ilCtrl->isAsynch())
507  {
508  //if ($column_gui->getScreenMode() != IL_SCREEN_SIDE)
510  {
511  // right column wants center
513  {
514  $column_gui = new ilColumnGUI($obj_type, IL_COL_RIGHT);
515  $this->setColumnSettings($column_gui);
516  $html = $ilCtrl->forwardCommand($column_gui);
517  }
518  // left column wants center
520  {
521  $column_gui = new ilColumnGUI($obj_type, IL_COL_LEFT);
522  $this->setColumnSettings($column_gui);
523  $html = $ilCtrl->forwardCommand($column_gui);
524  }
525  }
526  else
527  {
528  if ($_GET["col_return"] == "objectives")
529  {
530  //return $this->__forwardToObjectivePresentation();
531  include_once 'Modules/Course/classes/class.ilCourseObjectivePresentationGUI.php';
532  $this->ctrl->setReturn($this,'');
533  $objectives_gui = new ilCourseObjectivePresentationGUI($this->container_gui);
534  $this->ctrl->getHTML($objectives_gui);
535  }
536  else
537  {
538  $this->getDefaultView();
539  }
540  }
541  }
542 
543  return $html;
544  }
545 
546 
547 
555  protected function displayRow($cont_data,$subitem = false)
556  {
557  static $row_num = 1;
558 
559  global $ilAccess;
560 
561  if(!$ilAccess->checkAccess('visible','',$cont_data['ref_id']))
562  {
563  return '';
564  }
565 
566  // BEGIN WebDAV: Don't display hidden Files.
567  // Note: If you change this if-statement, make sure to
568  // change the corresponding if-statement in ilContainer
569  // as well.
570  if (!$this->container_gui->isActiveAdministrationPanel())
571  {
572  require_once 'Modules/File/classes/class.ilObjFileAccess.php';
573  if (ilObjFileAccess::_isFileHidden($cont_data['title']))
574  {
575  return false;
576  }
577  }
578  // END WebDAV: Don't display hidden Files.
579 
580  if($subitem)
581  {
582  $tpl = new ilTemplate('tpl.crs_subcontent_row.html',true,true,'Modules/Course');
583  }
584  else
585  {
586  $row_num++;
587  $tpl = new ilTemplate('tpl.crs_content_row.html',true,true,'Modules/Course');
588  }
589 
590 
591  $item_list_gui = $this->__getItemGUI($cont_data);
592 
593  $html = $item_list_gui->getListItemHTML($cont_data['ref_id'],
594  $cont_data['obj_id'], $cont_data['title'], $cont_data['description']);
595 
596  if(!strlen($html))
597  {
598  return false;
599  }
600 
601  if(!$subitem)
602  {
603  foreach($this->__getOptions($cont_data,$num) as $key => $image)
604  {
605  $tpl->setCurrentBlock("img");
606  $tpl->setVariable("IMG_TYPE",$image["gif"]);
607  $tpl->setVariable("IMG_ALT",$image["lng"]);
608  $tpl->setVariable("IMG_LINK",$image["lnk"]);
609  $tpl->setVariable("IMG_TARGET",$image["tar"]);
610  $tpl->parseCurrentBlock();
611  }
612  }
613 
614  if(!$subitem)
615  {
616  $tpl->setCurrentBlock("options");
617  $tpl->setVariable("OPT_ROWCOL", ilUtil::switchColor($row_num,"tblrow1","tblrow2"));
618  $tpl->parseCurrentBlock();
619  }
620 
621  if ($this->container_gui->isActiveAdministrationPanel())
622  {
623  $tpl->setCurrentBlock("block_row_check");
624  $tpl->setVariable("ITEM_ID", $cont_data['ref_id']);
625  $tpl->parseCurrentBlock();
626  }
627 
628  // change row color
629  $tpl->setVariable("ITEM_HTML",$html);
630  $tpl->setVariable("ROWCOL", ilUtil::switchColor($row_num,"tblrow1","tblrow2"));
631  // BEGIN WebDAV: Render icon using list icon gui
632  $tpl->setVariable('TYPE_IMG',ilUtil::getTypeIconPath($item_list_gui->getIconImageType(),$cont_data['obj_id'],'small'));
633  // END WebDAV: Render icon using list icon gui
634  $tpl->setVariable("ALT_IMG", $this->lng->txt("obj_".$cont_data["type"]));
635  $tpl->setCurrentBlock("tbl_content");
636  $tpl->parseCurrentBlock();
637 
638  $html = $tpl->get();
639 
640  // show subitems
641  if($cont_data['type'] == 'sess')
642  {
643  foreach($this->course_obj->items_obj->getItemsByEvent($cont_data['obj_id']) as $item)
644  {
645  $html .= $this->displayRow($item,true);
646  }
647  }
648  return $html;
649  }
650 
651  function __showMaterials($a_selection)
652  {
653  global $ilAccess;
654 
655  $this->course_obj->initCourseItemObject($this->container_obj->getRefId());
656  switch($a_selection)
657  {
658  case 'session':
659  $this->cont_arr = $this->course_obj->items_obj->getFilteredItems($this->container_obj->getRefId());
660  $this->cont_arr = ilCourseItems::_sort(ilContainer::SORT_ACTIVATION,$this->cont_arr);
661  break;
662  // Get all sessions => sort by start
663 
664  case 'nosession':
665  $this->cont_arr = $this->course_obj->items_obj->getFilteredItems($this->container_obj->getRefId());
666  break;
667  // filtered => default sort
668 
669  case 'all':
670  $this->cont_arr = $this->course_obj->items_obj->getFilteredItems($this->container_obj->getRefId());
671  break;
672  // all => sort default sort
673  }
674 
675  // NO ITEMS FOUND
676  if(!count($this->cont_arr))
677  {
678  #ilUtil::sendInfo($this->lng->txt("crs_no_items_found"));
679  $this->tpl->addBlockFile("CONTENT_TABLE", "content_tab", "tpl.container_page.html",
680  "Services/Container");
681  $this->tpl->setVariable("FORM_ACTION", $this->ctrl->getFormAction($this));
682  $this->tpl->setVariable("CONTAINER_PAGE_CONTENT", "");
683  return true;
684  }
685 
686  // show course materials
687  $tpl =& new ilTemplate("tpl.table.html", true, true);
688  $cont_num = count($this->cont_arr);
689 
690  $this->container_gui->clearAdminCommandsDetermination();
691 
692 
693  $num = 0;
694  $html = '';
695  foreach ($this->cont_arr as $cont_data)
696  {
697  switch($a_selection)
698  {
699  case 'all':
700  $html .= $this->displayRow($cont_data,$item_list_gui);
701  break;
702 
703  case 'session':
704  if($cont_data['type'] == 'sess')
705  {
706  $html .= $this->displayRow($cont_data,$item_list_gui);
707  }
708  break;
709 
710  case 'nosession':
711  if($cont_data['type'] != 'sess')
712  {
713  $html .= $this->displayRow($cont_data,$item_list_gui);
714  }
715  break;
716  }
717  }
718  if(strlen($html))
719  {
720  $tpl->setVariable('TBL_CONTENT',$html);
721  }
722  else
723  {
724  return true;
725  }
726  // create table
727  include_once "./Services/Table/classes/class.ilTableGUI.php";
728  $tbl = new ilTableGUI();
729  $tbl->setStyle('table','il_ContainerBlock');
730 
731  // title & header columns
732 
733  if($a_selection == 'session')
734  {
735  $title = $this->lng->txt('events');
736  }
737  else
738  {
739  $title = $this->lng->txt("crs_content");
740  }
741  $tbl->setTitle($title,"icon_crs.gif",$title);
742 
743  $tbl->setHelp("tbl_help.php","icon_help.gif",$this->lng->txt("help"));
744 
745  if($this->is_tutor)
746  {
747  $tbl->setHeaderNames(array($this->lng->txt("type"),$this->lng->txt("title"),
748  ""));
749  $tbl->setHeaderVars(array("type","title","options"),
750  array("ref_id" => $this->course_obj->getRefId(),
751  "cmdClass" => "ilobjcoursecontentgui",
752  "cmdNode" => $_GET["cmdNode"]));
753  $tbl->setColumnWidth(array("1px","100%","24px"));
754  $tbl->disable("header");
755  }
756  else
757  {
758  $tbl->setHeaderNames(array($this->lng->txt("type"),$this->lng->txt("title"),''));
759  $tbl->setHeaderVars(array("type","title",'options'),
760  array("ref_id" => $this->course_obj->getRefId(),
761  "cmdClass" => "ilobjcoursecontentgui",
762  "cmdNode" => $_GET["cmdNode"]));
763  $tbl->setColumnWidth(array("1px",""));
764  $tbl->disable("header");
765  }
766 
767  // footer
768  $tbl->disable("footer");
769  $tbl->disable('sort');
770  $tbl->disable("form");
771 
772  // render table
773  $tbl->setTemplate($tpl);
774  $tbl->render();
775 
776  $this->tpl->setVariable("FORM_ACTION", $this->ctrl->getFormAction($this));
777  $this->tpl->setCurrentBlock("cont_page_content");
778  $this->tpl->setVariable("CONTAINER_PAGE_CONTENT", $tpl->get());
779  $this->tpl->parseCurrentBlock();
780 
781  return true;
782 
783  }
784 
785  function editTimings()
786  {
787  global $ilAccess,$ilErr;
788 
789  include_once 'Services/MetaData/classes/class.ilMDEducational.php';
790  include_once 'classes/class.ilLink.php';
791 
792  $this->lng->loadLanguageModule('meta');
793 
794  if(!$ilAccess->checkAccess('write','',$this->container_obj->getRefId()))
795  {
796  $ilErr->raiseError($this->lng->txt('msg_no_perm_write'),$ilErr->WARNING);
797  }
798  $this->__showTimingsPanel();
799  $this->tabs_gui->setSubTabActive('timings_timings');
800 
801  $this->course_obj->initCourseItemObject($this->container_obj->getRefId());
802  $this->cont_arr = $this->course_obj->items_obj->getAllItems($this->container_obj->getId());
803 
804  $this->tpl->addBlockfile('ADM_CONTENT','adm_content','tpl.crs_edit_items.html','Modules/Course');
805  $this->tpl->setVariable("FORMACTION",$this->ctrl->getFormAction($this));
806  $this->tpl->setVariable("HEADER_IMG",ilUtil::getImagePath('icon_crs.gif'));
807  $this->tpl->setVariable("HEADER_ALT",$this->lng->txt('crs_materials'));
808  $this->tpl->setVariable("BLOCK_HEADER_CONTENT",$this->lng->txt('edit_timings_list'));
809  $this->tpl->setVariable("TXT_TITLE",$this->lng->txt('title'));
810 
811 
812  $this->tpl->setVariable("TXT_DURATION",$this->lng->txt('crs_timings_time_frame'));
813  $this->tpl->setVariable("TXT_INFO_DURATION",$this->lng->txt('crs_timings_in_days'));
814 
815  $this->tpl->setVariable("TXT_START_END",$this->lng->txt('crs_timings_short_start_end'));
816  $this->tpl->setVariable("TXT_INFO_START_END",$this->lng->txt('crs_timings_start_end_info'));
817 
818  $this->tpl->setVariable("TXT_CHANGEABLE",$this->lng->txt('crs_timings_short_changeable'));
819 
820  $this->tpl->setVariable("TXT_INFO_LIMIT",$this->lng->txt('crs_timings_from_until'));
821  $this->tpl->setVariable("TXT_LIMIT",$this->lng->txt('crs_timings_short_limit_start_end'));
822  $this->tpl->setVariable("TXT_ACTIVE",$this->lng->txt('crs_timings_short_active'));
823  $this->tpl->setVariable("TXT_INFO_ACTIVE",$this->lng->txt('crs_timings_info_active'));
824 
825  $counter = 0;
826  foreach($this->cont_arr as $item)
827  {
828  /*
829  if($item['type'] == 'sess')
830  {
831  continue;
832  }
833  */
834  $item = $this->__loadFromPost($item);
835  $item_prefix = "item[$item[ref_id]]";
836  $item_change_prefix = "item_change[$item[ref_id]]";
837  $item_active_prefix = "item_active[$item[ref_id]]";
838 
839  if($item['type'] == 'grp' or
840  $item['type'] == 'fold')
841  {
842  $this->tpl->setVariable("TITLE_LINK",ilLink::_getLink($item['ref_id'],$item['type']));
843  $this->tpl->setVariable("TITLE_FRAME",ilFrameTargetInfo::_getFrame('MainContent',$item['type']));
844  $this->tpl->setVariable("TITLE_LINK_NAME",$item['title']);
845  }
846  else
847  {
848  $this->tpl->setVariable("TITLE",$item['title']);
849  }
850 
851  if(strlen($item['description']))
852  {
853  $this->tpl->setCurrentBlock("item_description");
854  $this->tpl->setVariable("DESC",$item['description']);
855  $this->tpl->parseCurrentBlock();
856  }
857 
858  if($tlt = ilMDEducational::_getTypicalLearningTimeSeconds($item['obj_id']))
859  {
860  $this->tpl->setCurrentBlock("tlt");
861  $this->tpl->setVariable("TXT_TLT",$this->lng->txt('meta_typical_learning_time'));
862  $this->tpl->setVariable("TLT_VAL",ilFormat::_secondsToString($tlt));
863  $this->tpl->parseCurrentBlock();
864  }
865 
866  $this->tpl->setCurrentBlock("container_standard_row");
867 
868  // Suggested
869  if(is_array($_POST['item']["$item[ref_id]"]['sug_start']))
870  {
871  $start = $this->__toUnix($_POST['item']["$item[ref_id]"]['sug_start']);
872  }
873  else
874  {
875  $start = $item['suggestion_start'];
876  }
877  $end = $item['suggestion_end'];
878  $date = $this->__prepareDateSelect($start);
879  $this->tpl->setVariable("SUG_START",
880  ilUtil::makeDateSelect($item_prefix."[sug_start]",
881  $date['y'],$date['m'],$date['d'],date('Y',time()),false));
882 
883  $this->tpl->setVariable("NAME_DURATION_A",$item_prefix."[duration_a]");
884  if(isset($_POST['item']["$item[ref_id]"]['duration_a']))
885  {
886  $this->tpl->setVariable("VAL_DURATION_A",abs($_POST['item']["$item[ref_id]"]['duration_a']));
887  }
888  else
889  {
890  $this->tpl->setVariable("VAL_DURATION_A",intval(($end-$start)/(60*60*24)));
891  }
892 
893  $this->tpl->setVariable('SUG_END',ilDatePresentation::formatDate(new ilDate($item['suggestion_end'],IL_CAL_UNIX)));
894 
895  // Limit
896  if(is_array($_POST['item']["$item[ref_id]"]['lim_end']))
897  {
898  $end = $this->__toUnix($_POST['item']["$item[ref_id]"]['lim_end']);
899  }
900  else
901  {
902  $end = $item['latest_end'];
903  }
904 
905  $date = $this->__prepareDateSelect($end);
906  $this->tpl->setVariable("LIM_END",
907  ilUtil::makeDateSelect($item_prefix."[lim_end]",
908  $date['y'],$date['m'],$date['d'],date('Y',time()),false));
909 
910  $this->tpl->setVariable("NAME_CHANGE",$item_change_prefix."[change]");
911  $this->tpl->setVariable("NAME_ACTIVE",$item_active_prefix."[active]");
912 
913  if(isset($_POST['item']))
914  {
915  $change = $_POST['item_change']["$item[ref_id]"]['change'];
916  $active = $_POST['item_active']["$item[ref_id]"]['active'];
917  }
918  else
919  {
920  $change = $item['changeable'];
921  $active = ($item['timing_type'] == IL_CRS_TIMINGS_PRESETTING);
922  }
923 
924  $this->tpl->setVariable("CHECKED_ACTIVE",$active ? 'checked="checked"' : '');
925  $this->tpl->setVariable("CHECKED_CHANGE",$change ? 'checked="checked"' : '');
926 
927  if(isset($this->failed["$item[ref_id]"]))
928  {
929  $this->tpl->setVariable("ROWCLASS",'tblrowmarked');
930  }
931  else
932  {
933  $this->tpl->setVariable("ROWCLASS",ilUtil::switchColor($counter++,'tblrow1','tblrow2'));
934  }
935  $this->tpl->parseCurrentBlock();
936  }
937 
938  // Select all
939  $this->tpl->setVariable("CHECKCLASS",ilUtil::switchColor($counter++,'tblrow1','tblrow2'));
940  $this->tpl->setVariable("SELECT_ALL",$this->lng->txt('select_all'));
941 
942  $this->tpl->setVariable("BTN_SAVE",$this->lng->txt('save'));
943  $this->tpl->setVariable("BTN_CANCEL",$this->lng->txt('cancel'));
944 
945  }
946 
948  {
949  global $ilUser;
950 
951  include_once 'Modules/Course/classes/Timings/class.ilTimingAccepted.php';
952  $accept_obj = new ilTimingAccepted($this->course_obj->getId(),$ilUser->getId());
953 
954  $this->tpl->setVariable("REMARK",$accept_obj->getRemark());
955  $this->tpl->setVariable("ACCEPT_CHECKED",$accept_obj->isAccepted() ? 'checked="checked"' : '');
956  $this->tpl->setVariable("TUTOR_CHECKED",$accept_obj->isVisible() ? 'checked="checked"' : '');
957 
958  $this->tpl->setVariable("TIMING_ACCEPT",$this->lng->txt('timing_accept_table'));
959  $this->tpl->setVariable("TXT_ACCEPT",$this->lng->txt('timing_user_accept'));
960  $this->tpl->setVariable("TXT_REMARK",$this->lng->txt('timing_remark'));
961  $this->tpl->setVariable("TXT_TUTOR",$this->lng->txt('timing_tutor_visible'));
962  $this->tpl->setVariable("TXT_BTN_UPDATE",$this->lng->txt('save'));
963  }
964  function saveAcceptance()
965  {
966  global $ilUser;
967 
968  include_once 'Modules/Course/classes/Timings/class.ilTimingAccepted.php';
969  $accept_obj = new ilTimingAccepted($this->course_obj->getId(),$ilUser->getId());
970 
971  $accept_obj->setRemark(ilUtil::stripSlashes($_POST['remark']));
972  $accept_obj->accept($_POST['accepted']);
973  $accept_obj->setVisible($_POST['tutor']);
974  $accept_obj->update();
975  ilUtil::sendSuccess($this->lng->txt('settings_saved'));
976  $this->editUserTimings();
977  }
978 
979  function editUserTimings()
980  {
981  if($_SESSION['crs_timings_panel'][$this->course_obj->getId()])
982  {
983  return $this->editTimings();
984  }
985  global $ilAccess,$ilErr;
986 
987  if(!$ilAccess->checkAccess('read','',$this->container_obj->getRefId()))
988  {
989  $ilErr->raiseError($this->lng->txt('msg_no_perm_read'),$ilErr->WARNING);
990  }
991  $this->tabs_gui->setSubTabActive('timings_timings');
992 
993  $_SESSION['crs_timings_user_hidden'] = isset($_GET['show_details']) ? $_GET['show_details'] : $_SESSION['crs_timings_user_hidden'];
994 
995  include_once 'Modules/Course/classes/class.ilCourseItems.php';
996  if(ilCourseItems::_hasChangeableTimings($this->course_obj->getRefId()))
997  {
998  $this->__editAdvancedUserTimings();
999  }
1000  else
1001  {
1002  $this->__editUserTimings();
1003  }
1004  }
1005 
1006  function returnToMembers()
1007  {
1008  $this->ctrl->returnToParent($this);
1009  }
1010 
1011  function showUserTimings()
1012  {
1013  global $ilObjDataCache;
1014 
1015  $this->tpl->addBlockfile('ADM_CONTENT','adm_content','tpl.crs_user_timings.html','Modules/Course');
1016  $this->tabs_gui->clearSubTabs();
1017  $this->tabs_gui->setTabActive('members');
1018 
1019  if(!$_GET['member_id'])
1020  {
1021  ilUtil::sendFailure($this->lng->txt('no_checkbox'),true);
1022  $this->ctrl->returnToParent($this);
1023  }
1024 
1025 
1026  // Back button
1027  $this->tpl->addBlockfile("BUTTONS", "buttons", "tpl.buttons.html");
1028  $this->tpl->setCurrentBlock("btn_cell");
1029  $this->tpl->setVariable("BTN_LINK",$this->ctrl->getLinkTarget($this,'returnToMembers'));
1030  $this->tpl->setVariable("BTN_TXT",$this->lng->txt("back"));
1031  $this->tpl->parseCurrentBlock();
1032 
1033  include_once 'Modules/Course/classes/Timings/class.ilTimingAccepted.php';
1034  $usr_accepted = new ilTimingAccepted($this->course_obj->getId(),(int) $_GET['member_id']);
1035 
1036  if($usr_accepted->isAccepted())
1037  {
1038  $this->tpl->setVariable("ACC_IMG",ilUtil::getImagePath('icon_ok.gif'));
1039  $this->tpl->setVariable("ACC_ALT",$this->lng->txt('timing_accepted'));
1040  }
1041  else
1042  {
1043  $this->tpl->setVariable("ACC_IMG",ilUtil::getImagePath('icon_not_ok.gif'));
1044  $this->tpl->setVariable("ACC_ALT",$this->lng->txt('timing_not_accepted'));
1045  }
1046  if($usr_accepted->isVisible() and strlen($usr_accepted->getRemark()))
1047  {
1048  $this->tpl->setVariable("REMARK",nl2br($usr_accepted->getRemark()));
1049  }
1050  else
1051  {
1052  $this->tpl->setVariable("REMARK",$this->lng->txt('not_available'));
1053  }
1054 
1055  $this->tpl->setVariable("TIMING_ACCEPT",$this->lng->txt('timing_accept_table'));
1056  $this->tpl->setVariable("TXT_ACCEPTED",$this->lng->txt('timing_user_accepted'));
1057  $this->tpl->setVariable("TXT_REMARK",$this->lng->txt('timing_remark'));
1058 
1059  $this->tpl->setVariable("HEADER_IMG",ilUtil::getImagePath('icon_usr.gif'));
1060  $this->tpl->setVariable("HEADER_ALT",$this->lng->txt('obj_usr'));
1061  $this->tpl->setVariable("TABLE_HEADER",$this->lng->txt('timings_of'));
1062  $name = ilObjUser::_lookupName($_GET['member_id']);
1063  $this->tpl->setVariable("USER_NAME",$name['lastname'].', '.$name['firstname']);
1064 
1065  $this->tpl->setVariable("TXT_TITLE",$this->lng->txt('title'));
1066  $this->tpl->setVariable("TXT_START_END",$this->lng->txt('crs_timings_short_start_end'));
1067  $this->tpl->setVariable("TXT_INFO_START_END",$this->lng->txt('crs_timings_start_end_info'));
1068  $this->tpl->setVariable("TXT_CHANGED",$this->lng->txt('crs_timings_changed'));
1069  $this->tpl->setVariable("TXT_OWN_PRESETTING",$this->lng->txt('crs_timings_planed_start'));
1070  $this->tpl->setVariable("TXT_INFO_OWN_PRESETTING",$this->lng->txt('crs_timings_from_until'));
1071 
1072  $this->items_obj = new ilCourseItems($this->course_obj->getRefId(),$this->container_obj->getRefId());
1073  $items =& $this->items_obj->getItems();
1074 
1075  foreach($items as $item)
1076  {
1077  if(($item['timing_type'] == IL_CRS_TIMINGS_PRESETTING) or
1078  ilCourseItems::_hasChangeableTimings($item['ref_id']))
1079  {
1080  $this->__renderUserItem($item,0);
1081  }
1082  }
1083  }
1084 
1085  function __renderUserItem($item,$level)
1086  {
1087  global $ilUser,$ilAccess;
1088 
1089  include_once 'Modules/Course/classes/Timings/class.ilTimingPlaned.php';
1090  include_once './Services/MetaData/classes/class.ilMDEducational.php';
1091 
1092  $this->lng->loadLanguageModule('meta');
1093 
1094  $usr_planed = new ilTimingPlaned($item['ref_id'],$_GET['member_id']);
1095  for($i = 0;$i < $level;$i++)
1096  {
1097  $this->tpl->touchBlock('start_indent');
1098  $this->tpl->touchBlock('end_indent');
1099  }
1100  if(strlen($item['description']))
1101  {
1102  $this->tpl->setCurrentBlock("item_description");
1103  $this->tpl->setVariable("DESC",$item['description']);
1104  $this->tpl->parseCurrentBlock();
1105  }
1106  if($tlt = ilMDEducational::_getTypicalLearningTimeSeconds($item['obj_id']))
1107  {
1108  $this->tpl->setCurrentBlock("tlt");
1109  $this->tpl->setVariable("TXT_TLT",$this->lng->txt('meta_typical_learning_time'));
1110  $this->tpl->setVariable("TLT_VAL",ilFormat::_secondsToString($tlt));
1111  $this->tpl->parseCurrentBlock();
1112  }
1113 
1114  $this->tpl->setCurrentBlock("title_plain");
1115  $this->tpl->setVariable("TITLE",$item['title']);
1116  $this->tpl->parseCurrentBlock();
1117 
1118  $this->tpl->setCurrentBlock("container_standard_row");
1119 
1120  $this->tpl->setVariable("ROWCLASS",ilUtil::switchColor($this->counter++,'tblrow1','tblrow2'));
1121  #$this->tpl->setVariable("TYPE_IMG",ilUtil::getImagePath('icon_'.$item['type'].'.gif'));
1122  $this->tpl->setVariable('TYPE_IMG',ilUtil::getTypeIconPath($item['type'],$item['obj_id'],'tiny'));
1123  $this->tpl->setVariable("TYPE_ALT_IMG",$this->lng->txt('obj_'.$item['type']));
1124 
1125  if($item['timing_type'] == IL_CRS_TIMINGS_PRESETTING)
1126  {
1127  $this->tpl->setVariable('SUG_START',ilDatePresentation::formatDate(new ilDate($item['suggestion_start'],IL_CAL_UNIX)));
1128  $this->tpl->setVariable('SUG_END',ilDatePresentation::formatDate(new ilDate($item['suggestion_end'],IL_CAL_UNIX)));
1129  }
1130 
1131  if($item['changeable'] and $item['timing_type'] == IL_CRS_TIMINGS_PRESETTING)
1132  {
1133  if($usr_planed->getPlanedStartingTime())
1134  {
1135  $start = $usr_planed->getPlanedStartingTime();
1136  }
1137  else
1138  {
1139  $start = $item['suggestion_start'];
1140  }
1141  $this->tpl->setVariable('OWN_START',ilDatePresentation::formatDate(new ilDate($start,IL_CAL_UNIX)));
1142 
1143  if($usr_planed->getPlanedEndingTime())
1144  {
1145  $end = $usr_planed->getPlanedEndingTime();
1146  }
1147  else
1148  {
1149  $end = $item['suggestion_end'];
1150  }
1151  if($start != $item['suggestion_start'] or $end != $item['suggestion_end'])
1152  {
1153  $this->tpl->setVariable("OK_IMG",ilUtil::getImagePath('icon_ok.gif'));
1154  $this->tpl->setVariable("OK_ALT",$this->lng->txt('crs_timings_changed'));
1155  }
1156  else
1157  {
1158  $this->tpl->setVariable("OK_IMG",ilUtil::getImagePath('icon_not_ok.gif'));
1159  $this->tpl->setVariable("OK_ALT",$this->lng->txt('crs_timings_not_changed'));
1160  }
1161  $this->tpl->setVariable('OWN_END',ilDatePresentation::formatDate(new ilDate($end,IL_CAL_UNIX)));
1162  }
1163 
1164  $this->tpl->parseCurrentBlock();
1165 
1166  $sub_items_obj = new ilCourseItems($this->course_obj->getRefId(),$item['ref_id'],$_GET['member_id']);
1167  foreach($sub_items_obj->getItems() as $item_data)
1168  {
1169  if(($item_data['timing_type'] == IL_CRS_TIMINGS_PRESETTING) or
1170  ilCourseItems::_hasChangeableTimings($item_data['ref_id']))
1171  {
1172  $this->__renderUserItem($item_data,$level+1);
1173  }
1174  }
1175  }
1176 
1177 
1178 
1180  {
1181  $this->tpl->addBlockfile('ADM_CONTENT','adm_content','tpl.crs_usr_edit_timings_adv.html','Modules/Course');
1182  $this->__showTimingsPanel();
1183  $this->__showUserAcceptanceTable();
1184 
1185  $this->tpl->setVariable("FORMACTION",$this->ctrl->getFormAction($this));
1186  $this->tpl->setVariable("HEADER_IMG",ilUtil::getImagePath('icon_crs.gif'));
1187  $this->tpl->setVariable("HEADER_ALT",$this->lng->txt('obj_crs'));
1188  $this->tpl->setVariable("BLOCK_HEADER_CONTENT",$this->lng->txt('timings_usr_edit'));
1189 
1190  if(!$_SESSION['crs_timings_user_hidden'])
1191  {
1192  $this->tpl->setVariable("SHOW_HIDE_TEXT",$this->lng->txt('show_details'));
1193  $this->ctrl->setParameter($this,'show_details',1);
1194  $this->tpl->setVariable("SHOW_HIDE_LINK",$this->ctrl->getLinkTarget($this,'editUserTimings'));
1195  }
1196  else
1197  {
1198  $this->tpl->setVariable("SHOW_HIDE_TEXT",$this->lng->txt('hide_details'));
1199  $this->ctrl->setParameter($this,'show_details',0);
1200  $this->tpl->setVariable("SHOW_HIDE_LINK",$this->ctrl->getLinkTarget($this,'editUserTimings'));
1201  }
1202  $this->ctrl->clearParameters($this);
1203  $this->tpl->setVariable("TXT_TITLE",$this->lng->txt('title'));
1204  $this->tpl->setVariable("TXT_START_END",$this->lng->txt('crs_timings_short_start_end'));
1205  $this->tpl->setVariable("TXT_INFO_START_END",$this->lng->txt('crs_timings_start_end_info'));
1206 
1207  $this->tpl->setVariable("TXT_LIMIT",$this->lng->txt('crs_timings_short_limit_start_end'));
1208  $this->tpl->setVariable("TXT_INFO_LIMIT",$this->lng->txt('crs_timings_from_until'));
1209 
1210  $this->tpl->setVariable("TXT_OWN_PRESETTING",$this->lng->txt('crs_timings_planed_start'));
1211  $this->tpl->setVariable("TXT_INFO_OWN_PRESETTING",$this->lng->txt('crs_timings_start_end_info'));
1212 
1213  $this->tpl->setVariable("TXT_DURATION",$this->lng->txt('crs_timings_time_frame'));
1214  $this->tpl->setVariable("TXT_INFO_DURATION",$this->lng->txt('crs_timings_in_days'));
1215 
1216  $this->tpl->setVariable("TXT_BTN_UPDATE",$this->lng->txt('save'));
1217  $this->tpl->setVariable("TXT_CANCEL",$this->lng->txt('cancel'));
1218 
1219  $this->items_obj = new ilCourseItems($this->course_obj->getRefId(),$this->container_obj->getRefId());
1220  $items =& $this->items_obj->getItems();
1221 
1222  $all_items = $this->items_obj->getFilteredItems($this->course_obj->getRefId());
1223  $sorted_items = $this->__sortByStart($all_items);
1224 
1225  $this->counter = 0;
1226  foreach($sorted_items as $item)
1227  {
1228  switch($item['type'])
1229  {
1230  /*
1231  case 'sess':
1232  $this->__renderEvent($item);
1233  break;
1234  */
1235  default:
1236  $this->__renderItem($item,0);
1237  break;
1238  }
1239  }
1240  }
1241 
1243  {
1244  $this->tpl->addBlockfile('ADM_CONTENT','adm_content','tpl.crs_usr_edit_timings.html','Modules/Course');
1245 
1246  $this->__showTimingsPanel();
1247  $this->__showUserAcceptanceTable();
1248 
1249  $this->tpl->setVariable("FORMACTION",$this->ctrl->getFormAction($this));
1250  $this->tpl->setVariable("HEADER_IMG",ilUtil::getImagePath('icon_crs.gif'));
1251  $this->tpl->setVariable("HEADER_ALT",$this->lng->txt('obj_crs'));
1252 
1253  if(!$_SESSION['crs_timings_user_hidden'])
1254  {
1255  $this->tpl->setVariable("SHOW_HIDE_TEXT",$this->lng->txt('show_details'));
1256  $this->ctrl->setParameter($this,'show_details',1);
1257  $this->tpl->setVariable("SHOW_HIDE_LINK",$this->ctrl->getLinkTarget($this,'editUserTimings'));
1258  }
1259  else
1260  {
1261  $this->tpl->setVariable("SHOW_HIDE_TEXT",$this->lng->txt('hide_details'));
1262  $this->ctrl->setParameter($this,'show_details',0);
1263  $this->tpl->setVariable("SHOW_HIDE_LINK",$this->ctrl->getLinkTarget($this,'editUserTimings'));
1264  }
1265  $this->ctrl->clearParameters($this);
1266 
1267  $this->tpl->setVariable("BLOCK_HEADER_CONTENT",$this->lng->txt('timings_timings'));
1268  $this->tpl->setVariable("TXT_TITLE",$this->lng->txt('title'));
1269  $this->tpl->setVariable("TXT_START",$this->lng->txt('crs_timings_sug_begin'));
1270  $this->tpl->setVariable("TXT_END",$this->lng->txt('crs_timings_sug_end'));
1271 
1272 
1273  $this->items_obj = new ilCourseItems($this->course_obj->getRefId(),$this->container_obj->getRefId());
1274 
1275  $all_items = $this->items_obj->getFilteredItems($this->course_obj->getRefId());
1276  $sorted_items = $this->__sortByStart($all_items);
1277 
1278  $this->counter = 0;
1279  foreach($sorted_items as $item)
1280  {
1281  switch($item['type'])
1282  {
1283  /*
1284  case 'sess':
1285  $this->__renderEvent($item);
1286  break;
1287  */
1288  default:
1289  $this->__renderItem($item,0);
1290  break;
1291  }
1292  }
1293  }
1294 
1295 
1296 
1297  function __sortByStart($a_items)
1298  {
1299  foreach($a_items as $item)
1300  {
1301  if($item['timing_type'] == IL_CRS_TIMINGS_DEACTIVATED)
1302  {
1303  $inactive[] = $item;
1304  }
1305  else
1306  {
1307  $active[] = $item;
1308  }
1309  }
1310  $sorted_active = ilUtil::sortArray((array) $active,"start","asc");
1311  $sorted_inactive = ilUtil::sortArray((array) $inactive,'title','asc');
1312 
1313  return array_merge($sorted_active,$sorted_inactive);
1314  }
1315 
1316  function __renderEvent($item)
1317  {
1318  global $ilAccess;
1319 
1320  if(strlen($item['description']))
1321  {
1322  $this->tpl->setCurrentBlock("item_description");
1323  $this->tpl->setVariable("DESC",$item['description']);
1324  $this->tpl->parseCurrentBlock();
1325  }
1326 
1327  if($ilAccess->checkAccess('read','',$item['ref_id']))
1328  {
1329  $this->tpl->setCurrentBlock("title_as_link");
1330 
1331  include_once './classes/class.ilLink.php';
1332  $this->tpl->setVariable("TITLE_LINK",ilLink::_getLink($item['ref_id'],$item['type']));
1333  $this->tpl->setVariable("TITLE_NAME",$item['title']);
1334  $this->tpl->parseCurrentBlock();
1335  }
1336  else
1337  {
1338  $this->tpl->setCurrentBlock("title_plain");
1339  $this->tpl->setVariable("TITLE",$item['title']);
1340  $this->tpl->parseCurrentBlock();
1341  }
1342 
1343 
1344  $this->tpl->setVariable('SUG_START',ilDatePresentation::formatDate(new ilDate($item['start'],IL_CAL_UNIX)));
1345  $this->tpl->setVariable('SUG_END',ilDatePresentation::formatDate(new ilDate($item['end'],IL_CAL_UNIX)));
1346 
1347  $this->tpl->setCurrentBlock("tlt");
1348  $this->tpl->setVariable("TXT_TLT",$this->lng->txt('event_date'));
1349  include_once('./Modules/Session/classes/class.ilSessionAppointment.php');
1350  $this->tpl->setVariable("TLT_VAL",ilSessionAppointment::_appointmentToString($item['start'],$item['end'],$item['fulltime']));
1351  $this->tpl->parseCurrentBlock();
1352 
1353  $this->tpl->setCurrentBlock("container_standard_row");
1354  $this->tpl->setVariable("ROWCLASS",ilUtil::switchColor($this->counter++,'tblrow1','tblrow2'));
1355  $this->tpl->setVariable("TYPE_IMG",ilUtil::getImagePath('icon_'.$item['type'].'.gif'));
1356  $this->tpl->setVariable("TYPE_ALT_IMG",$this->lng->txt('obj_'.$item['type']));
1357  $this->tpl->parseCurrentBlock();
1358 
1359  #if(!$_SESSION['crs_timings_user_hidden'])
1360  #{
1361  # return true;
1362  #}
1363  foreach($this->items_obj->getItemsByEvent($item['event_id']) as $item)
1364  {
1365  $this->__renderItem($item,1);
1366  }
1367  }
1368 
1369  function __renderItem($item,$level)
1370  {
1371  global $ilUser,$ilAccess;
1372 
1373  include_once 'Modules/Course/classes/Timings/class.ilTimingPlaned.php';
1374  include_once './classes/class.ilLink.php';
1375  include_once './Services/MetaData/classes/class.ilMDEducational.php';
1376 
1377  if(!$ilAccess->checkAccess('visible','',$item['ref_id']))
1378  {
1379  return false;
1380  }
1381 
1382  $this->lng->loadLanguageModule('meta');
1383 
1384  $usr_planed = new ilTimingPlaned($item['ref_id'],$ilUser->getId());
1385 
1386  for($i = 0;$i < $level;$i++)
1387  {
1388  $this->tpl->touchBlock('start_indent');
1389  $this->tpl->touchBlock('end_indent');
1390  }
1391  if(strlen($item['description']))
1392  {
1393  $this->tpl->setCurrentBlock("item_description");
1394  $this->tpl->setVariable("DESC",$item['description']);
1395  $this->tpl->parseCurrentBlock();
1396  }
1397  if($tlt = ilMDEducational::_getTypicalLearningTimeSeconds($item['obj_id']))
1398  {
1399  $this->tpl->setCurrentBlock("tlt");
1400  $this->tpl->setVariable("TXT_TLT",$this->lng->txt('meta_typical_learning_time'));
1401  $this->tpl->setVariable("TLT_VAL",ilFormat::_secondsToString($tlt));
1402  $this->tpl->parseCurrentBlock();
1403  }
1404 
1405  if($ilAccess->checkAccess('read','',$item['ref_id']))
1406  {
1407  $this->tpl->setCurrentBlock("title_as_link");
1408  $this->tpl->setVariable("TITLE_LINK",ilLink::_getLink($item['ref_id'],$item['type']));
1409  $this->tpl->setVariable("TITLE_NAME",$item['title']);
1410  $this->tpl->parseCurrentBlock();
1411  }
1412  else
1413  {
1414  $this->tpl->setCurrentBlock("title_plain");
1415  $this->tpl->setVariable("TITLE",$item['title']);
1416  $this->tpl->parseCurrentBlock();
1417  }
1418  $this->tpl->setCurrentBlock("container_standard_row");
1419 
1420  if(isset($this->invalid["$item[ref_id]"]))
1421  {
1422  $this->tpl->setVariable("ROWCLASS",'tblrowmarked');
1423  }
1424  else
1425  {
1426  $this->tpl->setVariable("ROWCLASS",ilUtil::switchColor($this->counter++,'tblrow1','tblrow2'));
1427  }
1428  #$this->tpl->setVariable("TYPE_IMG",ilUtil::getImagePath('icon_'.$item['type'].'.gif'));
1429  $this->tpl->setVariable('TYPE_IMG',ilUtil::getTypeIconPath($item['type'],$item['obj_id'],'small'));
1430  $this->tpl->setVariable("TYPE_ALT_IMG",$this->lng->txt('obj_'.$item['type']));
1431 
1432 
1433  if($item['timing_type'] == IL_CRS_TIMINGS_PRESETTING)
1434  {
1435  $this->tpl->setVariable('SUG_START',ilDatePresentation::formatDate(new ilDate($item['suggestion_start'],IL_CAL_UNIX)));
1436  $this->tpl->setVariable('SUG_END',ilDatePresentation::formatDate(new ilDate($item['suggestion_end'],IL_CAL_UNIX)));
1437  }
1438 
1439  if($item['changeable'])
1440  {
1441  $item_prefix = "item[".$item['ref_id'].']';
1442 
1443  if(is_array($_POST['item']["$item[ref_id]"]['own_start']))
1444  {
1445  #echo "Start post<br>";
1446  $start = $this->__toUnix($_POST['item']["$item[ref_id]"]['own_start']);
1447  }
1448  elseif($usr_planed->getPlanedStartingTime())
1449  {
1450  #echo "Own start<br>";
1451  $start = $usr_planed->getPlanedStartingTime();
1452  }
1453  else
1454  {
1455  #echo "Empfehlung start<br>";
1456  $start = $item['suggestion_start'];
1457  }
1458 
1459  $date = $this->__prepareDateSelect($start);
1460  $this->tpl->setVariable("OWN_START",
1461  ilUtil::makeDateSelect($item_prefix."[own_start]",
1462  $date['y'],$date['m'],$date['d'],date('Y',time()),false));
1463 
1464  if($usr_planed->getPlanedEndingTime())
1465  {
1466  #echo "Own End<br>";
1467  $end = $usr_planed->getPlanedEndingTime();
1468  }
1469  else
1470  {
1471  #echo "Empfehlung end<br>";
1472  $end = $item['suggestion_end'];
1473  }
1474  $this->tpl->setVariable('OWN_END',ilDatePresentation::formatDate(new ilDate($end,IL_CAL_UNIX)));
1475  $this->tpl->setVariable("NAME_DURATION",$item_prefix."[duration]");
1476 
1477  // Duration
1478  if(isset($_POST['item']["$item[ref_id]"]['duration']))
1479  {
1480  $this->tpl->setVariable("VAL_DURATION",$_POST['item']["$item[ref_id]"]['duration']);
1481  }
1482  else
1483  {
1484  $this->tpl->setVariable("VAL_DURATION",intval(($end - $start) / (60 * 60 * 24)));
1485  }
1486  $this->tpl->setVariable('LIM_START',ilDatePresentation::formatDate(new ilDate($item['earliest_start'],IL_CAL_UNIX)));
1487  $this->tpl->setVariable('LIM_END',ilDatePresentation::formatDate(new ilDate($item['latest_end'],IL_CAL_UNIX)));
1488  }
1489 
1490  $this->tpl->parseCurrentBlock();
1491 
1492  if(!$_SESSION['crs_timings_user_hidden'])
1493  {
1494  return true;
1495  }
1496 
1497  $sub_items_obj = new ilCourseItems($this->course_obj->getRefId(),$item['ref_id']);
1498  foreach($sub_items_obj->getItems() as $item_data)
1499  {
1500  $this->__renderItem($item_data,$level+1);
1501  }
1502  }
1503 
1505  {
1506  global $ilAccess;
1507 
1508  if(!$ilAccess->checkAccess('write','',$this->container_obj->getRefId()))
1509  {
1510  return true;
1511  }
1512 
1513  if(!$_SESSION['crs_timings_panel'][$this->course_obj->getId()])
1514  {
1515  $this->tpl->addBlockfile("BUTTONS", "buttons", "tpl.buttons.html");
1516  $this->tpl->setCurrentBlock("btn_cell");
1517  $this->tpl->setVariable("BTN_LINK",$this->ctrl->getLinkTarget($this,'timingsOn'));
1518  $this->tpl->setVariable("BTN_TXT",$this->lng->txt("timings_timings_on"));
1519  $this->tpl->parseCurrentBlock();
1520  }
1521  else
1522  {
1523  $this->tpl->addBlockfile("BUTTONS", "buttons", "tpl.buttons.html");
1524  $this->tpl->setCurrentBlock("btn_cell");
1525  $this->tpl->setVariable("BTN_LINK",$this->ctrl->getLinkTarget($this,'timingsOff'));
1526  $this->tpl->setVariable("BTN_TXT",$this->lng->txt("timings_timings_off"));
1527  $this->tpl->parseCurrentBlock();
1528  }
1529  }
1530 
1531  function timingsOn()
1532  {
1533  global $ilTabs;
1534  $_SESSION['crs_timings_panel'][$this->course_obj->getId()] = 1;
1535 
1536  $ilTabs->clearSubTabs();
1537  $this->__setSubTabs();
1538  $this->editTimings();
1539  }
1540 
1541  function timingsOff()
1542  {
1543  global $ilTabs;
1544  $_SESSION['crs_timings_panel'][$this->course_obj->getId()] = 0;
1545 
1546  $ilTabs->clearSubTabs();
1547  $this->__setSubTabs();
1548  $this->editUserTimings();
1549  }
1550 
1551 
1553  {
1554  global $ilUser,$ilObjDataCache;
1555  include_once 'Modules/Course/classes/Timings/class.ilTimingPlaned.php';
1556 
1557  // Validate
1558  $this->invalid = array();
1559  foreach($_POST['item'] as $ref_id => $data)
1560  {
1561  $tmp_planed = new ilTimingPlaned($ref_id,$ilUser->getId());
1562 
1563  $tmp_planed->setPlanedStartingTime($this->__toUnix($data['own_start']));
1564  if(isset($data['duration']))
1565  {
1566  $data['own_start']['d'] += $data['duration'];
1567  $tmp_planed->setPlanedEndingTime($this->__toUnix($data['own_start'],array('h' => 23,'m' => 55)));
1568  }
1569  else
1570  {
1571  $tmp_planed->setPlanedEndingTime($this->__toUnix($data['own_start']),array('h' => 23,'m' => 55));
1572  }
1573  if(!$tmp_planed->validate())
1574  {
1575  $this->invalid[$ref_id] = $ilObjDataCache->lookupTitle($ilObjDataCache->lookupObjId($ref_id));
1576  }
1577  $all_items[] = $tmp_planed;
1578  }
1579  if(count($this->invalid))
1580  {
1581  $message = $this->lng->txt('crs_timings_update_error');
1582  $message .= ("<br />".$this->lng->txt('crs_materials').': ');
1583  $message .= (implode(',',$this->invalid));
1584  ilUtil::sendFailure($message);
1585  $this->editUserTimings();
1586  return false;
1587  }
1588  foreach($all_items as $new_item_obj)
1589  {
1590  $new_item_obj->update();
1591  }
1592  ilUtil::sendSuccess($this->lng->txt('settings_saved'));
1593  $this->editUserTimings();
1594  return true;
1595 
1596  }
1597 
1598 
1599  function &__loadFromPost(&$item)
1600  {
1601  $obj_id = $item['obj_id'];
1602 
1603  if(!isset($_POST['item'][$obj_id]))
1604  {
1605  return $item;
1606  }
1607  $item['suggestion_start'] = $this->__toUnix($_POST['item'][$obj_id]['sug_start']);
1608  $item['suggestion_end'] = $this->__toUnix($_POST['item'][$obj_id]['sug_end']);
1609  $item['earliest_start'] = $this->__toUnix($_POST['item'][$obj_id]['lim_start']);
1610  $item['latest_end'] = $this->__toUnix($_POST['item'][$obj_id]['lim_end']);
1611  $item['changeable'] = $_POST['item'][$obj_id]['change'];
1612  $item['timing_type'] = $_POST['item'][$obj_id]['active'] ? IL_CRS_TIMINGS_PRESETTING : $item['timing_type'];
1613  $item['duration_a'] = $_POST['item'][$obj_id]['duration_a'];
1614  $item['duration_b'] = $_POST['item'][$obj_id]['duration_b'];
1615 
1616  return $item;
1617  }
1618 
1619  function updateTimings()
1620  {
1621  include_once 'Modules/Course/classes/class.ilCourseItems.php';
1622 
1623  global $ilAccess,$ilErr;
1624 
1625  if(!$ilAccess->checkAccess('write','',$this->container_obj->getRefId()))
1626  {
1627  $ilErr->raiseError($this->lng->txt('msg_no_perm_write'),$ilErr->WARNING);
1628  }
1629  $this->failed = array();
1630  // Validate
1631 
1632  $_POST['item'] = is_array($_POST['item']) ? $_POST['item'] : array();
1633  $all_items = array();
1634 
1635  foreach($_POST['item'] as $ref_id => $data)
1636  {
1637  $item_obj =& new ilCourseItems($this->course_obj->getRefId(),$this->container_obj->getRefId());
1638  $old_data = $item_obj->getItem($ref_id);
1639 
1640  $item_obj->setTimingType($_POST['item_active'][$ref_id]['active'] ? IL_CRS_TIMINGS_PRESETTING : IL_CRS_TIMINGS_DEACTIVATED);
1641  $item_obj->setTimingStart($old_data['timing_start']);
1642  $item_obj->setTimingEnd($old_data['timing_end']);
1643  $item_obj->setSuggestionStart($this->__toUnix($data["sug_start"]));
1644 
1645  // add duration
1646  $data['sug_start']['d'] += abs($data['duration_a']);
1647  $item_obj->setSuggestionEnd($this->__toUnix($data['sug_start'],array('h' => 23,'m' => 55)));
1648 
1649  $item_obj->setEarliestStart(time());
1650  $item_obj->setLatestEnd($this->__toUnix($data['lim_end'],array('h' => 23,'m' => 55)));
1651 
1652  $item_obj->toggleVisible($old_data['visible']);
1653  $item_obj->toggleChangeable($_POST['item_change'][$ref_id]['change']);
1654 
1655  if(!$item_obj->validateActivation())
1656  {
1657  $this->failed[$ref_id] = $old_data['title'];
1658  }
1659  $all_items[$ref_id] =& $item_obj;
1660  unset($item_obj);
1661  }
1662 
1663  if(count($this->failed))
1664  {
1665  $message = $this->lng->txt('crs_timings_update_error');
1666  $message .= ("<br />".$this->lng->txt('crs_materials').': ');
1667  $message .= (implode(',',$this->failed));
1668  ilUtil::sendFailure($message);
1669  $this->editTimings();
1670  return false;
1671  }
1672 
1673  // No do update
1674  foreach($all_items as $ref_id => $item_obj_new)
1675  {
1676  $item_obj_new->update($ref_id);
1677  }
1678  ilUtil::sendSuccess($this->lng->txt('settings_saved'));
1679  $this->editTimings();
1680  return false;
1681  }
1682 
1683 
1684  // BEGIN WebDAV: Get Icon of Item from List Item GUI
1685 /* this moved to ilContainerContentGUI and ilContainerGUI->modifyItemGUI */
1686  function __getItemGUI($cont_data,$a_show_path = false)
1687  {
1688  include_once 'Services/Object/classes/class.ilObjectListGUIFactory.php';
1689 
1690  // ACTIVATION
1691  $activation = '';
1692  if($cont_data['timing_type'] != IL_CRS_TIMINGS_DEACTIVATED and $cont_data['timing_type'] != IL_CRS_TIMINGS_FIXED)
1693  {
1694  $long = $cont_data['timing_type'] == IL_CRS_TIMINGS_ACTIVATION;
1695 
1696  $activation = ilDatePresentation::formatPeriod(
1697  new ilDateTime($cont_data['start'],IL_CAL_UNIX),
1698  new ilDateTime($cont_data['end'],IL_CAL_UNIX));
1699 
1700  }
1701  // get item list gui object
1702  if (!is_object ($this->list_gui[$cont_data["type"]]))
1703  {
1704  $item_list_gui =& ilObjectListGUIFactory::_getListGUIByType($cont_data["type"]);
1705 
1706  $item_list_gui->setContainerObject($this->container_gui);
1707  // Enable/disable subscription depending on course settings
1708  $item_list_gui->enableSubscribe($this->course_obj->getAboStatus());
1709 
1710  $this->list_gui[$cont_data["type"]] =& $item_list_gui;
1711  }
1712  else
1713  {
1714  $item_list_gui =& $this->list_gui[$cont_data["type"]];
1715  }
1716 
1717  // show administration command buttons (or not)
1718  if (!$this->container_gui->isActiveAdministrationPanel())
1719  {
1720  $item_list_gui->enableDelete(false);
1721  $item_list_gui->enableLink(false);
1722  $item_list_gui->enableCut(false);
1723  $item_list_gui->enableCopy(false);
1724  }
1725 
1726  // add activation custom property
1727  if ($activation != "")
1728  {
1729  $item_list_gui->addCustomProperty($this->lng->txt($cont_data['activation_info']), $activation,
1730  false, true);
1731  }
1732 
1733  if($a_show_path and $this->is_tutor)
1734  {
1735  $item_list_gui->addCustomProperty($this->lng->txt('path'),
1736  $this->__buildPath($cont_data['ref_id']),
1737  false,
1738  true);
1739  }
1740 
1741 
1742  if($this->is_tutor)
1743  {
1744  $this->ctrl->setParameterByClass('ilcourseitemadministrationgui',"ref_id",
1745  $this->container_obj->getRefId());
1746  $this->ctrl->setParameterByClass('ilcourseitemadministrationgui',"item_id",
1747  $cont_data['child']);
1748 
1749  $item_list_gui->addCustomCommand($this->ctrl->getLinkTargetByClass('ilCourseItemAdministrationGUI',
1750  'edit'),
1751  'activation');
1752  }
1753 
1754  return $item_list_gui;
1755  }
1756  // ENDWebDAV: Get Icon of Item from List Item GUI
1757 
1758  function __getOptions($cont_data,$num)
1759  {
1760  if($this->is_tutor)
1761  {
1762  $images = array();
1763  if($this->course_obj->getOrderType() == ilContainer::SORT_MANUAL)
1764  {
1765  if($num != 0)
1766  {
1767  $tmp_array["gif"] = ilUtil::getImagePath("a_up.gif");
1768  $tmp_array["lng"] = $this->lng->txt("crs_move_up");
1769 
1770  $this->ctrl->setParameterByClass('ilcourseitemadministrationgui',"ref_id",
1771  $this->container_obj->getRefId());
1772  $this->ctrl->setParameterByClass('ilcourseitemadministrationgui',"item_id",
1773  $cont_data['child']);
1774  $tmp_array['lnk'] = $this->ctrl->getLinkTargetByClass('ilcourseitemadministrationgui','moveUp');
1775  $tmp_array["tar"] = "";
1776 
1777  $images[] = $tmp_array;
1778  }
1779  if($num != count($this->cont_arr) - 1)
1780  {
1781  $tmp_array["gif"] = ilUtil::getImagePath("a_down.gif");
1782  $tmp_array["lng"] = $this->lng->txt("crs_move_down");
1783  $this->ctrl->setParameterByClass('ilcourseitemadministrationgui',"ref_id",
1784  $this->container_obj->getRefId());
1785  $this->ctrl->setParameterByClass('ilcourseitemadministrationgui',"item_id",
1786  $cont_data['child']);
1787  $tmp_array['lnk'] = $this->ctrl->getLinkTargetByClass('ilcourseitemadministrationgui','moveDown');
1788 
1789  $images[] = $tmp_array;
1790  }
1791  }
1792 
1793  }
1794  return $images ? $images : array();
1795  }
1796 
1797 
1798  function __showFeedback()
1799  {
1800  if(!$this->is_tutor && $this->container_obj->getType() == 'crs')
1801  {
1802  include_once('Services/Feedback/classes/class.ilFeedbackGUI.php');
1803  $feedbackGUI = new ilFeedbackGUI();
1804  $feedbackHTML = $feedbackGUI->getCRSFeedbackListHTML();
1805 
1806  if(strlen($feedbackHTML))
1807  {
1808  $this->tpl->setCurrentBlock("cont_page_content");
1809  $this->tpl->setVariable("CONTAINER_PAGE_CONTENT",$feedbackHTML);
1810  $this->tpl->parseCurrentBlock();
1811  }
1812  }
1813  return true;
1814  }
1815 
1816  function __setSubTabs()
1817  {
1818  if($this->container_obj->getType() == 'crs')
1819  {
1820  $this->container_gui->setContentSubTabs();
1821  }
1822  }
1823 
1825  {
1826  global $tree;
1827 
1828  if($this->container_obj->getType() == 'crs')
1829  {
1830  // Container is course
1831  $this->course_obj =& $this->container_obj;
1832  }
1833  else
1834  {
1835 
1836  $course_ref_id = $tree->checkForParentType($this->container_obj->getRefId(),'crs');
1837  $this->course_obj =& ilObjectFactory::getInstanceByRefId($course_ref_id);
1838  }
1839  return true;
1840  }
1841 
1842  function __toUnix($date,$time = array())
1843  {
1844  return gmmktime($time['h'],$time['m'],0,$date['m'],$date['d'],$date['y']);
1845  }
1846 
1847  function __prepareDateSelect($a_unix_time)
1848  {
1849  return array('y' => date('Y',$a_unix_time),
1850  'm' => date('m',$a_unix_time),
1851  'd' => date('d',$a_unix_time));
1852  }
1853 
1854  function __prepareTimeSelect($a_unix_time)
1855  {
1856  return array('h' => date('G',$a_unix_time),
1857  'm' => date('i',$a_unix_time),
1858  's' => date('s',$a_unix_time));
1859  }
1860 
1861 
1862  function __buildPath($a_ref_id)
1863  {
1864  global $tree;
1865 
1866  $path_arr = $tree->getPathFull($a_ref_id,$this->course_obj->getRefId());
1867  $counter = 0;
1868  foreach($path_arr as $data)
1869  {
1870  if($counter++)
1871  {
1872  $path .= " -> ";
1873  }
1874  $path .= $data['title'];
1875  }
1876 
1877  return $path;
1878  }
1879 
1880 
1881 } // END class.ilCourseContentGUI
1882 ?>