ILIAS  trunk Revision v11.0_alpha-3011-gc6b235a2e85
class.ilExAssignmentListTextTableGUI.php
Go to the documentation of this file.
1<?php
2
20
27{
30 protected bool $show_peer_review;
32
33 public function __construct(
34 object $a_parent_obj,
35 string $a_parent_cmd,
36 ilExAssignment $a_ass,
37 bool $a_show_peer_review = false,
38 bool $a_disable_peer_review = false
39 ) {
40 global $DIC;
41
42 $this->ctrl = $DIC->ctrl();
43 $this->lng = $DIC->language();
44 $ilCtrl = $DIC->ctrl();
45 $lng = $DIC->language();
46
47 $this->subm = $DIC->exercise()->internal()->domain()->submission($a_ass->getId());
48 $this->ass = $a_ass;
49 $this->show_peer_review = $a_show_peer_review;
50 $this->setId("excassltxt" . $this->ass->getId());
51
52 parent::__construct($a_parent_obj, $a_parent_cmd);
53
54 $this->setTitle(
55 $lng->txt("exc_list_text_assignment") .
56 ": \"" . $this->ass->getTitle() . "\""
57 );
58
59 // if you add pagination and disable the unlimited setting:
60 // fix saving of ordering of single pages!
61 $this->setLimit(9999);
62
63 $this->addColumn($this->lng->txt("user"), "uname", "15%");
64 $this->addColumn($this->lng->txt("exc_last_submission"), "udate", "10%");
65
66 if ($this->show_peer_review) {
67 $this->addColumn($this->lng->txt("exc_files_returned_text"), "", "45%");
68 $this->addColumn($this->lng->txt("exc_peer_review"), "", "30%");
69
70 $this->peer_review = new ilExPeerReview($this->ass);
71 } else {
72 $this->addColumn($this->lng->txt("exc_files_returned_text"), "", "75%");
73 }
74
75 $this->setDefaultOrderField("uname");
76 $this->setDefaultOrderDirection("asc");
77
78 $this->setFormAction($ilCtrl->getFormAction($a_parent_obj));
79 $this->setRowTemplate("tpl.exc_list_text_assignment_row.html", "components/ILIAS/Exercise");
80
81 if (!$a_disable_peer_review &&
82 $this->ass->getPeerReview() &&
83 !$a_show_peer_review) {
84 $this->addCommandButton("listTextAssignment", $lng->txt("exc_show_peer_review"));
85 }
86
87 $this->parse();
88 }
89
90 public function numericOrdering(string $a_field): bool
91 {
92 return ($a_field == "udate");
93 }
94
95 protected function parse(): void
96 {
97 $peer_data = array();
98 if ($this->show_peer_review) {
99 $peer_data = $this->peer_review->getAllPeerReviews();
100 }
101 $data = [];
102 foreach ($this->subm->getAllAssignmentFiles() as $file) {
103 if (trim($file["atext"])) {
104 $data[$file["user_id"]] = array(
105 "uid" => $file["user_id"],
106 "uname" => ilUserUtil::getNamePresentation($file["user_id"]),
107 "udate" => $file["ts"],
108 "utext" => ilRTE::_replaceMediaObjectImageSrc($file["atext"], 1) // mob id to mob src
109 );
110
111 if (isset($peer_data[$file["user_id"]])) {
112 $data[$file["user_id"]]["peer"] = array_keys($peer_data[$file["user_id"]]);
113 }
114 }
115 }
116
117 $this->setData($data);
118 }
119
120 protected function fillRow(array $a_set): void
121 {
122 if ($this->show_peer_review) {
123 $peer_data = "&nbsp;";
124 if (isset($a_set["peer"])) {
125 $acc = new ilAccordionGUI();
126 $acc->setId($this->ass->getId() . "_" . $a_set["uid"]);
127
128 foreach ($a_set["peer"] as $peer_id) {
129 $submission = new ilExSubmission($this->ass, $a_set["uid"]);
130 $values = $submission->getPeerReview()->getPeerReviewValues($peer_id, $a_set["uid"]);
131
132 $acc_html = array();
133 foreach ($this->ass->getPeerReviewCriteriaCatalogueItems() as $crit) {
134 $crit_id = $crit->getId()
135 ? $crit->getId()
136 : $crit->getType();
137 $crit->setPeerReviewContext($this->ass, $peer_id, $a_set["uid"]);
138
139 // see ilWikiAdvMetaDataBlockGUI
140 $acc_html[] = '<p>' .
141 '<div class="ilBlockPropertyCaption">' . $crit->getTitle() . '</div>' .
142 '<div>' . $crit->getHTML($values[$crit_id]) . '</div>' .
143 '</p>';
144 }
145
146 $acc->addItem(
147 ilUserUtil::getNamePresentation($peer_id, false, false, "", true),
148 '<div style="margin-left:10px;">' . implode("\n", $acc_html) . '</div>'
149 );
150 }
151
152 $peer_data = $acc->getHTML();
153 }
154 $this->tpl->setCurrentBlock("peer_bl");
155 $this->tpl->setVariable("PEER_REVIEW", $peer_data);
156 $this->tpl->parseCurrentBlock();
157 }
158
159 $this->tpl->setVariable("USER_NAME", $a_set["uname"]);
160 $this->tpl->setVariable(
161 "USER_DATE",
163 );
164 $this->tpl->setVariable("USER_TEXT", nl2br($a_set["utext"]));
165 }
166}
const IL_CAL_DATETIME
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
static formatDate(ilDateTime $date, bool $a_skip_day=false, bool $a_include_wd=false, bool $include_seconds=false, ?ilObjUser $user=null,)
Class for single dates.
numericOrdering(string $a_field)
Should this field be sorted numeric?
__construct(object $a_parent_obj, string $a_parent_cmd, ilExAssignment $a_ass, bool $a_show_peer_review=false, bool $a_disable_peer_review=false)
fillRow(array $a_set)
Standard Version of Fill Row.
Exercise assignment.
Exercise peer review.
Exercise submission //TODO: This class has many static methods related to delivered "files".
txt(string $a_topic, string $a_default_lang_fallback_mod="")
gets the text for a given topic if the topic is not in the list, the topic itself with "-" will be re...
static _replaceMediaObjectImageSrc(string $a_text, int $a_direction=0, string $nic='')
Replaces image source from mob image urls with the mob id or replaces mob id with the correct image s...
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
setLimit(int $a_limit=0, int $a_default_limit=0)
set max.
setTitle(string $a_title, string $a_icon="", string $a_icon_alt="")
addCommandButton(string $a_cmd, string $a_text, string $a_onclick='', string $a_id="", string $a_class="")
setFormAction(string $a_form_action, bool $a_multipart=false)
addColumn(string $a_text, string $a_sort_field="", string $a_width="", bool $a_is_checkbox_action_column=false, string $a_class="", string $a_tooltip="", bool $a_tooltip_with_html=false)
setDefaultOrderField(string $a_defaultorderfield)
setRowTemplate(string $a_template, string $a_template_dir="")
Set row template.
setId(string $a_val)
setDefaultOrderDirection(string $a_defaultorderdirection)
setData(array $a_data)
Set table data.
ilLanguage $lng
static getNamePresentation( $a_user_id, bool $a_user_image=false, bool $a_profile_link=false, string $a_profile_back_link='', bool $a_force_first_lastname=false, bool $a_omit_login=false, bool $a_sortable=true, bool $a_return_data_array=false, $a_ctrl_path=null)
Default behaviour is:
__construct(Container $dic, ilPlugin $plugin)
@inheritDoc
global $DIC
Definition: shib_login.php:26