ILIAS  release_5-3 Revision v5.3.23-19-g915713cf615
ilExPeerReviewGUI Class Reference

Class ilExPeerReviewGUI. More...

+ Collaboration diagram for ilExPeerReviewGUI:

Public Member Functions

 __construct (ilExAssignment $a_ass, ilExSubmission $a_submission=null)
 Constructor. More...
 
 executeCommand ()
 
 returnToParentObject ()
 
 showGivenPeerReviewObject ()
 
 showReceivedPeerReviewObject ()
 
 editPeerReviewObject ()
 
 editPeerReviewItemObject (ilPropertyFormGUI $a_form=null)
 
 updateCritAjaxObject ()
 
 updatePeerReviewObject ()
 
 downloadPeerReviewObject ()
 
 showPeerReviewOverviewObject ()
 
 confirmResetPeerReviewObject ()
 
 resetPeerReviewObject ()
 

Static Public Member Functions

static getOverviewContent (ilInfoScreenGUI $a_info, ilExSubmission $a_submission)
 

Protected Member Functions

 canGive ()
 
 canView ()
 
 renderInfoWidget (ilInfoScreenGUI $a_info_widget, array $a_peer_items, $a_by_peer=false)
 
 getLateSubmissionInfo (ilExSubmission $a_submission)
 
 isValidPeer ($a_peer_id)
 
 getSubmissionContent (ilExSubmission $a_submission)
 
 initPeerReviewItemForm ($a_peer_id)
 
 handlePeerReviewChange ()
 

Protected Attributes

 $ctrl
 
 $tabs_gui
 
 $lng
 
 $tpl
 
 $user
 
 $ass
 
 $submission
 

Detailed Description

Constructor & Destructor Documentation

◆ __construct()

ilExPeerReviewGUI::__construct ( ilExAssignment  $a_ass,
ilExSubmission  $a_submission = null 
)

Constructor.

Parameters
ilExAssignment$a_ass
ilExSubmission$a_sub
Returns
object

Definition at line 50 of file class.ilExPeerReviewGUI.php.

References $DIC, $ilCtrl, $lng, $tpl, and user().

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  }
global $DIC
Definition: saml.php:7
user()
Definition: user.php:4
global $ilCtrl
Definition: ilias.php:18
+ Here is the call graph for this function:

Member Function Documentation

◆ canGive()

ilExPeerReviewGUI::canGive ( )
protected

Definition at line 257 of file class.ilExPeerReviewGUI.php.

References time.

Referenced by downloadPeerReviewObject(), editPeerReviewItemObject(), editPeerReviewObject(), executeCommand(), updateCritAjaxObject(), and updatePeerReviewObject().

258  {
259  return ($this->submission->isOwner() &&
260  $this->ass->afterDeadlineStrict() &&
261  (!$this->ass->getPeerReviewDeadline() ||
262  $this->ass->getPeerReviewDeadline() > time()));
263  }
Add data(end) time
Method that wraps PHPs time in order to allow simulations with the workflow.
+ Here is the caller graph for this function:

◆ canView()

ilExPeerReviewGUI::canView ( )
protected

Definition at line 265 of file class.ilExPeerReviewGUI.php.

References time.

Referenced by downloadPeerReviewObject(), showGivenPeerReviewObject(), and showReceivedPeerReviewObject().

266  {
267  return ($this->submission->isTutor() ||
268  ($this->submission->isOwner() &&
269  $this->ass->afterDeadlineStrict() &&
270  (!$this->ass->getPeerReviewDeadline() ||
271  $this->ass->getPeerReviewDeadline() < time())));
272  }
Add data(end) time
Method that wraps PHPs time in order to allow simulations with the workflow.
+ Here is the caller graph for this function:

◆ confirmResetPeerReviewObject()

ilExPeerReviewGUI::confirmResetPeerReviewObject ( )

Definition at line 788 of file class.ilExPeerReviewGUI.php.

References $ctrl, $ilCtrl, $tabs_gui, $tpl, and returnToParentObject().

789  {
791  $tpl = $this->tpl;
792  $ilTabs = $this->tabs_gui;
793 
794  if (!$this->ass ||
795  !$this->ass->getPeerReview()) {
796  $this->returnToParentObject();
797  }
798 
799  $ilTabs->clearTargets();
800 
801  include_once("./Services/Utilities/classes/class.ilConfirmationGUI.php");
802  $cgui = new ilConfirmationGUI();
803  $cgui->setFormAction($ilCtrl->getFormAction($this));
804  $cgui->setHeaderText(sprintf($this->lng->txt("exc_peer_review_reset_sure"), $this->ass->getTitle()));
805  $cgui->setCancel($this->lng->txt("cancel"), "showPeerReviewOverview");
806  $cgui->setConfirm($this->lng->txt("delete"), "resetPeerReview");
807 
808  $tpl->setContent($cgui->getHTML());
809  }
global $ilCtrl
Definition: ilias.php:18
Confirmation screen class.
+ Here is the call graph for this function:

