ILIAS  trunk Revision v11.0_alpha-3011-gc6b235a2e85
class.ilExAssignmentPeerReviewOverviewTableGUI.php
Go to the documentation of this file.
1<?php
2
26{
28 protected array $panel_info = [];
29
30 public function __construct(
31 object $a_parent_obj,
32 string $a_parent_cmd,
33 ilExAssignment $a_ass
34 ) {
35 global $DIC;
36
37 $this->ctrl = $DIC->ctrl();
38 $ilCtrl = $DIC->ctrl();
39
40 $this->ass = $a_ass;
41
42 parent::__construct($a_parent_obj, $a_parent_cmd);
43
44 $this->setLimit(9999);
45
46 $this->addColumn($this->lng->txt("exc_peer_review_recipient"), "recipient");
47 $this->addColumn($this->lng->txt("exc_peer_review_giver"), "giver");
48 $this->addColumn($this->lng->txt("status"), "status");
49
50 $this->setDefaultOrderField("recipient");
51
52 $this->setRowTemplate("tpl.exc_peer_review_overview_row.html", "components/ILIAS/Exercise");
53 $this->setFormAction($ilCtrl->getFormAction($a_parent_obj, $a_parent_cmd));
54
55 $this->setTitle($a_ass->getTitle() . ": " . $this->lng->txt("exc_peer_review_overview"));
56
57 $this->disable("numinfo");
58
59 $this->getItems();
60
61 $this->addCommandButton("confirmResetPeerReview", $this->lng->txt("exc_peer_review_reset"));
62 }
63
64 protected function translateUserIds(
65 array $a_user_ids
66 ): array {
67 $res = array();
68
69 foreach (array_unique($a_user_ids) as $user_id) {
71 }
72
73 return $res;
74 }
75
76 public function getPanelInfo(): array
77 {
78 return $this->panel_info;
79 }
80
81 protected function getItems(): void
82 {
83 $data = array();
84
85 $peer_review = new ilExPeerReview($this->ass);
86 $tmp = $peer_review->validatePeerReviewGroups();
87
88 if (!is_array($tmp)) {
89 return;
90 }
91
92 foreach ($tmp["reviews"] as $peer_id => $reviews) {
93 $peer = current($this->translateUserIds([$peer_id]));
94
95 foreach ($reviews as $giver_id => $status) {
96 $data[] = array("recipient" => $peer,
97 "giver" => current($this->translateUserIds([$giver_id])),
98 "status" => ($status ? $this->lng->txt("valid") : ""));
99 }
100 }
101
102 if ($tmp["missing_user_ids"]) {
103 $this->panel_info[] = array(
104 "title" => $this->lng->txt("exc_peer_review_missing_users"),
105 "value" => $this->translateUserIds($tmp["missing_user_ids"])
106 );
107 }
108
109 if ($tmp["not_returned_ids"]) {
110 $this->panel_info[] = array(
111 "title" => $this->lng->txt("exc_peer_review_not_returned_users"),
112 "value" => $this->translateUserIds($tmp["not_returned_ids"])
113 );
114 }
115
116 if ($tmp["invalid_peer_ids"]) {
117 $this->panel_info[] = array(
118 "title" => $this->lng->txt("exc_peer_review_invalid_peer_ids"),
119 "value" => $this->translateUserIds($tmp["invalid_peer_ids"])
120 );
121 }
122
123 if ($tmp["invalid_giver_ids"]) {
124 $this->panel_info[] = array(
125 "title" => $this->lng->txt("exc_peer_review_invalid_giver_ids"),
126 "value" => $this->translateUserIds($tmp["invalid_giver_ids"])
127 );
128 }
129
130 $this->setData($data);
131 }
132
133 protected function fillRow(array $a_set): void
134 {
135 $this->tpl->setVariable("PEER", $a_set["recipient"]);
136 $this->tpl->setVariable("GIVER", $a_set["giver"]);
137 $this->tpl->setVariable("STATUS", $a_set["status"]);
138 }
139}
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
__construct(object $a_parent_obj, string $a_parent_cmd, ilExAssignment $a_ass)
Exercise assignment.
Exercise peer review.
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
setLimit(int $a_limit=0, int $a_default_limit=0)
set max.
setTitle(string $a_title, string $a_icon="", string $a_icon_alt="")
addCommandButton(string $a_cmd, string $a_text, string $a_onclick='', string $a_id="", string $a_class="")
setFormAction(string $a_form_action, bool $a_multipart=false)
addColumn(string $a_text, string $a_sort_field="", string $a_width="", bool $a_is_checkbox_action_column=false, string $a_class="", string $a_tooltip="", bool $a_tooltip_with_html=false)
setDefaultOrderField(string $a_defaultorderfield)
setRowTemplate(string $a_template, string $a_template_dir="")
Set row template.
disable(string $a_module_name)
static getNamePresentation( $a_user_id, bool $a_user_image=false, bool $a_profile_link=false, string $a_profile_back_link='', bool $a_force_first_lastname=false, bool $a_omit_login=false, bool $a_sortable=true, bool $a_return_data_array=false, $a_ctrl_path=null)
Default behaviour is:
$res
Definition: ltiservices.php:69
__construct(Container $dic, ilPlugin $plugin)
@inheritDoc
global $DIC
Definition: shib_login.php:26