ILIAS  release_5-1 Revision 5.0.0-5477-g43f3e3fab5f
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 $ilCtrl;
27
28 $this->ass = $a_ass;
29
30 parent::__construct($a_parent_obj, $a_parent_cmd);
31
32 $this->setLimit(9999);
33
34 $this->addColumn($this->lng->txt("exc_peer_review_recipient"), "recipient");
35 $this->addColumn($this->lng->txt("exc_peer_review_giver"), "giver");
36 $this->addColumn($this->lng->txt("status"), "status");
37
38 $this->setDefaultOrderField("recipient");
39
40 $this->setRowTemplate("tpl.exc_peer_review_overview_row.html", "Modules/Exercise");
41 $this->setFormAction($ilCtrl->getFormAction($a_parent_obj, $a_parent_cmd));
42
43 $this->setTitle($a_ass->getTitle().": ".$this->lng->txt("exc_peer_review_overview"));
44
45 $this->disable("numinfo");
46
47 $this->getItems();
48
49 $this->addCommandButton("confirmResetPeerReview", $this->lng->txt("exc_peer_review_reset"));
50 }
51
52 protected function translateUserIds($a_user_ids, $a_implode = false)
53 {
54 if(!is_array($a_user_ids) && is_numeric($a_user_ids))
55 {
56 $a_user_ids = array($a_user_ids);
57 }
58
59 $res = array();
60
61 include_once "Services/User/classes/class.ilUserUtil.php";
62 foreach(array_unique($a_user_ids) as $user_id)
63 {
65 }
66
67 if($a_implode)
68 {
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 {
89 return;
90 }
91
92 foreach($tmp["reviews"] as $peer_id => $reviews)
93 {
94 $peer = $this->translateUserIds($peer_id, true);
95
96 foreach($reviews as $giver_id => $status)
97 {
98 $data[] = array("recipient" => $peer,
99 "giver" => $this->translateUserIds($giver_id, true),
100 "status" => ($status ? $this->lng->txt("valid") : ""));
101 }
102 }
103
104 if($tmp["missing_user_ids"])
105 {
106 $this->panel_info[] = array(
107 "title" => $this->lng->txt("exc_peer_review_missing_users"),
108 "value" => $this->translateUserIds($tmp["missing_user_ids"])
109 );
110 }
111
112 if($tmp["not_returned_ids"])
113 {
114 $this->panel_info[] = array(
115 "title" => $this->lng->txt("exc_peer_review_not_returned_users"),
116 "value" => $this->translateUserIds($tmp["not_returned_ids"])
117 );
118 }
119
120 if($tmp["invalid_peer_ids"])
121 {
122 $this->panel_info[] = array(
123 "title" => $this->lng->txt("exc_peer_review_invalid_peer_ids"),
124 "value" => $this->translateUserIds($tmp["invalid_peer_ids"])
125 );
126 }
127
128 if($tmp["invalid_giver_ids"])
129 {
130 $this->panel_info[] = array(
131 "title" => $this->lng->txt("exc_peer_review_invalid_giver_ids"),
132 "value" => $this->translateUserIds($tmp["invalid_giver_ids"])
133 );
134 }
135
136 $this->setData($data);
137 }
138
139 protected function fillRow($a_set)
140 {
141 $this->tpl->setVariable("PEER", $a_set["recipient"]);
142 $this->tpl->setVariable("GIVER", $a_set["giver"]);
143 $this->tpl->setVariable("STATUS", $a_set["status"]);
144 }
145}
146
147?>
__construct($a_parent_obj, $a_parent_cmd, ilExAssignment $a_ass)
Constructor.
Exercise assignment.
Exercise peer review.
Class ilTable2GUI.
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.
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.
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)
Default behaviour is:
global $ilCtrl
Definition: ilias.php:18