38 $this->lng->loadLanguageModule(
'crs');
39 $this->tabs_gui =& $ilTabs;
41 $this->container_gui =& $container_gui_obj;
42 $this->container_obj =& $this->container_gui->object;
51 if(!$ilAccess->checkAccess(
'read',
'',$this->container_obj->getRefId()))
53 $ilErr->raiseError($this->lng->txt(
'msg_no_perm_read'),$ilErr->WARNING);
60 $this->tabs_gui->setTabActive(
'view_content');
61 $cmd = $this->ctrl->getCmd();
63 switch($this->ctrl->getNextClass($this))
65 case 'ilcoursearchivesgui':
70 $ilCtrl->saveParameterByClass(
"ilcolumngui",
"col_return");
71 $ilTabs->setSubTabActive(
"crs_content");
83 if(!$this->is_tutor = $ilAccess->checkAccess(
'write',
'',$this->course_obj->getRefId()) and
84 $this->course_obj->isArchived())
91 if((!$this->is_tutor and
92 $this->container_obj->getType() ==
'crs' and
93 $this->container_obj->enabledObjectiveView()) ||
94 $_GET[
"col_return"] ==
"objectives")
96 $this->use_objective_presentation =
true;
117 if(
$_SESSION[
'crs_timings_panel'][$this->course_obj->getId()])
119 return 'editTimings';
121 if($ilAccess->checkAccess(
'write',
'',$this->container_obj->getRefId()))
125 if($this->container_obj->getType() ==
'crs' and
128 return 'editUserTimings';
135 include_once
'Modules/Course/classes/class.ilCourseArchivesGUI.php';
137 $this->ctrl->setReturn($this,
'');
139 $this->ctrl->forwardCommand($archives_gui);
141 $this->tabs_gui->setTabActive(
'view_content');
142 $this->tabs_gui->setSubTabActive(
'crs_archives');
149 include_once
'./Modules/Course/classes/class.ilCourseStart.php';
153 if($ilAccess->checkAccess(
'write',
'',$this->course_obj->getRefId()))
157 $this->start_obj =
new ilCourseStart($this->course_obj->getRefId(),$this->course_obj->getId());
158 if(count($this->start_obj->getStartObjects()) and !$this->start_obj->allFullfilled($ilUser->getId()))
167 include_once
'./Modules/Course/classes/class.ilCourseLMHistory.php';
168 include_once
'./Services/Repository/classes/class.ilRepositoryExplorer.php';
169 include_once
'./Services/Link/classes/class.ilLink.php';
173 $this->tabs_gui->setSubTabActive(
'crs_content');
175 $this->tpl->addBlockFile(
"ADM_CONTENT",
"adm_content",
"tpl.crs_start_view.html",
'Modules/Course');
176 $this->tpl->setVariable(
"INFO_STRING",$this->lng->txt(
'crs_info_start'));
177 $this->tpl->setVariable(
"TBL_TITLE_START",$this->lng->txt(
'crs_table_start_objects'));
178 $this->tpl->setVariable(
"HEADER_NR",$this->lng->txt(
'crs_nr'));
179 $this->tpl->setVariable(
"HEADER_DESC",$this->lng->txt(
'description'));
180 $this->tpl->setVariable(
"HEADER_EDITED",$this->lng->txt(
'crs_objective_accomplished'));
183 $lm_continue =&
new ilCourseLMHistory($this->course_obj->getRefId(),$ilUser->getId());
187 foreach($this->start_obj->getStartObjects() as $start)
189 $obj_id = $ilObjDataCache->lookupObjId($start[
'item_ref_id']);
190 $ref_id = $start[
'item_ref_id'];
191 $type = $ilObjDataCache->lookupType(
$obj_id);
197 $obj_frame = $obj_frame ? $obj_frame :
'';
200 $obj_frame = $type ==
'tst' ?
'' : $obj_frame;
204 if($ilAccess->checkAccess(
'read',
'',
$ref_id))
206 $this->tpl->setCurrentBlock(
"start_read");
207 $this->tpl->setVariable(
"READ_TITLE_START",$ilObjDataCache->lookupTitle(
$obj_id));
208 $this->tpl->setVariable(
"READ_TARGET_START",$obj_frame);
209 $this->tpl->setVariable(
"READ_LINK_START", $obj_link.
'&crs_show_result='.$this->course_obj->getRefId());
210 $this->tpl->parseCurrentBlock();
214 $this->tpl->setCurrentBlock(
"start_visible");
215 $this->tpl->setVariable(
"VISIBLE_LINK_START",$ilObjDataCache->lookupTitle(
$obj_id));
216 $this->tpl->parseCurrentBlock();
220 if(isset($continue_data[
$ref_id]))
222 $this->tpl->setCurrentBlock(
"link");
223 $this->tpl->setVariable(
"LINK_HREF",
ilLink::_getLink($ref_id,
'',array(
'obj_id',
224 $continue_data[$ref_id][
'lm_page_id'])));
225 #$this->tpl->setVariable("CONTINUE_LINK_TARGET",$target);
226 $this->tpl->setVariable(
"LINK_NAME",$this->lng->txt(
'continue_work'));
227 $this->tpl->parseCurrentBlock();
231 if(!$ilUser->isDesktopItem($ref_id,$type) and
232 $this->course_obj->getAboStatus())
234 if ($ilAccess->checkAccess(
'read',
'',$ref_id))
236 $this->tpl->setCurrentBlock(
"link");
237 $this->ctrl->setParameterByClass(get_class($this->container_gui),
'item_ref_id',$ref_id);
238 $this->ctrl->setParameterByClass(get_class($this->container_gui),
'item_id',$ref_id);
239 $this->ctrl->setParameterByClass(get_class($this->container_gui),
'type',$type);
241 $this->tpl->setVariable(
"LINK_HREF",$this->ctrl->getLinkTarget($this->container_gui,
'addToDesk'));
242 $this->tpl->setVariable(
"LINK_NAME", $this->lng->txt(
"to_desktop"));
243 $this->tpl->parseCurrentBlock();
246 elseif($this->course_obj->getAboStatus())
248 $this->tpl->setCurrentBlock(
"link");
249 $this->ctrl->setParameterByClass(get_class($this->container_gui),
'item_ref_id',$ref_id);
250 $this->ctrl->setParameterByClass(get_class($this->container_gui),
'item_id',$ref_id);
251 $this->ctrl->setParameterByClass(get_class($this->container_gui),
'type',$type);
253 $this->tpl->setVariable(
"LINK_HREF",$this->ctrl->getLinkTarget($this->container_gui,
'removeFromDesk'));
254 $this->tpl->setVariable(
"LINK_NAME", $this->lng->txt(
"unsubscribe"));
255 $this->tpl->parseCurrentBlock();
260 if(strlen($ilObjDataCache->lookupDescription(
$obj_id)))
262 $this->tpl->setCurrentBlock(
"start_description");
263 $this->tpl->setVariable(
"DESCRIPTION_START",$ilObjDataCache->lookupDescription(
$obj_id));
264 $this->tpl->parseCurrentBlock();
268 if($this->start_obj->isFullfilled($ilUser->getId(),
$ref_id))
270 $accomplished =
'accomplished';
275 $accomplished =
'not_accomplished';
278 $this->tpl->setCurrentBlock(
"start_row");
279 $this->tpl->setVariable(
"EDITED_IMG", $icon);
280 $this->tpl->setVariable(
"EDITED_ALT",$this->lng->txt(
'crs_objective_'.$accomplished));
281 $this->tpl->setVariable(
"ROW_CLASS",
'option_value');
282 $this->tpl->setVariable(
"ROW_CLASS_CENTER",
'option_value_center');
283 $this->tpl->setVariable(
"OBJ_NR_START",++$counter.
'.');
284 $this->tpl->parseCurrentBlock();
295 require_once(
'Services/Tracking/classes/class.ilChangeEvent.php');
299 $this->container_obj->getType(), $this->container_obj->getRefId(),
305 if (!$this->no_right_column)
318 $ilCtrl->saveParameterByClass(
"ilcolumngui",
"col_return");
323 include_once(
"Services/Block/classes/class.ilColumnGUI.php");
333 if ($ilCtrl->getNextClass() ==
"ilcolumngui" &&
338 $html = $ilCtrl->forwardCommand($column_gui);
342 if (!$ilCtrl->isAsynch())
344 $html = $ilCtrl->getHTML($column_gui);
353 global $ilAccess,
$lng;
355 $column_gui->setRepositoryMode(
true);
356 $column_gui->setEnableEdit(
false);
357 $column_gui->setBlockProperty(
"news",
"title",
358 $lng->txt(
"crs_news"));
360 include_once
"Services/Object/classes/class.ilObjectActivation.php";
361 $grouped_items = array();
364 $grouped_items[$item[
"type"]][] = $item;
367 $column_gui->setRepositoryItems($grouped_items);
368 if ($ilAccess->checkAccess(
"write",
"", $this->container_obj->getRefId()))
370 $column_gui->setEnableEdit(
true);
374 if ($this->is_tutor &&
375 $this->container_gui->isActiveAdministrationPanel())
377 $column_gui->setEnableMovement(
true);
383 $column_gui->setBlockProperty(
"news",
"settings",
true);
385 $column_gui->setBlockProperty(
"news",
"default_visibility_option",
true);
386 $column_gui->setBlockProperty(
"news",
"hide_news_block_option",
true);
389 if ($this->container_gui->isActiveAdministrationPanel())
391 $column_gui->setAdminCommands(
true);
403 include_once(
"Services/Block/classes/class.ilColumnGUI.php");
408 if (!$ilCtrl->isAsynch())
418 $html = $ilCtrl->forwardCommand($column_gui);
425 $html = $ilCtrl->forwardCommand($column_gui);
431 $this->getDefaultView();
443 include_once
'Services/MetaData/classes/class.ilMDEducational.php';
444 include_once
'./Services/Link/classes/class.ilLink.php';
446 $this->lng->loadLanguageModule(
'meta');
448 if(!$ilAccess->checkAccess(
'write',
'',$this->container_obj->getRefId()))
450 $ilErr->raiseError($this->lng->txt(
'msg_no_perm_write'),$ilErr->WARNING);
453 $this->tabs_gui->setSubTabActive(
'timings_timings');
455 include_once
'Services/Object/classes/class.ilObjectActivation.php';
458 $this->tpl->addBlockfile(
'ADM_CONTENT',
'adm_content',
'tpl.crs_edit_items.html',
'Modules/Course');
459 $this->tpl->setVariable(
"FORMACTION",$this->ctrl->getFormAction($this));
461 $this->tpl->setVariable(
"HEADER_ALT",$this->lng->txt(
'crs_materials'));
462 $this->tpl->setVariable(
"BLOCK_HEADER_CONTENT",$this->lng->txt(
'edit_timings_list'));
463 $this->tpl->setVariable(
"TXT_TITLE",$this->lng->txt(
'title'));
466 $this->tpl->setVariable(
"TXT_DURATION",$this->lng->txt(
'crs_timings_time_frame'));
467 $this->tpl->setVariable(
"TXT_INFO_DURATION",$this->lng->txt(
'crs_timings_in_days'));
469 $this->tpl->setVariable(
"TXT_START_END",$this->lng->txt(
'crs_timings_short_start_end'));
470 $this->tpl->setVariable(
"TXT_INFO_START_END",$this->lng->txt(
'crs_timings_start_end_info'));
472 $this->tpl->setVariable(
"TXT_CHANGEABLE",$this->lng->txt(
'crs_timings_short_changeable'));
474 $this->tpl->setVariable(
"TXT_INFO_LIMIT",$this->lng->txt(
'crs_timings_from_until'));
475 $this->tpl->setVariable(
"TXT_LIMIT",$this->lng->txt(
'crs_timings_short_limit_start_end'));
476 $this->tpl->setVariable(
"TXT_ACTIVE",$this->lng->txt(
'crs_timings_short_active'));
477 $this->tpl->setVariable(
"TXT_INFO_ACTIVE",$this->lng->txt(
'crs_timings_info_active'));
480 foreach($this->cont_arr as $item)
482 if($item[
'type'] ==
'itgr')
487 $item_prefix =
"item[$item[ref_id]]";
488 $item_change_prefix =
"item_change[$item[ref_id]]";
489 $item_active_prefix =
"item_active[$item[ref_id]]";
491 if($item[
'type'] ==
'grp' or
492 $item[
'type'] ==
'fold')
494 $this->tpl->setVariable(
"TITLE_LINK",
ilLink::_getLink($item[
'ref_id'],$item[
'type']));
496 $this->tpl->setVariable(
"TITLE_LINK_NAME",$item[
'title']);
500 if(!$item[
'title'] &&
501 $item[
'type'] ==
'sess')
503 include_once(
'./Modules/Session/classes/class.ilSessionAppointment.php');
508 $this->tpl->setVariable(
"TITLE",$item[
'title']);
511 if(strlen($item[
'description']))
513 $this->tpl->setCurrentBlock(
"item_description");
514 $this->tpl->setVariable(
"DESC",$item[
'description']);
515 $this->tpl->parseCurrentBlock();
520 $this->tpl->setCurrentBlock(
"tlt");
521 $this->tpl->setVariable(
"TXT_TLT",$this->lng->txt(
'meta_typical_learning_time'));
523 $this->tpl->parseCurrentBlock();
526 $this->tpl->setCurrentBlock(
"container_standard_row");
529 if(is_array(
$_POST[
'item'][
"$item[ref_id]"][
'sug_start']))
531 $start = $this->
__toUnix(
$_POST[
'item'][
"$item[ref_id]"][
'sug_start']);
535 $start = $item[
'suggestion_start'];
537 $end = $item[
'suggestion_end'];
539 $this->tpl->setVariable(
"SUG_START",
541 $date[
'y'],$date[
'm'],$date[
'd'],date(
'Y',time()),
false));
543 $this->tpl->setVariable(
"NAME_DURATION_A",$item_prefix.
"[duration_a]");
544 if(isset(
$_POST[
'item'][
"$item[ref_id]"][
'duration_a']))
546 $this->tpl->setVariable(
"VAL_DURATION_A",abs(
$_POST[
'item'][
"$item[ref_id]"][
'duration_a']));
550 $this->tpl->setVariable(
"VAL_DURATION_A",intval(($end-$start)/(60*60*24)));
556 if(is_array(
$_POST[
'item'][
"$item[ref_id]"][
'lim_end']))
558 $end = $this->
__toUnix(
$_POST[
'item'][
"$item[ref_id]"][
'lim_end']);
562 $end = $item[
'latest_end'];
566 $this->tpl->setVariable(
"LIM_END",
568 $date[
'y'],$date[
'm'],$date[
'd'],date(
'Y',time()),
false));
570 $this->tpl->setVariable(
"NAME_CHANGE",$item_change_prefix.
"[change]");
571 $this->tpl->setVariable(
"NAME_ACTIVE",$item_active_prefix.
"[active]");
575 $change =
$_POST[
'item_change'][
"$item[ref_id]"][
'change'];
576 $active =
$_POST[
'item_active'][
"$item[ref_id]"][
'active'];
580 $change = $item[
'changeable'];
584 $this->tpl->setVariable(
"CHECKED_ACTIVE",$active ?
'checked="checked"' :
'');
585 $this->tpl->setVariable(
"CHECKED_CHANGE",$change ?
'checked="checked"' :
'');
587 if(isset($this->failed[
"$item[ref_id]"]))
589 $this->tpl->setVariable(
"ROWCLASS",
'tblrowmarked');
595 $this->tpl->parseCurrentBlock();
600 $this->tpl->setVariable(
"SELECT_ALL",$this->lng->txt(
'select_all'));
602 $this->tpl->setVariable(
"BTN_SAVE",$this->lng->txt(
'save'));
603 $this->tpl->setVariable(
"BTN_CANCEL",$this->lng->txt(
'cancel'));
611 include_once
'Modules/Course/classes/Timings/class.ilTimingAccepted.php';
612 $accept_obj =
new ilTimingAccepted($this->course_obj->getId(),$ilUser->getId());
614 include_once(
'Services/Form/classes/class.ilPropertyFormGUI.php');
616 $form->setFormAction($this->ctrl->getFormAction($this,
'saveAcceptance'));
617 $form->setTitle($this->lng->txt(
'timing_accept_table'));
620 $accept->
setChecked($accept_obj->isAccepted());
621 $form->addItem($accept);
624 $remark->
setValue($accept_obj->getRemark());
625 $form->addItem($remark);
629 $form->addItem($tutor);
631 $form->addCommandButton(
'saveAcceptance', $this->lng->txt(
'save'));
632 $this->tpl->setVariable(
"FORM", $form->getHTML());
639 include_once
'Modules/Course/classes/Timings/class.ilTimingAccepted.php';
640 $accept_obj =
new ilTimingAccepted($this->course_obj->getId(),$ilUser->getId());
643 $accept_obj->accept(
$_POST[
'accepted']);
644 $accept_obj->setVisible(
$_POST[
'tutor']);
645 $accept_obj->update();
652 if(
$_SESSION[
'crs_timings_panel'][$this->course_obj->getId()])
658 if(!$ilAccess->checkAccess(
'read',
'',$this->container_obj->getRefId()))
660 $ilErr->raiseError($this->lng->txt(
'msg_no_perm_read'),$ilErr->WARNING);
662 $this->tabs_gui->setSubTabActive(
'timings_timings');
666 include_once
'Services/Object/classes/class.ilObjectActivation.php';
679 $this->ctrl->returnToParent($this);
684 $this->tpl->addBlockfile(
'ADM_CONTENT',
'adm_content',
'tpl.crs_user_timings.html',
'Modules/Course');
685 $this->tabs_gui->clearSubTabs();
686 $this->tabs_gui->setTabActive(
'members');
688 if(!
$_GET[
'member_id'])
691 $this->ctrl->returnToParent($this);
696 $this->tpl->addBlockfile(
"BUTTONS",
"buttons",
"tpl.buttons.html");
697 $this->tpl->setCurrentBlock(
"btn_cell");
698 $this->tpl->setVariable(
"BTN_LINK",$this->ctrl->getLinkTarget($this,
'returnToMembers'));
699 $this->tpl->setVariable(
"BTN_TXT",$this->lng->txt(
"back"));
700 $this->tpl->parseCurrentBlock();
702 include_once
'Modules/Course/classes/Timings/class.ilTimingAccepted.php';
705 if($usr_accepted->isAccepted())
708 $this->tpl->setVariable(
"ACC_ALT",$this->lng->txt(
'timing_accepted'));
713 $this->tpl->setVariable(
"ACC_ALT",$this->lng->txt(
'timing_not_accepted'));
715 if($usr_accepted->isVisible() and strlen($usr_accepted->getRemark()))
717 $this->tpl->setVariable(
"REMARK",nl2br($usr_accepted->getRemark()));
721 $this->tpl->setVariable(
"REMARK",$this->lng->txt(
'not_available'));
724 $this->tpl->setVariable(
"TIMING_ACCEPT",$this->lng->txt(
'timing_accept_table'));
725 $this->tpl->setVariable(
"TXT_ACCEPTED",$this->lng->txt(
'timing_user_accepted'));
726 $this->tpl->setVariable(
"TXT_REMARK",$this->lng->txt(
'timing_remark'));
729 $this->tpl->setVariable(
"HEADER_ALT",$this->lng->txt(
'obj_usr'));
730 $this->tpl->setVariable(
"TABLE_HEADER",$this->lng->txt(
'timings_of'));
732 $this->tpl->setVariable(
"USER_NAME",$name[
'lastname'].
', '.$name[
'firstname']);
734 $this->tpl->setVariable(
"TXT_TITLE",$this->lng->txt(
'title'));
735 $this->tpl->setVariable(
"TXT_START_END",$this->lng->txt(
'crs_timings_short_start_end'));
736 $this->tpl->setVariable(
"TXT_INFO_START_END",$this->lng->txt(
'crs_timings_start_end_info'));
737 $this->tpl->setVariable(
"TXT_CHANGED",$this->lng->txt(
'crs_timings_changed'));
738 $this->tpl->setVariable(
"TXT_OWN_PRESETTING",$this->lng->txt(
'crs_timings_planed_start'));
739 $this->tpl->setVariable(
"TXT_INFO_OWN_PRESETTING",$this->lng->txt(
'crs_timings_from_until'));
741 include_once
'Services/Object/classes/class.ilObjectActivation.php';
743 foreach($items as $item)
755 include_once
'Modules/Course/classes/Timings/class.ilTimingPlaned.php';
756 include_once
'./Services/MetaData/classes/class.ilMDEducational.php';
758 $this->lng->loadLanguageModule(
'meta');
761 for($i = 0;$i < $level;$i++)
763 $this->tpl->touchBlock(
'start_indent');
764 $this->tpl->touchBlock(
'end_indent');
766 if(strlen($item[
'description']))
768 $this->tpl->setCurrentBlock(
"item_description");
769 $this->tpl->setVariable(
"DESC",$item[
'description']);
770 $this->tpl->parseCurrentBlock();
774 $this->tpl->setCurrentBlock(
"tlt");
775 $this->tpl->setVariable(
"TXT_TLT",$this->lng->txt(
'meta_typical_learning_time'));
777 $this->tpl->parseCurrentBlock();
780 if(!$item[
'title'] &&
781 $item[
'type'] ==
'sess')
783 include_once(
'./Modules/Session/classes/class.ilSessionAppointment.php');
788 $this->tpl->setCurrentBlock(
"title_plain");
789 $this->tpl->setVariable(
"TITLE",$item[
'title']);
790 $this->tpl->parseCurrentBlock();
792 $this->tpl->setCurrentBlock(
"container_standard_row");
794 $this->tpl->setVariable(
"ROWCLASS",
ilUtil::switchColor($this->counter++,
'tblrow1',
'tblrow2'));
795 #$this->tpl->setVariable("TYPE_IMG",ilUtil::getImagePath('icon_'.$item['type'].'.svg'));
797 $this->tpl->setVariable(
"TYPE_ALT_IMG",$this->lng->txt(
'obj_'.$item[
'type']));
807 if($usr_planed->getPlanedStartingTime())
809 $start = $usr_planed->getPlanedStartingTime();
813 $start = $item[
'suggestion_start'];
817 if($usr_planed->getPlanedEndingTime())
819 $end = $usr_planed->getPlanedEndingTime();
823 $end = $item[
'suggestion_end'];
825 if($start != $item[
'suggestion_start'] or $end != $item[
'suggestion_end'])
828 $this->tpl->setVariable(
"OK_ALT",$this->lng->txt(
'crs_timings_changed'));
833 $this->tpl->setVariable(
"OK_ALT",$this->lng->txt(
'crs_timings_not_changed'));
838 $this->tpl->parseCurrentBlock();
854 $this->tpl->addBlockfile(
'ADM_CONTENT',
'adm_content',
'tpl.crs_usr_edit_timings_adv.html',
'Modules/Course');
858 $this->tpl->setVariable(
"FORMACTION",$this->ctrl->getFormAction($this));
860 $this->tpl->setVariable(
"HEADER_ALT",$this->lng->txt(
'obj_crs'));
861 $this->tpl->setVariable(
"BLOCK_HEADER_CONTENT",$this->lng->txt(
'timings_usr_edit'));
863 if(!
$_SESSION[
'crs_timings_user_hidden'])
865 $this->tpl->setVariable(
"SHOW_HIDE_TEXT",$this->lng->txt(
'show_details'));
866 $this->ctrl->setParameter($this,
'show_details',1);
867 $this->tpl->setVariable(
"SHOW_HIDE_LINK",$this->ctrl->getLinkTarget($this,
'editUserTimings'));
871 $this->tpl->setVariable(
"SHOW_HIDE_TEXT",$this->lng->txt(
'hide_details'));
872 $this->ctrl->setParameter($this,
'show_details',0);
873 $this->tpl->setVariable(
"SHOW_HIDE_LINK",$this->ctrl->getLinkTarget($this,
'editUserTimings'));
875 $this->ctrl->clearParameters($this);
876 $this->tpl->setVariable(
"TXT_TITLE",$this->lng->txt(
'title'));
877 $this->tpl->setVariable(
"TXT_START_END",$this->lng->txt(
'crs_timings_short_start_end'));
878 $this->tpl->setVariable(
"TXT_INFO_START_END",$this->lng->txt(
'crs_timings_start_end_info'));
880 $this->tpl->setVariable(
"TXT_LIMIT",$this->lng->txt(
'crs_timings_short_limit_start_end'));
881 $this->tpl->setVariable(
"TXT_INFO_LIMIT",$this->lng->txt(
'crs_timings_from_until'));
883 $this->tpl->setVariable(
"TXT_OWN_PRESETTING",$this->lng->txt(
'crs_timings_planed_start'));
884 $this->tpl->setVariable(
"TXT_INFO_OWN_PRESETTING",$this->lng->txt(
'crs_timings_start_end_info'));
886 $this->tpl->setVariable(
"TXT_DURATION",$this->lng->txt(
'crs_timings_time_frame'));
887 $this->tpl->setVariable(
"TXT_INFO_DURATION",$this->lng->txt(
'crs_timings_in_days'));
889 $this->tpl->setVariable(
"TXT_BTN_UPDATE",$this->lng->txt(
'save'));
890 $this->tpl->setVariable(
"TXT_CANCEL",$this->lng->txt(
'cancel'));
892 include_once
'Services/Object/classes/class.ilObjectActivation.php';
896 foreach($sorted_items as $item)
898 switch($item[
'type'])
912 $this->tpl->addBlockfile(
'ADM_CONTENT',
'adm_content',
'tpl.crs_usr_edit_timings.html',
'Modules/Course');
917 $this->tpl->setVariable(
"FORMACTION",$this->ctrl->getFormAction($this));
919 $this->tpl->setVariable(
"HEADER_ALT",$this->lng->txt(
'obj_crs'));
921 if(!
$_SESSION[
'crs_timings_user_hidden'])
923 $this->tpl->setVariable(
"SHOW_HIDE_TEXT",$this->lng->txt(
'show_details'));
924 $this->ctrl->setParameter($this,
'show_details',1);
925 $this->tpl->setVariable(
"SHOW_HIDE_LINK",$this->ctrl->getLinkTarget($this,
'editUserTimings'));
929 $this->tpl->setVariable(
"SHOW_HIDE_TEXT",$this->lng->txt(
'hide_details'));
930 $this->ctrl->setParameter($this,
'show_details',0);
931 $this->tpl->setVariable(
"SHOW_HIDE_LINK",$this->ctrl->getLinkTarget($this,
'editUserTimings'));
933 $this->ctrl->clearParameters($this);
935 $this->tpl->setVariable(
"BLOCK_HEADER_CONTENT",$this->lng->txt(
'timings_timings'));
936 $this->tpl->setVariable(
"TXT_TITLE",$this->lng->txt(
'title'));
937 $this->tpl->setVariable(
"TXT_START",$this->lng->txt(
'crs_timings_sug_begin'));
938 $this->tpl->setVariable(
"TXT_END",$this->lng->txt(
'crs_timings_sug_end'));
940 include_once
'Services/Object/classes/class.ilObjectActivation.php';
944 foreach($sorted_items as $item)
946 switch($item[
'type'])
962 include_once
'Modules/Course/classes/Timings/class.ilTimingPlaned.php';
963 include_once
'./Services/Link/classes/class.ilLink.php';
964 include_once
'./Services/MetaData/classes/class.ilMDEducational.php';
966 if(!$ilAccess->checkAccess(
'visible',
'',$item[
'ref_id']))
971 $this->lng->loadLanguageModule(
'meta');
973 $usr_planed =
new ilTimingPlaned($item[
'ref_id'],$ilUser->getId());
975 for($i = 0;$i < $level;$i++)
977 $this->tpl->touchBlock(
'start_indent');
978 $this->tpl->touchBlock(
'end_indent');
980 if(strlen($item[
'description']))
982 $this->tpl->setCurrentBlock(
"item_description");
983 $this->tpl->setVariable(
"DESC",$item[
'description']);
984 $this->tpl->parseCurrentBlock();
988 $this->tpl->setCurrentBlock(
"tlt");
989 $this->tpl->setVariable(
"TXT_TLT",$this->lng->txt(
'meta_typical_learning_time'));
991 $this->tpl->parseCurrentBlock();
994 if(!$item[
'title'] &&
995 $item[
'type'] ==
'sess')
997 include_once(
'./Modules/Session/classes/class.ilSessionAppointment.php');
1002 if($ilAccess->checkAccess(
'read',
'',$item[
'ref_id']))
1004 $this->tpl->setCurrentBlock(
"title_as_link");
1005 $this->tpl->setVariable(
"TITLE_LINK",
ilLink::_getLink($item[
'ref_id'],$item[
'type']));
1006 $this->tpl->setVariable(
"TITLE_NAME",$item[
'title']);
1007 $this->tpl->parseCurrentBlock();
1011 $this->tpl->setCurrentBlock(
"title_plain");
1012 $this->tpl->setVariable(
"TITLE",$item[
'title']);
1013 $this->tpl->parseCurrentBlock();
1015 $this->tpl->setCurrentBlock(
"container_standard_row");
1017 if(isset($this->invalid[
"$item[ref_id]"]))
1019 $this->tpl->setVariable(
"ROWCLASS",
'tblrowmarked');
1023 $this->tpl->setVariable(
"ROWCLASS",
ilUtil::switchColor($this->counter++,
'tblrow1',
'tblrow2'));
1025 #$this->tpl->setVariable("TYPE_IMG",ilUtil::getImagePath('icon_'.$item['type'].'.svg'));
1027 $this->tpl->setVariable(
"TYPE_ALT_IMG",$this->lng->txt(
'obj_'.$item[
'type']));
1036 if($item[
'changeable'])
1038 $item_prefix =
"item[".$item[
'ref_id'].
']';
1040 if(is_array(
$_POST[
'item'][
"$item[ref_id]"][
'own_start']))
1042 #echo "Start post<br>";
1043 $start = $this->
__toUnix(
$_POST[
'item'][
"$item[ref_id]"][
'own_start']);
1045 elseif($usr_planed->getPlanedStartingTime())
1047 #echo "Own start<br>";
1048 $start = $usr_planed->getPlanedStartingTime();
1052 #echo "Empfehlung start<br>";
1053 $start = $item[
'suggestion_start'];
1057 $this->tpl->setVariable(
"OWN_START",
1059 $date[
'y'],$date[
'm'],$date[
'd'],date(
'Y',time()),
false));
1061 if($usr_planed->getPlanedEndingTime())
1063 #echo "Own End<br>";
1064 $end = $usr_planed->getPlanedEndingTime();
1068 #echo "Empfehlung end<br>";
1069 $end = $item[
'suggestion_end'];
1072 $this->tpl->setVariable(
"NAME_DURATION",$item_prefix.
"[duration]");
1075 if(isset(
$_POST[
'item'][
"$item[ref_id]"][
'duration']))
1077 $this->tpl->setVariable(
"VAL_DURATION",
$_POST[
'item'][
"$item[ref_id]"][
'duration']);
1081 $this->tpl->setVariable(
"VAL_DURATION",intval(($end - $start) / (60 * 60 * 24)));
1087 $this->tpl->parseCurrentBlock();
1089 if(!
$_SESSION[
'crs_timings_user_hidden'])
1102 global $ilAccess, $ilToolbar;
1104 if(!$ilAccess->checkAccess(
'write',
'',$this->container_obj->getRefId()))
1109 include_once
"Services/UIComponent/Button/classes/class.ilLinkButton.php";
1112 if(!
$_SESSION[
'crs_timings_panel'][$this->course_obj->getId()])
1114 $btn->setCaption(
"timings_timings_on");
1115 $btn->setUrl($this->ctrl->getLinkTarget($this,
'timingsOn'));
1119 $btn->setCaption(
"timings_timings_off");
1120 $btn->setUrl($this->ctrl->getLinkTarget($this,
'timingsOff'));
1123 $ilToolbar->addButtonInstance($btn);
1129 $_SESSION[
'crs_timings_panel'][$this->course_obj->getId()] = 1;
1131 $ilTabs->clearSubTabs();
1139 $_SESSION[
'crs_timings_panel'][$this->course_obj->getId()] = 0;
1141 $ilTabs->clearSubTabs();
1149 global
$ilUser,$ilObjDataCache;
1150 include_once
'Modules/Course/classes/Timings/class.ilTimingPlaned.php';
1153 $this->invalid = array();
1159 if(isset(
$data[
'duration']))
1161 $data[
'own_start'][
'd'] +=
$data[
'duration'];
1162 $tmp_planed->setPlanedEndingTime($this->
__toUnix(
$data[
'own_start'],array(
'h' => 23,
'm' => 55)));
1166 $tmp_planed->setPlanedEndingTime($this->
__toUnix(
$data[
'own_start']),array(
'h' => 23,
'm' => 55));
1168 if(!$tmp_planed->validate())
1170 $this->invalid[
$ref_id] = $ilObjDataCache->lookupTitle($ilObjDataCache->lookupObjId(
$ref_id));
1172 $all_items[] = $tmp_planed;
1174 if(count($this->invalid))
1176 $message = $this->lng->txt(
'crs_timings_update_error');
1177 $message .= (
"<br />".$this->lng->txt(
'crs_materials').
': ');
1178 $message .= (implode(
',',$this->invalid));
1183 foreach($all_items as $new_item_obj)
1185 $new_item_obj->update();
1202 $item[
'suggestion_start'] = $this->
__toUnix(
$_POST[
'item'][$obj_id][
'sug_start']);
1203 if(isset(
$_POST[
'item'][$obj_id][
'sug_end']))
1206 $item[
'suggestion_end'] = $this->
__toUnix(
$_POST[
'item'][$obj_id][
'sug_end']);
1208 $item[
'earliest_start'] = $this->
__toUnix(
$_POST[
'item'][$obj_id][
'lim_start']);
1209 $item[
'latest_end'] = $this->
__toUnix(
$_POST[
'item'][$obj_id][
'lim_end']);
1212 $item[
'duration_a'] =
$_POST[
'item'][
$obj_id][
'duration_a'];
1213 $item[
'duration_b'] =
$_POST[
'item'][
$obj_id][
'duration_b'];
1220 include_once
'Services/Object/classes/class.ilObjectActivation.php';
1224 if(!$ilAccess->checkAccess(
'write',
'',$this->container_obj->getRefId()))
1226 $ilErr->raiseError($this->lng->txt(
'msg_no_perm_write'),$ilErr->WARNING);
1228 $this->failed = array();
1232 $all_items = array();
1239 $item_obj->setTimingType(
$_POST[
'item_active'][
$ref_id][
'active'] ?
1242 $item_obj->setTimingStart($old_data[
'timing_start']);
1243 $item_obj->setTimingEnd($old_data[
'timing_end']);
1244 $item_obj->setSuggestionStart($this->
__toUnix(
$data[
"sug_start"]));
1247 $data[
'sug_start'][
'd'] += abs(
$data[
'duration_a']);
1248 $item_obj->setSuggestionEnd($this->
__toUnix(
$data[
'sug_start'],array(
'h' => 23,
'm' => 55)));
1250 $item_obj->setEarliestStart(time());
1251 $item_obj->setLatestEnd($this->
__toUnix(
$data[
'lim_end'],array(
'h' => 23,
'm' => 55)));
1253 $item_obj->toggleVisible($old_data[
'visible']);
1254 $item_obj->toggleChangeable(
$_POST[
'item_change'][
$ref_id][
'change']);
1256 if(!$item_obj->validateActivation())
1258 $this->failed[
$ref_id] = $old_data[
'title'];
1260 $all_items[
$ref_id] =& $item_obj;
1264 if(count($this->failed))
1266 $message = $this->lng->txt(
'crs_timings_update_error');
1267 $message .= (
"<br />".$this->lng->txt(
'crs_materials').
': ');
1268 $message .= (implode(
',',$this->failed));
1275 foreach($all_items as
$ref_id => $item_obj_new)
1277 $item_obj_new->update(
$ref_id);
1286 if($this->container_obj->getType() ==
'crs')
1288 $this->container_gui->setContentSubTabs();
1296 if($this->container_obj->getType() ==
'crs')
1304 $course_ref_id = $tree->checkForParentType($this->container_obj->getRefId(),
'crs');
1312 return gmmktime($time[
'h'],$time[
'm'],0,$date[
'm'],$date[
'd'],$date[
'y']);
1317 return array(
'y' => date(
'Y',$a_unix_time),
1318 'm' => date(
'm',$a_unix_time),
1319 'd' => date(
'd',$a_unix_time));
1324 return array(
'h' => date(
'G',$a_unix_time),
1325 'm' => date(
'i',$a_unix_time),
1326 's' => date(
's',$a_unix_time));
1334 $path_arr = $tree->getPathFull($a_ref_id,$this->course_obj->getRefId());
1336 foreach($path_arr as
$data)
1342 $path .= $data[
'title'];