3declare(strict_types=1);
27use GuzzleHttp\Psr7\ServerRequest;
110 $cmd = $this->
ctrl->getCmd();
123 case AbstractCtrlAwareUploadHandler::CMD_UPLOAD:
124 case AbstractCtrlAwareUploadHandler::CMD_REMOVE:
125 case AbstractCtrlAwareUploadHandler::CMD_INFO:
126 parent::executeCommand();
129 throw new LogicException(
"Unknown command $cmd");
133 protected function view(): void
140 $this->tpl->setContent($this->renderer->render($form));
143 protected function edit(): void
152 $this->tpl->setContent($this->renderer->render($form));
155 protected function update(): void
159 ->withRequest($this->request)
163 $grading = $form->getData();
164 if (is_null($grading)) {
165 $this->tpl->setContent($this->renderer->render($form));
170 $storage->deleteAllFilesBut($grading->getFile());
172 if ($grading->isFinalized()) {
173 $not_finalized_grading = $grading->withFinalized(
false);
185 $this->tpl->setOnScreenMessage(
"success", $this->
lng->txt(
'iass_membership_saved'),
true);
186 $this->
ctrl->redirectByClass(ilIndividualAssessmentMembersGUI::class,
'view');
198 $form->withSubmitCaption($this->
lng->txt(
"save_amend"));
199 $this->tpl->setContent($this->renderer->render($form));
205 $action = $this->
ctrl->getFormAction($this, $cmd);
206 $this->
ctrl->clearParameterByClass(self::class,
'usr_id');
214 $file_name = $this->
getMember()->fileName();
226 ->buildForm($this->
ctrl->getFormAction($this, self::CMD_AMEND),
true,
true)
227 ->withRequest($this->request)
230 $grading = $form->getData();
232 if (!is_null($grading)) {
236 $storage->deleteAllFilesBut($grading->getFile());
242 $this->tpl->setOnScreenMessage(
"success", $this->
lng->txt(
'iass_amend_saved'),
true);
243 $this->
ctrl->redirectByClass(ilIndividualAssessmentMembersGUI::class,
'view');
252 $date_format = $this->date_formatter->getUserDateFormat($this->
user, false);
254 $section = $this->
getMember()->getGrading()->toFormInput(
255 $this->input_factory->field(),
258 $this->refinery_factory,
261 $this->getPossibleLPStates(),
263 $this->getObject()->getSettings()->isEventTimePlaceRequired(),
267 $form = $this->input_factory->container()->form()->standard($form_action, [$section]);
268 return $form->withAdditionalTransformation(
269 $this->refinery_factory->custom()->transformation(
271 return array_shift($values);
279 if (!$this->mayBeEdited()) {
280 $this->handleAccessViolation();
284 $member = $this->getMember();
285 if (!$member->mayBeFinalized()) {
286 $this->tpl->setOnScreenMessage(
"failure", $this->
lng->txt(
'iass_may_not_finalize'),
true);
287 $this->redirect(
'edit');
292 $grading = $member->getGrading()->withFinalized(
true);
293 $member = $member->withGrading($grading);
294 $this->getObject()->membersStorage()->updateMember($member);
296 $this->tpl->setOnScreenMessage(
"failure",
$e->getMessage(),
true);
297 $this->redirect(
'edit');
301 if ($this->
object->isActiveLP()) {
306 $member->maybeSendNotification($this->notificator);
307 $this->
ctrl->redirectByClass(ilIndividualAssessmentMembersGUI::class,
'view');
309 $this->tpl->setOnScreenMessage(
"failure",
$e->getMessage(),
true);
310 $this->redirect(
'edit');
314 $this->tpl->setOnScreenMessage(
"success", $this->
lng->txt(
'iass_membership_finalized'),
true);
315 $this->redirect(
'view');
320 if (!$this->mayBeEdited()) {
321 $this->handleAccessViolation();
325 $message = $this->
lng->txt(
'iass_finalize_user_qst');
326 $this->
ctrl->setParameterByClass(self::class,
'usr_id', $this->getExaminee()->
getId());
327 $finalize = $this->
ctrl->getFormActionByClass(self::class, self::CMD_FINALIZE);
328 $cancel = $this->
ctrl->getFormActionByClass(self::class, self::CMD_EDIT);
329 $this->
ctrl->clearParameterByClass(self::class,
'usr_id');
332 $this->button_factory->standard($this->
lng->txt(
'iass_confirm_finalize'), $finalize),
333 $this->button_factory->standard($this->
lng->txt(
'iass_cancel'), $cancel)
336 $message_box = $this->messagebox_factory->confirmation(
$message)->withButtons($buttons);
338 $this->tpl->setContent($this->renderer->render($message_box));
343 bool $keep_examiner =
false,
346 $member = $this->getMember()
347 ->withGrading($grading)
351 $member = $member->withChangerId($this->
user->getId());
354 if (!$keep_examiner) {
355 $member = $member->withExaminerId($this->
user->getId());
357 $this->getObject()->membersStorage()->updateMember($member);
372 $array = $this->
upload->getResults();
373 $result = end($array);
375 $storage = $this->getUserFileStorage();
379 $identifier = $storage->uploadFile($result);
380 $status = HandlerResult::STATUS_OK;
383 $status = HandlerResult::STATUS_FAILED;
385 $message = $result->getStatus()->getMessage();
393 $status = HandlerResult::STATUS_OK;
401 $storage = $this->getUserFileStorage();
402 $path = $storage->getAbsolutePath() .
"/" . $identifier;
404 $this->getFileIdentifierParameterName(),
408 pathinfo(
$path, PATHINFO_EXTENSION)
414 $file_ids = array_filter($file_ids, fn (
$id) =>
$id !==
"");
415 $path = $this->getUserFileStorage()->getAbsolutePath();
416 return array_map(
function (
$id) use (
$path) {
418 $this->getFileIdentifierParameterName(),
422 pathinfo(
$path .
"/" .
$id, PATHINFO_EXTENSION)
434 $this->
ctrl->setParameter($this,
'usr_id', $this->getExaminee()->
getId());
435 $link = $this->
ctrl->getLinkTarget($this, self::CMD_UPLOAD);
436 $this->
ctrl->setParameter($this,
'usr_id',
null);
443 $this->
ctrl->setParameter($this,
'usr_id', $this->getExaminee()->
getId());
444 $link = $this->
ctrl->getLinkTarget($this, self::CMD_INFO);
445 $this->
ctrl->setParameter($this,
'usr_id',
null);
452 $this->
ctrl->setParameterByClass(self::class,
'usr_id', $this->getExaminee()->
getId());
453 $this->
ctrl->redirect($this, $cmd);
458 $this->
object = $object;
463 return $this->object;
468 $this->parent_gui = $parent_gui;
473 return $this->parent_gui;
478 if (is_null($this->iass_access)) {
479 $this->iass_access = $this->getObject()->accessHandler();
481 return $this->iass_access;
486 return new ilObjUser($this->request_wrapper->retrieve(
'usr_id', $this->refinery->kindlyTo()->int()));
491 $storage = $this->getObject()->getFileStorage();
498 return $this->getObject()->membersStorage()->loadMember(
506 $member = $this->getMember();
507 if ($member->fileName() !=
'') {
509 $btn->setCaption(
'download_assessment_paper');
510 $this->
ctrl->setParameter($this,
'usr_id', $this->getExaminee()->
getId());
511 $btn->setUrl($this->
ctrl->getLinkTarget($this, self::CMD_DOWNLOAD_FILE,
"",
false,
true));
512 $this->
ctrl->setParameter($this,
'usr_id',
null);
513 $this->
toolbar->addButtonInstance($btn);
519 return $this->getAccessHandler()->isSystemAdmin() || (!$this->isFinalized() && $this->userMayGrade());
525 $this->getAccessHandler()->isSystemAdmin() ||
526 ($this->isFinalized() && ($this->userMayGrade() || $this->userMayView()))
532 return $this->getAccessHandler()->isSystemAdmin() || ($this->isFinalized() && $this->userMayAmend());
538 $this->getAccessHandler()->isSystemAdmin() ||
539 (!$this->targetWasEditedByOtherUser($this->getMember()) && $this->getAccessHandler()->mayGradeUser($this->getMember()->
id()))
545 return $this->getAccessHandler()->mayViewUser($this->getMember()->
id());
550 return $this->getAccessHandler()->mayAmendAllUsers();
563 return $this->getMember()->finalized();
568 $this->error_object->raiseError($this->
lng->txt(
"msg_no_perm_read"), $this->error_object->WARNING);
$id
plugin.php for ilComponentBuildPluginInfoObjectiveTest::testAddPlugins
static return function(ContainerConfigurator $containerConfigurator)
Builds a Color from either hex- or rgb values.
Class ilCtrlAwareUploadHandler.
Class BasicFileInfoResult.
Class BasicHandlerResult.
Class ilCtrl provides processing control methods.
Error Handling & global info handling uses PEAR error class.
static deliverFileLegacy(string $a_file, ?string $a_filename=null, ?string $a_mime=null, ?bool $isInline=false, ?bool $removeAfterDelivery=false, ?bool $a_exit_after=true)
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
Handles the file upload and folder creation for files uploaded in grading form.
setUserId(int $user_id)
Set the user id for an extra folder of each participant in the IA.
static updateLPStatusOfMember(ilIndividualAssessmentMember $member)
ILIAS Refinery Factory $refinery
buildForm(string $form_action, bool $may_be_edited, bool $amend=false)
ILIAS HTTP Wrapper RequestWrapper $request_wrapper
Refinery Factory $refinery_factory
ilIndividualAssessmentDateFormatter $date_formatter
Button Factory $button_factory
Data Factory $data_factory
getInfoForExistingFiles(array $file_ids)
getFormActionForCommand(string $cmd)
getUploadURL()
@inheritDoc
__construct(ilCtrl $ctrl, ilLanguage $lng, ilGlobalPageTemplate $tpl, ilObjUser $user, Input\Factory $input_factory, MessageBox\Factory $messagebox_factory, Button\Factory $button_factory, Refinery\Factory $refinery_factory, Data\Factory $data_factory, Renderer $renderer, ServerRequest $request, ilIndividualAssessmentPrimitiveInternalNotificator $notificator, ilToolbarGUI $toolbar, ilObjIndividualAssessment $object, ilErrorHandling $error_object, ILIAS\Refinery\Factory $refinery, ILIAS\HTTP\Wrapper\RequestWrapper $request_wrapper, ilIndividualAssessmentDateFormatter $date_formatter)
getFileIdentifierParameterName()
@inheritDoc
saveMember(ilIndividualAssessmentUserGrading $grading, bool $keep_examiner=false, bool $amend=false)
setObject(ilObjIndividualAssessment $object)
ilObjIndividualAssessment $object
MessageBox Factory $messagebox_factory
Input Factory $input_factory
ilGlobalPageTemplate $tpl
setParentGUI(ilIndividualAssessmentMembersGUI $parent_gui)
ilIndividualAssessmentMembersGUI $parent_gui
ilErrorHandling $error_object
executeCommand()
Since this is a ilCtrl aware UploadHandler executeCommand MUST be implemented.
ilIndividualAssessmentPrimitiveInternalNotificator $notificator
getInfoResult(string $identifier)
getExistingFileInfoURL()
@inheritDoc
targetWasEditedByOtherUser(ilIndividualAssessmentMember $member)
const CMD_FINALIZE_CONFIRMATION
getRemoveResult(string $identifier)
ilIndividualAssessmentAccessHandler $iass_access
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
For the purpose of streamlining the grading and learning-process status definition outside of tests,...
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
Interface FileInfoResult.
Interface RequestWrapper.
This is how a factory for Message Boxes looks like.
An entity that renders components to a string output.
__construct(Container $dic, ilPlugin $plugin)
@inheritDoc
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
Class ChatMainBarProvider \MainMenu\Provider.