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