ILIAS  release_8 Revision v8.24
class.ilExPeerReviewGUI.php
Go to the documentation of this file.
1<?php
2
27{
28 protected ilCtrl $ctrl;
30 protected ilLanguage $lng;
32 protected ilObjUser $user;
35 protected int $requested_review_giver_id = 0;
36 protected int $requested_review_peer_id = 0;
37 protected string $requested_review_crit_id = "";
38 protected int $requested_peer_id = 0;
39 protected string $requested_crit_id = "";
40
41 public function __construct(
42 ilExAssignment $a_ass,
43 ilExSubmission $a_submission = null
44 ) {
46 global $DIC;
47
48 $this->user = $DIC->user();
49 $ilCtrl = $DIC->ctrl();
50 $ilTabs = $DIC->tabs();
51 $lng = $DIC->language();
52 $tpl = $DIC["tpl"];
53
54 $this->ass = $a_ass;
55 $this->submission = $a_submission;
56
57 // :TODO:
58 $this->ctrl = $ilCtrl;
59 $this->tabs_gui = $ilTabs;
60 $this->lng = $lng;
61 $this->tpl = $tpl;
62
63 $request = $DIC->exercise()->internal()->gui()->request();
64 $this->requested_review_giver_id = $request->getReviewGiverId();
65 $this->requested_review_peer_id = $request->getReviewPeerId();
66 $this->requested_review_crit_id = $request->getReviewCritId();
67 $this->requested_peer_id = $request->getPeerId();
68 $this->requested_crit_id = $request->getCritId();
69 }
70
74 public function executeCommand(): void
75 {
76 $ilCtrl = $this->ctrl;
78 $ilTabs = $this->tabs_gui;
79
80 if (!$this->ass->getPeerReview()) {
81 $this->returnToParentObject();
82 }
83
84 $class = $ilCtrl->getNextClass($this);
85 $cmd = $ilCtrl->getCmd("showpeerreviewoverview");
86
87 switch ($class) {
88 case "ilfilesystemgui":
89 $ilCtrl->saveParameter($this, array("fu"));
90
91 // see self::downloadPeerReview()
94
95 if (!$this->canGive()) {
96 $this->returnToParentObject();
97 }
98
99 $valid = false;
100 $peer_items = $this->submission->getPeerReview()->getPeerReviewsByPeerId($peer_id, true);
101 if (is_array($peer_items)) {
102 foreach ($peer_items as $item) {
103 if ($item["giver_id"] == $giver_id) {
104 $valid = true;
105 }
106 }
107 }
108 if (!$valid) {
109 $ilCtrl->redirect($this, "editPeerReview");
110 }
111
112 $ilTabs->clearTargets();
113 $ilTabs->setBackTarget(
114 $lng->txt("back"),
115 $ilCtrl->getLinkTarget($this, "editPeerReview")
116 );
117
118 $fstorage = new ilFSStorageExercise($this->ass->getExerciseId(), $this->ass->getId());
119 $fstorage->create();
120
121 $fs_gui = new ilFileSystemGUI($fstorage->getPeerReviewUploadPath($peer_id, $giver_id));
122 $fs_gui->setTableId("excfbpeer");
123 $fs_gui->setAllowDirectories(false);
124 $fs_gui->setTitle($this->ass->getTitle() . ": " .
125 $lng->txt("exc_peer_review") . " - " .
126 $lng->txt("exc_peer_review_give"));
127 $this->ctrl->forwardCommand($fs_gui);
128 break;
129
130 case "ilratinggui":
131 $peer_review = new ilExPeerReview($this->ass);
132 $peer_review->updatePeerReviewTimestamp($this->requested_peer_id);
133
134 $rating_gui = new ilRatingGUI();
135 $rating_gui->setObject(
136 $this->ass->getId(),
137 "ass",
138 $this->requested_peer_id,
139 "peer"
140 );
141 $this->ctrl->forwardCommand($rating_gui);
142 $ilCtrl->redirect($this, "editPeerReview");
143 break;
144
145 case "ilexsubmissiontextgui":
146 $ilTabs->clearTargets();
147 if (!$this->submission->isTutor()) {
148 $ilTabs->setBackTarget(
149 $lng->txt("back"),
150 $ilCtrl->getLinkTarget($this, "editPeerReview")
151 );
152 $this->ctrl->setReturn($this, "editPeerReview");
153 } else {
154 $ilTabs->setBackTarget(
155 $lng->txt("back"),
156 $ilCtrl->getLinkTarget($this, "showGivenPeerReview")
157 );
158 $this->ctrl->setReturn($this, "showGivenPeerReview");
159 }
160 $gui = new ilExSubmissionTextGUI(new ilObjExercise($this->ass->getExerciseId(), false), $this->submission);
161 $ilCtrl->forwardCommand($gui);
162 break;
163
164 default:
165 $this->{$cmd . "Object"}();
166 break;
167 }
168 }
169
170 public function returnToParentObject(): void
171 {
172 $this->ctrl->returnToParent($this);
173 }
174
178 public static function getOverviewContent(
179 ilInfoScreenGUI $a_info,
180 ilExSubmission $a_submission
181 ): void {
182 global $DIC;
183
184 $lng = $DIC->language();
185 $ilCtrl = $DIC->ctrl();
186
187 $state = ilExcAssMemberState::getInstanceByIds($a_submission->getAssignment()->getId(), $a_submission->getUserId());
188
189 $ass = $a_submission->getAssignment();
190
191 $view_pc = "";
192 $edit_pc = "";
193
194
195 //if($ass->afterDeadlineStrict() &&
196 // $ass->getPeerReview())
197 if ($state->hasSubmissionEndedForAllUsers() &&
198 $ass->getPeerReview()) {
199 $ilCtrl->setParameterByClass("ilExPeerReviewGUI", "ass_id", $a_submission->getAssignment()->getId());
200
201 $nr_missing_fb = $a_submission->getPeerReview()->getNumberOfMissingFeedbacksForReceived();
202
203 // before deadline (if any)
204 // if(!$ass->getPeerReviewDeadline() ||
205 // $ass->getPeerReviewDeadline() > time())
206 if ($state->isPeerReviewAllowed()) {
207 $dl_info = "";
209 $dl_info = " (" . sprintf(
210 $lng->txt("exc_peer_review_deadline_info_button"),
211 $state->getPeerReviewDeadlinePresentation()
212 ) . ")";
213 }
214
215 $button = ilLinkButton::getInstance(); // edit peer review
216 $button->setPrimary($nr_missing_fb);
217 $button->setCaption($lng->txt("exc_peer_review_give") . $dl_info, false);
218 $button->setUrl($ilCtrl->getLinkTargetByClass(array("ilExSubmissionGUI", "ilExPeerReviewGUI"), "editPeerReview"));
219 $edit_pc = $button->render();
220 } elseif ($ass->getPeerReviewDeadline()) {
221 $edit_pc = $lng->txt("exc_peer_review_deadline_reached");
222 }
223
224 // after deadline (if any)
225 if ((!$ass->getPeerReviewDeadline() ||
226 $ass->getPeerReviewDeadline() < time())) {
227 // given peer review should be accessible at all times (read-only when not editable - see above)
229 $a_submission->getPeerReview()->countGivenFeedback(false)) {
230 $button = ilLinkButton::getInstance();
231 $button->setCaption("exc_peer_review_given");
232 $button->setUrl($ilCtrl->getLinkTargetByClass(array("ilExSubmissionGUI", "ilExPeerReviewGUI"), "showGivenPeerReview"));
233 $view_pc = $button->render() . " ";
234 }
235
236 // did give enough feedback
237 if (!$nr_missing_fb) {
238 // received any?
239 $received = (bool) sizeof($a_submission->getPeerReview()->getPeerReviewsByPeerId($a_submission->getUserId(), true));
240 if ($received) {
241 $button = ilLinkButton::getInstance();
242 $button->setCaption("exc_peer_review_show");
243 $button->setUrl($ilCtrl->getLinkTargetByClass(array("ilExSubmissionGUI", "ilExPeerReviewGUI"), "showReceivedPeerReview"));
244 $view_pc .= $button->render();
245 }
246 // received none
247 else {
248 $view_pc .= $lng->txt("exc_peer_review_show_received_none");
249 }
250 }
251 // did not give enough
252 else {
253 $view_pc .= $lng->txt("exc_peer_review_show_missing");
254 }
255 }
256 /* must give before showing received
257 else
258 {
259 $view_pc = $lng->txt("exc_peer_review_show_not_rated_yet");
260 }
261 */
262
263 $sep = ($edit_pc != "" && $view_pc != "")
264 ? "<br><br>"
265 : "";
266
267 $a_info->addProperty($lng->txt("exc_peer_review"), $edit_pc . $sep . $view_pc);
268
269 $ilCtrl->setParameterByClass("ilExPeerReviewGUI", "ass_id", "");
270 }
271 }
272
273 protected function canGive(): bool
274 {
275 return ($this->submission->isOwner() &&
276 $this->ass->afterDeadlineStrict() &&
277 (!$this->ass->getPeerReviewDeadline() ||
278 $this->ass->getPeerReviewDeadline() > time()));
279 }
280
281 protected function canView(): bool
282 {
283 return ($this->submission->isTutor() ||
284 ($this->submission->isOwner() &&
285 $this->ass->afterDeadlineStrict() &&
286 (!$this->ass->getPeerReviewDeadline() ||
287 $this->ass->getPeerReviewDeadline() < time())));
288 }
289
296 public function showGivenPeerReviewObject(): void
297 {
300
301 if (!$this->canView()) {
302 $this->returnToParentObject();
303 }
304
305 $peer_items = $this->submission->getPeerReview()->getPeerReviewsByGiver($this->submission->getUserId());
306 if ($peer_items === []) {
307 $this->tpl->setOnScreenMessage('failure', $this->lng->txt("exc_peer_review_no_peers"), true);
308 $this->returnToParentObject();
309 }
310
311 $tpl->setTitle($this->ass->getTitle() . ": " . $lng->txt("exc_peer_review_given"));
312
313 $info_widget = new ilInfoScreenGUI($this);
314
315 $this->renderInfoWidget($info_widget, $peer_items);
316
317 $tpl->setContent($info_widget->getHTML());
318 }
319
326 public function showReceivedPeerReviewObject(): void
327 {
328 $ilCtrl = $this->ctrl;
331
332 if (!$this->canView() ||
333 (!$this->submission->isTutor() &&
334 $this->submission->getPeerReview()->getNumberOfMissingFeedbacksForReceived())) {
335 $this->returnToParentObject();
336 }
337
338 $this->tabs_gui->clearTargets();
339 $this->tabs_gui->setBackTarget($this->lng->txt("back"), $this->ctrl->getLinkTarget($this, "returnToParent"));
340
341 $peer_items = $this->submission->getPeerReview()->getPeerReviewsByPeerId($this->submission->getUserId(), !$this->submission->isTutor());
342 if ($peer_items === []) {
343 // #11373
344 $this->tpl->setOnScreenMessage('failure', $this->lng->txt("exc_peer_review_no_peers_reviewed_yet"), true);
345 $ilCtrl->redirect($this, "returnToParent");
346 }
347
348 $tpl->setTitle($this->ass->getTitle() . ": " . $lng->txt("exc_peer_review_show"));
349
350 $info_widget = new ilInfoScreenGUI($this);
351
352 $this->renderInfoWidget($info_widget, $peer_items, true);
353
354 $tpl->setContent($info_widget->getHTML());
355 }
356
357 protected function renderInfoWidget(
358 ilInfoScreenGUI $a_info_widget,
359 array $a_peer_items,
360 bool $a_by_peer = false
361 ): void {
362 $lng = $this->lng;
363
364 if ($this->submission->isTutor()) {
365 $user_title = $a_by_peer
366 ? $lng->txt("exc_peer_review_recipient")
367 : $lng->txt("exc_peer_review_giver");
368 $a_info_widget->addSection($user_title);
369 $a_info_widget->addProperty(
370 $lng->txt("name"),
371 ilUserUtil::getNamePresentation($this->submission->getUserId(), false, false, "", true)
372 );
373 }
374
375 if ($a_by_peer) {
376 // submission
377
378 $a_info_widget->addSection($lng->txt("exc_submission"));
379
380 $submission = new ilExSubmission($this->ass, $this->submission->getUserId());
381 $file_info = $submission->getDownloadedFilesInfoForTableGUIS();
382
383 $a_info_widget->addProperty(
384 $file_info["last_submission"]["txt"],
385 $file_info["last_submission"]["value"] .
386 $this->getLateSubmissionInfo($submission)
387 );
388
389 $sub_data = $this->getSubmissionContent($submission);
390 if ($sub_data === '' || $sub_data === '0') {
391 $sub_data = '<a href="' . $file_info["files"]["download_url"] . '">' . $lng->txt("download") . '</a>';
392 }
393 $a_info_widget->addProperty($lng->txt("exc_submission"), $sub_data);
394 }
395
396 foreach ($a_peer_items as $peer) {
397 if (!$a_by_peer) {
398 $giver_id = $this->submission->getUserId();
399 $peer_id = $peer["peer_id"];
400 $id_title = $lng->txt("exc_peer_review_recipient");
401 $user_id = $peer_id;
402 } else {
403 $giver_id = $peer["giver_id"];
404 $peer_id = $this->submission->getUserId();
405 $id_title = $lng->txt("exc_peer_review_giver");
406 $user_id = $giver_id;
407 }
408
409 // peer info
410 if ($this->submission->isTutor()) {
411 $id_value = ilUserUtil::getNamePresentation($user_id, "", "", false, true);
412 } elseif (!$this->ass->hasPeerReviewPersonalized()) {
413 $id_value = $peer["seq"];
414 } else {
415 $id_value = ilUserUtil::getNamePresentation($user_id);
416 }
417 $a_info_widget->addSection($id_title . ": " . $id_value);
418
419
420 // submission info
421
422 if (!$a_by_peer) {
423 $submission = new ilExSubmission($this->ass, $peer_id);
424 $file_info = $submission->getDownloadedFilesInfoForTableGUIS();
425
426 $a_info_widget->addProperty(
427 $file_info["last_submission"]["txt"],
428 $file_info["last_submission"]["value"] .
429 $this->getLateSubmissionInfo($submission)
430 );
431
432 $sub_data = $this->getSubmissionContent($submission);
433 if ($sub_data === '' || $sub_data === '0') {
434 if (isset($file_info["files"]["download_url"])) {
435 $sub_data = '<a href="' . $file_info["files"]["download_url"] . '">' . $lng->txt("download") . '</a>';
436 }
437 }
438 $a_info_widget->addProperty($lng->txt("exc_submission"), $sub_data);
439 }
440
441
442 // peer review items
443
444 $values = $this->submission->getPeerReview()->getPeerReviewValues($giver_id, $peer_id);
445
446 foreach ($this->ass->getPeerReviewCriteriaCatalogueItems() as $item) {
447 $crit_id = $item->getId()
448 ? $item->getId()
449 : $item->getType();
450
451 $item->setPeerReviewContext(
452 $this->ass,
453 $giver_id,
454 $peer_id
455 );
456
457 $title = $item->getTitle();
458 $html = $item->getHTML($values[$crit_id] ?? null);
459 $a_info_widget->addProperty($title ?: "&nbsp;", $html ?: "&nbsp;");
460 }
461 }
462 }
463
464 protected function getLateSubmissionInfo(
465 ilExSubmission $a_submission
466 ): string {
467 $lng = $this->lng;
468
469 // #18966 - late files info
470 foreach ($a_submission->getFiles() as $file) {
471 if ($file["late"]) {
472 return '<div class="warning">' . $lng->txt("exc_late_submission") . '</div>';
473 }
474 }
475 return "";
476 }
477
481 public function editPeerReviewObject(): void
482 {
484
485 if (!$this->canGive()) {
486 $this->returnToParentObject();
487 }
488
489 $peer_items = $this->submission->getPeerReview()->getPeerReviewsByGiver($this->submission->getUserId());
490 if ($peer_items === []) {
491 $this->tpl->setOnScreenMessage('failure', $this->lng->txt("exc_peer_review_no_peers"), true);
492 $this->returnToParentObject();
493 }
494
495 $missing = $this->submission->getPeerReview()->getNumberOfMissingFeedbacksForReceived();
496 if ($missing !== 0) {
497 $dl = $this->ass->getPeerReviewDeadline();
498 if (!$dl || $dl < time()) {
499 $this->tpl->setOnScreenMessage('info', sprintf($this->lng->txt("exc_peer_review_missing_info"), $missing));
500 } else {
501 $this->tpl->setOnScreenMessage('info', sprintf(
502 $this->lng->txt("exc_peer_review_missing_info_deadline"),
503 $missing,
505 ));
506 }
507 }
508
510 $this,
511 "editPeerReview",
512 $this->ass,
513 $this->submission->getUserId(),
514 $peer_items
515 );
516 $tpl->setContent($tbl->getHTML());
517 }
518
520 ilPropertyFormGUI $a_form = null
521 ): void {
522 $tpl = $this->tpl;
523
524 if (!$this->canGive() ||
525 !$this->isValidPeer($this->requested_peer_id)) {
526 $this->returnToParentObject();
527 }
528
529 if ($a_form === null) {
530 $a_form = $this->initPeerReviewItemForm($this->requested_peer_id);
531 }
532
533 $tpl->setContent($a_form->getHTML());
534 }
535
536 protected function isValidPeer(int $a_peer_id): bool
537 {
538 $peer_items = $this->submission->getPeerReview()->getPeerReviewsByGiver($this->submission->getUserId());
539 foreach ($peer_items as $item) {
540 if ($item["peer_id"] == $a_peer_id) {
541 return true;
542 }
543 }
544 return false;
545 }
546
547 protected function getSubmissionContent(
548 ilExSubmission $a_submission
549 ): string {
550 if ($this->ass->getType() != ilExAssignment::TYPE_TEXT) {
551 return "";
552 }
553
554 $text = $a_submission->getFiles();
555 if ($text !== []) {
556 $text = array_shift($text);
557 if (trim($text["atext"]) !== '' && trim($text["atext"]) !== '0') {
558 // mob id to mob src
559 return nl2br(ilRTE::_replaceMediaObjectImageSrc($text["atext"], 1));
560 }
561 }
562 return "";
563 }
564
568 protected function initPeerReviewItemForm(
569 int $a_peer_id
571 $ilCtrl = $this->ctrl;
573
574 // get peer data
575 $peer_items = $this->submission->getPeerReview()->getPeerReviewsByGiver($this->submission->getUserId());
576 $peer = [];
577 foreach ($peer_items as $item) {
578 if ($item["peer_id"] == $a_peer_id) {
579 $peer = $item;
580 break;
581 }
582 }
583
584 $ilCtrl->saveParameter($this, "peer_id");
585
586 $form = new ilPropertyFormGUI();
587 $form->setFormAction($ilCtrl->getFormAction($this, "updatePeerReview"));
588
589 $form->setTitle($this->ass->getTitle() . ": " . $lng->txt("exc_peer_review_give"));
590
591 // peer info
592 if (!$this->ass->hasPeerReviewPersonalized()) {
593 $id_title = $lng->txt("id");
594 $id_value = $peer["seq"];
595 } else {
596 $id_title = $lng->txt("exc_peer_review_recipient");
597 $id_value = ilUserUtil::getNamePresentation($peer["peer_id"]);
598 }
599 $id = new ilNonEditableValueGUI($id_title);
600 $id->setValue($id_value);
601 $form->addItem($id);
602
603 // submission info
604
605 $submission = new ilExSubmission($this->ass, $peer["peer_id"]);
606 $file_info = $submission->getDownloadedFilesInfoForTableGUIS();
607
608 $last_sub = new ilNonEditableValueGUI($file_info["last_submission"]["txt"], "", true);
609 $last_sub->setValue($file_info["last_submission"]["value"] .
610 $this->getLateSubmissionInfo($submission));
611 $form->addItem($last_sub);
612
613 $sub_data = $this->getSubmissionContent($submission);
614 if (($sub_data === '' || $sub_data === '0') && isset($file_info["files"]["download_url"])) {
615 $sub_data = '<a href="' . $file_info["files"]["download_url"] . '">' . $lng->txt("download") . '</a>';
616 }
617
618 $sub = new ilNonEditableValueGUI($lng->txt("exc_submission"), "", true);
619 $sub->setValue($sub_data);
620 $form->addItem($sub);
621
622 // peer review items
623
624 $input = new ilFormSectionHeaderGUI();
625 $input->setTitle($lng->txt("exc_peer_review"));
626 $form->addItem($input);
627
628 $values = $this->submission->getPeerReview()->getPeerReviewValues($this->submission->getUserId(), $a_peer_id);
629
630 foreach ($this->ass->getPeerReviewCriteriaCatalogueItems() as $item) {
631 $crit_id = $item->getId()
632 ? $item->getId()
633 : $item->getType();
634
635 $item->setPeerReviewContext(
636 $this->ass,
637 $this->submission->getUserId(),
638 $peer["peer_id"],
639 $form
640 );
641 $item->addToPeerReviewForm($values[$crit_id] ?? null);
642 }
643
644 $form->addCommandButton("updatePeerReview", $lng->txt("save"));
645 $form->addCommandButton("editPeerReview", $lng->txt("cancel"));
646
647 return $form;
648 }
649
650 public function updateCritAjaxObject(): void
651 {
652 $ilCtrl = $this->ctrl;
653 $ilUser = $this->user;
655
656 if (!$this->canGive() ||
657 !$this->requested_peer_id ||
658 !$this->requested_crit_id ||
659 !$ilCtrl->isAsynch()) {
660 exit();
661 }
662
663 $peer_id = $this->requested_peer_id;
664 $crit_id = $this->requested_crit_id;
665 $giver_id = $ilUser->getId();
666
667 if (!is_numeric($crit_id)) {
668 $crit = ilExcCriteria::getInstanceByType($crit_id);
669 } else {
670 $crit = ilExcCriteria::getInstanceById($crit_id);
671 }
672 $crit->setPeerReviewContext($this->ass, $giver_id, $peer_id);
673 $html = $crit->updateFromAjax();
674
675 $this->handlePeerReviewChange();
676
677 echo $html;
678 echo $tpl->getOnLoadCodeForAsynch();
679 exit();
680 }
681
682 public function updatePeerReviewObject(): void
683 {
685 $ilCtrl = $this->ctrl;
686
687 if (!$this->canGive() ||
688 !$this->isValidPeer($this->requested_peer_id)) {
689 $this->returnToParentObject();
690 }
691
692 $peer_id = $this->requested_peer_id;
693
694 $form = $this->initPeerReviewItemForm($peer_id);
695 if ($form->checkInput()) {
696 $valid = true;
697
698 $values = array();
699 foreach ($this->ass->getPeerReviewCriteriaCatalogueItems() as $item) {
700 $item->setPeerReviewContext(
701 $this->ass,
702 $this->submission->getUserId(),
703 $peer_id,
704 $form
705 );
706 $value = $item->importFromPeerReviewForm();
707 if ($value !== null) {
708 $crit_id = $item->getId()
709 ? $item->getId()
710 : $item->getType();
711 $values[$crit_id] = $value;
712 }
713 if (!$item->validate($value)) {
714 $valid = false;
715 }
716 }
717
718 if ($valid) {
719 $this->submission->getPeerReview()->updatePeerReview($peer_id, $values);
720
721 $this->handlePeerReviewChange();
722
723 $this->tpl->setOnScreenMessage('success', $this->lng->txt("exc_peer_review_updated"), true);
724 $ilCtrl->redirect($this, "editPeerReview");
725 } else {
726 $this->tpl->setOnScreenMessage('failure', $lng->txt("form_input_not_valid"));
727 }
728 }
729
730 $form->setValuesByPost();
731 $this->editPeerReviewItemObject($form);
732 }
733
734 protected function handlePeerReviewChange(): void
735 {
736 // (in)valid peer reviews could change assignment status
737 $exercise = new ilObjExercise($this->ass->getExerciseId(), false);
738 $exercise->processExerciseStatus(
739 $this->ass,
740 $this->submission->getUserIds(),
741 $this->submission->hasSubmitted(),
742 $this->submission->validatePeerReviews()
743 );
744 }
745
746 public function downloadPeerReviewObject(): void
747 {
748 $ilCtrl = $this->ctrl;
749
750 if (!$this->canView() &&
751 !$this->canGive()) {
752 $this->returnToParentObject();
753 }
754
755 $giver_id = $this->requested_review_giver_id;
756 $peer_id = $this->requested_review_peer_id;
757 $crit_id = $this->requested_review_crit_id;
758
759 if (!is_numeric($crit_id)) {
760 $crit = ilExcCriteria::getInstanceByType($crit_id);
761 } else {
762 $crit = ilExcCriteria::getInstanceById($crit_id);
763 }
764
765 $crit->setPeerReviewContext($this->ass, $giver_id, $peer_id);
766 $file = $crit->getFileByHash();
767 if ($file) {
768 ilFileDelivery::deliverFileLegacy($file, basename($file));
769 }
770
771 $ilCtrl->redirect($this, "returnToParent");
772 }
773
774
775
776 //
777 // ADMIN
778 //
779
780 public function showPeerReviewOverviewObject(): void
781 {
783
784 if (!$this->ass ||
785 !$this->ass->getPeerReview()) {
786 $this->returnToParentObject();
787 }
788
790 $this,
791 "showPeerReviewOverview",
792 $this->ass
793 );
794
795 $panel = "";
796 $panel_data = $tbl->getPanelInfo();
797 if (is_array($panel_data) && count($panel_data) > 0) {
798 $ptpl = new ilTemplate("tpl.exc_peer_review_overview_panel.html", true, true, "Modules/Exercise");
799 foreach ($panel_data as $item) {
800 $ptpl->setCurrentBlock("user_bl");
801 foreach ($item["value"] as $user) {
802 $ptpl->setVariable("USER", $user);
803 $ptpl->parseCurrentBlock();
804 }
805
806 $ptpl->setCurrentBlock("item_bl");
807 $ptpl->setVariable("TITLE", $item["title"]);
808 $ptpl->parseCurrentBlock();
809 }
810
812 $panel->setHeading($this->lng->txt("exc_peer_review_overview_invalid_users"));
813 $panel->setBody($ptpl->get());
814 $panel = $panel->getHTML();
815 }
816
817 $tpl->setContent($tbl->getHTML() . $panel);
818 }
819
820 public function confirmResetPeerReviewObject(): void
821 {
822 $ilCtrl = $this->ctrl;
824 $ilTabs = $this->tabs_gui;
825
826 if (!$this->ass ||
827 !$this->ass->getPeerReview()) {
828 $this->returnToParentObject();
829 }
830
831 $ilTabs->clearTargets();
832
833 $cgui = new ilConfirmationGUI();
834 $cgui->setFormAction($ilCtrl->getFormAction($this));
835 $cgui->setHeaderText(sprintf($this->lng->txt("exc_peer_review_reset_sure"), $this->ass->getTitle()));
836 $cgui->setCancel($this->lng->txt("cancel"), "showPeerReviewOverview");
837 $cgui->setConfirm($this->lng->txt("delete"), "resetPeerReview");
838
839 $tpl->setContent($cgui->getHTML());
840 }
841
842 public function resetPeerReviewObject(): void
843 {
844 $ilCtrl = $this->ctrl;
845
846 if (!$this->ass ||
847 !$this->ass->getPeerReview()) {
848 $this->returnToParentObject();
849 }
850
851 $peer_review = new ilExPeerReview($this->ass);
852 $all_giver_ids = $peer_review->resetPeerReviews();
853
854 if (is_array($all_giver_ids)) {
855 // if peer review is valid for completion, we have to re-calculate all assignment members
856 $exercise = new ilObjExercise($this->ass->getExerciseId(), false);
857 if ($exercise->isCompletionBySubmissionEnabled() &&
858 $this->ass->getPeerReviewValid() != ilExAssignment::PEER_REVIEW_VALID_NONE) {
859 foreach ($all_giver_ids as $user_id) {
860 $submission = new ilExSubmission($this->ass, $user_id);
861 $pgui = new self($this->ass, $submission);
862 $pgui->handlePeerReviewChange();
863 }
864 }
865 }
866
867 $this->tpl->setOnScreenMessage('success', $this->lng->txt("exc_peer_review_reset_done"), true);
868 $ilCtrl->redirect($this, "showPeerReviewOverview");
869 }
870}
$id
plugin.php for ilComponentBuildPluginInfoObjectiveTest::testAddPlugins
Definition: plugin.php:23
const IL_CAL_UNIX
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
Class ilCtrl provides processing control methods.
static formatDate(ilDateTime $date, bool $a_skip_day=false, bool $a_include_wd=false, bool $include_seconds=false)
@classDescription Date and time handling
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
Exercise assignment.
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
static getOverviewContent(ilInfoScreenGUI $a_info, ilExSubmission $a_submission)
initPeerReviewItemForm(int $a_peer_id)
getSubmissionContent(ilExSubmission $a_submission)
editPeerReviewItemObject(ilPropertyFormGUI $a_form=null)
ilGlobalPageTemplate $tpl
getLateSubmissionInfo(ilExSubmission $a_submission)
renderInfoWidget(ilInfoScreenGUI $a_info_widget, array $a_peer_items, bool $a_by_peer=false)
Exercise peer review.
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
getFiles(array $a_file_ids=null, bool $a_only_valid=false, string $a_min_timestamp=null, bool $print_versions=false)
Get submission items (not only files)
static getInstanceByIds(int $a_ass_id, int $a_user_id=0)
static getInstanceById(int $a_id)
static getInstanceByType(string $a_type)
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
static deliverFileLegacy(string $a_file, ?string $a_filename=null, ?string $a_mime=null, ?bool $isInline=false, ?bool $removeAfterDelivery=false, ?bool $a_exit_after=true)
File System Explorer GUI class.
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
setContent(string $a_html)
Sets content for standard template.
Class ilInfoScreenGUI.
addSection(string $a_title)
addProperty(string $a_name, string $a_value, string $a_link="")
add a property to current section
language handling
txt(string $a_topic, string $a_default_lang_fallback_mod="")
gets the text for a given topic if the topic is not in the list, the topic itself with "-" will be re...
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
Class ilObjExercise.
User class.
static getInstance()
This class represents a property form user interface.
static _replaceMediaObjectImageSrc(string $a_text, int $a_direction=0, string $nic='')
Replaces image source from mob image urls with the mob id or replaces mob id with the correct image s...
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
special template class to simplify handling of ITX/PEAR
static getNamePresentation( $a_user_id, bool $a_user_image=false, bool $a_profile_link=false, string $a_profile_back_link="", bool $a_force_first_lastname=false, bool $a_omit_login=false, bool $a_sortable=true, bool $a_return_data_array=false, $a_ctrl_path="ilpublicuserprofilegui")
Default behaviour is:
if(!file_exists(getcwd() . '/ilias.ini.php'))
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
Definition: confirmReg.php:20
$valid
global $DIC
Definition: feed.php:28
if(isset($_FILES['img_file']) &&is_array($_FILES['img_file'])) $panel
Definition: imgupload.php:198
$ilUser
Definition: imgupload.php:34
if($DIC->http() ->request() ->getMethod()=="GET" &&isset($DIC->http() ->request() ->getQueryParams()['tex'])) $tpl
Definition: latex.php:41
exit
Definition: login.php:28
__construct(Container $dic, ilPlugin $plugin)
@inheritDoc
$lng