30 protected \ILIAS\Exercise\InternalGUIService
$gui;
31 protected \ILIAS\MediaObjects\MediaType\MediaTypeManager
$media_type;
53 $request = $DIC->exercise()->internal()->gui()->request();
54 $this->requested_ass_id = $request->getAssId();
56 $this->
lng = $DIC->language();
57 $this->
user = $DIC->user();
58 $this->
ctrl = $DIC->ctrl();
59 $this->
ui = $DIC->ui();
63 $this->mandatory_manager = $service->
domain()->assignment()->mandatoryAssignments($this->exc);
64 $this->media_type = $DIC->mediaObjects()->internal()->domain()->mediaType();
65 $this->gui = $DIC->exercise()
83 $tpl =
new ilTemplate(
"tpl.assignment_head.html",
true,
true,
"Modules/Exercise");
88 if ($state->exceededOfficialDeadline()) {
89 $tpl->setCurrentBlock(
"prop");
90 $tpl->setVariable(
"PROP", $lng->
txt(
"exc_ended_on"));
91 $tpl->setVariable(
"PROP_VAL", $state->getCommonDeadlinePresentation());
92 $tpl->parseCurrentBlock();
95 if ($state->getPeerReviewDeadline()) {
96 $tpl->setCurrentBlock(
"prop");
97 $tpl->setVariable(
"PROP", $lng->
txt(
"exc_peer_review_deadline"));
98 $tpl->setVariable(
"PROP_VAL", $state->getPeerReviewDeadlinePresentation());
99 $tpl->parseCurrentBlock();
101 } elseif (!$state->hasGenerallyStarted()) {
102 $tpl->setCurrentBlock(
"prop");
103 if ($state->getRelativeDeadline()) {
104 $tpl->setVariable(
"PROP", $lng->
txt(
"exc_earliest_start_time"));
106 $tpl->setVariable(
"PROP", $lng->
txt(
"exc_starting_on"));
108 $tpl->setVariable(
"PROP_VAL", $state->getGeneralStartPresentation());
109 $tpl->parseCurrentBlock();
111 if ($state->getCommonDeadline() > 0) {
112 $tpl->setCurrentBlock(
"prop");
113 $tpl->setVariable(
"PROP", $lng->
txt(
"exc_time_to_send"));
114 $tpl->setVariable(
"PROP_VAL", $state->getRemainingTimePresentation());
115 $tpl->parseCurrentBlock();
117 $tpl->setCurrentBlock(
"prop");
118 $tpl->setVariable(
"PROP", $lng->
txt(
"exc_edit_until"));
119 $tpl->setVariable(
"PROP_VAL", $state->getCommonDeadlinePresentation());
120 $tpl->parseCurrentBlock();
121 } elseif ($state->getRelativeDeadline()) {
122 $tpl->setCurrentBlock(
"prop");
123 $tpl->setVariable(
"PROP", $lng->
txt(
"exc_rem_time_after_start"));
124 $tpl->setVariable(
"PROP_VAL", $state->getRelativeDeadlinePresentation());
125 $tpl->parseCurrentBlock();
127 if ($state->getLastSubmissionOfRelativeDeadline()) {
128 $tpl->setCurrentBlock(
"prop");
129 $tpl->setVariable(
"PROP", $lng->
txt(
"exc_rel_last_submission"));
130 $tpl->setVariable(
"PROP_VAL", $state->getLastSubmissionOfRelativeDeadlinePresentation());
131 $tpl->parseCurrentBlock();
136 if ($state->getIndividualDeadline() > 0) {
137 $tpl->setCurrentBlock(
"prop");
138 $tpl->setVariable(
"PROP", $lng->
txt(
"exc_individual_deadline"));
139 $tpl->setVariable(
"PROP_VAL", $state->getIndividualDeadlinePresentation());
140 $tpl->parseCurrentBlock();
145 if ($this->mandatory_manager->isMandatoryForUser($a_ass->
getId(), $this->
user->getId())) {
146 $mand =
" (" . $lng->
txt(
"exc_mandatory") .
")";
148 $tpl->setVariable(
"TITLE", $a_ass->
getTitle() . $mand);
173 $ilUser = $DIC->user();
175 $this->current_ass_id = $a_ass->
getId();
177 $tpl =
new ilTemplate(
"tpl.assignment_body.html",
true,
true,
"Modules/Exercise");
182 $info->setTableClass(
"");
183 if ($state->areInstructionsVisible()) {
190 if ($state->hasSubmissionStarted()) {
194 $tpl->setVariable(
"CONTENT", $info->getHTML());
207 if (count($inst) > 0) {
208 $a_info->
addSection($inst[
"instruction"][
"txt"]);
209 $a_info->
addProperty(
"", $inst[
"instruction"][
"value"]);
230 if ($state->getGeneralStart() > 0) {
231 $a_info->
addProperty($schedule[
"start_time"][
"txt"], $schedule[
"start_time"][
"value"]);
235 if ($state->getCommonDeadline()) {
236 $a_info->
addProperty($schedule[
"until"][
"txt"], $schedule[
"until"][
"value"]);
237 } elseif ($state->getRelativeDeadline()) {
239 if ($state->hasGenerallyStarted()) {
240 $ilCtrl->setParameterByClass(
"ilobjexercisegui",
"ass_id", $a_ass->
getId());
241 $but = $this->
ui->factory()->button()->primary($lng->
txt(
"exc_start_assignment"), $ilCtrl->getLinkTargetByClass(
"ilobjexercisegui",
"startAssignment"));
242 $ilCtrl->setParameterByClass(
"ilobjexercisegui",
"ass_id", $this->requested_ass_id);
243 $but = $this->
ui->renderer()->render($but);
246 $a_info->
addProperty($schedule[
"time_after_start"][
"txt"], $schedule[
"time_after_start"][
"value"] .
" " . $but);
247 if ($state->getLastSubmissionOfRelativeDeadline()) {
249 $lng->
txt(
"exc_rel_last_submission"),
250 $state->getLastSubmissionOfRelativeDeadlinePresentation()
255 if ($state->getOfficialDeadline() > $state->getCommonDeadline()) {
256 $a_info->
addProperty($schedule[
"individual_deadline"][
"txt"], $schedule[
"individual_deadline"][
"value"]);
259 if ($state->hasSubmissionStarted()) {
260 $a_info->
addProperty($schedule[
"time_to_send"][
"txt"], $schedule[
"time_to_send"][
"value"]);
274 if ($state->hasSubmissionEnded()) {
275 $b = $this->gui->link(
276 $lng->
txt(
"exc_list_submission"),
283 $lng->
txt(
"exc_public_submission"),
284 $lng->
txt(
"exc_msg_public_submission")
296 if (count($files) > 0) {
303 foreach ($files as $file) {
308 $ui_factory = $DIC->ui()->factory();
309 $ui_renderer = $DIC->ui()->renderer();
311 $output_filename = htmlspecialchars($file[
'name']);
313 if ($this->media_type->isImage($mime)) {
314 $item_id =
"il-ex-modal-img-" . $a_ass->
getId() .
"-" . $cnt;
317 $image = $ui_renderer->render($ui_factory->image()->responsive($file[
'fullpath'], $output_filename));
321 $modal->setId($item_id);
323 $modal->setBody($image);
324 $modal->setHeading($output_filename);
325 $modal = $modal->getHTML();
327 $img_tpl =
new ilTemplate(
"tpl.image_file.html",
true,
true,
"Modules/Exercise");
328 $img_tpl->setCurrentBlock(
"image_content");
329 $img_tpl->setVariable(
"MODAL", $modal);
330 $img_tpl->setVariable(
"ITEM_ID", $item_id);
331 $img_tpl->setVariable(
"IMAGE", $image);
332 $img_tpl->setvariable(
"IMAGE_LENS", $image_lens);
333 $img_tpl->setvariable(
"ALT_LENS", $lng->
txt(
"exc_fullscreen"));
334 $img_tpl->parseCurrentBlock();
336 $a_info->
addProperty($output_filename, $img_tpl->get());
337 } elseif ($this->media_type->isAudio($mime) || $this->media_type->isVideo($mime)) {
338 $media_tpl =
new ilTemplate(
"tpl.media_file.html",
true,
true,
"Modules/Exercise");
340 if ($this->media_type->isAudio($mime)) {
341 $p = $ui_factory->player()->audio($file[
'fullpath']);
343 $p = $ui_factory->player()->video($file[
'fullpath']);
345 $media_tpl->setVariable(
"MEDIA", $ui_renderer->render($p));
347 $but = $ui_factory->button()->shy(
348 $lng->
txt(
"download"),
349 $this->
getSubmissionLink(
"downloadFile", array(
"file" => urlencode($file[
"name"])))
351 $media_tpl->setVariable(
"DOWNLOAD_BUTTON", $ui_renderer->render($but));
352 $a_info->
addProperty($output_filename, $media_tpl->get());
377 ilExSubmissionGUI::getOverviewContent($a_info, $submission, $this->exc);
380 if ($submission->hasSubmitted()) {
381 $last_sub = $submission->getLastSubmission();
384 $a_info->
addProperty($lng->
txt(
"exc_last_submission"), $last_sub);
388 if ($this->exc->getShowSubmissions()) {
396 $show_global_feedback = ($state->hasSubmissionEndedForAllUsers() && $a_ass->
getFeedbackFile());
412 string $a_feedback_id,
413 bool $a_show_global_feedback
417 $feedback_file_manager = $this->service->domain()->assignment()->tutorFeedbackFile($a_ass->
getId());
418 $cnt_files = $feedback_file_manager->count($this->
user->getId());
423 if ($lpcomment !=
"" ||
425 $status !=
"notgraded" ||
427 $a_show_global_feedback) {
429 if ($lpcomment !=
"") {
431 $lng->
txt(
"exc_comment"),
437 $lng->
txt(
"exc_mark"),
442 if ($status !=
"" && $status !=
"notgraded") {
446 $img .
" " . $lng->
txt(
"exc_" . $status)
450 if ($cnt_files > 0) {
452 '<a id="fb' . $a_ass->
getId() .
'"></a>');
454 if ($cnt_files > 0) {
455 $files = $feedback_file_manager->getFiles($this->
user->getId());
456 foreach ($files as $file) {
459 $lng->
txt(
"download"),
460 $this->
getSubmissionLink(
"downloadFeedbackFile", array(
"file" => urlencode($file)))
467 if ($a_show_global_feedback) {
472 $lng->
txt(
"download"),
487 if ($a_deadline == 0) {
488 return $lng->
txt(
"exc_submit_convenience_no_deadline");
491 if ($a_deadline - time() <= 0) {
492 $time_str = $lng->
txt(
"exc_time_over_short");
502 array $a_params = null
506 if (is_array($a_params)) {
507 foreach ($a_params as $name => $value) {
512 $ilCtrl->setParameterByClass(
"ilexsubmissiongui",
"ass_id", $this->current_ass_id);
513 $url = $ilCtrl->getLinkTargetByClass([ilAssignmentPresentationGUI::class,
"ilexsubmissiongui"], $a_cmd);
514 $ilCtrl->setParameterByClass(
"ilexsubmissiongui",
"ass_id",
"");
516 if (is_array($a_params)) {
517 foreach ($a_params as $name => $value) {
518 $ilCtrl->setParameterByClass(
"ilexsubmissiongui", $name,
"");
535 return $icons->renderIcon(
536 $icons->getImagePathCompleted(),
537 $lng->
txt(
"exc_" . $status)
541 return $icons->renderIcon(
542 $icons->getImagePathFailed(),
543 $lng->
txt(
"exc_" . $status)
547 return $icons->renderIcon(
548 $icons->getImagePathNotAttempted(),
549 $lng->
txt(
"exc_" . $status)
addSubmissionFeedback(ilInfoScreenGUI $a_info, ilExAssignment $a_ass, string $a_feedback_id, bool $a_show_global_feedback)
static getOverviewContent(ilInfoScreenGUI $a_info, ilExSubmission $a_submission)
ILIAS Exercise InternalGUIService $gui
addPublicSubmissions(ilInfoScreenGUI $a_info, ilExAssignment $a_ass)
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 getImagePath(string $img, string $module_path="", string $mode="output", bool $offline=false)
get image path (for images located in a template directory)
getMemberStatus(?int $a_user_id=null)
addProperty(string $a_name, string $a_value, string $a_link="")
add a property to current section
MandatoryAssignmentsManager $mandatory_manager
static formatDate(ilDateTime $date, bool $a_skip_day=false, bool $a_include_wd=false, bool $include_seconds=false)
static getInstance(int $variant=ilLPStatusIcons::ICON_VARIANT_DEFAULT, ?\ILIAS\UI\Renderer $renderer=null, ?\ILIAS\UI\Factory $factory=null)
Exercise internal service.
addInstructions(ilInfoScreenGUI $a_info, ilExAssignment $a_ass)
setParameterByClass(string $a_class, string $a_parameter, $a_value)
loadLanguageModule(string $a_module)
Load language module.
addSchedule(ilInfoScreenGUI $a_info, ilExAssignment $a_ass)
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
GUI class for exercise assignments.
Provides fluid interface to RBAC services.
getOverviewBody(ilExAssignment $a_ass)
Get assignment body for overview.
addFiles(ilInfoScreenGUI $a_info, ilExAssignment $a_ass)
static getInstanceByIds(int $a_ass_id, int $a_user_id=0)
addSection(string $a_title)
getOverviewHeader(ilExAssignment $a_ass)
Get assignment header for overview.
const FEEDBACK_DATE_DEADLINE
addSubmission(ilInfoScreenGUI $a_info, ilExAssignment $a_ass)
getTimeString(int $a_deadline)
Get time string for deadline.
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
Manages random mandatory assignments of an exercise.
const FEEDBACK_DATE_CUSTOM
getIconForStatus(string $status, int $variant=ilLPStatusIcons::ICON_VARIANT_LONG)
Get the rendered icon for a status (failed, passed or not graded).
ILIAS MediaObjects MediaType MediaTypeManager $media_type
getSubmissionLink(string $a_cmd, array $a_params=null)