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