ILIAS  release_5-3 Revision v5.3.23-19-g915713cf615
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
16{
20
21 public $tpl;
22 public $ctrl;
23 public $lng;
24 public $tabs_gui;
25
31 public function __construct($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 public function executeCommand()
48 {
49 global $ilAccess, $ilErr, $ilTabs, $ilCtrl;
50
51 if (!$ilAccess->checkAccess('read', '', $this->container_obj->getRefId())) {
52 $ilErr->raiseError($this->lng->txt('msg_no_perm_read'), $ilErr->WARNING);
53 }
54
55 // Handle timings view
56 $_SESSION['crs_timings'] = true;
57
58 $this->__setSubTabs();
59 $this->tabs_gui->setTabActive('view_content');
60 $cmd = $this->ctrl->getCmd();
61
62 switch ($this->ctrl->getNextClass($this)) {
63 case 'ilcoursearchivesgui':
64 $this->__forwardToArchivesGUI();
65 break;
66
67 case "ilcolumngui":
68 $ilCtrl->saveParameterByClass("ilcolumngui", "col_return");
69 $ilTabs->setSubTabActive("crs_content");
70 $this->view();
71 break;
72
73 default:
74 if (!$this->__checkStartObjects()) {
75 $this->showStartObjects();
76 break;
77 }
78
79 // forward to objective presentation
80 if ((!$this->is_tutor and
81 $this->container_obj->getType() == 'crs' and
82 $this->container_obj->enabledObjectiveView()) ||
83 $_GET["col_return"] == "objectives") {
84 $this->use_objective_presentation = true;
85 $this->view();
86 //$this->__forwardToObjectivePresentation();
87 break;
88 }
89
90
91 if (!$cmd) {
92 $cmd = $this->__getDefaultCommand();
93 }
94 $this->$cmd();
95 break;
96 }
97 }
98
99 public function __getDefaultCommand()
100 {
101 global $ilAccess;
102
103 // edit timings if panel is on
104 if ($_SESSION['crs_timings_panel'][$this->course_obj->getId()]) {
105 return 'editTimings';
106 }
107 if ($ilAccess->checkAccess('write', '', $this->container_obj->getRefId())) {
108 return 'view';
109 }
110 if ($this->container_obj->getType() == 'crs' and
111 $this->course_obj->getViewMode() == IL_CRS_VIEW_TIMING) {
112 return 'editUserTimings';
113 }
114 return 'view';
115 }
116
117 public function __checkStartObjects()
118 {
119 include_once './Modules/Course/classes/class.ilCourseStart.php';
120
121 global $ilAccess,$ilUser;
122
123 if ($ilAccess->checkAccess('write', '', $this->course_obj->getRefId())) {
124 return true;
125 }
126 $this->start_obj = new ilCourseStart($this->course_obj->getRefId(), $this->course_obj->getId());
127 if (count($this->start_obj->getStartObjects()) and !$this->start_obj->allFullfilled($ilUser->getId())) {
128 return false;
129 }
130 return true;
131 }
132
133 public function showStartObjects()
134 {
135 include_once './Modules/Course/classes/class.ilCourseLMHistory.php';
136 include_once './Services/Repository/classes/class.ilRepositoryExplorer.php';
137 include_once './Services/Link/classes/class.ilLink.php';
138
139 global $rbacsystem,$ilias,$ilUser,$ilAccess,$ilObjDataCache;
140
141 $this->tabs_gui->setSubTabActive('crs_content');
142
143 $this->tpl->addBlockFile("ADM_CONTENT", "adm_content", "tpl.crs_start_view.html", 'Modules/Course');
144 $this->tpl->setVariable("INFO_STRING", $this->lng->txt('crs_info_start'));
145 $this->tpl->setVariable("TBL_TITLE_START", $this->lng->txt('crs_table_start_objects'));
146 $this->tpl->setVariable("HEADER_NR", $this->lng->txt('crs_nr'));
147 $this->tpl->setVariable("HEADER_DESC", $this->lng->txt('description'));
148 $this->tpl->setVariable("HEADER_EDITED", $this->lng->txt('crs_objective_accomplished'));
149
150
151 $lm_continue = new ilCourseLMHistory($this->course_obj->getRefId(), $ilUser->getId());
152 $continue_data = $lm_continue->getLMHistory();
153
154 $counter = 0;
155 foreach ($this->start_obj->getStartObjects() as $start) {
156 $obj_id = $ilObjDataCache->lookupObjId($start['item_ref_id']);
157 $ref_id = $start['item_ref_id'];
158 $type = $ilObjDataCache->lookupType($obj_id);
159
161
162 $obj_link = ilLink::_getLink($ref_id, $type);
164 $obj_frame = $obj_frame ? $obj_frame : '';
165
166 // Tmp fix for tests
167 $obj_frame = $type == 'tst' ? '' : $obj_frame;
168
169 $contentObj = false;
170
171 if ($ilAccess->checkAccess('read', '', $ref_id)) {
172 $this->tpl->setCurrentBlock("start_read");
173 $this->tpl->setVariable("READ_TITLE_START", $ilObjDataCache->lookupTitle($obj_id));
174 $this->tpl->setVariable("READ_TARGET_START", $obj_frame);
175 $this->tpl->setVariable("READ_LINK_START", $obj_link . '&crs_show_result=' . $this->course_obj->getRefId());
176 $this->tpl->parseCurrentBlock();
177 } else {
178 $this->tpl->setCurrentBlock("start_visible");
179 $this->tpl->setVariable("VISIBLE_LINK_START", $ilObjDataCache->lookupTitle($obj_id));
180 $this->tpl->parseCurrentBlock();
181 }
182
183 // CONTINUE LINK
184 if (isset($continue_data[$ref_id])) {
185 $this->tpl->setCurrentBlock("link");
186 $this->tpl->setVariable("LINK_HREF", ilLink::_getLink($ref_id, '', array('obj_id',
187 $continue_data[$ref_id]['lm_page_id'])));
188 #$this->tpl->setVariable("CONTINUE_LINK_TARGET",$target);
189 $this->tpl->setVariable("LINK_NAME", $this->lng->txt('continue_work'));
190 $this->tpl->parseCurrentBlock();
191 }
192
193 // add to desktop link
194 if (!$ilUser->isDesktopItem($ref_id, $type) and
195 $this->course_obj->getAboStatus()) {
196 if ($ilAccess->checkAccess('read', '', $ref_id)) {
197 $this->tpl->setCurrentBlock("link");
198 $this->ctrl->setParameterByClass(get_class($this->container_gui), 'item_ref_id', $ref_id);
199 $this->ctrl->setParameterByClass(get_class($this->container_gui), 'item_id', $ref_id);
200 $this->ctrl->setParameterByClass(get_class($this->container_gui), 'type', $type);
201
202 $this->tpl->setVariable("LINK_HREF", $this->ctrl->getLinkTarget($this->container_gui, 'addToDesk'));
203 $this->tpl->setVariable("LINK_NAME", $this->lng->txt("to_desktop"));
204 $this->tpl->parseCurrentBlock();
205 }
206 } elseif ($this->course_obj->getAboStatus()) {
207 $this->tpl->setCurrentBlock("link");
208 $this->ctrl->setParameterByClass(get_class($this->container_gui), 'item_ref_id', $ref_id);
209 $this->ctrl->setParameterByClass(get_class($this->container_gui), 'item_id', $ref_id);
210 $this->ctrl->setParameterByClass(get_class($this->container_gui), 'type', $type);
211
212 $this->tpl->setVariable("LINK_HREF", $this->ctrl->getLinkTarget($this->container_gui, 'removeFromDesk'));
213 $this->tpl->setVariable("LINK_NAME", $this->lng->txt("unsubscribe"));
214 $this->tpl->parseCurrentBlock();
215 }
216
217
218 // Description
219 if (strlen($ilObjDataCache->lookupDescription($obj_id))) {
220 $this->tpl->setCurrentBlock("start_description");
221 $this->tpl->setVariable("DESCRIPTION_START", $ilObjDataCache->lookupDescription($obj_id));
222 $this->tpl->parseCurrentBlock();
223 }
224
225
226 if ($this->start_obj->isFullfilled($ilUser->getId(), $ref_id)) {
227 $accomplished = 'accomplished';
228 $icon = ilUtil::getImagePath("icon_ok.svg");
229 } else {
230 $accomplished = 'not_accomplished';
231 $icon = ilUtil::getImagePath("icon_not_ok.svg");
232 }
233 $this->tpl->setCurrentBlock("start_row");
234 $this->tpl->setVariable("EDITED_IMG", $icon);
235 $this->tpl->setVariable("EDITED_ALT", $this->lng->txt('crs_objective_' . $accomplished));
236 $this->tpl->setVariable("ROW_CLASS", 'option_value');
237 $this->tpl->setVariable("ROW_CLASS_CENTER", 'option_value_center');
238 $this->tpl->setVariable("OBJ_NR_START", ++$counter . '.');
239 $this->tpl->parseCurrentBlock();
240 }
241 return true;
242 }
243
247 public function view()
248 {
249 // BEGIN ChangeEvent: record read event.
250 require_once('Services/Tracking/classes/class.ilChangeEvent.php');
251 global $ilUser;
252 $obj_id = ilObject::_lookupObjId($this->container_obj->getRefId());
254 $this->container_obj->getType(),
255 $this->container_obj->getRefId(),
256 $obj_id,
257 $ilUser->getId()
258 );
259 // END ChangeEvent: record read event.
260
261 $this->getCenterColumnHTML();
262
263 if (!$this->no_right_column) {
264 $this->tpl->setRightContent($this->getRightColumnHTML());
265 }
266 }
267
271 public function getRightColumnHTML()
272 {
273 global $ilUser, $lng, $ilCtrl, $ilAccess;
274
275 $ilCtrl->saveParameterByClass("ilcolumngui", "col_return");
276
277 $obj_id = ilObject::_lookupObjId($this->container_obj->getRefId());
278 $obj_type = ilObject::_lookupType($obj_id);
279
280 include_once("Services/Block/classes/class.ilColumnGUI.php");
281 $column_gui = new ilColumnGUI($obj_type, IL_COL_RIGHT);
282
283 if ($column_gui->getScreenMode() == IL_SCREEN_FULL) {
284 return "";
285 }
286
287 $this->setColumnSettings($column_gui);
288
289 if ($ilCtrl->getNextClass() == "ilcolumngui" &&
290 $column_gui->getCmdSide() == IL_COL_RIGHT &&
291 $column_gui->getScreenMode() == IL_SCREEN_SIDE) {
292 $html = $ilCtrl->forwardCommand($column_gui);
293 } else {
294 if (!$ilCtrl->isAsynch()) {
295 $html = $ilCtrl->getHTML($column_gui);
296 }
297 }
298
299 return $html;
300 }
301
302 public function setColumnSettings($column_gui)
303 {
304 global $ilAccess, $lng;
305
306 $column_gui->setRepositoryMode(true);
307 $column_gui->setEnableEdit(false);
308 $column_gui->setBlockProperty(
309 "news",
310 "title",
311 $lng->txt("crs_news")
312 );
313
314 include_once "Services/Object/classes/class.ilObjectActivation.php";
315 $grouped_items = array();
316 foreach (ilObjectActivation::getItems($this->container_obj->getRefId()) as $item) {
317 $grouped_items[$item["type"]][] = $item;
318 }
319
320 $column_gui->setRepositoryItems($grouped_items);
321 if ($ilAccess->checkAccess("write", "", $this->container_obj->getRefId())) {
322 $column_gui->setEnableEdit(true);
323 }
324
325 // Allow movement of blocks for tutors
326 if ($this->is_tutor &&
327 $this->container_gui->isActiveAdministrationPanel()) {
328 $column_gui->setEnableMovement(true);
329 }
330
331 // Configure Settings, if administration panel is on
332 if ($this->is_tutor) {
333 $column_gui->setBlockProperty("news", "settings", true);
334 //$column_gui->setBlockProperty("news", "public_notifications_option", true);
335 $column_gui->setBlockProperty("news", "default_visibility_option", true);
336 $column_gui->setBlockProperty("news", "hide_news_block_option", true);
337 }
338
339 if ($this->container_gui->isActiveAdministrationPanel()) {
340 $column_gui->setAdminCommands(true);
341 }
342 }
343
344
348 public function __forwardToColumnGUI()
349 {
350 global $ilCtrl, $ilAccess;
351
352 include_once("Services/Block/classes/class.ilColumnGUI.php");
353
354 $obj_id = ilObject::_lookupObjId($this->container_obj->getRefId());
355 $obj_type = ilObject::_lookupType($obj_id);
356
357 if (!$ilCtrl->isAsynch()) {
358 //if ($column_gui->getScreenMode() != IL_SCREEN_SIDE)
360 // right column wants center
362 $column_gui = new ilColumnGUI($obj_type, IL_COL_RIGHT);
363 $this->setColumnSettings($column_gui);
364 $html = $ilCtrl->forwardCommand($column_gui);
365 }
366 // left column wants center
368 $column_gui = new ilColumnGUI($obj_type, IL_COL_LEFT);
369 $this->setColumnSettings($column_gui);
370 $html = $ilCtrl->forwardCommand($column_gui);
371 }
372 } else {
373 {
374 $this->getDefaultView();
375 }
376 }
377 }
378
379 return $html;
380 }
381
382 public function editTimings()
383 {
384 global $ilAccess,$ilErr;
385
386 include_once 'Services/MetaData/classes/class.ilMDEducational.php';
387 include_once './Services/Link/classes/class.ilLink.php';
388
389 $this->lng->loadLanguageModule('meta');
390
391 if (!$ilAccess->checkAccess('write', '', $this->container_obj->getRefId())) {
392 $ilErr->raiseError($this->lng->txt('msg_no_perm_write'), $ilErr->WARNING);
393 }
394 $this->__showTimingsPanel();
395 $this->tabs_gui->setSubTabActive('timings_timings');
396
397 include_once 'Services/Object/classes/class.ilObjectActivation.php';
398 $this->cont_arr = ilObjectActivation::getTimingsAdministrationItems($this->container_obj->getRefId());
399
400 $this->tpl->addBlockfile('ADM_CONTENT', 'adm_content', 'tpl.crs_edit_items.html', 'Modules/Course');
401 $this->tpl->setVariable("FORMACTION", $this->ctrl->getFormAction($this));
402 $this->tpl->setVariable("HEADER_IMG", ilUtil::getImagePath('icon_crs.svg'));
403 $this->tpl->setVariable("HEADER_ALT", $this->lng->txt('crs_materials'));
404 $this->tpl->setVariable("BLOCK_HEADER_CONTENT", $this->lng->txt('edit_timings_list'));
405 $this->tpl->setVariable("TXT_TITLE", $this->lng->txt('title'));
406
407
408 $this->tpl->setVariable("TXT_DURATION", $this->lng->txt('crs_timings_time_frame'));
409 $this->tpl->setVariable("TXT_INFO_DURATION", $this->lng->txt('crs_timings_in_days'));
410
411 $this->tpl->setVariable("TXT_START_END", $this->lng->txt('crs_timings_short_start_end'));
412 $this->tpl->setVariable("TXT_INFO_START_END", $this->lng->txt('crs_timings_start_end_info'));
413
414 $this->tpl->setVariable("TXT_CHANGEABLE", $this->lng->txt('crs_timings_short_changeable'));
415
416 $this->tpl->setVariable("TXT_INFO_LIMIT", $this->lng->txt('crs_timings_from_until'));
417 $this->tpl->setVariable("TXT_LIMIT", $this->lng->txt('crs_timings_short_limit_start_end'));
418 $this->tpl->setVariable("TXT_ACTIVE", $this->lng->txt('crs_timings_short_active'));
419 $this->tpl->setVariable("TXT_INFO_ACTIVE", $this->lng->txt('crs_timings_info_active'));
420
421 $counter = 0;
422 foreach ($this->cont_arr as $item) {
423 if ($item['type'] == 'itgr') {
424 continue;
425 }
426 $item = $this->__loadFromPost($item);
427 $item_prefix = "item[$item[ref_id]]";
428 $item_change_prefix = "item_change[$item[ref_id]]";
429 $item_active_prefix = "item_active[$item[ref_id]]";
430
431 if ($item['type'] == 'grp' or
432 $item['type'] == 'fold') {
433 $this->tpl->setVariable("TITLE_LINK", ilLink::_getLink($item['ref_id'], $item['type']));
434 $this->tpl->setVariable("TITLE_FRAME", ilFrameTargetInfo::_getFrame('MainContent', $item['type']));
435 $this->tpl->setVariable("TITLE_LINK_NAME", $item['title']);
436 } else {
437 if (!$item['title'] &&
438 $item['type'] == 'sess') {
439 include_once('./Modules/Session/classes/class.ilSessionAppointment.php');
441 $item['title'] = ilSessionAppointment::_appointmentToString($app_info['start'], $app_info['end'], $app_info['fullday']);
442 }
443
444 $this->tpl->setVariable("TITLE", $item['title']);
445 }
446
447 if (strlen($item['description'])) {
448 $this->tpl->setCurrentBlock("item_description");
449 $this->tpl->setVariable("DESC", $item['description']);
450 $this->tpl->parseCurrentBlock();
451 }
452
453 if ($tlt = ilMDEducational::_getTypicalLearningTimeSeconds($item['obj_id'])) {
454 $this->tpl->setCurrentBlock("tlt");
455 $this->tpl->setVariable("TXT_TLT", $this->lng->txt('meta_typical_learning_time'));
456 $this->tpl->setVariable("TLT_VAL", ilDatePresentation::secondsToString($tlt));
457 $this->tpl->parseCurrentBlock();
458 }
459
460 $this->tpl->setCurrentBlock("container_standard_row");
461
462 // Suggested
463 if (is_array($_POST['item']["$item[ref_id]"]['sug_start'])) {
464 $start = $this->__toUnix($_POST['item']["$item[ref_id]"]['sug_start']);
465 } else {
466 $start = $item['suggestion_start'];
467 }
468 $end = $item['suggestion_end'];
469 $date = $this->__prepareDateSelect($start);
470 $this->tpl->setVariable(
471 "SUG_START",
473 $item_prefix . "[sug_start]",
474 $date['y'],
475 $date['m'],
476 $date['d'],
477 date('Y', time()),
478 false
479 )
480 );
481
482 $this->tpl->setVariable("NAME_DURATION_A", $item_prefix . "[duration_a]");
483 if (isset($_POST['item']["$item[ref_id]"]['duration_a'])) {
484 $this->tpl->setVariable("VAL_DURATION_A", abs($_POST['item']["$item[ref_id]"]['duration_a']));
485 } else {
486 $this->tpl->setVariable("VAL_DURATION_A", intval(($end-$start)/(60*60*24)));
487 }
488
489 $this->tpl->setVariable('SUG_END', ilDatePresentation::formatDate(new ilDate($item['suggestion_end'], IL_CAL_UNIX)));
490
491 // Limit
492 if (is_array($_POST['item']["$item[ref_id]"]['lim_end'])) {
493 $end = $this->__toUnix($_POST['item']["$item[ref_id]"]['lim_end']);
494 } else {
495 $end = $item['latest_end'];
496 }
497
498 $date = $this->__prepareDateSelect($end);
499 $this->tpl->setVariable(
500 "LIM_END",
502 $item_prefix . "[lim_end]",
503 $date['y'],
504 $date['m'],
505 $date['d'],
506 date('Y', time()),
507 false
508 )
509 );
510
511 $this->tpl->setVariable("NAME_CHANGE", $item_change_prefix . "[change]");
512 $this->tpl->setVariable("NAME_ACTIVE", $item_active_prefix . "[active]");
513
514 if (isset($_POST['item'])) {
515 $change = $_POST['item_change']["$item[ref_id]"]['change'];
516 $active = $_POST['item_active']["$item[ref_id]"]['active'];
517 } else {
518 $change = $item['changeable'];
519 $active = ($item['timing_type'] == ilObjectActivation::TIMINGS_PRESETTING);
520 }
521
522 $this->tpl->setVariable("CHECKED_ACTIVE", $active ? 'checked="checked"' : '');
523 $this->tpl->setVariable("CHECKED_CHANGE", $change ? 'checked="checked"' : '');
524
525 if (isset($this->failed["$item[ref_id]"])) {
526 $this->tpl->setVariable("ROWCLASS", 'tblrowmarked');
527 } else {
528 $this->tpl->setVariable("ROWCLASS", ilUtil::switchColor($counter++, 'tblrow1', 'tblrow2'));
529 }
530 $this->tpl->parseCurrentBlock();
531 }
532
533 // Select all
534 $this->tpl->setVariable("CHECKCLASS", ilUtil::switchColor($counter++, 'tblrow1', 'tblrow2'));
535 $this->tpl->setVariable("SELECT_ALL", $this->lng->txt('select_all'));
536
537 $this->tpl->setVariable("BTN_SAVE", $this->lng->txt('save'));
538 $this->tpl->setVariable("BTN_CANCEL", $this->lng->txt('cancel'));
539 }
540
542 {
543 global $ilUser;
544
545 include_once 'Modules/Course/classes/Timings/class.ilTimingAccepted.php';
546 $accept_obj = new ilTimingAccepted($this->course_obj->getId(), $ilUser->getId());
547
548 include_once('Services/Form/classes/class.ilPropertyFormGUI.php');
549 $form = new ilPropertyFormGUI();
550 $form->setFormAction($this->ctrl->getFormAction($this, 'saveAcceptance'));
551 $form->setTitle($this->lng->txt('timing_accept_table'));
552
553 $accept = new ilCheckboxInputGUI($this->lng->txt('timing_user_accept'), "accepted");
554 $accept->setChecked($accept_obj->isAccepted());
555 $form->addItem($accept);
556
557 $remark = new ilTextAreaInputGUI($this->lng->txt('timing_remark'), "remark");
558 $remark->setValue($accept_obj->getRemark());
559 $form->addItem($remark);
560
561 $tutor = new ilCheckboxInputGUI($this->lng->txt('timing_tutor_visible'), "tutor");
562 $tutor->setChecked($accept_obj->isVisible());
563 $form->addItem($tutor);
564
565 $form->addCommandButton('saveAcceptance', $this->lng->txt('save'));
566 $this->tpl->setVariable("FORM", $form->getHTML());
567 }
568
569 public function saveAcceptance()
570 {
571 global $ilUser;
572
573 include_once 'Modules/Course/classes/Timings/class.ilTimingAccepted.php';
574 $accept_obj = new ilTimingAccepted($this->course_obj->getId(), $ilUser->getId());
575
576 $accept_obj->setRemark(ilUtil::stripSlashes($_POST['remark']));
577 $accept_obj->accept($_POST['accepted']);
578 $accept_obj->setVisible($_POST['tutor']);
579 $accept_obj->update();
580 ilUtil::sendSuccess($this->lng->txt('settings_saved'));
581 $this->editUserTimings();
582 }
583
584 public function editUserTimings()
585 {
586 if ($_SESSION['crs_timings_panel'][$this->course_obj->getId()]) {
587 return $this->editTimings();
588 }
589 global $ilAccess,$ilErr;
590
591 if (!$ilAccess->checkAccess('read', '', $this->container_obj->getRefId())) {
592 $ilErr->raiseError($this->lng->txt('msg_no_perm_read'), $ilErr->WARNING);
593 }
594 $this->tabs_gui->setSubTabActive('timings_timings');
595
596 $_SESSION['crs_timings_user_hidden'] = isset($_GET['show_details']) ? $_GET['show_details'] : $_SESSION['crs_timings_user_hidden'];
597
598 include_once 'Services/Object/classes/class.ilObjectActivation.php';
599 if (ilObjectActivation::hasChangeableTimings($this->course_obj->getRefId())) {
601 } else {
602 $this->__editUserTimings();
603 }
604 }
605
606 public function returnToMembers()
607 {
608 $this->ctrl->returnToParent($this);
609 }
610
611 public function showUserTimings()
612 {
613 $this->tpl->addBlockfile('ADM_CONTENT', 'adm_content', 'tpl.crs_user_timings.html', 'Modules/Course');
614 $this->tabs_gui->clearSubTabs();
615 $this->tabs_gui->setTabActive('members');
616
617 if (!$_GET['member_id']) {
618 ilUtil::sendFailure($this->lng->txt('no_checkbox'), true);
619 $this->ctrl->returnToParent($this);
620 }
621
622
623 // Back button
624 $this->tpl->addBlockfile("BUTTONS", "buttons", "tpl.buttons.html");
625 $this->tpl->setCurrentBlock("btn_cell");
626 $this->tpl->setVariable("BTN_LINK", $this->ctrl->getLinkTarget($this, 'returnToMembers'));
627 $this->tpl->setVariable("BTN_TXT", $this->lng->txt("back"));
628 $this->tpl->parseCurrentBlock();
629
630 include_once 'Modules/Course/classes/Timings/class.ilTimingAccepted.php';
631 $usr_accepted = new ilTimingAccepted($this->course_obj->getId(), (int) $_GET['member_id']);
632
633 if ($usr_accepted->isAccepted()) {
634 $this->tpl->setVariable("ACC_IMG", ilUtil::getImagePath('icon_ok.svg'));
635 $this->tpl->setVariable("ACC_ALT", $this->lng->txt('timing_accepted'));
636 } else {
637 $this->tpl->setVariable("ACC_IMG", ilUtil::getImagePath('icon_not_ok.svg'));
638 $this->tpl->setVariable("ACC_ALT", $this->lng->txt('timing_not_accepted'));
639 }
640 if ($usr_accepted->isVisible() and strlen($usr_accepted->getRemark())) {
641 $this->tpl->setVariable("REMARK", nl2br($usr_accepted->getRemark()));
642 } else {
643 $this->tpl->setVariable("REMARK", $this->lng->txt('not_available'));
644 }
645
646 $this->tpl->setVariable("TIMING_ACCEPT", $this->lng->txt('timing_accept_table'));
647 $this->tpl->setVariable("TXT_ACCEPTED", $this->lng->txt('timing_user_accepted'));
648 $this->tpl->setVariable("TXT_REMARK", $this->lng->txt('timing_remark'));
649
650 $this->tpl->setVariable("HEADER_IMG", ilUtil::getImagePath('icon_usr.svg'));
651 $this->tpl->setVariable("HEADER_ALT", $this->lng->txt('obj_usr'));
652 $this->tpl->setVariable("TABLE_HEADER", $this->lng->txt('timings_of'));
653 $name = ilObjUser::_lookupName($_GET['member_id']);
654 $this->tpl->setVariable("USER_NAME", $name['lastname'] . ', ' . $name['firstname']);
655
656 $this->tpl->setVariable("TXT_TITLE", $this->lng->txt('title'));
657 $this->tpl->setVariable("TXT_START_END", $this->lng->txt('crs_timings_short_start_end'));
658 $this->tpl->setVariable("TXT_INFO_START_END", $this->lng->txt('crs_timings_start_end_info'));
659 $this->tpl->setVariable("TXT_CHANGED", $this->lng->txt('crs_timings_changed'));
660 $this->tpl->setVariable("TXT_OWN_PRESETTING", $this->lng->txt('crs_timings_planed_start'));
661 $this->tpl->setVariable("TXT_INFO_OWN_PRESETTING", $this->lng->txt('crs_timings_from_until'));
662
663 include_once 'Services/Object/classes/class.ilObjectActivation.php';
664 $items = ilObjectActivation::getTimingsAdministrationItems($this->course_obj->getRefId());
665 foreach ($items as $item) {
666 if (($item['timing_type'] == ilObjectActivation::TIMINGS_PRESETTING) or
668 $this->__renderUserItem($item, 0);
669 }
670 }
671 }
672
673 public function __renderUserItem($item, $level)
674 {
675 include_once 'Modules/Course/classes/Timings/class.ilTimingPlaned.php';
676 include_once './Services/MetaData/classes/class.ilMDEducational.php';
677
678 $this->lng->loadLanguageModule('meta');
679
680 $usr_planed = new ilTimingPlaned($item['ref_id'], $_GET['member_id']);
681 for ($i = 0;$i < $level;$i++) {
682 $this->tpl->touchBlock('start_indent');
683 $this->tpl->touchBlock('end_indent');
684 }
685 if (strlen($item['description'])) {
686 $this->tpl->setCurrentBlock("item_description");
687 $this->tpl->setVariable("DESC", $item['description']);
688 $this->tpl->parseCurrentBlock();
689 }
690 if ($tlt = ilMDEducational::_getTypicalLearningTimeSeconds($item['obj_id'])) {
691 $this->tpl->setCurrentBlock("tlt");
692 $this->tpl->setVariable("TXT_TLT", $this->lng->txt('meta_typical_learning_time'));
693 $this->tpl->setVariable("TLT_VAL", ilDatePresentation::secondsToString($tlt));
694 $this->tpl->parseCurrentBlock();
695 }
696
697 if (!$item['title'] &&
698 $item['type'] == 'sess') {
699 include_once('./Modules/Session/classes/class.ilSessionAppointment.php');
701 $item['title'] = ilSessionAppointment::_appointmentToString($app_info['start'], $app_info['end'], $app_info['fullday']);
702 }
703
704 $this->tpl->setCurrentBlock("title_plain");
705 $this->tpl->setVariable("TITLE", $item['title']);
706 $this->tpl->parseCurrentBlock();
707
708 $this->tpl->setCurrentBlock("container_standard_row");
709
710 $this->tpl->setVariable("ROWCLASS", ilUtil::switchColor($this->counter++, 'tblrow1', 'tblrow2'));
711 #$this->tpl->setVariable("TYPE_IMG",ilUtil::getImagePath('icon_'.$item['type'].'.svg'));
712 $this->tpl->setVariable('TYPE_IMG', ilUtil::getTypeIconPath($item['type'], $item['obj_id'], 'tiny'));
713 $this->tpl->setVariable("TYPE_ALT_IMG", $this->lng->txt('obj_' . $item['type']));
714
715 if ($item['timing_type'] == ilObjectActivation::TIMINGS_PRESETTING) {
716 $this->tpl->setVariable('SUG_START', ilDatePresentation::formatDate(new ilDate($item['suggestion_start'], IL_CAL_UNIX)));
717 $this->tpl->setVariable('SUG_END', ilDatePresentation::formatDate(new ilDate($item['suggestion_end'], IL_CAL_UNIX)));
718 }
719
720 if ($item['changeable'] and $item['timing_type'] == ilObjectActivation::TIMINGS_PRESETTING) {
721 if ($usr_planed->getPlanedStartingTime()) {
722 $start = $usr_planed->getPlanedStartingTime();
723 } else {
724 $start = $item['suggestion_start'];
725 }
726 $this->tpl->setVariable('OWN_START', ilDatePresentation::formatDate(new ilDate($start, IL_CAL_UNIX)));
727
728 if ($usr_planed->getPlanedEndingTime()) {
729 $end = $usr_planed->getPlanedEndingTime();
730 } else {
731 $end = $item['suggestion_end'];
732 }
733 if ($start != $item['suggestion_start'] or $end != $item['suggestion_end']) {
734 $this->tpl->setVariable("OK_IMG", ilUtil::getImagePath('icon_ok.svg'));
735 $this->tpl->setVariable("OK_ALT", $this->lng->txt('crs_timings_changed'));
736 } else {
737 $this->tpl->setVariable("OK_IMG", ilUtil::getImagePath('icon_not_ok.svg'));
738 $this->tpl->setVariable("OK_ALT", $this->lng->txt('crs_timings_not_changed'));
739 }
740 $this->tpl->setVariable('OWN_END', ilDatePresentation::formatDate(new ilDate($end, IL_CAL_UNIX)));
741 }
742
743 $this->tpl->parseCurrentBlock();
744
745 foreach (ilObjectActivation::getTimingsAdministrationItems($item['ref_id']) as $item_data) {
746 if (($item_data['timing_type'] == ilObjectActivation::TIMINGS_PRESETTING) or
747 ilObjectActivation::hasChangeableTimings($item_data['ref_id'])) {
748 $this->__renderUserItem($item_data, $level+1);
749 }
750 }
751 }
752
753
754
756 {
757 $this->tpl->addBlockfile('ADM_CONTENT', 'adm_content', 'tpl.crs_usr_edit_timings_adv.html', 'Modules/Course');
758 $this->__showTimingsPanel();
760
761 $this->tpl->setVariable("FORMACTION", $this->ctrl->getFormAction($this));
762 $this->tpl->setVariable("HEADER_IMG", ilUtil::getImagePath('icon_crs.svg'));
763 $this->tpl->setVariable("HEADER_ALT", $this->lng->txt('obj_crs'));
764 $this->tpl->setVariable("BLOCK_HEADER_CONTENT", $this->lng->txt('timings_usr_edit'));
765
766 if (!$_SESSION['crs_timings_user_hidden']) {
767 $this->tpl->setVariable("SHOW_HIDE_TEXT", $this->lng->txt('show_details'));
768 $this->ctrl->setParameter($this, 'show_details', 1);
769 $this->tpl->setVariable("SHOW_HIDE_LINK", $this->ctrl->getLinkTarget($this, 'editUserTimings'));
770 } else {
771 $this->tpl->setVariable("SHOW_HIDE_TEXT", $this->lng->txt('hide_details'));
772 $this->ctrl->setParameter($this, 'show_details', 0);
773 $this->tpl->setVariable("SHOW_HIDE_LINK", $this->ctrl->getLinkTarget($this, 'editUserTimings'));
774 }
775 $this->ctrl->clearParameters($this);
776 $this->tpl->setVariable("TXT_TITLE", $this->lng->txt('title'));
777 $this->tpl->setVariable("TXT_START_END", $this->lng->txt('crs_timings_short_start_end'));
778 $this->tpl->setVariable("TXT_INFO_START_END", $this->lng->txt('crs_timings_start_end_info'));
779
780 $this->tpl->setVariable("TXT_LIMIT", $this->lng->txt('crs_timings_short_limit_start_end'));
781 $this->tpl->setVariable("TXT_INFO_LIMIT", $this->lng->txt('crs_timings_from_until'));
782
783 $this->tpl->setVariable("TXT_OWN_PRESETTING", $this->lng->txt('crs_timings_planed_start'));
784 $this->tpl->setVariable("TXT_INFO_OWN_PRESETTING", $this->lng->txt('crs_timings_start_end_info'));
785
786 $this->tpl->setVariable("TXT_DURATION", $this->lng->txt('crs_timings_time_frame'));
787 $this->tpl->setVariable("TXT_INFO_DURATION", $this->lng->txt('crs_timings_in_days'));
788
789 $this->tpl->setVariable("TXT_BTN_UPDATE", $this->lng->txt('save'));
790 $this->tpl->setVariable("TXT_CANCEL", $this->lng->txt('cancel'));
791
792 include_once 'Services/Object/classes/class.ilObjectActivation.php';
793 $sorted_items = ilObjectActivation::getTimingsItems($this->course_obj->getRefId());
794
795 $this->counter = 0;
796 foreach ($sorted_items as $item) {
797 switch ($item['type']) {
798 case 'itgr':
799 break;
800
801 default:
802 $this->__renderItem($item, 0);
803 break;
804 }
805 }
806 }
807
808 public function __editUserTimings()
809 {
810 $this->tpl->addBlockfile('ADM_CONTENT', 'adm_content', 'tpl.crs_usr_edit_timings.html', 'Modules/Course');
811
812 $this->__showTimingsPanel();
814
815 $this->tpl->setVariable("FORMACTION", $this->ctrl->getFormAction($this));
816 $this->tpl->setVariable("HEADER_IMG", ilUtil::getImagePath('icon_crs.svg'));
817 $this->tpl->setVariable("HEADER_ALT", $this->lng->txt('obj_crs'));
818
819 if (!$_SESSION['crs_timings_user_hidden']) {
820 $this->tpl->setVariable("SHOW_HIDE_TEXT", $this->lng->txt('show_details'));
821 $this->ctrl->setParameter($this, 'show_details', 1);
822 $this->tpl->setVariable("SHOW_HIDE_LINK", $this->ctrl->getLinkTarget($this, 'editUserTimings'));
823 } else {
824 $this->tpl->setVariable("SHOW_HIDE_TEXT", $this->lng->txt('hide_details'));
825 $this->ctrl->setParameter($this, 'show_details', 0);
826 $this->tpl->setVariable("SHOW_HIDE_LINK", $this->ctrl->getLinkTarget($this, 'editUserTimings'));
827 }
828 $this->ctrl->clearParameters($this);
829
830 $this->tpl->setVariable("BLOCK_HEADER_CONTENT", $this->lng->txt('timings_timings'));
831 $this->tpl->setVariable("TXT_TITLE", $this->lng->txt('title'));
832 $this->tpl->setVariable("TXT_START", $this->lng->txt('crs_timings_sug_begin'));
833 $this->tpl->setVariable("TXT_END", $this->lng->txt('crs_timings_sug_end'));
834
835 include_once 'Services/Object/classes/class.ilObjectActivation.php';
836 $sorted_items = ilObjectActivation::getTimingsItems($this->course_obj->getRefId());
837
838 $this->counter = 0;
839 foreach ($sorted_items as $item) {
840 switch ($item['type']) {
841 case 'itgr':
842 break;
843
844 default:
845 $this->__renderItem($item, 0);
846 break;
847 }
848 }
849 }
850
851 public function __renderItem($item, $level)
852 {
853 global $ilUser,$ilAccess;
854
855 include_once 'Modules/Course/classes/Timings/class.ilTimingPlaned.php';
856 include_once './Services/Link/classes/class.ilLink.php';
857 include_once './Services/MetaData/classes/class.ilMDEducational.php';
858
859 if (!$ilAccess->checkAccess('visible', '', $item['ref_id'])) {
860 return false;
861 }
862
863 $this->lng->loadLanguageModule('meta');
864
865 $usr_planed = new ilTimingPlaned($item['ref_id'], $ilUser->getId());
866
867 for ($i = 0;$i < $level;$i++) {
868 $this->tpl->touchBlock('start_indent');
869 $this->tpl->touchBlock('end_indent');
870 }
871 if (strlen($item['description'])) {
872 $this->tpl->setCurrentBlock("item_description");
873 $this->tpl->setVariable("DESC", $item['description']);
874 $this->tpl->parseCurrentBlock();
875 }
876 if ($tlt = ilMDEducational::_getTypicalLearningTimeSeconds($item['obj_id'])) {
877 $this->tpl->setCurrentBlock("tlt");
878 $this->tpl->setVariable("TXT_TLT", $this->lng->txt('meta_typical_learning_time'));
879 $this->tpl->setVariable("TLT_VAL", ilDatePresentation::secondsToString($tlt));
880 $this->tpl->parseCurrentBlock();
881 }
882
883 if (!$item['title'] &&
884 $item['type'] == 'sess') {
885 include_once('./Modules/Session/classes/class.ilSessionAppointment.php');
887 $item['title'] = ilSessionAppointment::_appointmentToString($app_info['start'], $app_info['end'], $app_info['fullday']);
888 }
889
890 if ($ilAccess->checkAccess('read', '', $item['ref_id'])) {
891 $this->tpl->setCurrentBlock("title_as_link");
892 $this->tpl->setVariable("TITLE_LINK", ilLink::_getLink($item['ref_id'], $item['type']));
893 $this->tpl->setVariable("TITLE_NAME", $item['title']);
894 $this->tpl->parseCurrentBlock();
895 } else {
896 $this->tpl->setCurrentBlock("title_plain");
897 $this->tpl->setVariable("TITLE", $item['title']);
898 $this->tpl->parseCurrentBlock();
899 }
900 $this->tpl->setCurrentBlock("container_standard_row");
901
902 if (isset($this->invalid["$item[ref_id]"])) {
903 $this->tpl->setVariable("ROWCLASS", 'tblrowmarked');
904 } else {
905 $this->tpl->setVariable("ROWCLASS", ilUtil::switchColor($this->counter++, 'tblrow1', 'tblrow2'));
906 }
907 #$this->tpl->setVariable("TYPE_IMG",ilUtil::getImagePath('icon_'.$item['type'].'.svg'));
908 $this->tpl->setVariable('TYPE_IMG', ilUtil::getTypeIconPath($item['type'], $item['obj_id'], 'small'));
909 $this->tpl->setVariable("TYPE_ALT_IMG", $this->lng->txt('obj_' . $item['type']));
910
911
912 if ($item['timing_type'] == ilObjectActivation::TIMINGS_PRESETTING) {
913 $this->tpl->setVariable('SUG_START', ilDatePresentation::formatDate(new ilDate($item['suggestion_start'], IL_CAL_UNIX)));
914 $this->tpl->setVariable('SUG_END', ilDatePresentation::formatDate(new ilDate($item['suggestion_end'], IL_CAL_UNIX)));
915 }
916
917 if ($item['changeable']) {
918 $item_prefix = "item[" . $item['ref_id'] . ']';
919
920 if (is_array($_POST['item']["$item[ref_id]"]['own_start'])) {
921 #echo "Start post<br>";
922 $start = $this->__toUnix($_POST['item']["$item[ref_id]"]['own_start']);
923 } elseif ($usr_planed->getPlanedStartingTime()) {
924 #echo "Own start<br>";
925 $start = $usr_planed->getPlanedStartingTime();
926 } else {
927 #echo "Empfehlung start<br>";
928 $start = $item['suggestion_start'];
929 }
930
931 $date = $this->__prepareDateSelect($start);
932 $this->tpl->setVariable(
933 "OWN_START",
935 $item_prefix . "[own_start]",
936 $date['y'],
937 $date['m'],
938 $date['d'],
939 date('Y', time()),
940 false
941 )
942 );
943
944 if ($usr_planed->getPlanedEndingTime()) {
945 #echo "Own End<br>";
946 $end = $usr_planed->getPlanedEndingTime();
947 } else {
948 #echo "Empfehlung end<br>";
949 $end = $item['suggestion_end'];
950 }
951 $this->tpl->setVariable('OWN_END', ilDatePresentation::formatDate(new ilDate($end, IL_CAL_UNIX)));
952 $this->tpl->setVariable("NAME_DURATION", $item_prefix . "[duration]");
953
954 // Duration
955 if (isset($_POST['item']["$item[ref_id]"]['duration'])) {
956 $this->tpl->setVariable("VAL_DURATION", $_POST['item']["$item[ref_id]"]['duration']);
957 } else {
958 $this->tpl->setVariable("VAL_DURATION", intval(($end - $start) / (60 * 60 * 24)));
959 }
960 $this->tpl->setVariable('LIM_START', ilDatePresentation::formatDate(new ilDate($item['earliest_start'], IL_CAL_UNIX)));
961 $this->tpl->setVariable('LIM_END', ilDatePresentation::formatDate(new ilDate($item['latest_end'], IL_CAL_UNIX)));
962 }
963
964 $this->tpl->parseCurrentBlock();
965
966 if (!$_SESSION['crs_timings_user_hidden']) {
967 return true;
968 }
969
970 foreach (ilObjectActivation::getTimingsItems($item['ref_id']) as $item_data) {
971 $this->__renderItem($item_data, $level+1);
972 }
973 }
974
975 public function __showTimingsPanel()
976 {
977 global $ilAccess, $ilToolbar;
978
979 if (!$ilAccess->checkAccess('write', '', $this->container_obj->getRefId())) {
980 return true;
981 }
982
983 include_once "Services/UIComponent/Button/classes/class.ilLinkButton.php";
985
986 if (!$_SESSION['crs_timings_panel'][$this->course_obj->getId()]) {
987 $btn->setCaption("timings_timings_on");
988 $btn->setUrl($this->ctrl->getLinkTarget($this, 'timingsOn'));
989 } else {
990 $btn->setCaption("timings_timings_off");
991 $btn->setUrl($this->ctrl->getLinkTarget($this, 'timingsOff'));
992 }
993
994 $ilToolbar->addButtonInstance($btn);
995 }
996
997 public function timingsOn()
998 {
999 global $ilTabs;
1000 $_SESSION['crs_timings_panel'][$this->course_obj->getId()] = 1;
1001
1002 $ilTabs->clearSubTabs();
1003 $this->__setSubTabs();
1004 $this->editTimings();
1005 }
1006
1007 public function timingsOff()
1008 {
1009 global $ilTabs;
1010 $_SESSION['crs_timings_panel'][$this->course_obj->getId()] = 0;
1011
1012 $ilTabs->clearSubTabs();
1013 $this->__setSubTabs();
1014 $this->editUserTimings();
1015 }
1016
1017
1018 public function updateUserTimings()
1019 {
1020 global $ilUser,$ilObjDataCache;
1021 include_once 'Modules/Course/classes/Timings/class.ilTimingPlaned.php';
1022
1023 // Validate
1024 $this->invalid = array();
1025 foreach ($_POST['item'] as $ref_id => $data) {
1026 $tmp_planed = new ilTimingPlaned($ref_id, $ilUser->getId());
1027
1028 $tmp_planed->setPlanedStartingTime($this->__toUnix($data['own_start']));
1029 if (isset($data['duration'])) {
1030 $data['own_start']['d'] += $data['duration'];
1031 $tmp_planed->setPlanedEndingTime($this->__toUnix($data['own_start'], array('h' => 23,'m' => 55)));
1032 } else {
1033 $tmp_planed->setPlanedEndingTime($this->__toUnix($data['own_start']), array('h' => 23,'m' => 55));
1034 }
1035 if (!$tmp_planed->validate()) {
1036 $this->invalid[$ref_id] = $ilObjDataCache->lookupTitle($ilObjDataCache->lookupObjId($ref_id));
1037 }
1038 $all_items[] = $tmp_planed;
1039 }
1040 if (count($this->invalid)) {
1041 $message = $this->lng->txt('crs_timings_update_error');
1042 $message .= ("<br />" . $this->lng->txt('crs_materials') . ': ');
1043 $message .= (implode(',', $this->invalid));
1045 $this->editUserTimings();
1046 return false;
1047 }
1048 foreach ($all_items as $new_item_obj) {
1049 $new_item_obj->update();
1050 }
1051 ilUtil::sendSuccess($this->lng->txt('settings_saved'));
1052 $this->editUserTimings();
1053 return true;
1054 }
1055
1056
1057 public function &__loadFromPost(&$item)
1058 {
1059 $obj_id = $item['obj_id'];
1060
1061 if (!isset($_POST['item'][$obj_id])) {
1062 return $item;
1063 }
1064 $item['suggestion_start'] = $this->__toUnix($_POST['item'][$obj_id]['sug_start']);
1065 if (isset($_POST['item'][$obj_id]['sug_end'])) {
1066 // #9325
1067 $item['suggestion_end'] = $this->__toUnix($_POST['item'][$obj_id]['sug_end']);
1068 }
1069 $item['earliest_start'] = $this->__toUnix($_POST['item'][$obj_id]['lim_start']);
1070 $item['latest_end'] = $this->__toUnix($_POST['item'][$obj_id]['lim_end']);
1071 $item['changeable'] = $_POST['item'][$obj_id]['change'];
1072 $item['timing_type'] = $_POST['item'][$obj_id]['active'] ? ilObjectActivation::TIMINGS_PRESETTING : $item['timing_type'];
1073 $item['duration_a'] = $_POST['item'][$obj_id]['duration_a'];
1074 $item['duration_b'] = $_POST['item'][$obj_id]['duration_b'];
1075
1076 return $item;
1077 }
1078
1079 public function updateTimings()
1080 {
1081 include_once 'Services/Object/classes/class.ilObjectActivation.php';
1082
1083 global $ilAccess,$ilErr;
1084
1085 if (!$ilAccess->checkAccess('write', '', $this->container_obj->getRefId())) {
1086 $ilErr->raiseError($this->lng->txt('msg_no_perm_write'), $ilErr->WARNING);
1087 }
1088 $this->failed = array();
1089 // Validate
1090
1091 $_POST['item'] = is_array($_POST['item']) ? $_POST['item'] : array();
1092 $all_items = array();
1093
1094 foreach ($_POST['item'] as $ref_id => $data) {
1095 $item_obj = new ilObjectActivation();
1097
1098 $item_obj->setTimingType($_POST['item_active'][$ref_id]['active'] ?
1101 $item_obj->setTimingStart($old_data['timing_start']);
1102 $item_obj->setTimingEnd($old_data['timing_end']);
1103 $item_obj->setSuggestionStart($this->__toUnix($data["sug_start"]));
1104
1105 // add duration
1106 $data['sug_start']['d'] += abs($data['duration_a']);
1107 $item_obj->setSuggestionEnd($this->__toUnix($data['sug_start'], array('h' => 23,'m' => 55)));
1108
1109 $item_obj->setEarliestStart(time());
1110 $item_obj->setLatestEnd($this->__toUnix($data['lim_end'], array('h' => 23,'m' => 55)));
1111
1112 $item_obj->toggleVisible($old_data['visible']);
1113 $item_obj->toggleChangeable($_POST['item_change'][$ref_id]['change']);
1114
1115 if (!$item_obj->validateActivation()) {
1116 $this->failed[$ref_id] = $old_data['title'];
1117 }
1118 $all_items[$ref_id] =&$item_obj;
1119 unset($item_obj);
1120 }
1121
1122 if (count($this->failed)) {
1123 $message = $this->lng->txt('crs_timings_update_error');
1124 $message .= ("<br />" . $this->lng->txt('crs_materials') . ': ');
1125 $message .= (implode(',', $this->failed));
1127 $this->editTimings();
1128 return false;
1129 }
1130
1131 // No do update
1132 foreach ($all_items as $ref_id => $item_obj_new) {
1133 $item_obj_new->update($ref_id);
1134 }
1135 ilUtil::sendSuccess($this->lng->txt('settings_saved'));
1136 $this->editTimings();
1137 return false;
1138 }
1139
1140 public function __setSubTabs()
1141 {
1142 if ($this->container_obj->getType() == 'crs') {
1143 $this->container_gui->setContentSubTabs();
1144 }
1145 }
1146
1147 public function __initCourseObject()
1148 {
1149 global $tree;
1150
1151 if ($this->container_obj->getType() == 'crs') {
1152 // Container is course
1153 $this->course_obj =&$this->container_obj;
1154 } else {
1155 $course_ref_id = $tree->checkForParentType($this->container_obj->getRefId(), 'crs');
1156 $this->course_obj =&ilObjectFactory::getInstanceByRefId($course_ref_id);
1157 }
1158 return true;
1159 }
1160
1161 public function __toUnix($date, $time = array())
1162 {
1163 return gmmktime($time['h'], $time['m'], 0, $date['m'], $date['d'], $date['y']);
1164 }
1165
1166 public function __prepareDateSelect($a_unix_time)
1167 {
1168 return array('y' => date('Y', $a_unix_time),
1169 'm' => date('m', $a_unix_time),
1170 'd' => date('d', $a_unix_time));
1171 }
1172
1173 public function __prepareTimeSelect($a_unix_time)
1174 {
1175 return array('h' => date('G', $a_unix_time),
1176 'm' => date('i', $a_unix_time),
1177 's' => date('s', $a_unix_time));
1178 }
1179
1180
1181 public function __buildPath($a_ref_id)
1182 {
1183 global $tree;
1184
1185 $path_arr = $tree->getPathFull($a_ref_id, $this->course_obj->getRefId());
1186 $counter = 0;
1187 foreach ($path_arr as $data) {
1188 if ($counter++) {
1189 $path .= " -> ";
1190 }
1191 $path .= $data['title'];
1192 }
1193
1194 return $path;
1195 }
1196} // END class.ilCourseContentGUI
date( 'd-M-Y', $objPHPExcel->getProperties() ->getCreated())
$_GET["client_id"]
$_POST["username"]
$_SESSION["AccountId"]
An exception for terminatinating execution or to throw for unit testing.
const IL_SCREEN_SIDE
const IL_COL_RIGHT
const IL_SCREEN_FULL
const IL_COL_LEFT
const IL_CRS_VIEW_TIMING
const IL_CAL_UNIX
static _recordReadEvent( $a_type, $a_ref_id, $obj_id, $usr_id, $isCatchupWriteEvents=true, $a_ext_rc=false, $a_ext_time=false)
Records a read event and catches up with write events.
This class represents a checkbox property in a property form.
Column user interface class.
static getScreenMode()
Get Screen Mode for current command.
static getCmdSide()
Get Column Side of Current Command.
static _checkAllConditionsOfTarget($a_target_ref_id, $a_target_id, $a_target_type="", $a_usr_id=0)
checks wether all conditions of a target object are fulfilled
Class ilCourseContentGUI.
__construct($container_gui_obj)
Constructor @access public.
__toUnix($date, $time=array())
view()
Output course content.
__forwardToColumnGUI()
Get columngui output.
getRightColumnHTML()
Display right column.
executeCommand()
execute command
class ilCourseLMHistory
Class ilObj<module_name>
static secondsToString($seconds, $force_with_seconds=false, $a_lng=null)
converts seconds to string: Long: 7 days 4 hour(s) ...
static formatDate(ilDateTime $date, $a_skip_day=false, $a_include_wd=false)
Format a date @access public.
Class for single dates.
static _getFrame($a_class, $a_type='')
Get content frame name.
static getInstance()
Factory.
static _getTypicalLearningTimeSeconds($a_rbac_id, $a_obj_id=0)
static _lookupName($a_user_id)
lookup user name
Class ilObjectActivation.
static getTimingsAdministrationItems($a_parent_id)
Get (sub) item data for timings administration view (active/inactive)
static hasChangeableTimings($a_ref_id)
Check if there is any active changeable timing (in subtree)
static getTimingsItems($a_container_ref_id)
Get (sub) item data for timings view (no session material, no side blocks)
static getItem($a_ref_id)
Get item data.
static getItems($a_parent_id, $a_with_list_data=true)
Get sub item data.
static getInstanceByRefId($a_ref_id, $stop_on_error=true)
get an instance of an Ilias object by reference id
getCenterColumnHTML()
Get center column.
static _lookupObjId($a_id)
static _lookupType($a_id, $a_reference=false)
lookup object type
This class represents a property form user interface.
buildFrameTarget($a_type, $a_child=0, $a_obj_id=0)
STATIC, do not use $this inside!
static _lookupAppointment($a_obj_id)
lookup appointment
static _appointmentToString($start, $end, $fulltime)
This class represents a text area property in a property form.
class ilTimingAccepted
class ilTimingPlaned
static sendSuccess($a_info="", $a_keep=false)
Send Success Message to Screen.
static sendFailure($a_info="", $a_keep=false)
Send Failure Message to Screen.
static switchColor($a_num, $a_css1, $a_css2)
switches style sheets for each even $a_num (used for changing colors of different result rows)
static makeDateSelect($prefix, $year="", $month="", $day="", $startyear="", $a_long_month=true, $a_further_options=array(), $emptyoption=false)
Creates a combination of HTML selects for date inputs.
static stripSlashes($a_str, $a_strip_html=true, $a_allow="")
strip slashes if magic qoutes is enabled
static getTypeIconPath($a_type, $a_obj_id, $a_size='small')
Get type icon path path Return image path for icon_xxx.pngs Or (if enabled) path to custom icon Depre...
static getImagePath($img, $module_path="", $mode="output", $offline=false)
get image path (for images located in a template directory)
$counter
$i
Definition: disco.tpl.php:19
$html
Definition: example_001.php:87
global $ilCtrl
Definition: ilias.php:18
$time
Definition: cron.php:21
if($format !==null) $name
Definition: metadata.php:146
$end
Definition: saml1-acs.php:18
catch(Exception $e) $message
$type
if(isset($_POST['submit'])) $form
$ilUser
Definition: imgupload.php:18