4 include_once
'./Services/Table/classes/class.ilTable2GUI.php';
5 include_once
'./Modules/Exercise/classes/class.ilExAssignment.php';
6 include_once
'./Services/Rating/classes/class.ilRatingGUI.php';
34 public function __construct($a_parent_obj, $a_parent_cmd,
ilExAssignment $a_ass, $a_user_id, array $a_peer_data, $a_title, $a_cancel_cmd, $a_read_only =
false)
39 $this->user_id = $a_user_id;
40 $this->peer_data = $a_peer_data;
41 $this->read_only = $a_read_only;
47 if(!$this->ass->hasPeerReviewPersonalized())
49 $this->
addColumn($this->lng->txt(
"id"),
"seq");
51 else if(!$this->read_only)
53 $this->
addColumn($this->lng->txt(
"exc_peer_review_recipient"),
"name");
57 $this->
addColumn($this->lng->txt(
"exc_peer_review_giver"),
"name");
61 $this->
addColumn($this->lng->txt(
"exc_submission"),
"");
64 $this->
addColumn($this->lng->txt(
"exc_peer_review_rating"),
"mark");
68 $this->
addColumn($this->lng->txt(
"exc_peer_review_comment"),
"");
72 $this->
addColumn($this->lng->txt(
"exc_peer_review"),
"");
75 $this->
addColumn($this->lng->txt(
"last_update"),
"tstamp");
79 $this->
setRowTemplate(
"tpl.exc_peer_review_row.html",
"Modules/Exercise");
80 $this->
setFormAction($ilCtrl->getFormAction($a_parent_obj, $a_parent_cmd));
82 $this->
setTitle($a_ass->
getTitle().
": ".$this->lng->txt(
"exc_peer_review").
" - ".$this->lng->txt($a_title));
90 include_once
"Services/User/classes/class.ilUserUtil.php";
91 $this->
setDescription($this->lng->txt(
"exc_peer_review_recipient").
92 ": ".ilUserUtil::getNamePresentation($a_user_id));
101 if($this->ass->hasPeerReviewFileUpload())
103 include_once(
"./Modules/Exercise/classes/class.ilFSStorageExercise.php");
104 $this->fstorage =
new ilFSStorageExercise($this->ass->getExerciseId(), $this->ass->getId());
105 $this->fstorage->
create();
113 $personal = $this->ass->hasPeerReviewPersonalized();
117 include_once
"Services/User/classes/class.ilUserUtil.php";
120 foreach($this->peer_data as $idx => $item)
124 $row[
"giver_id"] = $item[
"giver_id"];
125 $row[
"peer_id"] = $item[
"peer_id"];
126 $row[
"submission"] =
"";
128 "ass", $item[
"peer_id"],
"peer", $item[
"giver_id"]));
129 $row[
"comment"] = $item[
"pcomment"];
130 $row[
"tstamp"] = $item[
"tstamp"];
134 $row[
"seq"] = $idx+1;
136 else if(!$this->read_only)
153 if(in_array($a_field, array(
"mark",
"tstamp",
"seq")))
164 if(isset($a_set[
"seq"]))
166 $this->tpl->setVariable(
"VAL_SEQ", $a_set[
"seq"]);
170 $this->tpl->setVariable(
"VAL_SEQ", $a_set[
"name"]);
177 $this->tpl->setVariable(
"VAL_TSTAMP", $a_set[
"tstamp"]);
181 $ilCtrl->setParameter($this->parent_obj,
"peer_id", $a_set[
"peer_id"]);
183 $rating->setObject($this->ass->getId(),
"ass", $a_set[
"peer_id"],
"peer");
184 $rating->setUserId($a_set[
"giver_id"]);
185 $this->tpl->setVariable(
"ID_RATING",
"rtr_".$a_set[
"peer_id"]);
186 if(!$this->read_only)
188 $this->tpl->setVariable(
"VAL_RATING", $rating->getHTML(
false,
true,
189 "il.ExcPeerReview.saveComments(".$a_set[
"peer_id"].
", %rating%)"));
193 $this->tpl->setVariable(
"VAL_RATING", $rating->getHTML(
false,
false));
195 $ilCtrl->setParameter($this->parent_obj,
"peer_id",
"");
201 if($this->ass->hasPeerReviewFileUpload())
203 $path = $this->fstorage->getPeerReviewUploadPath($a_set[
"peer_id"], $a_set[
"giver_id"]);
204 $uploads = glob(
$path.
"/*.*");
207 if(!$this->read_only)
209 $ilCtrl->setParameter($this->parent_obj,
"seq", $a_set[
"seq"]);
213 $ilCtrl->setParameter($this->parent_obj,
"seq",
"");
215 $this->tpl->setVariable(
"VAL_LAST_SUBMISSION", $file_info[
"last_submission"][
"value"]);
216 $this->tpl->setVariable(
"TXT_LAST_SUBMISSION", $file_info[
"last_submission"][
"txt"]);
218 $this->tpl->setVariable(
"TXT_SUBMITTED_FILES", $file_info[
"files"][
"txt"]);
219 $this->tpl->setVariable(
"VAL_SUBMITTED_FILES", $file_info[
"files"][
"count"]);
221 if($file_info[
"files"][
"download_url"])
223 $this->tpl->setCurrentBlock(
"download_link");
224 $this->tpl->setVariable(
"LINK_DOWNLOAD", $file_info[
"files"][
"download_url"]);
225 $this->tpl->setVariable(
"TXT_DOWNLOAD", $file_info[
"files"][
"download_txt"]);
226 $this->tpl->parseCurrentBlock();
229 if($file_info[
"files"][
"download_new_url"])
231 $this->tpl->setCurrentBlock(
"download_link");
232 $this->tpl->setVariable(
"LINK_NEW_DOWNLOAD", $file_info[
"files"][
"download_new_url"]);
233 $this->tpl->setVariable(
"TXT_NEW_DOWNLOAD", $file_info[
"files"][
"download_new_txt"]);
234 $this->tpl->parseCurrentBlock();
237 $idx = $a_set[
"giver_id"].
"__".$a_set[
"peer_id"];
240 if($this->ass->hasPeerReviewFileUpload())
242 $ilCtrl->setParameter($this->parent_obj,
"fu", $idx);
243 $ilCtrl->setParameter($this->parent_obj,
"fsmode",
"peer");
244 $url = $ilCtrl->getLinkTargetByClass(
"ilfilesystemgui",
"listFiles");
245 $ilCtrl->setParameter($this->parent_obj,
"fsmode",
"");
246 $ilCtrl->setParameter($this->parent_obj,
"fu",
"");
248 $this->tpl->setCurrentBlock(
"file_edit_bl");
249 $this->tpl->setVariable(
"FILE_EDIT_URL", $url);
250 $this->tpl->setVariable(
"FILE_EDIT_CAPTION", $uploads
251 ? $this->lng->txt(
"exc_peer_edit_file")
252 : $this->lng->txt(
"exc_peer_upload_file"));
253 $this->tpl->parseCurrentBlock();
256 $this->tpl->setCurrentBlock(
"pcomment_edit_bl");
257 $this->tpl->setVariable(
"VAL_ID", $idx);
258 $this->tpl->setVariable(
"VAL_PCOMMENT_EDIT", $a_set[
"comment"]);
259 $this->tpl->parseCurrentBlock();
263 $this->tpl->setCurrentBlock(
"pcomment_static_bl");
264 $this->tpl->setVariable(
"VAL_PCOMMENT_STATIC", $a_set[
"comment"]);
265 $this->tpl->parseCurrentBlock();
271 $idx = $a_set[
"giver_id"].
"__".$a_set[
"peer_id"];
273 $ilCtrl->setParameter($this->parent_obj,
"fu", $idx);
275 foreach($uploads as $upload)
277 $ilCtrl->setParameter($this->parent_obj,
"fuf", md5($upload));
278 $url = $ilCtrl->getLinkTarget($this->parent_obj,
"downloadPeerReview");
279 $ilCtrl->setParameter($this->parent_obj,
"fuf",
"");
281 $this->tpl->setCurrentBlock(
"file_static_bl");
282 $this->tpl->setVariable(
"FILE_NAME", basename($upload));
283 $this->tpl->setVariable(
"FILE_URL", $url);
284 $this->tpl->parseCurrentBlock();
287 $ilCtrl->setParameter($this->parent_obj,
"fu",
"");