32 protected \ILIAS\Exercise\Assignment\DomainService
$ass_domain;
42 protected array
$cols_default = array(
"login",
"submission",
"idl",
"calc_deadline");
43 protected array
$cols_order = array(
"image",
"name",
"login",
"team_members",
44 "sent_time",
"submission",
"calc_deadline",
"idl",
"status",
"mark",
"status_time",
45 "feedback_time",
"comment",
"notice");
61 $this->ui_factory = $DIC->ui()->factory();
62 $this->ui_renderer = $DIC->ui()->renderer();
64 $this->
ctrl = $DIC->ctrl();
65 $this->
access = $DIC->access();
66 $this->tpl = $DIC[
"tpl"];
67 $this->
lng = $DIC->language();
69 $ilCtrl = $DIC->ctrl();
80 $this->
setRowTemplate(
"tpl.exc_members_row.html",
"Modules/Exercise");
83 if ($this->mode == self::MODE_BY_ASSIGNMENT) {
95 foreach ($this->cols_order as
$id) {
96 if (in_array($id, $this->cols_mandatory) ||
97 in_array($id, $selected)) {
98 if (array_key_exists($id, $columns)) {
100 $this->
addColumn($col[0], $col[1] ??
"");
114 $this->
addMultiCommand(
"compareTextAssignments", $this->
lng->txt(
"exc_compare_submissions"));
120 if ($this->mode == self::MODE_BY_ASSIGNMENT &&
121 $this->ass->hasActiveIDl() &&
122 !$this->ass->hasReadOnlyIDl()) {
123 $this->
addMultiCommand(
"setIndividualDeadline", $this->
lng->txt(
"exc_individual_deadline_action"));
126 if ($this->exc->hasTutorFeedbackMail() &&
127 $this->mode == self::MODE_BY_ASSIGNMENT) {
128 $this->
addMultiCommand(
"redirectFeedbackMail", $this->
lng->txt(
"exc_tbl_action_feedback_mail"));
133 if ($this->mode == self::MODE_BY_ASSIGNMENT) {
134 $this->
addMultiCommand(
"sendGradingNotification", $this->
lng->txt(
"exc_send_grading_notification"));
137 if ($this->mode == self::MODE_BY_ASSIGNMENT &&
139 $this->ass->hasTeam()) {
144 if ($this->mode == self::MODE_BY_ASSIGNMENT) {
145 $this->
addMultiCommand(
"confirmDeassignMembers", $this->
lng->txt(
"exc_deassign_members"));
153 $this->ass_domain = $DIC->exercise()->internal()->domain()->assignment();
158 if ($this->mode == self::MODE_BY_ASSIGNMENT) {
160 $this->
filter[
"name"] = $item->getValue();
163 $this->
lng->loadLanguageModule(
"search");
165 "" => $this->
lng->txt(
"search_any"),
166 "notgraded" => $this->
lng->txt(
"exc_notgraded"),
167 "passed" => $this->
lng->txt(
"exc_passed"),
168 "failed" => $this->
lng->txt(
"exc_failed")
171 $item->setOptions($options);
172 $this->
filter[
"status"] = $item->getValue();
175 "" => $this->
lng->txt(
"search_any"),
176 "y" => $this->
lng->txt(
"exc_tbl_filter_has_submission"),
177 "n" => $this->
lng->txt(
"exc_tbl_filter_has_no_submission")
180 $item->setOptions($options);
181 $this->
filter[
"subm"] = $item->getValue();
183 $item = $this->
addFilterItemByMetaType(
"flt_subm_after", self::FILTER_DATE,
false, $this->
lng->txt(
"exc_tbl_filter_submission_after"));
184 $this->
filter[
"subm_after"] = $item->getDate();
186 $item = $this->
addFilterItemByMetaType(
"flt_subm_before", self::FILTER_DATE,
false, $this->
lng->txt(
"exc_tbl_filter_submission_before"));
187 $this->filter[
"subm_before"] = $item->getDate();
189 if ($this->mode == self::MODE_BY_ASSIGNMENT && !$this->ass->hasTeam()) {
197 $this->
lng->txt(
'exc_member_of_crs_grp'),
202 $repo->getExplorerGUI()->setSelectableTypes([
"crs",
"grp"]);
203 $repo->getExplorerGUI()->setTypeWhiteList([
"root",
"cat",
"crs",
"grp"]);
205 $repo->readFromSession();
206 $this->
filter[
'member_of'] = (
int) $repo->getValue();
216 abstract protected function initMode(
int $a_item_id): void;
218 abstract protected function parseData(): array;
227 foreach ($this->cols_order as
$id) {
228 if (in_array($id, $this->cols_mandatory)) {
232 if (array_key_exists($id, $columns)) {
233 $col = $columns[
$id];
237 "default" => in_array($id, $this->cols_default)
248 $cols[
"submission"] = array($this->
lng->txt(
"exc_tbl_submission_date"),
"submission");
250 $cols[
"status"] = array($this->
lng->txt(
"exc_tbl_status"),
"status");
251 $cols[
"mark"] = array($this->
lng->txt(
"exc_tbl_mark"),
"mark");
252 $cols[
"status_time"] = array($this->
lng->txt(
"exc_tbl_status_time"),
"status_time");
254 $cols[
"sent_time"] = array($this->
lng->txt(
"exc_tbl_sent_time"),
"sent_time");
256 if ($this->exc->hasTutorFeedbackText() ||
257 $this->exc->hasTutorFeedbackMail() ||
258 $this->exc->hasTutorFeedbackFile()) {
259 $cols[
"feedback_time"] = array($this->
lng->txt(
"exc_tbl_feedback_time"),
"feedback_time");
262 if ($this->exc->hasTutorFeedbackText()) {
263 $cols[
"comment"] = array($this->
lng->txt(
"exc_tbl_comment"),
"comment");
266 $cols[
"notice"] = array($this->
lng->txt(
"exc_tbl_notice"),
"notice");
276 protected function parseRow(
284 $has_no_team_yet = ($a_ass->
hasTeam() &&
290 if ($this->mode == self::MODE_BY_ASSIGNMENT) {
292 $this->tpl->setVariable(
"VAL_NAME", $a_row[
"name"]);
295 if (!$ilAccess->checkAccessOfUser($a_user_id,
"read",
"", $this->exc->getRefId()) &&
296 is_array($info = $ilAccess->getInfo())) {
297 $this->tpl->setCurrentBlock(
'access_warning');
298 $this->tpl->setVariable(
'PARENT_ACCESS', $info[0][
"text"]);
299 $this->tpl->parseCurrentBlock();
302 asort($a_row[
"team"]);
303 foreach ($a_row[
"team"] as $team_member_id => $team_member_name) {
304 if (count($a_row[
"team"]) > 1) {
305 $ilCtrl->setParameterByClass(
"ilExSubmissionTeamGUI",
"id", $team_member_id);
306 $url = $ilCtrl->getLinkTargetByClass(
"ilExSubmissionTeamGUI",
"confirmRemoveTeamMember");
307 $ilCtrl->setParameterByClass(
"ilExSubmissionTeamGUI",
"id",
"");
309 $this->tpl->setCurrentBlock(
"team_member_removal_bl");
310 $this->tpl->setVariable(
"URL_TEAM_MEMBER_REMOVAL",
$url);
312 $rem_gl = $this->ui_factory->symbol()->glyph()->remove(
$url);
313 $this->tpl->setVariable(
314 "TXT_TEAM_MEMBER_REMOVAL",
315 $this->ui_renderer->render($rem_gl)
318 $this->tpl->parseCurrentBlock();
322 if (!$ilAccess->checkAccessOfUser($team_member_id,
"read",
"", $this->exc->getRefId()) &&
323 is_array($info = $ilAccess->getInfo())) {
324 $this->tpl->setCurrentBlock(
'team_access_warning');
325 $this->tpl->setVariable(
'TEAM_PARENT_ACCESS', $info[0][
"text"]);
326 $this->tpl->parseCurrentBlock();
329 $this->tpl->setCurrentBlock(
"team_member");
330 $this->tpl->setVariable(
"TXT_MEMBER_NAME", $team_member_name);
331 $this->tpl->parseCurrentBlock();
334 $this->tpl->setCurrentBlock(
"team_info");
335 if ($has_no_team_yet) {
337 $this->tpl->setVariable(
"TXT_TEAM_INFO", $this->
lng->txt(
"exc_no_team_yet"));
339 $this->tpl->setVariable(
"TXT_TEAM_INFO",
"(" . $a_row[
"submission_obj"]->getTeam()->
getId() .
")");
343 $this->tpl->setVariable(
"VAL_NAME", $a_row[
"name"]);
347 if (!$has_no_team_yet) {
349 $this->tpl->setVariable(
"SEL_" . strtoupper($a_row[
"status"] ??
""),
' selected="selected" ');
350 $this->tpl->setVariable(
"TXT_NOTGRADED", $this->
lng->txt(
"exc_notgraded"));
351 $this->tpl->setVariable(
"TXT_PASSED", $this->
lng->txt(
"exc_passed"));
352 $this->tpl->setVariable(
"TXT_FAILED", $this->
lng->txt(
"exc_failed"));
358 $this->tpl->setVariable(
"NO_TEAM_COLSPAN", $nt_colspan);
363 $comment_id =
"excasscomm_" . $a_ass->
getId() .
"_" . $a_user_id;
364 if ($this->exc->hasTutorFeedbackText()) {
366 $modal->setId($comment_id);
367 $modal->setHeading($this->
lng->txt(
"exc_tbl_action_feedback_text"));
370 $lcomment_form->setId($comment_id);
371 $lcomment_form->setPreventDoubleSubmission(
false);
373 $lcomment =
new ilTextAreaInputGUI($this->
lng->txt(
"exc_comment_for_learner"),
"lcomment_" . $a_ass->
getId() .
"_" . $a_user_id);
374 $lcomment->
setInfo($this->
lng->txt(
"exc_comment_for_learner_info"));
375 $lcomment->setValue((
string) ($a_row[
"comment"] ??
""));
376 $lcomment->setRows(10);
377 $lcomment_form->addItem($lcomment);
379 $lcomment_form->addCommandButton(
"save", $this->
lng->txt(
"save"));
382 $modal->setBody($lcomment_form->getHTML());
384 $this->comment_modals[] = $modal->getHTML();
392 $include_seconds =
false;
398 $this->tpl->setVariable(
"VAL_IMAGE", $usr_obj->getPersonalPicturePath(
"xxsmall"));
399 $this->tpl->setVariable(
"TXT_IMAGE", $this->
lng->txt(
"personal_picture"));
406 if (count($a_row[
"team"]) === 0) {
407 $this->tpl->setVariable(
"VAL_TEAM_MEMBER", $this->
lng->txt(
"exc_no_team_yet"));
409 foreach ($a_row[
"team"] as $name) {
410 $this->tpl->setCurrentBlock(
"team_member_bl");
411 $this->tpl->setVariable(
"VAL_TEAM_MEMBER", $name);
412 $this->tpl->parseCurrentBlock();
416 $this->tpl->setVariable(
"VAL_TEAM_MEMBER",
" ");
420 case "calc_deadline":
424 if ($a_row[
"requested_idl"] ??
false) {
425 $this->tpl->setVariable(
426 "VAL_" . strtoupper($col),
427 $this->
lng->txt(
"exc_deadline_requested")
430 $this->tpl->setVariable(
431 "VAL_" . strtoupper($col),
436 $this->tpl->setVariable(
437 "VAL_" . strtoupper($col),
446 if (!$has_no_team_yet) {
447 $this->tpl->setVariable(
448 "VAL_" . strtoupper($col),
450 trim((
string) ($a_row[$col] ??
""))
458 $this->tpl->setVariable(
459 "VAL_" . strtoupper($col),
466 $this->tpl->setVariable(
"LCOMMENT_ID", $comment_id .
"_snip");
469 $this->tpl->setVariable(
"VAL_" . strtoupper($col), (trim((
string) ($a_row[$col] ??
"")) !==
"")
470 ? nl2br(trim((
string) $a_row[$col]))
474 case "feedback_time":
478 if ($col ==
"submission" && $a_row[
"submission_obj"]) {
479 $include_seconds =
true;
480 foreach ($a_row[
"submission_obj"]->getFiles() as $file) {
482 $this->tpl->setVariable(
"TXT_LATE", $this->
lng->txt(
"exc_late_submission"));
487 $this->tpl->setVariable(
488 "VAL_" . strtoupper($col),
489 ($a_row[$col] ??
false)
502 $this->tpl->setVariable(
"VAL_" . strtoupper($col), $a_row[$col]
503 ? trim((
string) $a_row[$col])
509 $this->tpl->setVariable(
"VAL_" . strtoupper($col), $a_row[$col]
510 ? trim((
string) $a_row[$col])
521 $file_info = $a_row[
"submission_obj"]->getDownloadedFilesInfoForTableGUIS();
523 $counter = $file_info[
"files"][
"count"];
525 if (isset($file_info[
"files"][
"download_url"])) {
526 $items[] = $this->ui_factory->button()->shy(
527 $file_info[
"files"][
"download_txt"] .
" (" . $counter .
")",
528 $file_info[
"files"][
"download_url"]
532 if (isset($file_info[
"files"][
"download_new_url"])) {
533 $items[] = $this->ui_factory->button()->shy(
534 $file_info[
"files"][
"download_new_txt"],
535 $file_info[
"files"][
"download_new_url"]
542 if ($ass_type->
supportsWebDirAccess() && $a_row[
'submission_obj']->hasSubmittedPrintVersion()) {
544 $items[] = $this->ui_factory->link()->standard($this->
lng->txt(
"exc_tbl_action_open_submission"),
$url)->withOpenInNewViewport(
true);
545 if ($a_row[
'submission_obj']->hasSubmittedPrintVersion()) {
547 $items[] = $this->ui_factory->link()->standard($this->
lng->txt(
"exc_print_pdf"),
$url)->withOpenInNewViewport(
true);
551 if (!$has_no_team_yet &&
554 (!is_null($a_row[
"calc_deadline"] ?? null) || $a_ass->
getDeadline() || $ind_deadline_mode)) {
559 $this->tpl->setVariable(
"VAL_IDL_ID", $a_ass->
getId() .
"_" . $idl_id);
561 $assignment_id = $a_ass->
getId();
562 $items[] = $this->ui_factory->button()->shy($this->
lng->txt(
"exc_individual_deadline_action"),
"#")
564 return "$('#$id').on('click', function() {il.ExcIDl.trigger('$idl_id', '$assignment_id'); return false;})";
569 if ($this->exc->hasTutorFeedbackMail()) {
570 $items[] = $this->ui_factory->button()->shy(
571 $this->
lng->txt(
"exc_tbl_action_feedback_mail"),
572 $ilCtrl->getLinkTarget($this->parent_obj,
"redirectFeedbackMail")
578 if ($this->exc->hasTutorFeedbackFile()) {
579 $tutor_feedback_manager = $this->ass_domain->tutorFeedbackFile($a_ass->
getId());
580 if ($tutor_feedback_manager->hasCollection($a_user_id)) {
582 $counter = $tutor_feedback_manager->count($a_user_id);
584 ?
" (" . $counter .
")" 586 $items[] = $this->ui_factory->button()->shy(
587 $this->
lng->txt(
"exc_tbl_action_feedback_file") . $counter,
588 $ilCtrl->getLinkTargetByClass(ilResourceCollectionGUI::class,
"")
595 ?
" (" . $counter .
")" 598 $items[] = $this->ui_factory->button()->shy(
599 $this->
lng->txt(
"exc_tbl_action_feedback_file") . $counter,
600 $ilCtrl->getLinkTargetByClass(
"ilfilesystemgui",
"listFiles")
606 if ($this->exc->hasTutorFeedbackText()) {
607 $items[] = $this->ui_factory->button()->shy($this->
lng->txt(
"exc_tbl_action_feedback_text"),
"#")
609 return "$('#$id').on('click', function() {il.ExcManagement.showComment('$comment_id'); return false;})";
615 if (($peer_review = $a_row[
"submission_obj"]->getPeerReview()) && $a_ass->
afterDeadlineStrict()) {
616 $counter = $peer_review->countGivenFeedback(
true, $a_user_id);
618 ?
" (" . $counter .
")" 620 $items[] = $this->ui_factory->button()->shy(
621 $this->
lng->txt(
"exc_tbl_action_peer_review_given") . $counter,
622 $ilCtrl->getLinkTargetByClass(
"ilexpeerreviewgui",
"showGivenPeerReview")
625 $counter = count($peer_review->getPeerReviewsByPeerId($a_user_id,
true));
626 $counter = $counter !== 0
627 ?
" (" . $counter .
")" 630 $items[] = $this->ui_factory->button()->shy(
631 $this->
lng->txt(
"exc_tbl_action_peer_review_received") . $counter,
632 $ilCtrl->getLinkTargetByClass(
"ilexpeerreviewgui",
"showReceivedPeerReview")
637 if ($has_no_team_yet) {
638 $items[] = $this->ui_factory->button()->shy(
639 $this->
lng->txt(
"exc_create_team"),
640 $ilCtrl->getLinkTargetByClass(
"ilExSubmissionTeamGUI",
"createSingleMemberTeam")
643 $items[] = $this->ui_factory->button()->shy(
644 $this->
lng->txt(
"exc_tbl_action_team_log"),
645 $ilCtrl->getLinkTargetByClass(
"ilExSubmissionTeamGUI",
"showTeamLog")
649 $actions = $this->ui_factory->dropdown()->standard($items);
651 $this->tpl->setVariable(
"ACTIONS", $this->ui_renderer->render($actions));
658 $tpl = $DIC->ui()->mainTemplate();
660 $url = $ilCtrl->getLinkTarget($this->
getParentObject(),
"saveCommentForLearners",
"",
true,
false);
662 $tpl->addJavaScript(
"Modules/Exercise/js/ilExcManagement.js");
663 $tpl->addOnLoadCode(
'il.ExcManagement.init("' .
$url .
'");');
665 return parent::render() .
666 implode(
"\n", $this->comment_modals);
An entity that renders components to a string output.
getType()
Get type this will most probably become an non public function in the future (or become obsolete) ...
canParticipantReceiveFeedback(int $part_id)
setFormAction(string $a_form_action, bool $a_multipart=false)
addFilterItem(ilTableFilterItem $a_input_item, bool $a_optional=false)
setResetCommand(string $a_val, string $a_caption="")
afterDeadlineStrict(bool $a_include_personal=true)
setShowTemplates(bool $a_value)
static formatDate(ilDateTime $date, bool $a_skip_day=false, bool $a_include_wd=false, bool $include_seconds=false)
setFormName(string $a_name="")
withOnLoadCode(Closure $binder)
countFeedbackFiles(string $a_user_id)
addFilterItemByMetaType(string $id, int $type=self::FILTER_TEXT, bool $a_optional=false, string $caption="")
Add filter by standard type.
const DEADLINE_ABSOLUTE_INDIVIDUAL
setDefaultOrderField(string $a_defaultorderfield)
setRowTemplate(string $a_template, string $a_template_dir="")
Set row template.
setFilterCommand(string $a_val, string $a_caption="")
Exercise submission table.
setDefaultOrderDirection(string $a_defaultorderdirection)
static getTeamId(int $a_assignment_id, int $a_user_id, bool $a_create_on_demand=false)
ILIAS Exercise Assignment DomainService $ass_domain
__construct(object $a_parent_obj, string $a_parent_cmd, ilObjExercise $a_exc, int $a_item_id)
static getInstanceByObjId(?int $obj_id, bool $stop_on_error=true)
get an instance of an Ilias object by object id
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
ilExAssignmentTypes $ass_types
ilExAssignmentTypeInterface $ass_type
This class represents a text area property in a property form.
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)
filter(string $filter_id, $class_path, string $cmd, bool $activated=true, bool $expanded=true)
isForwardingToFormDispatcher()
addMultiCommand(string $a_cmd, string $a_text)
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...