◆ downloadPeerReviewObject()

ilExPeerReviewGUI::downloadPeerReviewObject ( )

Definition at line 710 of file class.ilExPeerReviewGUI.php.

References $_GET, $ctrl, $file, $ilCtrl, canGive(), canView(), ilUtil\deliverFile(), ilExcCriteria\getInstanceById(), ilExcCriteria\getInstanceByType(), and returnToParentObject().

711  {
713 
714  if (!$this->canView() &&
715  !$this->canGive()) {
716  $this->returnToParentObject();
717  }
718 
719  $parts = explode("__", $_GET["fu"]);
720  $giver_id = $parts[0];
721  $peer_id = $parts[1];
722  $crit_id = $parts[2];
723 
724  include_once "Modules/Exercise/classes/class.ilExcCriteria.php";
725  if (!is_numeric($crit_id)) {
726  $crit = ilExcCriteria::getInstanceByType($crit_id);
727  } else {
728  $crit = ilExcCriteria::getInstanceById($crit_id);
729  }
730 
731  $crit->setPeerReviewContext($this->ass, $giver_id, $peer_id);
732  $file = $crit->getFileByHash();
733  if ($file) {
734  ilUtil::deliverFile($file, basename($file));
735  }
736 
737  $ilCtrl->redirect($this, "returnToParent");
738  }
static getInstanceByType($a_type)
$_GET["client_id"]
static getInstanceById($a_id)
global $ilCtrl
Definition: ilias.php:18
if(!file_exists("$old.txt")) if($old===$new) if(file_exists("$new.txt")) $file
static deliverFile( $a_file, $a_filename, $a_mime='', $isInline=false, $removeAfterDelivery=false, $a_exit_after=true)
deliver file for download via browser.
+ Here is the call graph for this function:

◆ editPeerReviewItemObject()

ilExPeerReviewGUI::editPeerReviewItemObject ( ilPropertyFormGUI  $a_form = null)

Definition at line 487 of file class.ilExPeerReviewGUI.php.

References $_GET, $tpl, canGive(), initPeerReviewItemForm(), isValidPeer(), and returnToParentObject().

Referenced by updatePeerReviewObject().

488  {
489  $tpl = $this->tpl;
490 
491  if (!$this->canGive() ||
492  !$this->isValidPeer($_GET["peer_id"])) {
493  $this->returnToParentObject();
494  }
495 
496  if (!$a_form) {
497  $a_form = $this->initPeerReviewItemForm($_GET["peer_id"]);
498  }
499 
500  $tpl->setContent($a_form->getHTML());
501  }
$_GET["client_id"]
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ editPeerReviewObject()

ilExPeerReviewGUI::editPeerReviewObject ( )

Definition at line 447 of file class.ilExPeerReviewGUI.php.

References $tbl, $tpl, canGive(), ilDatePresentation\formatDate(), IL_CAL_UNIX, returnToParentObject(), ilUtil\sendFailure(), ilUtil\sendInfo(), and time.

448  {
449  $tpl = $this->tpl;
450 
451  if (!$this->canGive()) {
452  $this->returnToParentObject();
453  }
454 
455  $peer_items = $this->submission->getPeerReview()->getPeerReviewsByGiver($this->submission->getUserId());
456  if (!sizeof($peer_items)) {
457  ilUtil::sendFailure($this->lng->txt("exc_peer_review_no_peers"), true);
458  $this->returnToParentObject();
459  }
460 
461  $missing = $this->submission->getPeerReview()->getNumberOfMissingFeedbacksForReceived();
462  if ($missing) {
463  $dl = $this->ass->getPeerReviewDeadline();
464  if (!$dl || $dl < time()) {
465  ilUtil::sendInfo(sprintf($this->lng->txt("exc_peer_review_missing_info"), $missing));
466  } else {
467  ilUtil::sendInfo(sprintf(
468  $this->lng->txt("exc_peer_review_missing_info_deadline"),
469  $missing,
471  ));
472  }
473  }
474 
475  include_once "Modules/Exercise/classes/class.ilExAssignmentPeerReviewTableGUI.php";
477  $this,
478  "editPeerReview",
479  $this->ass,
480  $this->submission->getUserId(),
481  $peer_items,
482  "returnToParent"
483  );
484  $tpl->setContent($tbl->getHTML());
485  }
$tbl
Definition: example_048.php:81
static formatDate(ilDateTime $date, $a_skip_day=false, $a_include_wd=false)
Format a date public.
const IL_CAL_UNIX
static sendInfo($a_info="", $a_keep=false)
Send Info Message to Screen.
List all peers to be reviewed for user.
Date and time handling
static sendFailure($a_info="", $a_keep=false)
Send Failure Message to Screen.
Add data(end) time
Method that wraps PHPs time in order to allow simulations with the workflow.
+ Here is the call graph for this function:

