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