ILIAS  release_5-3 Revision v5.3.23-19-g915713cf615
class.ilExAssignmentPeerReviewOverviewTableGUI.php
Go to the documentation of this file.
1<?php
2/* Copyright (c) 1998-2009 ILIAS open source, Extended GPL, see docs/LICENSE */
3
4include_once './Services/Table/classes/class.ilTable2GUI.php';
5
13{
14 protected $ass; // [ilExAssignment]
15 protected $panel_info; // [array]
16
24 public function __construct($a_parent_obj, $a_parent_cmd, ilExAssignment $a_ass)
25 {
26 global $DIC;
27
28 $this->ctrl = $DIC->ctrl();
29 $ilCtrl = $DIC->ctrl();
30
31 $this->ass = $a_ass;
32
33 parent::__construct($a_parent_obj, $a_parent_cmd);
34
35 $this->setLimit(9999);
36
37 $this->addColumn($this->lng->txt("exc_peer_review_recipient"), "recipient");
38 $this->addColumn($this->lng->txt("exc_peer_review_giver"), "giver");
39 $this->addColumn($this->lng->txt("status"), "status");
40
41 $this->setDefaultOrderField("recipient");
42
43 $this->setRowTemplate("tpl.exc_peer_review_overview_row.html", "Modules/Exercise");
44 $this->setFormAction($ilCtrl->getFormAction($a_parent_obj, $a_parent_cmd));
45
46 $this->setTitle($a_ass->getTitle() . ": " . $this->lng->txt("exc_peer_review_overview"));
47
48 $this->disable("numinfo");
49
50 $this->getItems();
51
52 $this->addCommandButton("confirmResetPeerReview", $this->lng->txt("exc_peer_review_reset"));
53 }
54
55 protected function translateUserIds($a_user_ids, $a_implode = false)
56 {
57 if (!is_array($a_user_ids) && is_numeric($a_user_ids)) {
58 $a_user_ids = array($a_user_ids);
59 }
60
61 $res = array();
62
63 include_once "Services/User/classes/class.ilUserUtil.php";
64 foreach (array_unique($a_user_ids) as $user_id) {
66 }
67
68 if ($a_implode) {
69 $res = implode("<br />", $res);
70 }
71 return $res;
72 }
73
74 public function getPanelInfo()
75 {
76 return $this->panel_info;
77 }
78
79 protected function getItems()
80 {
81 $data = array();
82
83 include_once("./Modules/Exercise/classes/class.ilExPeerReview.php");
84 $peer_review = new ilExPeerReview($this->ass);
85 $tmp = $peer_review->validatePeerReviewGroups();
86
87 if (!is_array($tmp)) {
88 return;
89 }
90
91 foreach ($tmp["reviews"] as $peer_id => $reviews) {
92 $peer = $this->translateUserIds($peer_id, true);
93
94 foreach ($reviews as $giver_id => $status) {
95 $data[] = array("recipient" => $peer,
96 "giver" => $this->translateUserIds($giver_id, true),
97 "status" => ($status ? $this->lng->txt("valid") : ""));
98 }
99 }
100
101 if ($tmp["missing_user_ids"]) {
102 $this->panel_info[] = array(
103 "title" => $this->lng->txt("exc_peer_review_missing_users"),
104 "value" => $this->translateUserIds($tmp["missing_user_ids"])
105 );
106 }
107
108 if ($tmp["not_returned_ids"]) {
109 $this->panel_info[] = array(
110 "title" => $this->lng->txt("exc_peer_review_not_returned_users"),
111 "value" => $this->translateUserIds($tmp["not_returned_ids"])
112 );
113 }
114
115 if ($tmp["invalid_peer_ids"]) {
116 $this->panel_info[] = array(
117 "title" => $this->lng->txt("exc_peer_review_invalid_peer_ids"),
118 "value" => $this->translateUserIds($tmp["invalid_peer_ids"])
119 );
120 }
121
122 if ($tmp["invalid_giver_ids"]) {
123 $this->panel_info[] = array(
124 "title" => $this->lng->txt("exc_peer_review_invalid_giver_ids"),
125 "value" => $this->translateUserIds($tmp["invalid_giver_ids"])
126 );
127 }
128
129 $this->setData($data);
130 }
131
132 protected function fillRow($a_set)
133 {
134 $this->tpl->setVariable("PEER", $a_set["recipient"]);
135 $this->tpl->setVariable("GIVER", $a_set["giver"]);
136 $this->tpl->setVariable("STATUS", $a_set["status"]);
137 }
138}
An exception for terminatinating execution or to throw for unit testing.
__construct($a_parent_obj, $a_parent_cmd, ilExAssignment $a_ass)
Constructor.
Exercise assignment.
Exercise peer review.
Class ilTable2GUI.
setTitle($a_title, $a_icon=0, $a_icon_alt=0)
Set title and title icon.
setData($a_data)
set table data @access public
setRowTemplate($a_template, $a_template_dir="")
Set row template.
setLimit($a_limit=0, $a_default_limit=0)
set max.
setDefaultOrderField($a_defaultorderfield)
Set Default order field.
addColumn( $a_text, $a_sort_field="", $a_width="", $a_is_checkbox_action_column=false, $a_class="", $a_tooltip="", $a_tooltip_with_html=false)
Add a column to the header.
setFormAction($a_form_action, $a_multipart=false)
Set Form action parameter.
addCommandButton($a_cmd, $a_text, $a_onclick='', $a_id="", $a_class=null)
Add Command button.
disable($a_module_name)
diesables particular modules of table
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:
global $ilCtrl
Definition: ilias.php:18
global $DIC
Definition: saml.php:7
foreach($_POST as $key=> $value) $res