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