ILIAS  release_8 Revision v8.19
All Data Structures Namespaces Files Functions Variables Modules Pages
class.ilExcRandomAssignmentGUI.php
Go to the documentation of this file.
1 <?php
2 
21 
28 {
32  protected ilLanguage $lng;
33  protected ilCtrl $ctrl;
34  protected UIServices $ui;
35 
36  public function __construct(
37  UIServices $ui,
38  ilToolbarGUI $toolbar,
39  ilLanguage $lng,
40  ilCtrl $ctrl,
41  Mandatory\RandomAssignmentsManager $random_manager
42  ) {
43  $this->main_tpl = $ui->mainTemplate();
44  $this->ui = $ui;
45  $this->random_manager = $random_manager;
46  $this->toolbar = $toolbar;
47  $this->ctrl = $ctrl;
48  $this->lng = $lng;
49  }
50 
51  public function executeCommand(): void
52  {
53  $ctrl = $this->ctrl;
54 
55  $next_class = $ctrl->getNextClass($this);
56  $cmd = $ctrl->getCmd("startExercise");
57 
58  switch ($next_class) {
59  default:
60  if ($cmd === "startExercise") {
61  $this->$cmd();
62  }
63  }
64  }
65 
72  public function renderStartPage(): void
73  {
74  $toolbar = $this->toolbar;
75  $lng = $this->lng;
76 
77  $but = $this->ui->factory()->button()->primary(
78  $lng->txt("exc_start_exercise"),
79  $this->ctrl->getLinkTarget($this, "startExercise")
80  );
81  $toolbar->addComponent($but);
82  $info_gui = new ilInfoScreenGUI($this);
83 
84  $info_gui->addSection($lng->txt("exc_random_assignment"));
85  $info_gui->addProperty(
86  " ",
87  $lng->txt("exc_random_assignment_info")
88  );
89  $info_gui->addProperty(
90  $lng->txt("exc_rand_overall_ass"),
91  $this->random_manager->getTotalNumberOfAssignments()
92  );
93  $info_gui->addProperty(
94  $lng->txt("exc_rand_nr_mandatory"),
95  $this->random_manager->getNumberOfMandatoryAssignments()
96  );
97  $this->main_tpl->setContent($info_gui->getHTML());
98  }
99 
100  protected function startExercise(): void
101  {
102  $this->random_manager->startExercise();
103  $this->ctrl->redirectByClass("ilObjExerciseGUI", "showOverview");
104  }
105 }
Mandatory RandomAssignmentsManager $random_manager
Class ilInfoScreenGUI.
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...
getCmd(string $fallback_command=null)
addComponent(\ILIAS\UI\Component\Component $a_comp)
Provides fluid interface to RBAC services.
Definition: UIServices.php:23
getNextClass($a_gui_class=null)
Manages random mandatory assignments of an exercise (business logic)
UI for random assignment (ui)
__construct(UIServices $ui, ilToolbarGUI $toolbar, ilLanguage $lng, ilCtrl $ctrl, Mandatory\RandomAssignmentsManager $random_manager)
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
mainTemplate()
Get the ILIAS main template.
Definition: UIServices.php:53