ILIAS  release_5-3 Revision v5.3.23-19-g915713cf615
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 public function __construct($a_parent_obj, $a_parent_cmd, ilExAssignment $a_ass, $a_show_peer_review = false, $a_disable_peer_review = false)
23 {
24 global $DIC;
25
26 $this->ctrl = $DIC->ctrl();
27 $this->lng = $DIC->language();
28 $ilCtrl = $DIC->ctrl();
29 $lng = $DIC->language();
30
31 $this->ass = $a_ass;
32 $this->show_peer_review = (bool) $a_show_peer_review;
33 $this->setId("excassltxt" . $this->ass->getId());
34
35 parent::__construct($a_parent_obj, $a_parent_cmd);
36
37 $this->setTitle($lng->txt("exc_list_text_assignment") .
38 ": \"" . $this->ass->getTitle() . "\"");
39
40 // if you add pagination and disable the unlimited setting:
41 // fix saving of ordering of single pages!
42 $this->setLimit(9999);
43
44 $this->addColumn($this->lng->txt("user"), "uname", "15%");
45 $this->addColumn($this->lng->txt("exc_last_submission"), "udate", "10%");
46
47 if ($this->show_peer_review) {
48 $this->addColumn($this->lng->txt("exc_files_returned_text"), "", "45%");
49 $this->addColumn($this->lng->txt("exc_peer_review"), "", "30%");
50
51 include_once './Services/Rating/classes/class.ilRatingGUI.php';
52 include_once './Services/Accordion/classes/class.ilAccordionGUI.php';
53
54 $this->peer_review = new ilExPeerReview($this->ass);
55 } else {
56 $this->addColumn($this->lng->txt("exc_files_returned_text"), "", "75%");
57 }
58
59 $this->setDefaultOrderField("uname");
60 $this->setDefaultOrderDirection("asc");
61
62 $this->setFormAction($ilCtrl->getFormAction($a_parent_obj));
63 $this->setRowTemplate("tpl.exc_list_text_assignment_row.html", "Modules/Exercise");
64
65 if (!$a_disable_peer_review &&
66 $this->ass->getPeerReview() &&
67 !$a_show_peer_review) {
68 $this->addCommandButton("listTextAssignmentWithPeerReview", $lng->txt("exc_show_peer_review"));
69 }
70
71 $this->parse();
72 }
73
74 public function numericOrdering($a_field)
75 {
76 return ($a_field == "udate");
77 }
78
79 protected function parse()
80 {
81 $peer_data = array();
82 if ($this->show_peer_review) {
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 if (trim($file["atext"])) {
90 $data[$file["user_id"]] = array(
91 "uid" => $file["user_id"],
92 "uname" => ilUserUtil::getNamePresentation($file["user_id"]),
93 "udate" => $file["ts"],
94 "utext" => ilRTE::_replaceMediaObjectImageSrc($file["atext"], 1) // mob id to mob src
95 );
96
97 if (isset($peer_data[$file["user_id"]])) {
98 $data[$file["user_id"]]["peer"] = array_keys($peer_data[$file["user_id"]]);
99 }
100 }
101 }
102
103 $this->setData($data);
104 }
105
106 protected function fillRow($a_set)
107 {
109
110 if ($this->show_peer_review) {
111 $peer_data = "&nbsp;";
112 if (isset($a_set["peer"])) {
113 $acc = new ilAccordionGUI();
114 $acc->setId($this->ass->getId() . "_" . $a_set["uid"]);
115
116 foreach ($a_set["peer"] as $peer_id) {
117 $peer_name = ilUserUtil::getNamePresentation($peer_id);
118 $acc_item = $peer_name;
119
120 $submission = new ilExSubmission($this->ass, $a_set["uid"]);
121 $values = $submission->getPeerReview()->getPeerReviewValues($peer_id, $a_set["uid"]);
122
123 $acc_html = array();
124 foreach ($this->ass->getPeerReviewCriteriaCatalogueItems() as $crit) {
125 $crit_id = $crit->getId()
126 ? $crit->getId()
127 : $crit->getType();
128 $crit->setPeerReviewContext($this->ass, $peer_id, $a_set["uid"]);
129
130 // see ilWikiAdvMetaDataBlockGUI
131 $acc_html[] = '<p>' .
132 '<div class="ilBlockPropertyCaption">' . $crit->getTitle() . '</div>' .
133 '<div>' . $crit->getHTML($values[$crit_id]) . '</div>' .
134 '</p>';
135 }
136
137 $acc->addItem(
138 ilUserUtil::getNamePresentation($peer_id, false, false, "", true),
139 '<div style="margin-left:10px;">' . implode("\n", $acc_html) . '</div>'
140 );
141 }
142
143 $peer_data = $acc->getHTML();
144 }
145 $this->tpl->setCurrentBlock("peer_bl");
146 $this->tpl->setVariable("PEER_REVIEW", $peer_data);
147 $this->tpl->parseCurrentBlock();
148 }
149
150 $this->tpl->setVariable("USER_NAME", $a_set["uname"]);
151 $this->tpl->setVariable(
152 "USER_DATE",
154 );
155 $this->tpl->setVariable("USER_TEXT", nl2br($a_set["utext"]));
156 }
157}
An exception for terminatinating execution or to throw for unit testing.
const IL_CAL_DATETIME
Accordion user interface class.
static formatDate(ilDateTime $date, $a_skip_day=false, $a_include_wd=false)
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.
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.
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, $a_ctrl_path="ilpublicuserprofilegui")
Default behaviour is:
global $ilCtrl
Definition: ilias.php:18
if(!file_exists("$old.txt")) if( $old===$new) if(file_exists("$new.txt")) $file
global $DIC
Definition: saml.php:7