ILIAS  release_6 Revision v6.24-5-g0c8bfefb3b8
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
12{
13 protected $ass; // [ilExAssignment]
14 protected $show_peer_review; // [bool]
15 protected $peer_review; // [ilExPeerReview]
16
17 public function __construct($a_parent_obj, $a_parent_cmd, ilExAssignment $a_ass, $a_show_peer_review = false, $a_disable_peer_review = false)
18 {
19 global $DIC;
20
21 $this->ctrl = $DIC->ctrl();
22 $this->lng = $DIC->language();
23 $ilCtrl = $DIC->ctrl();
24 $lng = $DIC->language();
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 $this->addColumn($this->lng->txt("exc_files_returned_text"), "", "45%");
44 $this->addColumn($this->lng->txt("exc_peer_review"), "", "30%");
45
46 $this->peer_review = new ilExPeerReview($this->ass);
47 } else {
48 $this->addColumn($this->lng->txt("exc_files_returned_text"), "", "75%");
49 }
50
51 $this->setDefaultOrderField("uname");
52 $this->setDefaultOrderDirection("asc");
53
54 $this->setFormAction($ilCtrl->getFormAction($a_parent_obj));
55 $this->setRowTemplate("tpl.exc_list_text_assignment_row.html", "Modules/Exercise");
56
57 if (!$a_disable_peer_review &&
58 $this->ass->getPeerReview() &&
59 !$a_show_peer_review) {
60 $this->addCommandButton("listTextAssignment", $lng->txt("exc_show_peer_review"));
61 }
62
63 $this->parse();
64 }
65
66 public function numericOrdering($a_field)
67 {
68 return ($a_field == "udate");
69 }
70
71 protected function parse()
72 {
73 $peer_data = array();
74 if ($this->show_peer_review) {
75 $peer_data = $this->peer_review->getAllPeerReviews();
76 }
77
78 foreach (ilExSubmission::getAllAssignmentFiles($this->ass->getExerciseId(), $this->ass->getId()) as $file) {
79 if (trim($file["atext"])) {
80 $data[$file["user_id"]] = array(
81 "uid" => $file["user_id"],
82 "uname" => ilUserUtil::getNamePresentation($file["user_id"]),
83 "udate" => $file["ts"],
84 "utext" => ilRTE::_replaceMediaObjectImageSrc($file["atext"], 1) // mob id to mob src
85 );
86
87 if (isset($peer_data[$file["user_id"]])) {
88 $data[$file["user_id"]]["peer"] = array_keys($peer_data[$file["user_id"]]);
89 }
90 }
91 }
92
93 $this->setData($data);
94 }
95
96 protected function fillRow($a_set)
97 {
99
100 if ($this->show_peer_review) {
101 $peer_data = "&nbsp;";
102 if (isset($a_set["peer"])) {
103 $acc = new ilAccordionGUI();
104 $acc->setId($this->ass->getId() . "_" . $a_set["uid"]);
105
106 foreach ($a_set["peer"] as $peer_id) {
107 $peer_name = ilUserUtil::getNamePresentation($peer_id);
108 $acc_item = $peer_name;
109
110 $submission = new ilExSubmission($this->ass, $a_set["uid"]);
111 $values = $submission->getPeerReview()->getPeerReviewValues($peer_id, $a_set["uid"]);
112
113 $acc_html = array();
114 foreach ($this->ass->getPeerReviewCriteriaCatalogueItems() as $crit) {
115 $crit_id = $crit->getId()
116 ? $crit->getId()
117 : $crit->getType();
118 $crit->setPeerReviewContext($this->ass, $peer_id, $a_set["uid"]);
119
120 // see ilWikiAdvMetaDataBlockGUI
121 $acc_html[] = '<p>' .
122 '<div class="ilBlockPropertyCaption">' . $crit->getTitle() . '</div>' .
123 '<div>' . $crit->getHTML($values[$crit_id]) . '</div>' .
124 '</p>';
125 }
126
127 $acc->addItem(
128 ilUserUtil::getNamePresentation($peer_id, false, false, "", true),
129 '<div style="margin-left:10px;">' . implode("\n", $acc_html) . '</div>'
130 );
131 }
132
133 $peer_data = $acc->getHTML();
134 }
135 $this->tpl->setCurrentBlock("peer_bl");
136 $this->tpl->setVariable("PEER_REVIEW", $peer_data);
137 $this->tpl->parseCurrentBlock();
138 }
139
140 $this->tpl->setVariable("USER_NAME", $a_set["uname"]);
141 $this->tpl->setVariable(
142 "USER_DATE",
144 );
145 $this->tpl->setVariable("USER_TEXT", nl2br($a_set["utext"]));
146 }
147}
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, $include_seconds=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 //TODO: This class has to much static methods related to delivered "files".
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
__construct(Container $dic, ilPlugin $plugin)
@inheritDoc
$DIC
Definition: xapitoken.php:46