ILIAS  release_5-1 Revision 5.0.0-5477-g43f3e3fab5f
class.ilExAssignmentListTextTableGUI.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");
5include_once("./Modules/Exercise/classes/class.ilExAssignment.php");
6include_once("./Modules/Exercise/classes/class.ilExPeerReview.php");
7
17{
18 protected $ass; // [ilExAssignment]
19 protected $show_peer_review; // [bool]
20 protected $peer_review; // [ilExPeerReview]
21
22 function __construct($a_parent_obj, $a_parent_cmd, ilExAssignment $a_ass, $a_show_peer_review = false, $a_disable_peer_review = false)
23 {
24 global $ilCtrl, $lng;
25
26 $this->ass = $a_ass;
27 $this->show_peer_review = (bool)$a_show_peer_review;
28 $this->setId("excassltxt".$this->ass->getId());
29
30 parent::__construct($a_parent_obj, $a_parent_cmd);
31
32 $this->setTitle($lng->txt("exc_list_text_assignment").
33 ": \"".$this->ass->getTitle()."\"");
34
35 // if you add pagination and disable the unlimited setting:
36 // fix saving of ordering of single pages!
37 $this->setLimit(9999);
38
39 $this->addColumn($this->lng->txt("user"), "uname", "15%");
40 $this->addColumn($this->lng->txt("exc_last_submission"), "udate", "10%");
41
42 if($this->show_peer_review)
43 {
44 $this->addColumn($this->lng->txt("exc_files_returned_text"), "", "45%");
45 $this->addColumn($this->lng->txt("exc_peer_review"), "", "30%");
46
47 include_once './Services/Rating/classes/class.ilRatingGUI.php';
48 include_once './Services/Accordion/classes/class.ilAccordionGUI.php';
49
50 $this->peer_review = new ilExPeerReview($this->ass);
51 }
52 else
53 {
54 $this->addColumn($this->lng->txt("exc_files_returned_text"), "", "75%");
55 }
56
57 $this->setDefaultOrderField("uname");
58 $this->setDefaultOrderDirection("asc");
59
60 $this->setFormAction($ilCtrl->getFormAction($a_parent_obj));
61 $this->setRowTemplate("tpl.exc_list_text_assignment_row.html", "Modules/Exercise");
62
63 if(!$a_disable_peer_review &&
64 $this->ass->getPeerReview() &&
65 !$a_show_peer_review)
66 {
67 $this->addCommandButton("listTextAssignmentWithPeerReview", $lng->txt("exc_show_peer_review"));
68 }
69
70 $this->parse();
71 }
72
73 public function numericOrdering($a_field)
74 {
75 return ($a_field == "udate");
76 }
77
78 protected function parse()
79 {
80 $peer_data = array();
81 if($this->show_peer_review)
82 {
83 $peer_data = $this->peer_review->getAllPeerReviews();
84 }
85
86 include_once "Services/User/classes/class.ilUserUtil.php";
87 include_once "Services/RTE/classes/class.ilRTE.php";
88 foreach(ilExSubmission::getAllAssignmentFiles($this->ass->getExerciseId(), $this->ass->getId()) as $file)
89 {
90 if(trim($file["atext"]))
91 {
92 $data[$file["user_id"]] = array(
93 "uid" => $file["user_id"],
94 "uname" => ilUserUtil::getNamePresentation($file["user_id"]),
95 "udate" => $file["ts"],
96 "utext" => ilRTE::_replaceMediaObjectImageSrc($file["atext"], 1) // mob id to mob src
97 );
98
99 if(isset($peer_data[$file["user_id"]]))
100 {
101 $data[$file["user_id"]]["peer"] = array_keys($peer_data[$file["user_id"]]);
102 }
103 }
104 }
105
106 $this->setData($data);
107 }
108
109 protected function fillRow($a_set)
110 {
111 global $ilCtrl;
112
113 if($this->show_peer_review)
114 {
115 $peer_data = "&nbsp;";
116 if(isset($a_set["peer"]))
117 {
118 $acc = new ilAccordionGUI();
119 $acc->setId($this->ass->getId()."_".$a_set["uid"]);
120
121 foreach($a_set["peer"] as $peer_id)
122 {
123 $peer_name = ilUserUtil::getNamePresentation($peer_id);
124 $acc_item = $peer_name;
125
126 $submission = new ilExSubmission($this->ass, $a_set["uid"]);
127 $values = $submission->getPeerReview()->getPeerReviewValues($peer_id, $a_set["uid"]);
128
129 $acc_html = array();
130 foreach($this->ass->getPeerReviewCriteriaCatalogueItems() as $crit)
131 {
132 $crit_id = $crit->getId()
133 ? $crit->getId()
134 : $crit->getType();
135 $crit->setPeerReviewContext($this->ass, $peer_id, $a_set["uid"]);
136
137 // see ilWikiAdvMetaDataBlockGUI
138 $acc_html[] = '<p>'.
139 '<div class="ilBlockPropertyCaption">'.$crit->getTitle().'</div>'.
140 '<div>'.$crit->getHTML($values[$crit_id]).'</div>'.
141 '</p>';
142 }
143
144 $acc->addItem(
145 ilUserUtil::getNamePresentation($peer_id, false, false, "", true),
146 '<div style="margin-left:10px;">'.implode("\n", $acc_html).'</div>'
147 );
148 }
149
150 $peer_data = $acc->getHTML();
151 }
152 $this->tpl->setCurrentBlock("peer_bl");
153 $this->tpl->setVariable("PEER_REVIEW", $peer_data);
154 $this->tpl->parseCurrentBlock();
155 }
156
157 $this->tpl->setVariable("USER_NAME", $a_set["uname"]);
158 $this->tpl->setVariable("USER_DATE",
160 $this->tpl->setVariable("USER_TEXT", nl2br($a_set["utext"]));
161 }
162}
163
164?>
print $file
const IL_CAL_DATETIME
Accordion user interface class.
static formatDate(ilDateTime $date)
Format a date @access public.
Class for single dates.
fillRow($a_set)
Standard Version of Fill Row.
__construct($a_parent_obj, $a_parent_cmd, ilExAssignment $a_ass, $a_show_peer_review=false, $a_disable_peer_review=false)
numericOrdering($a_field)
Should this field be sorted numeric?
Exercise assignment.
Exercise peer review.
Exercise submission.
static getAllAssignmentFiles($a_exc_id, $a_ass_id)
static _replaceMediaObjectImageSrc($a_text, $a_direction=0, $nic=IL_INST_ID)
replaces image source from mob image urls with the mob id or replaces mob id with the correct image s...
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.
setId($a_val)
Set id.
setFormAction($a_form_action, $a_multipart=false)
Set Form action parameter.
setDefaultOrderDirection($a_defaultorderdirection)
Set Default order direction.
addCommandButton($a_cmd, $a_text, $a_onclick='', $a_id="", $a_class=null)
Add Command button.
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
global $lng
Definition: privfeed.php:40