19declare(strict_types=1);
32use Psr\Http\Message\ServerRequestInterface;
42 private readonly UIFactory $ui_factory,
44 private readonly \
ilObjUser $current_user,
57 return $this->test_obj->getEnableProcessingTime()
58 && $this->test_access->checkManageParticipantsAccess();
70 ->withParameter($action_token, self::
ACTION_ID)
78 array $selected_participants,
79 bool $all_participants_selected
81 $has_different_extra_time = $this->resolveHasDifferentExtraTime($selected_participants);
82 $participant_rows = array_map(
87 sprintf($this->
lng->txt(
'already_added_extra_time'), $participant->
getExtraTime())
89 $selected_participants
92 return $this->ui_factory->modal()->roundtrip(
93 $this->
lng->txt(
'extratime'),
95 $this->ui_factory->messageBox()->info(
97 $this->resolveInfoMessage(
98 $selected_participants,
99 $all_participants_selected,
100 $has_different_extra_time
104 $this->ui_factory->listing()->unordered($participant_rows)
107 'extra_time' => $this->ui_factory->input()->field()->numeric(
108 $this->lng->txt(
'extratime')
109 )->withRequired(
true)
110 ->withAdditionalTransformation($this->refinery->int()->isGreaterThan(0))
113 $this->lng->txt(
'extra_time_byline')
116 $url_builder->
buildURI()->__toString()
117 )->withSubmitLabel($this->
lng->txt(
'add'));
122 ServerRequestInterface $request,
123 array $selected_participants,
124 bool $all_participants_selected
126 if (!$this->test_access->checkManageParticipantsAccess()) {
127 $this->tpl->setOnScreenMessage(
129 $this->
lng->txt(
'no_permission'),
134 $modal = $this->getModal(
136 $selected_participants,
137 $all_participants_selected
138 )->withRequest($request);
140 $data = $modal->getData();
141 if (
$data ===
null) {
142 return $modal->withOnLoad($modal->getShowSignal());
145 $this->saveExtraTime($selected_participants,
$data[
'extra_time']);
147 $this->tpl->setOnScreenMessage(
149 $this->
lng->txt(
'extratime_added'),
161 array $selected_participants,
162 bool $all_participants_selected,
163 bool $has_different_extra_time
165 if ($all_participants_selected) {
166 return 'extra_time_for_all_participants';
169 if (count($selected_participants) === 1) {
170 return 'extra_time_for_single_participant';
172 if ($has_different_extra_time) {
173 return 'extra_time_for_selected_participants_different';
176 return 'extra_time_for_selected_participants';
184 return count(array_unique(array_map(
195 foreach ($participants as $participant) {
196 $this->participant_repository->updateExtraTime($participant->withAddedExtraTime($minutes));
199 if ($this->test_obj->getTestLogger()->isLoggingEnabled()) {
200 $this->test_obj->getTestLogger()->logTestAdministrationInteraction(
201 $this->test_obj->getTestLogger()->getInteractionFactory()->buildTestAdministrationInteraction(
202 $this->test_obj->getRefId(),
203 $this->current_user->getId(),
204 TestAdministrationInteractionTypes::EXTRA_TIME_ADDED,
206 AdditionalInformationGenerator::KEY_USERS => array_map(
210 AdditionalInformationGenerator::KEY_TEST_ADDED_PROCESSING_TIME => $minutes
Builds a Color from either hex- or rgb values.
buildURI()
Get a URI representation of the full URL including query string and fragment/hash.
return['delivery_method'=> 'php',]
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
const MESSAGE_TYPE_SUCCESS
const MESSAGE_TYPE_FAILURE
This describes commonalities between the different modals.
TestAdministrationInteractionTypes
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
if(!file_exists('../ilias.ini.php'))