ILIAS  Release_5_0_x_branch Revision 61816
 All Data Structures Namespaces Files Functions Variables Groups Pages
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 
4 include_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  $tmp = $this->ass->validatePeerReviewGroups();
84 
85  if(!is_array($tmp))
86  {
87  return;
88  }
89 
90  foreach($tmp["reviews"] as $peer_id => $reviews)
91  {
92  $peer = $this->translateUserIds($peer_id, true);
93 
94  foreach($reviews as $giver_id => $status)
95  {
96  $data[] = array("recipient" => $peer,
97  "giver" => $this->translateUserIds($giver_id, true),
98  "status" => ($status ? $this->lng->txt("valid") : ""));
99  }
100  }
101 
102  if($tmp["missing_user_ids"])
103  {
104  $this->panel_info[] = array(
105  "title" => $this->lng->txt("exc_peer_review_missing_users"),
106  "value" => $this->translateUserIds($tmp["missing_user_ids"])
107  );
108  }
109 
110  if($tmp["not_returned_ids"])
111  {
112  $this->panel_info[] = array(
113  "title" => $this->lng->txt("exc_peer_review_not_returned_users"),
114  "value" => $this->translateUserIds($tmp["not_returned_ids"])
115  );
116  }
117 
118  if($tmp["invalid_peer_ids"])
119  {
120  $this->panel_info[] = array(
121  "title" => $this->lng->txt("exc_peer_review_invalid_peer_ids"),
122  "value" => $this->translateUserIds($tmp["invalid_peer_ids"])
123  );
124  }
125 
126  if($tmp["invalid_giver_ids"])
127  {
128  $this->panel_info[] = array(
129  "title" => $this->lng->txt("exc_peer_review_invalid_giver_ids"),
130  "value" => $this->translateUserIds($tmp["invalid_giver_ids"])
131  );
132  }
133 
134  $this->setData($data);
135  }
136 
137  protected function fillRow($a_set)
138  {
139  $this->tpl->setVariable("PEER", $a_set["recipient"]);
140  $this->tpl->setVariable("GIVER", $a_set["giver"]);
141  $this->tpl->setVariable("STATUS", $a_set["status"]);
142  }
143 }
144 
145 ?>