◆ executeCommand()

ilExPeerReviewGUI::executeCommand ( )

Definition at line 70 of file class.ilExPeerReviewGUI.php.

References $_GET, $ctrl, $ilCtrl, $ilUser, $lng, $ret, $tabs_gui, $user, $valid, array, canGive(), ilFSStorageExercise\create(), returnToParentObject(), and ilFileSystemGUI\setTableId().

71  {
73  $lng = $this->lng;
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 (sizeof($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  }
$_GET["client_id"]
$valid
global $ilCtrl
Definition: ilias.php:18
setTableId($a_val)
Set table id.
Class ilObjExercise.
Class ilRatingGUI.
$ilUser
Definition: imgupload.php:18
Create styles array
The data for the language used.
$ret
Definition: parser.php:6
File System Explorer GUI class.
Object-based submissions (ends up as static file)
+ Here is the call graph for this function:

◆ getLateSubmissionInfo()

ilExPeerReviewGUI::getLateSubmissionInfo ( ilExSubmission  $a_submission)
protected

Definition at line 435 of file class.ilExPeerReviewGUI.php.

References $file, $lng, and ilExSubmission\getFiles().

Referenced by initPeerReviewItemForm(), and renderInfoWidget().

436  {
437  $lng = $this->lng;
438 
439  // #18966 - late files info
440  foreach ($a_submission->getFiles() as $file) {
441  if ($file["late"]) {
442  return '<div class="warning">' . $lng->txt("exc_late_submission") . '</div>';
443  }
444  }
445  }
if(!file_exists("$old.txt")) if($old===$new) if(file_exists("$new.txt")) $file
getFiles(array $a_file_ids=null, $a_only_valid=false, $a_min_timestamp=null)
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ getOverviewContent()

static ilExPeerReviewGUI::getOverviewContent ( ilInfoScreenGUI  $a_info,
ilExSubmission  $a_submission 
)
static

Definition at line 177 of file class.ilExPeerReviewGUI.php.

References $ass, $DIC, $ilCtrl, $lng, ilInfoScreenGUI\addProperty(), array, ilDatePresentation\formatDate(), ilExSubmission\getAssignment(), ilLinkButton\getInstance(), ilExSubmission\getPeerReview(), ilExSubmission\getUserId(), IL_CAL_UNIX, and time.

Referenced by ilExAssignmentGUI\addSubmission().

178  {
179  global $DIC;
180 
181  $lng = $DIC->language();
182  $ilCtrl = $DIC->ctrl();
183 
184  $ass = $a_submission->getAssignment();
185 
186  if ($ass->afterDeadlineStrict() &&
187  $ass->getPeerReview()) {
188  $ilCtrl->setParameterByClass("ilExPeerReviewGUI", "ass_id", $a_submission->getAssignment()->getId());
189 
190  $nr_missing_fb = $a_submission->getPeerReview()->getNumberOfMissingFeedbacksForReceived($ass->getId(), $ass->getPeerReviewMin());
191 
192  // before deadline (if any)
193  if (!$ass->getPeerReviewDeadline() ||
194  $ass->getPeerReviewDeadline() > time()) {
195  $dl_info = "";
196  if ($ass->getPeerReviewDeadline()) {
197  $dl_info = " (" . sprintf(
198  $lng->txt("exc_peer_review_deadline_info_button"),
199  ilDatePresentation::formatDate(new ilDateTime($ass->getPeerReviewDeadline(), IL_CAL_UNIX))
200  ) . ")";
201  }
202 
203  $button = ilLinkButton::getInstance();
204  $button->setPrimary($nr_missing_fb);
205  $button->setCaption($lng->txt("exc_peer_review_give") . $dl_info, false);
206  $button->setUrl($ilCtrl->getLinkTargetByClass(array("ilExSubmissionGUI", "ilExPeerReviewGUI"), "editPeerReview"));
207  $edit_pc = $button->render();
208  } elseif ($ass->getPeerReviewDeadline()) {
209  $edit_pc = $lng->txt("exc_peer_review_deadline_reached");
210  }
211 
212  // after deadline (if any)
213  if ((!$ass->getPeerReviewDeadline() ||
214  $ass->getPeerReviewDeadline() < time())) {
215  // given peer review should be accessible at all times (read-only when not editable - see above)
216  if ($ass->getPeerReviewDeadline() &&
217  $a_submission->getPeerReview()->countGivenFeedback(false)) {
218  $button = ilLinkButton::getInstance();
219  $button->setCaption("exc_peer_review_given");
220  $button->setUrl($ilCtrl->getLinkTargetByClass(array("ilExSubmissionGUI", "ilExPeerReviewGUI"), "showGivenPeerReview"));
221  $view_pc = $button->render() . " ";
222  }
223 
224  // did give enough feedback
225  if (!$nr_missing_fb) {
226  // received any?
227  $received = (bool) sizeof($a_submission->getPeerReview()->getPeerReviewsByPeerId($a_submission->getUserId(), true));
228  if ($received) {
229  $button = ilLinkButton::getInstance();
230  $button->setCaption("exc_peer_review_show");
231  $button->setUrl($ilCtrl->getLinkTargetByClass(array("ilExSubmissionGUI", "ilExPeerReviewGUI"), "showReceivedPeerReview"));
232  $view_pc .= $button->render();
233  }
234  // received none
235  else {
236  $view_pc .= $lng->txt("exc_peer_review_show_received_none");
237  }
238  }
239  // did not give enough
240  else {
241  $view_pc .= $lng->txt("exc_peer_review_show_missing");
242  }
243  }
244  /* must give before showing received
245  else
246  {
247  $view_pc = $lng->txt("exc_peer_review_show_not_rated_yet");
248  }
249  */
250 
251  $a_info->addProperty($lng->txt("exc_peer_review"), $edit_pc . " " . $view_pc);
252 
253  $ilCtrl->setParameterByClass("ilExPeerReviewGUI", "ass_id", "");
254  }
255  }
global $DIC
Definition: saml.php:7
static formatDate(ilDateTime $date, $a_skip_day=false, $a_include_wd=false)
Format a date public.
const IL_CAL_UNIX
global $ilCtrl
Definition: ilias.php:18
Date and time handling
Create styles array
The data for the language used.
addProperty($a_name, $a_value, $a_link="")
add a property to current section
Add data(end) time
Method that wraps PHPs time in order to allow simulations with the workflow.
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ getSubmissionContent()

ilExPeerReviewGUI::getSubmissionContent ( ilExSubmission  $a_submission)
protected

Definition at line 514 of file class.ilExPeerReviewGUI.php.

References $text, ilRTE\_replaceMediaObjectImageSrc(), ilExSubmission\getFiles(), and ilExAssignment\TYPE_TEXT.

Referenced by initPeerReviewItemForm(), and renderInfoWidget().

515  {
516  if ($this->ass->getType() != ilExAssignment::TYPE_TEXT) {
517  return;
518  }
519 
520  $text = $a_submission->getFiles();
521  if ($text) {
522  $text = array_shift($text);
523  if (trim($text["atext"])) {
524  // mob id to mob src
525  include_once "Services/RTE/classes/class.ilRTE.php";
526  return nl2br(ilRTE::_replaceMediaObjectImageSrc($text["atext"], 1));
527  }
528  }
529  }
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...
$text
Definition: errorreport.php:18
getFiles(array $a_file_ids=null, $a_only_valid=false, $a_min_timestamp=null)
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ handlePeerReviewChange()

ilExPeerReviewGUI::handlePeerReviewChange ( )
protected

Definition at line 698 of file class.ilExPeerReviewGUI.php.

References ilObjExercise\processExerciseStatus().

Referenced by updateCritAjaxObject(), and updatePeerReviewObject().

699  {
700  // (in)valid peer reviews could change assignment status
701  $exercise = new ilObjExercise($this->ass->getExerciseId(), false);
702  $exercise->processExerciseStatus(
703  $this->ass,
704  $this->submission->getUserIds(),
705  $this->submission->hasSubmitted(),
706  $this->submission->validatePeerReviews()
707  );
708  }
Class ilObjExercise.
processExerciseStatus(ilExAssignment $a_ass, array $a_user_ids, $a_has_submitted, array $a_valid_submissions=null)
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ initPeerReviewItemForm()

ilExPeerReviewGUI::initPeerReviewItemForm (   $a_peer_id)
protected

Definition at line 531 of file class.ilExPeerReviewGUI.php.

References $ctrl, $form, $id, $ilCtrl, $lng, $submission, getLateSubmissionInfo(), ilUserUtil\getNamePresentation(), getSubmissionContent(), and ilNonEditableValueGUI\setValue().

Referenced by editPeerReviewItemObject(), and updatePeerReviewObject().

532  {
534  $lng = $this->lng;
535 
536  // get peer data
537  $peer_items = $this->submission->getPeerReview()->getPeerReviewsByGiver($this->submission->getUserId());
538  foreach ($peer_items as $item) {
539  if ($item["peer_id"] == $a_peer_id) {
540  $peer = $item;
541  break;
542  }
543  }
544 
545  $ilCtrl->saveParameter($this, "peer_id");
546 
547  include_once "Services/Form/classes/class.ilPropertyFormGUI.php";
548  $form = new ilPropertyFormGUI();
549  $form->setFormAction($ilCtrl->getFormAction($this, "updatePeerReview"));
550 
551  $form->setTitle($this->ass->getTitle() . ": " . $lng->txt("exc_peer_review_give"));
552 
553  // peer info
554  if (!$this->ass->hasPeerReviewPersonalized()) {
555  $id_title = $lng->txt("id");
556  $id_value = $peer["seq"];
557  } else {
558  include_once "Services/User/classes/class.ilUserUtil.php";
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  }
This class represents a property form user interface.
This class represents a section header in a property form.
if(!array_key_exists('StateId', $_REQUEST)) $id
global $ilCtrl
Definition: ilias.php:18
getLateSubmissionInfo(ilExSubmission $a_submission)
if(isset($_POST['submit'])) $form
getSubmissionContent(ilExSubmission $a_submission)
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:
This class represents a non editable value in a property form.
Exercise submission.
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ isValidPeer()

ilExPeerReviewGUI::isValidPeer (   $a_peer_id)
protected

Definition at line 503 of file class.ilExPeerReviewGUI.php.

Referenced by editPeerReviewItemObject(), and updatePeerReviewObject().

504  {
505  $peer_items = $this->submission->getPeerReview()->getPeerReviewsByGiver($this->submission->getUserId());
506  foreach ($peer_items as $item) {
507  if ($item["peer_id"] == $a_peer_id) {
508  return true;
509  }
510  }
511  return false;
512  }
+ Here is the caller graph for this function:

◆ renderInfoWidget()

ilExPeerReviewGUI::renderInfoWidget ( ilInfoScreenGUI  $a_info_widget,
array  $a_peer_items,
  $a_by_peer = false 
)
protected

Definition at line 331 of file class.ilExPeerReviewGUI.php.

References $html, $lng, $submission, $title, ilInfoScreenGUI\addProperty(), ilInfoScreenGUI\addSection(), getLateSubmissionInfo(), ilUserUtil\getNamePresentation(), and getSubmissionContent().

Referenced by showGivenPeerReviewObject(), and showReceivedPeerReviewObject().

332  {
333  $lng = $this->lng;
334 
335  include_once "Services/User/classes/class.ilUserUtil.php";
336 
337  if ($this->submission->isTutor()) {
338  $user_title = $a_by_peer
339  ? $lng->txt("exc_peer_review_recipient")
340  : $lng->txt("exc_peer_review_giver");
341  $a_info_widget->addSection($user_title);
342  $a_info_widget->addProperty(
343  $lng->txt("name"),
344  ilUserUtil::getNamePresentation($this->submission->getUserId(), false, false, "", true)
345  );
346  }
347 
348  if ($a_by_peer) {
349  // submission
350 
351  $a_info_widget->addSection($lng->txt("exc_submission"));
352 
353  $submission = new ilExSubmission($this->ass, $this->submission->getUserId());
354  $file_info = $submission->getDownloadedFilesInfoForTableGUIS($this, "showReceivedPeerReview");
355 
356  $a_info_widget->addProperty(
357  $file_info["last_submission"]["txt"],
358  $file_info["last_submission"]["value"] .
360  );
361 
362  $sub_data = $this->getSubmissionContent($submission);
363  if (!$sub_data) {
364  $sub_data = '<a href="' . $file_info["files"]["download_url"] . '">' . $lng->txt("download") . '</a>';
365  }
366  $a_info_widget->addProperty($lng->txt("exc_submission"), $sub_data);
367  }
368 
369  foreach ($a_peer_items as $peer) {
370  if (!$a_by_peer) {
371  $giver_id = $this->submission->getUserId();
372  $peer_id = $peer["peer_id"];
373  $id_title = $lng->txt("exc_peer_review_recipient");
374  $user_id = $peer_id;
375  } else {
376  $giver_id = $peer["giver_id"];
377  $peer_id = $this->submission->getUserId();
378  $id_title = $lng->txt("exc_peer_review_giver");
379  $user_id = $giver_id;
380  }
381 
382  // peer info
383  if ($this->submission->isTutor()) {
384  $id_value = ilUserUtil::getNamePresentation($user_id, "", "", false, true);
385  } elseif (!$this->ass->hasPeerReviewPersonalized()) {
386  $id_value = $peer["seq"];
387  } else {
388  $id_value = ilUserUtil::getNamePresentation($user_id);
389  }
390  $a_info_widget->addSection($id_title . ": " . $id_value);
391 
392 
393  // submission info
394 
395  if (!$a_by_peer) {
396  $submission = new ilExSubmission($this->ass, $peer_id);
397  $file_info = $submission->getDownloadedFilesInfoForTableGUIS($this, "editPeerReviewItem");
398 
399  $a_info_widget->addProperty(
400  $file_info["last_submission"]["txt"],
401  $file_info["last_submission"]["value"] .
403  );
404 
405  $sub_data = $this->getSubmissionContent($submission);
406  if (!$sub_data) {
407  $sub_data = '<a href="' . $file_info["files"]["download_url"] . '">' . $lng->txt("download") . '</a>';
408  }
409  $a_info_widget->addProperty($lng->txt("exc_submission"), $sub_data);
410  }
411 
412 
413  // peer review items
414 
415  $values = $this->submission->getPeerReview()->getPeerReviewValues($giver_id, $peer_id);
416 
417  foreach ($this->ass->getPeerReviewCriteriaCatalogueItems() as $item) {
418  $crit_id = $item->getId()
419  ? $item->getId()
420  : $item->getType();
421 
422  $item->setPeerReviewContext(
423  $this->ass,
424  $giver_id,
425  $peer_id
426  );
427 
428  $title = $item->getTitle();
429  $html = $item->getHTML($values[$crit_id]);
430  $a_info_widget->addProperty($title ? $title : "&nbsp;", $html ? $html : "&nbsp;");
431  }
432  }
433  }
addSection($a_title)
add a new section
getLateSubmissionInfo(ilExSubmission $a_submission)
getSubmissionContent(ilExSubmission $a_submission)
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:
addProperty($a_name, $a_value, $a_link="")
add a property to current section
Exercise submission.
$html
Definition: example_001.php:87
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ resetPeerReviewObject()

ilExPeerReviewGUI::resetPeerReviewObject ( )

Definition at line 811 of file class.ilExPeerReviewGUI.php.

References $ass, $ctrl, $ilCtrl, $submission, ilExAssignment\PEER_REVIEW_VALID_NONE, returnToParentObject(), and ilUtil\sendSuccess().

812  {
814 
815  if (!$this->ass ||
816  !$this->ass->getPeerReview()) {
817  $this->returnToParentObject();
818  }
819 
820  include_once "Modules/Exercise/classes/class.ilExPeerReview.php";
821  $peer_review = new ilExPeerReview($this->ass);
822  $all_giver_ids = $peer_review->resetPeerReviews();
823 
824  if (is_array($all_giver_ids)) {
825  // if peer review is valid for completion, we have to re-calculate all assignment members
826  $exercise = new ilObjExercise($this->ass->getExerciseId(), false);
827  if ($exercise->isCompletionBySubmissionEnabled() &&
828  $this->ass->getPeerReviewValid() != ilExAssignment::PEER_REVIEW_VALID_NONE) {
829  include_once "Modules/Exercise/classes/class.ilExSubmission.php";
830  foreach ($all_giver_ids as $user_id) {
831  $submission = new ilExSubmission($this->ass, $user_id);
832  $pgui = new self($this->ass, $submission);
833  $pgui->handlePeerReviewChange();
834  }
835  }
836  }
837 
838  ilUtil::sendSuccess($this->lng->txt("exc_peer_review_reset_done"), true);
839  $ilCtrl->redirect($this, "showPeerReviewOverview");
840  }
static sendSuccess($a_info="", $a_keep=false)
Send Success Message to Screen.
global $ilCtrl
Definition: ilias.php:18
Exercise peer review.
Class ilObjExercise.
Exercise submission.
+ Here is the call graph for this function:

◆ returnToParentObject()

ilExPeerReviewGUI::returnToParentObject ( )

◆ showGivenPeerReviewObject()

ilExPeerReviewGUI::showGivenPeerReviewObject ( )

Definition at line 274 of file class.ilExPeerReviewGUI.php.

References $lng, $tpl, canView(), renderInfoWidget(), returnToParentObject(), and ilUtil\sendFailure().

275  {
276  $tpl = $this->tpl;
277  $lng = $this->lng;
278 
279  if (!$this->canView()) {
280  $this->returnToParentObject();
281  }
282 
283  $peer_items = $this->submission->getPeerReview()->getPeerReviewsByGiver($this->submission->getUserId());
284  if (!sizeof($peer_items)) {
285  ilUtil::sendFailure($this->lng->txt("exc_peer_review_no_peers"), true);
286  $this->returnToParentObject();
287  }
288 
289  $tpl->setTitle($this->ass->getTitle() . ": " . $lng->txt("exc_peer_review_given"));
290 
291  include_once "Services/InfoScreen/classes/class.ilInfoScreenGUI.php";
292  $info_widget = new ilInfoScreenGUI($this);
293 
294  $this->renderInfoWidget($info_widget, $peer_items);
295 
296  $tpl->setContent($info_widget->getHTML());
297  }
Class ilInfoScreenGUI.
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)
+ Here is the call graph for this function:

◆ showPeerReviewOverviewObject()

ilExPeerReviewGUI::showPeerReviewOverviewObject ( )

Definition at line 746 of file class.ilExPeerReviewGUI.php.

References $tbl, $tpl, $user, ilPanelGUI\getInstance(), and returnToParentObject().

747  {
748  $tpl = $this->tpl;
749 
750  if (!$this->ass ||
751  !$this->ass->getPeerReview()) {
752  $this->returnToParentObject();
753  }
754 
755  include_once "Modules/Exercise/classes/class.ilExAssignmentPeerReviewOverviewTableGUI.php";
757  $this,
758  "showPeerReviewOverview",
759  $this->ass
760  );
761 
762  $panel = "";
763  $panel_data = $tbl->getPanelInfo();
764  if (sizeof($panel_data)) {
765  $ptpl = new ilTemplate("tpl.exc_peer_review_overview_panel.html", true, true, "Modules/Exercise");
766  foreach ($panel_data as $item) {
767  $ptpl->setCurrentBlock("user_bl");
768  foreach ($item["value"] as $user) {
769  $ptpl->setVariable("USER", $user);
770  $ptpl->parseCurrentBlock();
771  }
772 
773  $ptpl->setCurrentBlock("item_bl");
774  $ptpl->setVariable("TITLE", $item["title"]);
775  $ptpl->parseCurrentBlock();
776  }
777 
778  include_once "Services/UIComponent/Panel/classes/class.ilPanelGUI.php";
779  $panel = ilPanelGUI::getInstance();
780  $panel->setHeading($this->lng->txt("exc_peer_review_overview_invalid_users"));
781  $panel->setBody($ptpl->get());
782  $panel = $panel->getHTML();
783  }
784 
785  $tpl->setContent($tbl->getHTML() . $panel);
786  }
$tbl
Definition: example_048.php:81
special template class to simplify handling of ITX/PEAR
static getInstance()
Get instance.
+ Here is the call graph for this function:

◆ showReceivedPeerReviewObject()

ilExPeerReviewGUI::showReceivedPeerReviewObject ( )

Definition at line 299 of file class.ilExPeerReviewGUI.php.

References $ctrl, $ilCtrl, $lng, $tpl, canView(), renderInfoWidget(), returnToParentObject(), and ilUtil\sendFailure().

300  {
302  $tpl = $this->tpl;
303  $lng = $this->lng;
304 
305  if (!$this->canView() ||
306  (!$this->submission->isTutor() &&
307  $this->submission->getPeerReview()->getNumberOfMissingFeedbacksForReceived())) {
308  $this->returnToParentObject();
309  }
310 
311  $this->tabs_gui->clearTargets();
312  $this->tabs_gui->setBackTarget($this->lng->txt("back"), $this->ctrl->getLinkTarget($this, "returnToParent"));
313 
314  $peer_items = $this->submission->getPeerReview()->getPeerReviewsByPeerId($this->submission->getUserId(), !$this->submission->isTutor());
315  if (!sizeof($peer_items)) {
316  // #11373
317  ilUtil::sendFailure($this->lng->txt("exc_peer_review_no_peers_reviewed_yet"), true);
318  $ilCtrl->redirect($this, "returnToParent");
319  }
320 
321  $tpl->setTitle($this->ass->getTitle() . ": " . $lng->txt("exc_peer_review_show"));
322 
323  include_once "Services/InfoScreen/classes/class.ilInfoScreenGUI.php";
324  $info_widget = new ilInfoScreenGUI($this);
325 
326  $this->renderInfoWidget($info_widget, $peer_items, true);
327 
328  $tpl->setContent($info_widget->getHTML());
329  }
Class ilInfoScreenGUI.
global $ilCtrl
Definition: ilias.php:18
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)
+ Here is the call graph for this function:

