ILIAS  trunk Revision v11.0_alpha-3011-gc6b235a2e85
class.ilAssignmentPresentationGUI.php
Go to the documentation of this file.
1<?php
2
19declare(strict_types=1);
20
23
28{
29 protected ilCtrl $ctrl;
31 protected \ILIAS\Exercise\Assignment\AssignmentManager $ass_manager;
32 protected int $ass_id;
33 protected \ILIAS\DI\UIServices $ui;
34 protected ilLanguage $lng;
35 protected ilTabsGUI $tabs;
36 protected \ILIAS\Exercise\Assignment\PanelBuilderUI $panel_builder;
37 protected ilObjUser $user;
41
42 public function __construct(
46 ) {
47 $this->domain_service = $domain_service;
48 $this->gui_service = $gui_service;
49 $this->ctrl = $gui_service->ctrl();
50 $this->main_tpl = $gui_service->ui()->mainTemplate();
51 $this->exc = $exc;
52 $this->user = $domain_service->user();
53 $this->ass_manager = $domain_service->assignment()->assignments(
54 $exc->getId(),
55 $this->user->getId()
56 );
57 $this->panel_builder = $gui_service->assignment()->panelBuilder(
58 $this->exc,
59 $domain_service->assignment()->mandatoryAssignments($this->exc)
60 );
61 $this->ass_id = $gui_service->request()->getAssId();
62 $this->ctrl->saveParameter($this, "ass_id");
63 $this->ui = $gui_service->ui();
64 $this->tabs = $gui_service->tabs();
65 $this->lng = $domain_service->lng();
66 }
67
68 public function executeCommand(): void
69 {
71
72 $next_class = $ctrl->getNextClass($this);
73 $cmd = $ctrl->getCmd("showAssignment");
74
75
76 switch ($next_class) {
77
78 case "ilexsubmissiongui":
79 $ctrl->setReturn($this, "");
80 $random_manager = $this->domain_service->assignment()->randomAssignments($this->exc);
81 if (!$random_manager->isAssignmentVisible($this->ass_id, $this->user->getId())) {
82 return;
83 }
84 $this->setTabs();
85 $this->tabs->activateTab("submission");
86 $sub_gui = $this->gui_service->getSubmissionGUI();
87 $this->ctrl->forwardCommand($sub_gui);
88 break;
89
90 default:
91 $this->ctrl->setParameterByClass(ilObjExerciseGUI::class, "from_overview", null);
92 if (in_array($cmd, ["showAssignment"])) {
93 $this->$cmd();
94 }
95 }
96 }
97
98 public function showAssignment(): void
99 {
100 $this->setTabs();
101 $this->tabs->activateTab("ass");
102 $r = $this->ui->renderer();
103 $ass = $this->ass_manager->get($this->ass_id);
104 $panel = $this->panel_builder->getPanel($ass, $this->user->getId());
105 $this->main_tpl->setContent($r->render($panel));
106 }
107
108 protected function setTabs(): void
109 {
110 $this->tabs->setBackTarget(
111 $this->lng->txt("exc_assignment_list"),
112 $this->ctrl->getLinkTargetByClass(ilObjExerciseGUI::class, "showOverview")
113 );
114 $ass = $this->ass_manager->get($this->ass_id);
115 foreach ($this->panel_builder->getPanelViews($ass, $this->user->getId()) as $view) {
116 $this->tabs->addTab(
117 $view["id"],
118 $view["txt"],
119 $view["url"]
120 );
121 }
122 }
123
124}
Exercise UI frontend presentation service class.
request(?array $query_params=null, ?array $post_data=null)
Get request wrapper.
@ilCtrl_Calls ilAssignmentPresentationGUI: ilExSubmissionGUI
__construct(ilObjExercise $exc, InternalDomainService $domain_service, InternalGUIService $gui_service)
ILIAS Exercise Assignment PanelBuilderUI $panel_builder
ILIAS Exercise Assignment AssignmentManager $ass_manager
Class ilCtrl provides processing control methods.
getNextClass($a_gui_class=null)
@inheritDoc
getCmd(?string $fallback_command=null)
@inheritDoc
setReturn(object $a_gui_obj, ?string $a_cmd=null)
@inheritDoc
language handling
Class ilObjExercise.
User class.
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...