ILIAS  release_5-4 Revision v5.4.26-12-gabc799a52e6
class.ilObjExerciseGUI.php
Go to the documentation of this file.
1<?php
2
3/* Copyright (c) 1998-2010 ILIAS open source, Extended GPL, see docs/LICENSE */
4
5require_once "./Services/Object/classes/class.ilObjectGUI.php";
6
24{
29
33 protected $tabs;
34
38 protected $help;
39
43 protected $ass = null;
44
49 public function __construct($a_data, $a_id, $a_call_by_reference, $a_prepare_output = true)
50 {
51 global $DIC;
52
53 $this->lng = $DIC->language();
54 $this->user = $DIC->user();
55 $this->ctrl = $DIC->ctrl();
56 $this->tabs = $DIC->tabs();
57 $this->help = $DIC["ilHelp"];
58 $this->locator = $DIC["ilLocator"];
59 $this->tpl = $DIC["tpl"];
60 $this->toolbar = $DIC->toolbar();
61 $lng = $DIC->language();
62
63 $this->lng->loadLanguageModule('cert');
64
65 $this->type = "exc";
66 parent::__construct($a_data, $a_id, $a_call_by_reference, false);
67
68 $lng->loadLanguageModule("exercise");
69 $lng->loadLanguageModule("exc");
70 $this->ctrl->saveParameter($this, "ass_id");
71
72 include_once("./Modules/Exercise/classes/class.ilExAssignment.php");
73 if ($_REQUEST["ass_id"] > 0 && is_object($this->object) && ilExAssignment::lookupExerciseId($_REQUEST["ass_id"]) == $this->object->getId()) {
74 $this->ass = new ilExAssignment((int) $_REQUEST["ass_id"]);
75 } elseif ($_REQUEST["ass_id"] > 0) {
76 throw new ilExerciseException("Assignment ID does not match Exercise.");
77 }
78
79
80 $this->certificateDownloadValidator = new ilCertificateDownloadValidator();
81 }
82
83 public function executeCommand()
84 {
87 $ilTabs = $this->tabs;
89
90 $next_class = $this->ctrl->getNextClass($this);
91 $cmd = $this->ctrl->getCmd();
92 $this->prepareOutput();
93
94 //echo "-".$next_class."-".$cmd."-"; exit;
95 switch ($next_class) {
96 case "ilinfoscreengui":
97 $ilTabs->activateTab("info");
98 $this->infoScreen(); // forwards command
99 break;
100
101 case 'ilpermissiongui':
102 $ilTabs->activateTab("permissions");
103 include_once("Services/AccessControl/classes/class.ilPermissionGUI.php");
104 $perm_gui = new ilPermissionGUI($this);
105 $ret = &$this->ctrl->forwardCommand($perm_gui);
106 break;
107
108 case "illearningprogressgui":
109 $ilTabs->activateTab("learning_progress");
110 include_once './Services/Tracking/classes/class.ilLearningProgressGUI.php';
111
112 $new_gui = new ilLearningProgressGUI(
114 $this->object->getRefId(),
115 $_GET['user_id'] ? $_GET['user_id'] : $ilUser->getId()
116 );
117 $this->ctrl->forwardCommand($new_gui);
118 $this->tabs_gui->setTabActive('learning_progress');
119 break;
120
121 case 'ilobjectcopygui':
122 $ilCtrl->saveParameter($this, 'new_type');
123 $ilCtrl->setReturnByClass(get_class($this), 'create');
124
125 include_once './Services/Object/classes/class.ilObjectCopyGUI.php';
126 $cp = new ilObjectCopyGUI($this);
127 $cp->setType('exc');
128 $this->ctrl->forwardCommand($cp);
129 break;
130
131 case "ilexportgui":
132 $ilTabs->activateTab("export");
133 include_once("./Services/Export/classes/class.ilExportGUI.php");
134 $exp_gui = new ilExportGUI($this);
135 $exp_gui->addFormat("xml");
136 $ret = $this->ctrl->forwardCommand($exp_gui);
137// $this->tpl->show();
138 break;
139
140 case "ilcommonactiondispatchergui":
141 include_once("Services/Object/classes/class.ilCommonActionDispatcherGUI.php");
143 $this->ctrl->forwardCommand($gui);
144 break;
145
146 case "ilcertificategui":
147 $this->setSettingsSubTabs();
148 $this->tabs_gui->activateTab("settings");
149 $this->tabs_gui->activateSubTab("certificate");
150
151 $guiFactory = new ilCertificateGUIFactory();
152 $output_gui = $guiFactory->create($this->object);
153
154 $this->ctrl->forwardCommand($output_gui);
155 break;
156
157 case "ilexassignmenteditorgui":
158 $this->checkPermission("write");
159 $ilTabs->activateTab("content");
160 $this->addContentSubTabs("list_assignments");
161 include_once("./Modules/Exercise/classes/class.ilExAssignmentEditorGUI.php");
162 $ass_gui = new ilExAssignmentEditorGUI($this->object->getId(), $this->object->isCompletionBySubmissionEnabled(), $this->ass);
163 $this->ctrl->forwardCommand($ass_gui);
164 break;
165
166 case "ilexsubmissiongui":
167 $this->checkPermission("read");
168 $ilTabs->activateTab("content");
169 $this->addContentSubTabs("content");
170 $this->ctrl->setReturn($this, "showOverview");
171 include_once("./Modules/Exercise/classes/class.ilExSubmissionGUI.php");
172 $sub_gui = new ilExSubmissionGUI($this->object, $this->ass, (int) $_REQUEST["member_id"]);
173 $this->ctrl->forwardCommand($sub_gui);
174 break;
175
176 case "ilexercisemanagementgui":
177 // rbac or position access
178 if ($GLOBALS['DIC']->access()->checkRbacOrPositionPermissionAccess(
179 'edit_submissions_grades',
180 'edit_submissions_grades',
181 $this->object->getRefId()
182 )) {
183 $ilTabs->activateTab("grades");
184 include_once("./Modules/Exercise/classes/class.ilExerciseManagementGUI.php");
185 $mgmt_gui = new ilExerciseManagementGUI($this->object, $this->ass);
186 $this->ctrl->forwardCommand($mgmt_gui);
187 } else {
188 $this->checkPermission("edit_submissions_grades"); // throw error by standard procedure
189 }
190 break;
191
192 case "ilexccriteriacataloguegui":
193 $this->checkPermission("write");
194 $ilTabs->activateTab("settings");
195 $this->setSettingsSubTabs();
196 $ilTabs->activateSubTab("crit");
197 include_once("./Modules/Exercise/classes/class.ilExcCriteriaCatalogueGUI.php");
198 $crit_gui = new ilExcCriteriaCatalogueGUI($this->object);
199 $this->ctrl->forwardCommand($crit_gui);
200 break;
201
202 default:
203 if (!$cmd) {
204 $cmd = "infoScreen";
205 }
206
207 $cmd .= "Object";
208
209 $this->$cmd();
210
211 break;
212 }
213
214 $this->addHeaderAction();
215
216 return true;
217 }
218
219 public function viewObject()
220 {
221 $this->infoScreenObject();
222 }
223
224 protected function afterSave(ilObject $a_new_object)
225 {
227
228 $a_new_object->saveData();
229
230 ilUtil::sendSuccess($this->lng->txt("exc_added"), true);
231
232 $ilCtrl->setParameterByClass("ilExAssignmentEditorGUI", "ref_id", $a_new_object->getRefId());
233 $ilCtrl->redirectByClass("ilExAssignmentEditorGUI", "addAssignment");
234 }
235
236 protected function listAssignmentsObject()
237 {
239
240 $this->checkPermissionBool("write");
241
242 // #16587
243 $ilCtrl->redirectByClass("ilExAssignmentEditorGUI", "listAssignments");
244 }
245
249 protected function initEditCustomForm(ilPropertyFormGUI $a_form)
250 {
251 $obj_service = $this->getObjectService();
252
253 $a_form->setTitle($this->lng->txt("exc_edit_exercise"));
254
255 $pres = new ilFormSectionHeaderGUI();
256 $pres->setTitle($this->lng->txt('obj_presentation'));
257 $a_form->addItem($pres);
258
259 // tile image
260 $a_form = $obj_service->commonSettings()->legacyForm($a_form, $this->object)->addTileImage();
261
263 $section->setTitle($this->lng->txt('exc_passing_exc'));
264 $a_form->addItem($section);
265
266 // pass mode
267 $radg = new ilRadioGroupInputGUI($this->lng->txt("exc_pass_mode"), "pass_mode");
268
269 $op1 = new ilRadioOption(
270 $this->lng->txt("exc_pass_all"),
271 "all",
272 $this->lng->txt("exc_pass_all_info")
273 );
274 $radg->addOption($op1);
275 $op2 = new ilRadioOption(
276 $this->lng->txt("exc_pass_minimum_nr"),
277 "nr",
278 $this->lng->txt("exc_pass_minimum_nr_info")
279 );
280 $radg->addOption($op2);
281
282 // minimum number of assignments to pass
283 $ni = new ilNumberInputGUI($this->lng->txt("exc_min_nr"), "pass_nr");
284 $ni->setSize(4);
285 $ni->setMaxLength(4);
286 $ni->setRequired(true);
287 include_once("./Modules/Exercise/classes/class.ilExAssignment.php");
288 $mand = ilExAssignment::countMandatory($this->object->getId());
289 $min = max($mand, 1);
290 $ni->setMinValue($min, true);
291 $ni->setInfo($this->lng->txt("exc_min_nr_info"));
292 $op2->addSubItem($ni);
293
294 $a_form->addItem($radg);
295
296 // completion by submission
297 $subcompl = new ilRadioGroupInputGUI($this->lng->txt("exc_passed_status_determination"), "completion_by_submission");
298 $op1 = new ilRadioOption($this->lng->txt("exc_completion_by_tutor"), 0, "");
299 $subcompl->addOption($op1);
300 $op2 = new ilRadioOption($this->lng->txt("exc_completion_by_submission"), 1, $this->lng->txt("exc_completion_by_submission_info"));
301 $subcompl->addOption($op2);
302 $a_form->addItem($subcompl);
303
304 /*$subcompl = new ilCheckboxInputGUI($this->lng->txt('exc_completion_by_submission'), 'completion_by_submission');
305 $subcompl->setInfo($this->lng->txt('exc_completion_by_submission_info'));
306 $subcompl->setValue(1);
307 $a_form->addItem($subcompl);*/
308
310 $section->setTitle($this->lng->txt('exc_publishing'));
311 $a_form->addItem($section);
312
313 // show submissions
314 $cb = new ilCheckboxInputGUI($this->lng->txt("exc_show_submissions"), "show_submissions");
315 $cb->setInfo($this->lng->txt("exc_show_submissions_info"));
316 $a_form->addItem($cb);
317
319 $section->setTitle($this->lng->txt('exc_notification'));
320 $a_form->addItem($section);
321
322 // submission notifications
323 $cbox = new ilCheckboxInputGUI($this->lng->txt("exc_submission_notification"), "notification");
324 $cbox->setInfo($this->lng->txt("exc_submission_notification_info"));
325 $a_form->addItem($cbox);
326
327
328 // feedback settings
329
331 $section->setTitle($this->lng->txt('exc_feedback'));
332 $a_form->addItem($section);
333
334 $fdb = new ilCheckboxGroupInputGUI($this->lng->txt("exc_settings_feedback"), "tfeedback");
335 $a_form->addItem($fdb);
336
337 $option = new ilCheckboxOption($this->lng->txt("exc_settings_feedback_mail"), ilObjExercise::TUTOR_FEEDBACK_MAIL);
338 $option->setInfo($this->lng->txt("exc_settings_feedback_mail_info"));
339 $fdb->addOption($option);
340 $option = new ilCheckboxOption($this->lng->txt("exc_settings_feedback_file"), ilObjExercise::TUTOR_FEEDBACK_FILE);
341 $option->setInfo($this->lng->txt("exc_settings_feedback_file_info"));
342 $fdb->addOption($option);
343 $option = new ilCheckboxOption($this->lng->txt("exc_settings_feedback_text"), ilObjExercise::TUTOR_FEEDBACK_TEXT);
344 $option->setInfo($this->lng->txt("exc_settings_feedback_text_info"));
345 $fdb->addOption($option);
346
347 $position_settings = ilOrgUnitGlobalSettings::getInstance()
348 ->getObjectPositionSettingsByType($this->object->getType());
349
350 if ($position_settings->isActive()) {
351 // add additional feature section
352 $feat = new ilFormSectionHeaderGUI();
353 $feat->setTitle($this->lng->txt('obj_features'));
354 $a_form->addItem($feat);
355
356 // add orgunit settings
358 $this->object->getId(),
359 $a_form,
360 array(
362 )
363 );
364 }
365 }
366
370 protected function getEditFormCustomValues(array &$a_values)
371 {
373
374 $a_values["desc"] = $this->object->getLongDescription();
375 $a_values["show_submissions"] = $this->object->getShowSubmissions();
376 $a_values["pass_mode"] = $this->object->getPassMode();
377 if ($a_values["pass_mode"] == "nr") {
378 $a_values["pass_nr"] = $this->object->getPassNr();
379 }
380
381 include_once "./Services/Notification/classes/class.ilNotification.php";
382 $a_values["notification"] = ilNotification::hasNotification(
384 $ilUser->getId(),
385 $this->object->getId()
386 );
387
388 $a_values['completion_by_submission'] = (int) $this->object->isCompletionBySubmissionEnabled();
389
390 $tfeedback = array();
391 if ($this->object->hasTutorFeedbackMail()) {
393 }
394 if ($this->object->hasTutorFeedbackText()) {
396 }
397 if ($this->object->hasTutorFeedbackFile()) {
399 }
400 $a_values['tfeedback'] = $tfeedback;
401
402 // orgunit position setting enabled
403 $a_values['obj_orgunit_positions'] = (bool) ilOrgUnitGlobalSettings::getInstance()
404 ->isPositionAccessActiveForObject($this->object->getId());
405 }
406
407 protected function updateCustom(ilPropertyFormGUI $a_form)
408 {
409 $obj_service = $this->getObjectService();
410
412 $this->object->setShowSubmissions($a_form->getInput("show_submissions"));
413 $this->object->setPassMode($a_form->getInput("pass_mode"));
414 if ($this->object->getPassMode() == "nr") {
415 $this->object->setPassNr($a_form->getInput("pass_nr"));
416 }
417
418 $this->object->setCompletionBySubmission($a_form->getInput('completion_by_submission') == 1 ? true : false);
419
420 $feedback = $a_form->getInput("tfeedback");
421 $this->object->setTutorFeedback(is_array($feedback)
422 ? array_sum($feedback)
423 : null);
424
425 include_once "./Services/Notification/classes/class.ilNotification.php";
428 $ilUser->getId(),
429 $this->object->getId(),
430 (bool) $a_form->getInput("notification")
431 );
432
433 // tile image
434 $obj_service->commonSettings()->legacyForm($a_form, $this->object)->saveTileImage();
435
437 $this->object->getId(),
438 $a_form,
439 array(
441 )
442 );
443 }
444
450 public function addContentSubTabs($a_activate)
451 {
452 $ilTabs = $this->tabs;
455
456 $ilTabs->addSubTab(
457 "content",
458 $lng->txt("view"),
459 $ilCtrl->getLinkTarget($this, "showOverview")
460 );
461 if ($this->checkPermissionBool("write")) {
462 $ilTabs->addSubTab(
463 "list_assignments",
464 $lng->txt("edit"),
465 $ilCtrl->getLinkTargetByClass("ilExAssignmentEditorGUI", "listAssignments")
466 );
467 }
468 $ilTabs->activateSubTab($a_activate);
469 }
470
476 public function getTabs()
477 {
479 $ilHelp = $this->help;
480
481 $ilHelp->setScreenIdComponent("exc");
482
483 if ($this->checkPermissionBool("read")) {
484 $this->tabs_gui->addTab(
485 "content",
486 $lng->txt("exc_assignments"),
487 $this->ctrl->getLinkTarget($this, "showOverview")
488 );
489 }
490
491 $next_class = strtolower($this->ctrl->getNextClass());
492 if ($this->checkPermissionBool("visible") || $this->checkPermissionBool("read")) {
493 $this->tabs_gui->addTab(
494 "info",
495 $lng->txt("info_short"),
496 $this->ctrl->getLinkTargetByClass("ilinfoscreengui", "showSummary")
497 );
498 }
499
500 // edit properties
501 if ($this->checkPermissionBool("write")) {
502 /*$tabs_gui->addTab("assignments",
503 $lng->txt("exc_edit_assignments"),
504 $this->ctrl->getLinkTarget($this, 'listAssignments'));*/
505
506 $this->tabs_gui->addTab(
507 "settings",
508 $lng->txt("settings"),
509 $this->ctrl->getLinkTarget($this, 'edit')
510 );
511 }
512 if ($this->access->checkRbacOrPositionPermissionAccess(
513 'edit_submissions_grades',
514 'edit_submissions_grades',
515 $this->object->getRefId()
516 )) {
517 $this->tabs_gui->addTab(
518 "grades",
519 $lng->txt("exc_submissions_and_grades"),
520 $this->ctrl->getLinkTargetByClass("ilexercisemanagementgui", "members")
521 );
522 }
523
524 // learning progress
525 $save_sort_order = $_GET["sort_order"]; // hack, because exercise sort parameters
526 $save_sort_by = $_GET["sort_by"]; // must not be forwarded to learning progress
527 $save_offset = $_GET["offset"];
528 $_GET["offset"] = $_GET["sort_by"] = $_GET["sort_order"] = "";
529
530 include_once './Services/Tracking/classes/class.ilLearningProgressAccess.php';
531 if (ilLearningProgressAccess::checkAccess($this->object->getRefId())) {
532 $this->tabs_gui->addTab(
533 'learning_progress',
534 $lng->txt('learning_progress'),
535 $this->ctrl->getLinkTargetByClass(array('ilobjexercisegui','illearningprogressgui'), '')
536 );
537 }
538
539 $_GET["sort_order"] = $save_sort_order; // hack, part ii
540 $_GET["sort_by"] = $save_sort_by;
541 $_GET["offset"] = $save_offset;
542
543 // export
544 if ($this->checkPermissionBool("write")) {
545 $this->tabs_gui->addTab(
546 "export",
547 $lng->txt("export"),
548 $this->ctrl->getLinkTargetByClass("ilexportgui", "")
549 );
550 }
551
552
553 // permissions
554 if ($this->checkPermissionBool("edit_permission")) {
555 $this->tabs_gui->addTab(
556 'permissions',
557 $lng->txt("perm_settings"),
558 $this->ctrl->getLinkTargetByClass(array(get_class($this),'ilpermissiongui'), "perm")
559 );
560 }
561 }
562
568 public function infoScreenObject()
569 {
570 $this->ctrl->setCmd("showSummary");
571 $this->ctrl->setCmdClass("ilinfoscreengui");
572 $this->infoScreen();
573 }
574
578 public function infoScreen()
579 {
581 $ilTabs = $this->tabs;
583
584 $ilTabs->activateTab("info");
585
586 if (!$this->checkPermissionBool("read")) {
587 $this->checkPermission("visible");
588 }
589
590 include_once("./Services/InfoScreen/classes/class.ilInfoScreenGUI.php");
591 $info = new ilInfoScreenGUI($this);
592
593 $info->enablePrivateNotes();
594
595 $info->enableNews();
596 if ($this->checkPermissionBool("write")) {
597 $info->enableNewsEditing();
598 $info->setBlockProperty("news", "settings", true);
599 }
600
601 // standard meta data
602 //$info->addMetaDataSections($this->object->getId(),0, $this->object->getType());
603
604 // instructions
605 $info->addSection($this->lng->txt("exc_overview"));
606 include_once("./Modules/Exercise/classes/class.ilExAssignment.php");
607 $ass = ilExAssignment::getAssignmentDataOfExercise($this->object->getId());
608 $cnt = 0;
609 $mcnt = 0;
610 foreach ($ass as $a) {
611 $cnt++;
612 if ($a["mandatory"]) {
613 $mcnt++;
614 }
615 }
616 $info->addProperty($lng->txt("exc_assignments"), $cnt);
617 $info->addProperty($lng->txt("exc_mandatory"), $mcnt);
618 if ($this->object->getPassMode() != "nr") {
619 $info->addProperty(
620 $lng->txt("exc_pass_mode"),
621 $lng->txt("exc_msg_all_mandatory_ass")
622 );
623 } else {
624 $info->addProperty(
625 $lng->txt("exc_pass_mode"),
626 sprintf($lng->txt("exc_msg_min_number_ass"), $this->object->getPassNr())
627 );
628 }
629
630 // feedback from tutor
631 include_once("Services/Tracking/classes/class.ilLPMarks.php");
632 if ($this->checkPermissionBool("read")) {
633 $lpcomment = ilLPMarks::_lookupComment($ilUser->getId(), $this->object->getId());
634 $mark = ilLPMarks::_lookupMark($ilUser->getId(), $this->object->getId());
635 //$status = ilExerciseMembers::_lookupStatus($this->object->getId(), $ilUser->getId());
636 $st = $this->object->determinStatusOfUser($ilUser->getId());
637 $status = $st["overall_status"];
638 if ($lpcomment != "" || $mark != "" || $status != "notgraded") {
639 $info->addSection($this->lng->txt("exc_feedback_from_tutor"));
640 if ($lpcomment != "") {
641 $info->addProperty(
642 $this->lng->txt("exc_comment"),
643 $lpcomment
644 );
645 }
646 if ($mark != "") {
647 $info->addProperty(
648 $this->lng->txt("exc_mark"),
649 $mark
650 );
651 }
652
653 //if ($status == "")
654 //{
655 // $info->addProperty($this->lng->txt("status"),
656 // $this->lng->txt("message_no_delivered_files"));
657 //}
658 //else
659 if ($status != "notgraded") {
660 $img = '<img src="' . ilUtil::getImagePath("scorm/" . $status . ".svg") . '" ' .
661 ' alt="' . $lng->txt("exc_" . $status) . '" title="' . $lng->txt("exc_" . $status) .
662 '" />';
663
664 $add = "";
665 if ($st["failed_a_mandatory"]) {
666 $add = " (" . $lng->txt("exc_msg_failed_mandatory") . ")";
667 } elseif ($status == "failed") {
668 $add = " (" . $lng->txt("exc_msg_missed_minimum_number") . ")";
669 }
670 $info->addProperty(
671 $this->lng->txt("status"),
672 $img . " " . $this->lng->txt("exc_" . $status) . $add
673 );
674 }
675 }
676 }
677
678 // forward the command
679 $this->ctrl->forwardCommand($info);
680 }
681
682 public function editObject()
683 {
684 $this->setSettingsSubTabs();
685 $this->tabs_gui->activateSubTab("edit");
686 return parent::editObject();
687 }
688
689 protected function setSettingsSubTabs()
690 {
691 $this->tabs_gui->addSubTab(
692 "edit",
693 $this->lng->txt("general_settings"),
694 $this->ctrl->getLinkTarget($this, "edit")
695 );
696
697 $this->tabs_gui->addSubTab(
698 "crit",
699 $this->lng->txt("exc_criteria_catalogues"),
700 $this->ctrl->getLinkTargetByClass("ilexccriteriacataloguegui", "")
701 );
702
703 include_once "Services/Certificate/classes/class.ilCertificate.php";
705 $this->tabs_gui->addSubTab(
706 "certificate",
707 $this->lng->txt("certificate"),
708 $this->ctrl->getLinkTarget($this, "certificate")
709 );
710 }
711 }
712
718 public static function _goto($a_target, $a_raw)
719 {
720 global $DIC;
721
722 $ilErr = $DIC["ilErr"];
723 $lng = $DIC->language();
724 $ilAccess = $DIC->access();
725 $ilCtrl = $DIC->ctrl();
726
727 //we don't have baseClass here...
728 $ilCtrl->setTargetScript("ilias.php");
729 $ilCtrl->initBaseClass("ilRepositoryGUI");
730
731 //ilExerciseMailNotification has links to:
732 // "Assignments", "Submission and Grades" and Downnoad the NEW files if the assignment type is "File Upload".
733 $ass_id = $_GET['ass_id'];
734 $parts = explode("_", $a_raw);
735 if (!$ass_id) {
736 $ass_id = null;
737 $action = null;
738
739 switch (end($parts)) {
740 case "download":
741 $action = $parts[3];
742 $member = $parts[2];
743 $ass_id = $parts[1];
744 break;
745
746 case "setdownload":
747 $action = $parts[3];
748 $member = $parts[2];
749 $ass_id = $parts[1];
750 break;
751
752 case "grades":
753 $action = $parts[2];
754 $ass_id = $parts[1];
755 break;
756 }
757 }
758
759 $ilCtrl->setParameterByClass("ilExerciseHandlerGUI", "ref_id", $a_target);
760
761 if ($ilAccess->checkAccess("read", "", $a_target)) {
762 $ilCtrl->setParameterByClass("ilExerciseHandlerGUI", "target", $a_raw);
763
764 if ($ass_id) {
765 $ilCtrl->setParameterByClass("ilExerciseManagementGUI", "ass_id", $ass_id);
766 }
767
768 switch ($action) {
769 case "grades":
770 $ilCtrl->redirectByClass(array("ilRepositoryGUI", "ilExerciseHandlerGUI", "ilObjExerciseGUI", "ilExerciseManagementGUI"), "members");
771 break;
772
773 /*case "download":
774 $ilCtrl->setParameterByClass("ilExerciseHandlerGUI", "member_id", $member);
775 $ilCtrl->redirectByClass(array("ilRepositoryGUI", "ilExerciseHandlerGUI", "ilObjExerciseGUI", "ilExerciseManagementGUI", "ilExSubmissionFileGUI"),"downloadNewReturned");
776 break;*/
777
778 case "setdownload":
779 $ilCtrl->setParameterByClass("ilExerciseHandlerGUI", "member_id", $member);
780 $ilCtrl->redirectByClass(array("ilRepositoryGUI", "ilExerciseHandlerGUI", "ilObjExerciseGUI", "ilExerciseManagementGUI"), "waitingDownload");
781 break;
782
783 default:
784 if ($parts[1] != "") {
785 $ilCtrl->setParameterByClass("ilExerciseHandlerGUI", "ass_id", $parts[1]);
786 $ilCtrl->setParameterByClass("ilExerciseHandlerGUI", "ass_id_goto", $parts[1]);
787 }
788 $ilCtrl->redirectByClass(array("ilRepositoryGUI", "ilExerciseHandlerGUI", "ilObjExerciseGUI"), "showOverview");
789 break;
790
791 }
792 } elseif ($ilAccess->checkAccess("visible", "", $a_target)) {
793 $ilCtrl->redirectByClass(array("ilRepositoryGUI", "ilExerciseHandlerGUI", "ilObjExerciseGUI"), "infoScreen");
794 } elseif ($ilAccess->checkAccess("read", "", ROOT_FOLDER_ID)) {
795 ilUtil::sendFailure(sprintf(
796 $lng->txt("msg_no_perm_read_item"),
798 ), true);
800 }
801 }
802
806 public function addLocatorItems()
807 {
808 $ilLocator = $this->locator;
809
810 if (is_object($this->object)) {
811 // #17955
812 $ilLocator->addItem($this->object->getTitle(), $this->ctrl->getLinkTarget($this, "showOverview"), "", $_GET["ref_id"]);
813 }
814 }
815
816
820
824 public function showOverviewObject()
825 {
827 $ilTabs = $this->tabs;
829 $ilToolbar = $this->toolbar;
830
831 $this->checkPermission("read");
832
833 $tpl->addJavaScript("./Modules/Exercise/js/ilExcPresentation.js");
834
835 include_once("./Services/Tracking/classes/class.ilLearningProgress.php");
837 $ilUser->getId(),
838 $this->object->getId(),
839 $this->object->getRefId(),
840 'exc'
841 );
842
843 $ilTabs->activateTab("content");
844 $this->addContentSubTabs("content");
845
846 if ($this->certificateDownloadValidator->isCertificateDownloadable((int) $ilUser->getId(), (int) $this->object->getId())) {
847 $ilToolbar->addButton(
848 $this->lng->txt("certificate"),
849 $this->ctrl->getLinkTarget($this, "outCertificate")
850 );
851 }
852
853 include_once("./Modules/Exercise/classes/class.ilExAssignmentGUI.php");
854 $ass_gui = new ilExAssignmentGUI($this->object);
855
856 include_once("./Modules/Exercise/classes/class.ilExAssignment.php");
857 include_once("./Services/Accordion/classes/class.ilAccordionGUI.php");
858 $acc = new ilAccordionGUI();
859 $acc->setId("exc_ow_" . $this->object->getId());
860
861 $ass_data = ilExAssignment::getInstancesByExercise($this->object->getId());
862 foreach ($ass_data as $ass) {
863 // incoming assignment deeplink
864 $force_open = false;
865 if (isset($_GET["ass_id_goto"]) &&
866 (int) $_GET["ass_id_goto"] == $ass->getId()) {
867 $force_open = true;
868 }
869
870 $acc->addItem(
871 $ass_gui->getOverviewHeader($ass),
872 $ass_gui->getOverviewBody($ass),
873 $force_open
874 );
875 }
876
877 if (count($ass_data) < 2) {
878 $acc->setBehaviour("FirstOpen");
879 } else {
880 $acc->setUseSessionStorage(true);
881 }
882
883 $mtpl = new ilTemplate("tpl.exc_ass_overview.html", true, true, "Modules/Exercise");
884 $mtpl->setVariable("CONTENT", $acc->getHTML());
885
886 $tpl->setContent($mtpl->get());
887 }
888
889 public function certificateObject()
890 {
891 $this->setSettingsSubTabs();
892 $this->tabs_gui->activateTab("settings");
893 $this->tabs_gui->activateSubTab("certificate");
894
895 $guiFactory = new ilCertificateGUIFactory();
896 $output_gui = $guiFactory->create($this->object);
897
898 $output_gui->certificateEditor();
899 }
900
901 public function outCertificateObject()
902 {
903 global $DIC;
904
905 $database = $DIC->database();
906 $logger = $DIC->logger()->root();
907
909
910 $objectId = (int) $this->object->getId();
911
912 if (false === $this->certificateDownloadValidator->isCertificateDownloadable($ilUser->getId(), $objectId)) {
913 ilUtil::sendFailure($this->lng->txt("permission_denied"), true);
914 $this->ctrl->redirect($this);
915 }
916
917 $ilUserCertificateRepository = new ilUserCertificateRepository($database, $logger);
918 $pdfGenerator = new ilPdfGenerator($ilUserCertificateRepository, $logger);
919
920 $pdfAction = new ilCertificatePdfAction(
921 $logger,
922 $pdfGenerator,
924 $this->lng->txt('error_creating_certificate_pdf')
925 );
926
927 $pdfAction->downloadPdf((int) $ilUser->getId(), (int) $objectId);
928 }
929
933 public function startAssignmentObject()
934 {
935 global $DIC;
936
937 $ilCtrl = $DIC->ctrl();
938 $ilUser = $DIC->user();
939
940 if ($this->ass) {
941 include_once("./Modules/Exercise/classes/class.ilExcAssMemberState.php");
942 $state = ilExcAssMemberState::getInstanceByIds($this->ass->getId(), $ilUser->getId());
943 if (!$state->getCommonDeadline() && $state->getRelativeDeadline()) {
944 $idl = $state->getIndividualDeadlineObject();
945 $idl->setStartingTimestamp(time());
946 $idl->save();
947 }
948 }
949
950 $ilCtrl->redirect($this, "showOverview");
951 }
952}
user()
Definition: user.php:4
$section
Definition: Utf8Test.php:83
if(!array_key_exists('stateid', $_REQUEST)) $state
Handle linkback() response from LinkedIn.
Definition: linkback.php:10
$_GET["client_id"]
An exception for terminatinating execution or to throw for unit testing.
Accordion user interface class.
Validates if an active certificate is stored in the database and can be downloaded by the user.
Just a wrapper class to create Unit Test for other classes.
This class represents a property in a property form.
This class represents a checkbox property in a property form.
This class represents an option in a checkbox group.
static getInstanceFromAjaxCall()
(Re-)Build instance from ajax call
Class ilExAssignmentEditorGUI.
GUI class for exercise assignments.
Exercise assignment.
static countMandatory($a_ex_id)
Order assignments by deadline date.
static getInstancesByExercise($a_exc_id)
static lookupExerciseId($a_ass_id)
Lookup excercise id for assignment id.
static getAssignmentDataOfExercise($a_exc_id)
Get assignments data of an exercise in an array.
Class ilExSubmissionGUI.
static getInstanceByIds($a_ass_id, $a_user_id=0)
Get instance by IDs (recommended for consumer code)
Class ilExcCriteriaCatalogueGUI.
Exercise exceptions class.
Class ilExerciseManagementGUI.
Export User Interface Class.
This class represents a section header in a property form.
Class ilInfoScreenGUI.
static _lookupMark($a_usr_id, $a_obj_id)
static _lookupComment($a_usr_id, $a_obj_id)
static checkAccess($a_ref_id, $a_allow_only_read=true)
check access to learning progress
Class ilObjUserTrackingGUI.
static _tracProgress($a_user_id, $a_obj_id, $a_ref_id, $a_obj_type='')
static setNotification($type, $user_id, $id, $status=true)
Set notification status for object and user.
static hasNotification($type, $user_id, $id)
Check notification status for object and user.
This class represents a number property in a property form.
Class ilObjExerciseGUI.
addLocatorItems()
Add locator item.
infoScreenObject()
this one is called from the info button in the repository not very nice to set cmdClass/Cmd manually,...
viewObject()
list childs of current object
getEditFormCustomValues(array &$a_values)
Get values for properties form.
infoScreen()
show information screen
updateCustom(ilPropertyFormGUI $a_form)
Insert custom update form values into object.
executeCommand()
execute command
static _goto($a_target, $a_raw)
redirect script
getTabs()
adds tabs to tab gui object
startAssignmentObject()
Start assignment with relative deadline.
initEditCustomForm(ilPropertyFormGUI $a_form)
Init properties form.
showOverviewObject()
Show overview of assignments.
__construct($a_data, $a_id, $a_call_by_reference, $a_prepare_output=true)
Constructor @access public.
afterSave(ilObject $a_new_object)
Post (successful) object creation hook.
addContentSubTabs($a_activate)
Add subtabs of content view.
GUI class for the workflow of copying objects.
Class ilObjectGUI Basic methods of all Output classes.
checkPermission($a_perm, $a_cmd="", $a_type="", $a_ref_id=null)
Check permission and redirect on error.
prepareOutput($a_show_subobjects=true)
prepare output
static _gotoRepositoryRoot($a_raise_error=false)
Goto repository root.
checkPermissionBool($a_perm, $a_cmd="", $a_type="", $a_ref_id=null)
Check permission.
addHeaderAction()
Add header action menu.
getObjectService()
Get object service.
static initServiceSettingsForm($a_obj_id, ilPropertyFormGUI $form, $services)
Init service settings form.
static updateServiceSettingsForm($a_obj_id, ilPropertyFormGUI $form, $services)
Update service settings.
Class ilObject Basic functions for all objects.
static _lookupObjId($a_id)
static _lookupTitle($a_id)
lookup object title
getRefId()
get reference id @access public
New PermissionGUI (extends from old ilPermission2GUI) RBAC related output.
This class represents a property form user interface.
addItem($a_item)
Add Item (Property, SectionHeader).
getInput($a_post_var, $ensureValidation=true)
Returns the value of a HTTP-POST variable, identified by the passed id.
setTitle($a_title)
Set Title.
This class represents a property in a property form.
This class represents an option in a radio group.
special template class to simplify handling of ITX/PEAR
static sendFailure($a_info="", $a_keep=false)
Send Failure Message to Screen.
static getImagePath($img, $module_path="", $mode="output", $offline=false)
get image path (for images located in a template directory)
$action
global $ilCtrl
Definition: ilias.php:18
$info
Definition: index.php:5
$GLOBALS['JPEG_Segment_Names']
Global Variable: XMP_tag_captions.
Class ilPdfGeneratorConstantsTest.
$ret
Definition: parser.php:6
global $DIC
Definition: saml.php:7
$ilUser
Definition: imgupload.php:18