◆ updateCritAjaxObject()

ilExPeerReviewGUI::updateCritAjaxObject ( )

Definition at line 613 of file class.ilExPeerReviewGUI.php.

References $_POST, $ctrl, $html, $ilCtrl, $ilUser, $tpl, $user, canGive(), exit, ilExcCriteria\getInstanceById(), ilExcCriteria\getInstanceByType(), and handlePeerReviewChange().

614  {
617  $tpl = $this->tpl;
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  include_once "Modules/Exercise/classes/class.ilExcCriteria.php";
631  if (!is_numeric($crit_id)) {
632  $crit = ilExcCriteria::getInstanceByType($crit_id);
633  } else {
634  $crit = ilExcCriteria::getInstanceById($crit_id);
635  }
636  $crit->setPeerReviewContext($this->ass, $giver_id, $peer_id);
637  $html = $crit->updateFromAjax();
638 
639  $this->handlePeerReviewChange();
640 
641  echo $html;
642  echo $tpl->getOnLoadCodeForAsynch();
643  exit();
644  }
static getInstanceByType($a_type)
static getInstanceById($a_id)
global $ilCtrl
Definition: ilias.php:18
$ilUser
Definition: imgupload.php:18
$_POST["username"]
$html
Definition: example_001.php:87
+ Here is the call graph for this function:

