ILIAS  release_7 Revision v7.30-3-g800a261c036
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 {
72 $ilCtrl = $this->ctrl;
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 $fstorage = new ilFSStorageExercise($this->ass->getExerciseId(), $this->ass->getId());
117 $fstorage->create();
118
119 $fs_gui = new ilFileSystemGUI($fstorage->getPeerReviewUploadPath($peer_id, $giver_id));
120 $fs_gui->setTableId("excfbpeer");
121 $fs_gui->setAllowDirectories(false);
122 $fs_gui->setTitle($this->ass->getTitle() . ": " .
123 $lng->txt("exc_peer_review") . " - " .
124 $lng->txt("exc_peer_review_give"));
125 $ret = $this->ctrl->forwardCommand($fs_gui);
126 break;
127
128 case "ilratinggui":
129 $this->ass->updatePeerReviewTimestamp((int) $_REQUEST["peer_id"]);
130
131 $rating_gui = new ilRatingGUI();
132 $rating_gui->setObject(
133 $this->ass->getId(),
134 "ass",
135 (int) $_REQUEST["peer_id"],
136 "peer"
137 );
138 $this->ctrl->forwardCommand($rating_gui);
139 $ilCtrl->redirect($this, "editPeerReview");
140 break;
141
142 case "ilexsubmissiontextgui":
143 if (!$this->submission->isTutor()) {
144 $ilTabs->clearTargets();
145 $ilTabs->setBackTarget(
146 $lng->txt("back"),
147 $ilCtrl->getLinkTarget($this, "editPeerReview")
148 );
149 $this->ctrl->setReturn($this, "editPeerReview");
150 } else {
151 $ilTabs->clearTargets();
152 $ilTabs->setBackTarget(
153 $lng->txt("back"),
154 $ilCtrl->getLinkTarget($this, "showGivenPeerReview")
155 );
156 $this->ctrl->setReturn($this, "showGivenPeerReview");
157 }
158 $gui = new ilExSubmissionTextGUI(new ilObjExercise($this->ass->getExerciseId(), false), $this->submission);
159 $ilCtrl->forwardCommand($gui);
160 break;
161
162 default:
163 $this->{$cmd . "Object"}();
164 break;
165 }
166 }
167
168 public function returnToParentObject()
169 {
170 $this->ctrl->returnToParent($this);
171 }
172
173 public static function getOverviewContent(ilInfoScreenGUI $a_info, ilExSubmission $a_submission)
174 {
175 global $DIC;
176
177 $lng = $DIC->language();
178 $ilCtrl = $DIC->ctrl();
179
180 $state = ilExcAssMemberState::getInstanceByIds($a_submission->getAssignment()->getId(), $a_submission->getUserId());
181
182 $ass = $a_submission->getAssignment();
183
184
185
186
187 //if($ass->afterDeadlineStrict() &&
188 // $ass->getPeerReview())
189 if ($state->hasSubmissionEndedForAllUsers() &&
190 $ass->getPeerReview()) {
191 $ilCtrl->setParameterByClass("ilExPeerReviewGUI", "ass_id", $a_submission->getAssignment()->getId());
192
193 $nr_missing_fb = $a_submission->getPeerReview()->getNumberOfMissingFeedbacksForReceived();
194
195 // before deadline (if any)
196 // if(!$ass->getPeerReviewDeadline() ||
197 // $ass->getPeerReviewDeadline() > time())
198 if ($state->isPeerReviewAllowed()) {
199 $dl_info = "";
200 if ($ass->getPeerReviewDeadline()) {
201 $dl_info = " (" . sprintf(
202 $lng->txt("exc_peer_review_deadline_info_button"),
203 $state->getPeerReviewDeadlinePresentation()
204 ) . ")";
205 }
206
207 $button = ilLinkButton::getInstance(); // edit peer review
208 $button->setPrimary($nr_missing_fb);
209 $button->setCaption($lng->txt("exc_peer_review_give") . $dl_info, false);
210 $button->setUrl($ilCtrl->getLinkTargetByClass(array("ilExSubmissionGUI", "ilExPeerReviewGUI"), "editPeerReview"));
211 $edit_pc = $button->render();
212 } elseif ($ass->getPeerReviewDeadline()) {
213 $edit_pc = $lng->txt("exc_peer_review_deadline_reached");
214 }
215
216 // after deadline (if any)
217 if ((!$ass->getPeerReviewDeadline() ||
218 $ass->getPeerReviewDeadline() < time())) {
219 // given peer review should be accessible at all times (read-only when not editable - see above)
220 if ($ass->getPeerReviewDeadline() &&
221 $a_submission->getPeerReview()->countGivenFeedback(false)) {
222 $button = ilLinkButton::getInstance();
223 $button->setCaption("exc_peer_review_given");
224 $button->setUrl($ilCtrl->getLinkTargetByClass(array("ilExSubmissionGUI", "ilExPeerReviewGUI"), "showGivenPeerReview"));
225 $view_pc = $button->render() . " ";
226 }
227
228 // did give enough feedback
229 if (!$nr_missing_fb) {
230 // received any?
231 $received = (bool) sizeof($a_submission->getPeerReview()->getPeerReviewsByPeerId($a_submission->getUserId(), true));
232 if ($received) {
233 $button = ilLinkButton::getInstance();
234 $button->setCaption("exc_peer_review_show");
235 $button->setUrl($ilCtrl->getLinkTargetByClass(array("ilExSubmissionGUI", "ilExPeerReviewGUI"), "showReceivedPeerReview"));
236 $view_pc .= $button->render();
237 }
238 // received none
239 else {
240 $view_pc .= $lng->txt("exc_peer_review_show_received_none");
241 }
242 }
243 // did not give enough
244 else {
245 $view_pc .= $lng->txt("exc_peer_review_show_missing");
246 }
247 }
248 /* must give before showing received
249 else
250 {
251 $view_pc = $lng->txt("exc_peer_review_show_not_rated_yet");
252 }
253 */
254
255 $sep = ($edit_pc != "" && $view_pc != "")
256 ? "<br><br>"
257 : "";
258
259 $a_info->addProperty($lng->txt("exc_peer_review"), $edit_pc . $sep . $view_pc);
260
261 $ilCtrl->setParameterByClass("ilExPeerReviewGUI", "ass_id", "");
262 }
263 }
264
265 protected function canGive()
266 {
267 return ($this->submission->isOwner() &&
268 $this->ass->afterDeadlineStrict() &&
269 (!$this->ass->getPeerReviewDeadline() ||
270 $this->ass->getPeerReviewDeadline() > time()));
271 }
272
273 protected function canView()
274 {
275 return ($this->submission->isTutor() ||
276 ($this->submission->isOwner() &&
277 $this->ass->afterDeadlineStrict() &&
278 (!$this->ass->getPeerReviewDeadline() ||
279 $this->ass->getPeerReviewDeadline() < time())));
280 }
281
283 {
286
287 if (!$this->canView()) {
288 $this->returnToParentObject();
289 }
290
291 $peer_items = $this->submission->getPeerReview()->getPeerReviewsByGiver($this->submission->getUserId());
292 if (!sizeof($peer_items)) {
293 ilUtil::sendFailure($this->lng->txt("exc_peer_review_no_peers"), true);
294 $this->returnToParentObject();
295 }
296
297 $tpl->setTitle($this->ass->getTitle() . ": " . $lng->txt("exc_peer_review_given"));
298
299 $info_widget = new ilInfoScreenGUI($this);
300
301 $this->renderInfoWidget($info_widget, $peer_items);
302
303 $tpl->setContent($info_widget->getHTML());
304 }
305
307 {
308 $ilCtrl = $this->ctrl;
311
312 if (!$this->canView() ||
313 (!$this->submission->isTutor() &&
314 $this->submission->getPeerReview()->getNumberOfMissingFeedbacksForReceived())) {
315 $this->returnToParentObject();
316 }
317
318 $this->tabs_gui->clearTargets();
319 $this->tabs_gui->setBackTarget($this->lng->txt("back"), $this->ctrl->getLinkTarget($this, "returnToParent"));
320
321 $peer_items = $this->submission->getPeerReview()->getPeerReviewsByPeerId($this->submission->getUserId(), !$this->submission->isTutor());
322 if (!sizeof($peer_items)) {
323 // #11373
324 ilUtil::sendFailure($this->lng->txt("exc_peer_review_no_peers_reviewed_yet"), true);
325 $ilCtrl->redirect($this, "returnToParent");
326 }
327
328 $tpl->setTitle($this->ass->getTitle() . ": " . $lng->txt("exc_peer_review_show"));
329
330 $info_widget = new ilInfoScreenGUI($this);
331
332 $this->renderInfoWidget($info_widget, $peer_items, true);
333
334 $tpl->setContent($info_widget->getHTML());
335 }
336
337 protected function renderInfoWidget(ilInfoScreenGUI $a_info_widget, array $a_peer_items, $a_by_peer = false)
338 {
340
341 if ($this->submission->isTutor()) {
342 $user_title = $a_by_peer
343 ? $lng->txt("exc_peer_review_recipient")
344 : $lng->txt("exc_peer_review_giver");
345 $a_info_widget->addSection($user_title);
346 $a_info_widget->addProperty(
347 $lng->txt("name"),
348 ilUserUtil::getNamePresentation($this->submission->getUserId(), false, false, "", true)
349 );
350 }
351
352 if ($a_by_peer) {
353 // submission
354
355 $a_info_widget->addSection($lng->txt("exc_submission"));
356
357 $submission = new ilExSubmission($this->ass, $this->submission->getUserId());
358 $file_info = $submission->getDownloadedFilesInfoForTableGUIS($this, "showReceivedPeerReview");
359
360 $a_info_widget->addProperty(
361 $file_info["last_submission"]["txt"],
362 $file_info["last_submission"]["value"] .
364 );
365
366 $sub_data = $this->getSubmissionContent($submission);
367 if (!$sub_data) {
368 $sub_data = '<a href="' . $file_info["files"]["download_url"] . '">' . $lng->txt("download") . '</a>';
369 }
370 $a_info_widget->addProperty($lng->txt("exc_submission"), $sub_data);
371 }
372
373 foreach ($a_peer_items as $peer) {
374 if (!$a_by_peer) {
375 $giver_id = $this->submission->getUserId();
376 $peer_id = $peer["peer_id"];
377 $id_title = $lng->txt("exc_peer_review_recipient");
378 $user_id = $peer_id;
379 } else {
380 $giver_id = $peer["giver_id"];
381 $peer_id = $this->submission->getUserId();
382 $id_title = $lng->txt("exc_peer_review_giver");
383 $user_id = $giver_id;
384 }
385
386 // peer info
387 if ($this->submission->isTutor()) {
388 $id_value = ilUserUtil::getNamePresentation($user_id, "", "", false, true);
389 } elseif (!$this->ass->hasPeerReviewPersonalized()) {
390 $id_value = $peer["seq"];
391 } else {
392 $id_value = ilUserUtil::getNamePresentation($user_id);
393 }
394 $a_info_widget->addSection($id_title . ": " . $id_value);
395
396
397 // submission info
398
399 if (!$a_by_peer) {
400 $submission = new ilExSubmission($this->ass, $peer_id);
401 $file_info = $submission->getDownloadedFilesInfoForTableGUIS($this, "editPeerReviewItem");
402
403 $a_info_widget->addProperty(
404 $file_info["last_submission"]["txt"],
405 $file_info["last_submission"]["value"] .
407 );
408
409 $sub_data = $this->getSubmissionContent($submission);
410 if (!$sub_data) {
411 $sub_data = '<a href="' . $file_info["files"]["download_url"] . '">' . $lng->txt("download") . '</a>';
412 }
413 $a_info_widget->addProperty($lng->txt("exc_submission"), $sub_data);
414 }
415
416
417 // peer review items
418
419 $values = $this->submission->getPeerReview()->getPeerReviewValues($giver_id, $peer_id);
420
421 foreach ($this->ass->getPeerReviewCriteriaCatalogueItems() as $item) {
422 $crit_id = $item->getId()
423 ? $item->getId()
424 : $item->getType();
425
426 $item->setPeerReviewContext(
427 $this->ass,
428 $giver_id,
429 $peer_id
430 );
431
432 $title = $item->getTitle();
433 $html = $item->getHTML($values[$crit_id]);
434 $a_info_widget->addProperty($title ? $title : "&nbsp;", $html ? $html : "&nbsp;");
435 }
436 }
437 }
438
439 protected function getLateSubmissionInfo(ilExSubmission $a_submission)
440 {
442
443 // #18966 - late files info
444 foreach ($a_submission->getFiles() as $file) {
445 if ($file["late"]) {
446 return '<div class="warning">' . $lng->txt("exc_late_submission") . '</div>';
447 }
448 }
449 }
450
451 public function editPeerReviewObject()
452 {
454
455 if (!$this->canGive()) {
456 $this->returnToParentObject();
457 }
458
459 $peer_items = $this->submission->getPeerReview()->getPeerReviewsByGiver($this->submission->getUserId());
460 if (!sizeof($peer_items)) {
461 ilUtil::sendFailure($this->lng->txt("exc_peer_review_no_peers"), true);
462 $this->returnToParentObject();
463 }
464
465 $missing = $this->submission->getPeerReview()->getNumberOfMissingFeedbacksForReceived();
466 if ($missing) {
467 $dl = $this->ass->getPeerReviewDeadline();
468 if (!$dl || $dl < time()) {
469 ilUtil::sendInfo(sprintf($this->lng->txt("exc_peer_review_missing_info"), $missing));
470 } else {
471 ilUtil::sendInfo(sprintf(
472 $this->lng->txt("exc_peer_review_missing_info_deadline"),
473 $missing,
475 ));
476 }
477 }
478
480 $this,
481 "editPeerReview",
482 $this->ass,
483 $this->submission->getUserId(),
484 $peer_items,
485 "returnToParent"
486 );
487 $tpl->setContent($tbl->getHTML());
488 }
489
490 public function editPeerReviewItemObject(ilPropertyFormGUI $a_form = null)
491 {
493
494 if (!$this->canGive() ||
495 !$this->isValidPeer($_GET["peer_id"])) {
496 $this->returnToParentObject();
497 }
498
499 if (!$a_form) {
500 $a_form = $this->initPeerReviewItemForm($_GET["peer_id"]);
501 }
502
503 $tpl->setContent($a_form->getHTML());
504 }
505
506 protected function isValidPeer($a_peer_id)
507 {
508 $peer_items = $this->submission->getPeerReview()->getPeerReviewsByGiver($this->submission->getUserId());
509 foreach ($peer_items as $item) {
510 if ($item["peer_id"] == $a_peer_id) {
511 return true;
512 }
513 }
514 return false;
515 }
516
517 protected function getSubmissionContent(ilExSubmission $a_submission)
518 {
519 if ($this->ass->getType() != ilExAssignment::TYPE_TEXT) {
520 return;
521 }
522
523 $text = $a_submission->getFiles();
524 if ($text) {
525 $text = array_shift($text);
526 if (trim($text["atext"])) {
527 // mob id to mob src
528 return nl2br(ilRTE::_replaceMediaObjectImageSrc($text["atext"], 1));
529 }
530 }
531 }
532
533 protected function initPeerReviewItemForm($a_peer_id)
534 {
535 $ilCtrl = $this->ctrl;
537
538 // get peer data
539 $peer_items = $this->submission->getPeerReview()->getPeerReviewsByGiver($this->submission->getUserId());
540 foreach ($peer_items as $item) {
541 if ($item["peer_id"] == $a_peer_id) {
542 $peer = $item;
543 break;
544 }
545 }
546
547 $ilCtrl->saveParameter($this, "peer_id");
548
549 $form = new ilPropertyFormGUI();
550 $form->setFormAction($ilCtrl->getFormAction($this, "updatePeerReview"));
551
552 $form->setTitle($this->ass->getTitle() . ": " . $lng->txt("exc_peer_review_give"));
553
554 // peer info
555 if (!$this->ass->hasPeerReviewPersonalized()) {
556 $id_title = $lng->txt("id");
557 $id_value = $peer["seq"];
558 } else {
559 $id_title = $lng->txt("exc_peer_review_recipient");
560 $id_value = ilUserUtil::getNamePresentation($peer["peer_id"]);
561 }
562 $id = new ilNonEditableValueGUI($id_title);
563 $id->setValue($id_value);
564 $form->addItem($id);
565
566 // submission info
567
568 $submission = new ilExSubmission($this->ass, $peer["peer_id"]);
569 $file_info = $submission->getDownloadedFilesInfoForTableGUIS($this, "editPeerReviewItem");
570
571 $last_sub = new ilNonEditableValueGUI($file_info["last_submission"]["txt"], "", true);
572 $last_sub->setValue($file_info["last_submission"]["value"] .
574 $form->addItem($last_sub);
575
576 $sub_data = $this->getSubmissionContent($submission);
577 if (!$sub_data) {
578 $sub_data = '<a href="' . $file_info["files"]["download_url"] . '">' . $lng->txt("download") . '</a>';
579 }
580
581 $sub = new ilNonEditableValueGUI($lng->txt("exc_submission"), "", true);
582 $sub->setValue($sub_data);
583 $form->addItem($sub);
584
585 // peer review items
586
587 $input = new ilFormSectionHeaderGUI();
588 $input->setTitle($lng->txt("exc_peer_review"));
589 $form->addItem($input);
590
591 $values = $this->submission->getPeerReview()->getPeerReviewValues($this->submission->getUserId(), $a_peer_id);
592
593 foreach ($this->ass->getPeerReviewCriteriaCatalogueItems() as $item) {
594 $crit_id = $item->getId()
595 ? $item->getId()
596 : $item->getType();
597
598 $item->setPeerReviewContext(
599 $this->ass,
600 $this->submission->getUserId(),
601 $peer["peer_id"],
602 $form
603 );
604 $item->addToPeerReviewForm($values[$crit_id]);
605 }
606
607 $form->addCommandButton("updatePeerReview", $lng->txt("save"));
608 $form->addCommandButton("editPeerReview", $lng->txt("cancel"));
609
610 return $form;
611 }
612
613 public function updateCritAjaxObject()
614 {
615 $ilCtrl = $this->ctrl;
618
619 if (!$this->canGive() ||
620 !$_POST["peer_id"] ||
621 !$_POST["crit_id"] ||
622 !$ilCtrl->isAsynch()) {
623 exit();
624 }
625
626 $peer_id = (int) $_POST["peer_id"];
627 $crit_id = $_POST["crit_id"];
628 $giver_id = $ilUser->getId();
629
630 if (!is_numeric($crit_id)) {
631 $crit = ilExcCriteria::getInstanceByType($crit_id);
632 } else {
633 $crit = ilExcCriteria::getInstanceById($crit_id);
634 }
635 $crit->setPeerReviewContext($this->ass, $giver_id, $peer_id);
636 $html = $crit->updateFromAjax();
637
638 $this->handlePeerReviewChange();
639
640 echo $html;
641 echo $tpl->getOnLoadCodeForAsynch();
642 exit();
643 }
644
645 public function updatePeerReviewObject()
646 {
648 $ilCtrl = $this->ctrl;
649
650 if (!$this->canGive() ||
651 !$this->isValidPeer($_REQUEST["peer_id"])) {
652 $this->returnToParentObject();
653 }
654
655 $peer_id = $_REQUEST["peer_id"];
656
657 $form = $this->initPeerReviewItemForm($peer_id);
658 if ($form->checkInput()) {
659 $valid = true;
660
661 $values = array();
662 foreach ($this->ass->getPeerReviewCriteriaCatalogueItems() as $item) {
663 $item->setPeerReviewContext(
664 $this->ass,
665 $this->submission->getUserId(),
666 $peer_id,
667 $form
668 );
669 $value = $item->importFromPeerReviewForm();
670 if ($value !== null) {
671 $crit_id = $item->getId()
672 ? $item->getId()
673 : $item->getType();
674 $values[$crit_id] = $value;
675 }
676 if (!$item->validate($value)) {
677 $valid = false;
678 }
679 }
680
681 if ($valid) {
682 $this->submission->getPeerReview()->updatePeerReview($peer_id, $values);
683
684 $this->handlePeerReviewChange();
685
686 ilUtil::sendSuccess($this->lng->txt("exc_peer_review_updated"), true);
687 $ilCtrl->redirect($this, "editPeerReview");
688 } else {
689 ilUtil::sendFailure($lng->txt("form_input_not_valid"));
690 }
691 }
692
693 $form->setValuesByPost();
694 $this->editPeerReviewItemObject($form);
695 }
696
697 protected function handlePeerReviewChange()
698 {
699 // (in)valid peer reviews could change assignment status
700 $exercise = new ilObjExercise($this->ass->getExerciseId(), false);
701 $exercise->processExerciseStatus(
702 $this->ass,
703 $this->submission->getUserIds(),
704 $this->submission->hasSubmitted(),
705 $this->submission->validatePeerReviews()
706 );
707 }
708
709 public function downloadPeerReviewObject()
710 {
711 $ilCtrl = $this->ctrl;
712
713 if (!$this->canView() &&
714 !$this->canGive()) {
715 $this->returnToParentObject();
716 }
717
718 $parts = explode("__", $_GET["fu"]);
719 $giver_id = $parts[0];
720 $peer_id = $parts[1];
721 $crit_id = $parts[2];
722
723 if (!is_numeric($crit_id)) {
724 $crit = ilExcCriteria::getInstanceByType($crit_id);
725 } else {
726 $crit = ilExcCriteria::getInstanceById($crit_id);
727 }
728
729 $crit->setPeerReviewContext($this->ass, $giver_id, $peer_id);
730 $file = $crit->getFileByHash();
731 if ($file) {
732 ilUtil::deliverFile($file, basename($file));
733 }
734
735 $ilCtrl->redirect($this, "returnToParent");
736 }
737
738
739
740 //
741 // ADMIN
742 //
743
745 {
747
748 if (!$this->ass ||
749 !$this->ass->getPeerReview()) {
750 $this->returnToParentObject();
751 }
752
754 $this,
755 "showPeerReviewOverview",
756 $this->ass
757 );
758
759 $panel = "";
760 $panel_data = $tbl->getPanelInfo();
761 if (is_array($panel_data) && count($panel_data) > 0) {
762 $ptpl = new ilTemplate("tpl.exc_peer_review_overview_panel.html", true, true, "Modules/Exercise");
763 foreach ($panel_data as $item) {
764 $ptpl->setCurrentBlock("user_bl");
765 foreach ($item["value"] as $user) {
766 $ptpl->setVariable("USER", $user);
767 $ptpl->parseCurrentBlock();
768 }
769
770 $ptpl->setCurrentBlock("item_bl");
771 $ptpl->setVariable("TITLE", $item["title"]);
772 $ptpl->parseCurrentBlock();
773 }
774
776 $panel->setHeading($this->lng->txt("exc_peer_review_overview_invalid_users"));
777 $panel->setBody($ptpl->get());
778 $panel = $panel->getHTML();
779 }
780
781 $tpl->setContent($tbl->getHTML() . $panel);
782 }
783
785 {
786 $ilCtrl = $this->ctrl;
788 $ilTabs = $this->tabs_gui;
789
790 if (!$this->ass ||
791 !$this->ass->getPeerReview()) {
792 $this->returnToParentObject();
793 }
794
795 $ilTabs->clearTargets();
796
797 $cgui = new ilConfirmationGUI();
798 $cgui->setFormAction($ilCtrl->getFormAction($this));
799 $cgui->setHeaderText(sprintf($this->lng->txt("exc_peer_review_reset_sure"), $this->ass->getTitle()));
800 $cgui->setCancel($this->lng->txt("cancel"), "showPeerReviewOverview");
801 $cgui->setConfirm($this->lng->txt("delete"), "resetPeerReview");
802
803 $tpl->setContent($cgui->getHTML());
804 }
805
806 public function resetPeerReviewObject()
807 {
808 $ilCtrl = $this->ctrl;
809
810 if (!$this->ass ||
811 !$this->ass->getPeerReview()) {
812 $this->returnToParentObject();
813 }
814
815 $peer_review = new ilExPeerReview($this->ass);
816 $all_giver_ids = $peer_review->resetPeerReviews();
817
818 if (is_array($all_giver_ids)) {
819 // if peer review is valid for completion, we have to re-calculate all assignment members
820 $exercise = new ilObjExercise($this->ass->getExerciseId(), false);
821 if ($exercise->isCompletionBySubmissionEnabled() &&
822 $this->ass->getPeerReviewValid() != ilExAssignment::PEER_REVIEW_VALID_NONE) {
823 foreach ($all_giver_ids as $user_id) {
824 $submission = new ilExSubmission($this->ass, $user_id);
825 $pgui = new self($this->ass, $submission);
826 $pgui->handlePeerReviewChange();
827 }
828 }
829 }
830
831 ilUtil::sendSuccess($this->lng->txt("exc_peer_review_reset_done"), true);
832 $ilCtrl->redirect($this, "showPeerReviewOverview");
833 }
834}
user()
Definition: user.php:4
$_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
global $DIC
Definition: goto.php:24
if(isset($_FILES['img_file']) &&is_array($_FILES['img_file'])) $panel
Definition: imgupload.php:138
$ilUser
Definition: imgupload.php:18
exit
Definition: login.php:29
$ret
Definition: parser.php:6