ILIAS  release_5-1 Revision 5.0.0-5477-g43f3e3fab5f
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"], $file_info["last_submission"]["value"]);
330 
331  $sub_data = $this->getSubmissionContent($submission);
332  if(!$sub_data)
333  {
334  $sub_data = '<a href="'.$file_info["files"]["download_url"].'">'.$lng->txt("download").'</a>';
335  }
336  $a_info_widget->addProperty($lng->txt("exc_submission"), $sub_data);
337  }
338 
339  foreach($a_peer_items as $peer)
340  {
341  if(!$a_by_peer)
342  {
343  $giver_id = $this->submission->getUserId();
344  $peer_id = $peer["peer_id"];
345  $id_title = $lng->txt("exc_peer_review_recipient");
346  $user_id = $peer_id;
347  }
348  else
349  {
350  $giver_id = $peer["giver_id"];
351  $peer_id = $this->submission->getUserId();
352  $id_title = $lng->txt("exc_peer_review_giver");
353  $user_id = $giver_id;
354  }
355 
356  // peer info
357  if($this->submission->isTutor())
358  {
359  $id_value = ilUserUtil::getNamePresentation($user_id, "", "", false, true);
360  }
361  else if(!$this->ass->hasPeerReviewPersonalized())
362  {
363  $id_value = $peer["seq"];
364  }
365  else
366  {
367  $id_value = ilUserUtil::getNamePresentation($user_id);
368  }
369  $a_info_widget->addSection($id_title.": ".$id_value);
370 
371 
372  // submission info
373 
374  if(!$a_by_peer)
375  {
376  $submission = new ilExSubmission($this->ass, $peer_id);
377  $file_info = $submission->getDownloadedFilesInfoForTableGUIS($this, "editPeerReviewItem");
378 
379  $a_info_widget->addProperty($file_info["last_submission"]["txt"], $file_info["last_submission"]["value"]);
380 
381  $sub_data = $this->getSubmissionContent($submission);
382  if(!$sub_data)
383  {
384  $sub_data = '<a href="'.$file_info["files"]["download_url"].'">'.$lng->txt("download").'</a>';
385  }
386  $a_info_widget->addProperty($lng->txt("exc_submission"), $sub_data);
387  }
388 
389 
390  // peer review items
391 
392  $values = $this->submission->getPeerReview()->getPeerReviewValues($giver_id, $peer_id);
393 
394  foreach($this->ass->getPeerReviewCriteriaCatalogueItems() as $item)
395  {
396  $crit_id = $item->getId()
397  ? $item->getId()
398  : $item->getType();
399 
400  $item->setPeerReviewContext(
401  $this->ass,
402  $giver_id,
403  $peer_id
404  );
405 
406  $title = $item->getTitle();
407  $html = $item->getHTML($values[$crit_id]);
408  $a_info_widget->addProperty($title ? $title : "&nbsp;", $html ? $html : "&nbsp;");
409  }
410  }
411  }
412 
414  {
415  global $tpl;
416 
417  if(!$this->canGive())
418  {
419  $this->returnToParentObject();
420  }
421 
422  $peer_items = $this->submission->getPeerReview()->getPeerReviewsByGiver($this->submission->getUserId());
423  if(!sizeof($peer_items))
424  {
425  ilUtil::sendFailure($this->lng->txt("exc_peer_review_no_peers"), true);
426  $this->returnToParentObject();
427  }
428 
429  $missing = $this->submission->getPeerReview()->getNumberOfMissingFeedbacksForReceived();
430  if($missing)
431  {
432  $dl = $this->ass->getPeerReviewDeadline();
433  if(!$dl || $dl < time())
434  {
435  ilUtil::sendInfo(sprintf($this->lng->txt("exc_peer_review_missing_info"), $missing));
436  }
437  else
438  {
439  ilUtil::sendInfo(sprintf($this->lng->txt("exc_peer_review_missing_info_deadline"), $missing,
441  }
442  }
443 
444  include_once "Modules/Exercise/classes/class.ilExAssignmentPeerReviewTableGUI.php";
445  $tbl = new ilExAssignmentPeerReviewTableGUI($this, "editPeerReview", $this->ass, $this->submission->getUserId(),
446  $peer_items, "returnToParent");
447  $tpl->setContent($tbl->getHTML());
448  }
449 
451  {
452  global $tpl;
453 
454  if(!$this->canGive() ||
455  !$this->isValidPeer($_GET["peer_id"]))
456  {
457  $this->returnToParentObject();
458  }
459 
460  if(!$a_form)
461  {
462  $a_form = $this->initPeerReviewItemForm($_GET["peer_id"]);
463  }
464 
465  $tpl->setContent($a_form->getHTML());
466  }
467 
468  protected function isValidPeer($a_peer_id)
469  {
470  $peer_items = $this->submission->getPeerReview()->getPeerReviewsByGiver($this->submission->getUserId());
471  foreach($peer_items as $item)
472  {
473  if($item["peer_id"] == $a_peer_id)
474  {
475  return true;
476  }
477  }
478  return false;
479  }
480 
481  protected function getSubmissionContent(ilExSubmission $a_submission)
482  {
483  if($this->ass->getType() != ilExAssignment::TYPE_TEXT)
484  {
485  return;
486  }
487 
488  $text = $a_submission->getFiles();
489  if($text)
490  {
491  $text = array_shift($text);
492  if(trim($text["atext"]))
493  {
494  // mob id to mob src
495  include_once "Services/RTE/classes/class.ilRTE.php";
496  return nl2br(ilRTE::_replaceMediaObjectImageSrc($text["atext"], 1));
497  }
498  }
499  }
500 
501  protected function initPeerReviewItemForm($a_peer_id)
502  {
503  global $ilCtrl, $lng;
504 
505  // get peer data
506  $peer_items = $this->submission->getPeerReview()->getPeerReviewsByGiver($this->submission->getUserId());
507  foreach($peer_items as $item)
508  {
509  if($item["peer_id"] == $a_peer_id)
510  {
511  $peer = $item;
512  break;
513  }
514  }
515 
516  $ilCtrl->saveParameter($this, "peer_id");
517 
518  include_once "Services/Form/classes/class.ilPropertyFormGUI.php";
519  $form = new ilPropertyFormGUI();
520  $form->setFormAction($ilCtrl->getFormAction($this, "updatePeerReview"));
521 
522  $form->setTitle($this->ass->getTitle().": ".$lng->txt("exc_peer_review_give"));
523 
524  // peer info
525  if(!$this->ass->hasPeerReviewPersonalized())
526  {
527  $id_title = $lng->txt("id");
528  $id_value = $peer["seq"];
529  }
530  else
531  {
532  include_once "Services/User/classes/class.ilUserUtil.php";
533  $id_title = $lng->txt("exc_peer_review_recipient");
534  $id_value = ilUserUtil::getNamePresentation($peer["peer_id"]);
535  }
536  $id = new ilNonEditableValueGUI($id_title);
537  $id->setValue($id_value);
538  $form->addItem($id);
539 
540  // submission info
541 
542  $submission = new ilExSubmission($this->ass, $peer["peer_id"]);
543  $file_info = $submission->getDownloadedFilesInfoForTableGUIS($this, "editPeerReviewItem");
544 
545  $last_sub = new ilNonEditableValueGUI($file_info["last_submission"]["txt"]);
546  $last_sub->setValue($file_info["last_submission"]["value"]);
547  $form->addItem($last_sub);
548 
549  $sub_data = $this->getSubmissionContent($submission);
550  if(!$sub_data)
551  {
552  $sub_data = '<a href="'.$file_info["files"]["download_url"].'">'.$lng->txt("download").'</a>';
553  }
554 
555  $sub = new ilNonEditableValueGUI($lng->txt("exc_submission"), "", true);
556  $sub->setValue($sub_data);
557  $form->addItem($sub);
558 
559  // peer review items
560 
561  $input = new ilFormSectionHeaderGUI();
562  $input->setTitle($lng->txt("exc_peer_review"));
563  $form->addItem($input);
564 
565  $values = $this->submission->getPeerReview()->getPeerReviewValues($this->submission->getUserId(), $a_peer_id);
566 
567  foreach($this->ass->getPeerReviewCriteriaCatalogueItems() as $item)
568  {
569  $crit_id = $item->getId()
570  ? $item->getId()
571  : $item->getType();
572 
573  $item->setPeerReviewContext(
574  $this->ass,
575  $this->submission->getUserId(),
576  $peer["peer_id"],
577  $form
578  );
579  $item->addToPeerReviewForm($values[$crit_id]);
580  }
581 
582  $form->addCommandButton("updatePeerReview", $lng->txt("save"));
583  $form->addCommandButton("editPeerReview", $lng->txt("cancel"));
584 
585  return $form;
586  }
587 
589  {
590  global $ilCtrl, $ilUser, $tpl;
591 
592  if(!$this->canGive() ||
593  !$_POST["peer_id"] ||
594  !$_POST["crit_id"] ||
595  !$ilCtrl->isAsynch())
596  {
597  exit();
598  }
599 
600  $peer_id = (int)$_POST["peer_id"];
601  $crit_id = $_POST["crit_id"];
602  $giver_id = $ilUser->getId();
603 
604  include_once "Modules/Exercise/classes/class.ilExcCriteria.php";
605  if(!is_numeric($crit_id))
606  {
607  $crit = ilExcCriteria::getInstanceByType($crit_id);
608  }
609  else
610  {
611  $crit = ilExcCriteria::getInstanceById($crit_id);
612  }
613  $crit->setPeerReviewContext($this->ass, $giver_id, $peer_id);
614  $html = $crit->updateFromAjax();
615 
616  $this->handlePeerReviewChange();
617 
618  echo $html;
619  echo $tpl->getOnLoadCodeForAsynch();
620  exit();
621  }
622 
624  {
625  global $lng, $ilCtrl;
626 
627  if(!$this->canGive() ||
628  !$this->isValidPeer($_REQUEST["peer_id"]))
629  {
630  $this->returnToParentObject();
631  }
632 
633  $peer_id = $_REQUEST["peer_id"];
634 
635  $form = $this->initPeerReviewItemForm($peer_id);
636  if($form->checkInput())
637  {
638  $valid = true;
639 
640  $values = array();
641  foreach($this->ass->getPeerReviewCriteriaCatalogueItems() as $item)
642  {
643  $item->setPeerReviewContext(
644  $this->ass,
645  $this->submission->getUserId(),
646  $peer_id,
647  $form
648  );
649  $value = $item->importFromPeerReviewForm();
650  if($value !== null)
651  {
652  $crit_id = $item->getId()
653  ? $item->getId()
654  : $item->getType();
655  $values[$crit_id] = $value;
656  }
657  if(!$item->validate($value))
658  {
659  $valid = false;
660  }
661  }
662 
663  if($valid)
664  {
665  $this->submission->getPeerReview()->updatePeerReview($peer_id, $values);
666 
667  $this->handlePeerReviewChange();
668 
669  ilUtil::sendSuccess($this->lng->txt("exc_peer_review_updated"), true);
670  $ilCtrl->redirect($this, "editPeerReview");
671  }
672  else
673  {
674  ilUtil::sendFailure($lng->txt("form_input_not_valid"));
675  }
676  }
677 
678  $form->setValuesByPost();
679  $this->editPeerReviewItemObject($form);
680  }
681 
682  protected function handlePeerReviewChange()
683  {
684  // (in)valid peer reviews could change assignment status
685  $exercise = new ilObjExercise($this->ass->getExerciseId(), false);
686  $exercise->processExerciseStatus($this->ass,
687  $this->submission->getUserIds(),
688  $this->submission->hasSubmitted(),
689  $this->submission->validatePeerReviews()
690  );
691  }
692 
694  {
695  global $ilCtrl;
696 
697  if(!$this->canView() &&
698  !$this->canGive())
699  {
700  $this->returnToParentObject();
701  }
702 
703  $parts = explode("__", $_GET["fu"]);
704  $giver_id = $parts[0];
705  $peer_id = $parts[1];
706  $crit_id = $parts[2];
707 
708  include_once "Modules/Exercise/classes/class.ilExcCriteria.php";
709  if(!is_numeric($crit_id))
710  {
711  $crit = ilExcCriteria::getInstanceByType($crit_id);
712  }
713  else
714  {
715  $crit = ilExcCriteria::getInstanceById($crit_id);
716  }
717 
718  $crit->setPeerReviewContext($this->ass, $giver_id, $peer_id);
719  $file = $crit->getFileByHash();
720  if($file)
721  {
722  ilUtil::deliverFile($file, basename($file));
723  break(2);
724  }
725 
726  $ilCtrl->redirect($this, "returnToParent");
727  }
728 
729 
730 
731  //
732  // ADMIN
733  //
734 
736  {
737  global $tpl;
738 
739  if(!$this->ass ||
740  !$this->ass->getPeerReview())
741  {
742  $this->returnToParentObject();
743  }
744 
745  include_once "Modules/Exercise/classes/class.ilExAssignmentPeerReviewOverviewTableGUI.php";
746  $tbl = new ilExAssignmentPeerReviewOverviewTableGUI($this, "showPeerReviewOverview",
747  $this->ass);
748 
749  $panel = "";
750  $panel_data = $tbl->getPanelInfo();
751  if(sizeof($panel_data))
752  {
753  $ptpl = new ilTemplate("tpl.exc_peer_review_overview_panel.html", true, true, "Modules/Exercise");
754  foreach($panel_data as $item)
755  {
756  $ptpl->setCurrentBlock("user_bl");
757  foreach($item["value"] as $user)
758  {
759  $ptpl->setVariable("USER", $user);
760  $ptpl->parseCurrentBlock();
761  }
762 
763  $ptpl->setCurrentBlock("item_bl");
764  $ptpl->setVariable("TITLE", $item["title"]);
765  $ptpl->parseCurrentBlock();
766  }
767 
768  include_once "Services/UIComponent/Panel/classes/class.ilPanelGUI.php";
769  $panel = ilPanelGUI::getInstance();
770  $panel->setHeading($this->lng->txt("exc_peer_review_overview_invalid_users"));
771  $panel->setBody($ptpl->get());
772  $panel = $panel->getHTML();
773  }
774 
775  $tpl->setContent($tbl->getHTML().$panel);
776  }
777 
779  {
780  global $ilCtrl, $tpl, $ilTabs;
781 
782  if(!$this->ass ||
783  !$this->ass->getPeerReview())
784  {
785  $this->returnToParentObject();
786  }
787 
788  $ilTabs->clearTargets();
789 
790  include_once("./Services/Utilities/classes/class.ilConfirmationGUI.php");
791  $cgui = new ilConfirmationGUI();
792  $cgui->setFormAction($ilCtrl->getFormAction($this));
793  $cgui->setHeaderText(sprintf($this->lng->txt("exc_peer_review_reset_sure"), $this->ass->getTitle()));
794  $cgui->setCancel($this->lng->txt("cancel"), "showPeerReviewOverview");
795  $cgui->setConfirm($this->lng->txt("delete"), "resetPeerReview");
796 
797  $tpl->setContent($cgui->getHTML());
798  }
799 
800  public function resetPeerReviewObject()
801  {
802  global $ilCtrl;
803 
804  if(!$this->ass ||
805  !$this->ass->getPeerReview())
806  {
807  $this->returnToParentObject();
808  }
809 
810  include_once "Modules/Exercise/classes/class.ilExPeerReview.php";
811  $peer_review = new ilExPeerReview($this->ass);
812  $all_giver_ids = $peer_review->resetPeerReviews();
813 
814  if(is_array($all_giver_ids))
815  {
816  // if peer review is valid for completion, we have to re-calculate all assignment members
817  $exercise = new ilObjExercise($this->ass->getExerciseId(), false);
818  if($exercise->isCompletionBySubmissionEnabled() &&
819  $this->ass->getPeerReviewValid() != ilExAssignment::PEER_REVIEW_VALID_NONE)
820  {
821  include_once "Modules/Exercise/classes/class.ilExSubmission.php";
822  foreach($all_giver_ids as $user_id)
823  {
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 
835 
836 }
static sendSuccess($a_info="", $a_keep=false)
Send Success Message to Screen.
static getInstanceByType($a_type)
editPeerReviewItemObject(ilPropertyFormGUI $a_form=null)
static getOverviewContent(ilInfoScreenGUI $a_info, ilExSubmission $a_submission)
print $file
exit
Definition: login.php:54
Class ilInfoScreenGUI.
Exercise assignment.
$_POST['username']
Definition: cron.php:12
This class represents a property form user interface.
$_GET["client_id"]
$tbl
Definition: example_048.php:81
This class represents a section header in a property form.
static getInstanceById($a_id)
$valid
$cmd
Definition: sahs_server.php:35
addSection($a_title)
add a new section
const IL_CAL_UNIX
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...
global $tpl
Definition: ilias.php:8
global $ilCtrl
Definition: ilias.php:18
static sendInfo($a_info="", $a_keep=false)
Send Info Message to Screen.
setTableId($a_val)
Set table id.
List all peers to be reviewed for user.
Exercise peer review.
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:
Class ilObjExercise.
Class ilRatingGUI.
Class ilExPeerReviewGUI.
special template class to simplify handling of ITX/PEAR
static formatDate(ilDateTime $date)
Format a date public.
Date and time handling
getSubmissionContent(ilExSubmission $a_submission)
static deliverFile($a_file, $a_filename, $a_mime='', $isInline=false, $removeAfterDelivery=false, $a_exit_after=true)
deliver file for download via browser.
__construct(ilExAssignment $a_ass, ilExSubmission $a_submission=null)
Constructor.
static sendFailure($a_info="", $a_keep=false)
Send Failure Message to Screen.
renderInfoWidget(ilInfoScreenGUI $a_info_widget, array $a_peer_items, $a_by_peer=false)
static getInstance()
Get instance.
This class represents a non editable value in a property form.
global $ilUser
Definition: imgupload.php:15
addProperty($a_name, $a_value, $a_link="")
add a property to current section
global $lng
Definition: privfeed.php:40
$text
Exercise submission.
if($_REQUEST['ilias_path']) define('ILIAS_HTTP_PATH' $_REQUEST['ilias_path']
Definition: index.php:7
File System Explorer GUI class.
processExerciseStatus(ilExAssignment $a_ass, array $a_user_ids, $a_has_submitted, array $a_valid_submissions=null)
getFiles(array $a_file_ids=null, $a_only_valid=false, $a_min_timestamp=null)
$html
Definition: example_001.php:87
Object-based submissions (ends up as static file)
Confirmation screen class.