◆ updatePeerReviewObject()

ilExPeerReviewGUI::updatePeerReviewObject ( )

Definition at line 646 of file class.ilExPeerReviewGUI.php.

References $ctrl, $form, $ilCtrl, $lng, $valid, array, canGive(), editPeerReviewItemObject(), handlePeerReviewChange(), initPeerReviewItemForm(), isValidPeer(), returnToParentObject(), ilUtil\sendFailure(), and ilUtil\sendSuccess().

647  {
648  $lng = $this->lng;
650 
651  if (!$this->canGive() ||
652  !$this->isValidPeer($_REQUEST["peer_id"])) {
653  $this->returnToParentObject();
654  }
655 
656  $peer_id = $_REQUEST["peer_id"];
657 
658  $form = $this->initPeerReviewItemForm($peer_id);
659  if ($form->checkInput()) {
660  $valid = true;
661 
662  $values = array();
663  foreach ($this->ass->getPeerReviewCriteriaCatalogueItems() as $item) {
664  $item->setPeerReviewContext(
665  $this->ass,
666  $this->submission->getUserId(),
667  $peer_id,
668  $form
669  );
670  $value = $item->importFromPeerReviewForm();
671  if ($value !== null) {
672  $crit_id = $item->getId()
673  ? $item->getId()
674  : $item->getType();
675  $values[$crit_id] = $value;
676  }
677  if (!$item->validate($value)) {
678  $valid = false;
679  }
680  }
681 
682  if ($valid) {
683  $this->submission->getPeerReview()->updatePeerReview($peer_id, $values);
684 
685  $this->handlePeerReviewChange();
686 
687  ilUtil::sendSuccess($this->lng->txt("exc_peer_review_updated"), true);
688  $ilCtrl->redirect($this, "editPeerReview");
689  } else {
690  ilUtil::sendFailure($lng->txt("form_input_not_valid"));
691  }
692  }
693 
694  $form->setValuesByPost();
696  }
static sendSuccess($a_info="", $a_keep=false)
Send Success Message to Screen.
editPeerReviewItemObject(ilPropertyFormGUI $a_form=null)
$valid
global $ilCtrl
Definition: ilias.php:18
if(isset($_POST['submit'])) $form
Create styles array
The data for the language used.
static sendFailure($a_info="", $a_keep=false)
Send Failure Message to Screen.
+ Here is the call graph for this function:

Field Documentation

◆ $ass

ilExPeerReviewGUI::$ass
protected

Definition at line 40 of file class.ilExPeerReviewGUI.php.

Referenced by getOverviewContent(), and resetPeerReviewObject().

◆ $ctrl

◆ $lng

◆ $submission

ilExPeerReviewGUI::$submission
protected

◆ $tabs_gui

ilExPeerReviewGUI::$tabs_gui
protected

Definition at line 23 of file class.ilExPeerReviewGUI.php.

Referenced by confirmResetPeerReviewObject(), and executeCommand().

◆ $tpl

◆ $user

ilExPeerReviewGUI::$user
protected

The documentation for this class was generated from the following file: