4declare(strict_types=1);
12use GuzzleHttp\Psr7\ServerRequest;
154 $cmd = $this->ctrl->getCmd();
167 case AbstractCtrlAwareUploadHandler::CMD_UPLOAD:
168 case AbstractCtrlAwareUploadHandler::CMD_REMOVE:
169 case AbstractCtrlAwareUploadHandler::CMD_INFO:
170 parent::executeCommand();
173 throw new LogicException(
"Unknown command $cmd");
184 $this->tpl->setContent($this->renderer->render($form));
196 $this->tpl->setContent($this->renderer->render($form));
199 protected function update()
203 ->withRequest($this->request)
207 $grading = $form->getData();
208 if (is_null($grading)) {
209 $this->tpl->setContent($this->renderer->render($form));
213 if ($grading->getFile() ==
'') {
215 $storage->deleteCurrentFile();
218 if ($grading->isFinalized()) {
219 $not_finalized_grading = $grading->withFinalized(
false);
231 ilUtil::sendSuccess($this->lng->txt(
'iass_membership_saved'),
true);
245 $this->tpl->setContent($this->renderer->render($form));
250 $this->ctrl->setParameterByClass(self::class,
'usr_id', $this->
getExaminee()->getId());
251 $action = $this->ctrl->getFormAction($this, $cmd);
252 $this->ctrl->clearParameterByClass(self::class,
'usr_id');
260 $file_name = $this->
getMember()->fileName();
272 ->buildForm($this->ctrl->getFormAction($this, self::CMD_AMEND),
true,
true)
273 ->withRequest($this->request)
276 $grading = $form->getData();
278 if (!is_null($grading)) {
279 if ($grading->getFile() ==
'') {
281 $storage->deleteCurrentFile();
290 ilUtil::sendSuccess($this->lng->txt(
'iass_amend_saved'),
true);
301 $this->input_factory->field(),
304 $this->refinery_factory,
307 (bool) $this->
getObject()->getSettings()->isEventTimePlaceRequired(),
312 $form = $this->input_factory->container()->form()->standard($form_action, [
$section]);
313 $form = $form->withAdditionalTransformation(
314 $this->refinery_factory->custom()->transformation(
315 function ($values) use ($amend) {
316 return array_shift($values);
325 if (!$this->mayBeEdited()) {
326 $this->handleAccessViolation();
330 $member = $this->getMember();
331 if (!$member->mayBeFinalized()) {
333 $this->redirect(
'edit');
338 $grading = $member->getGrading()->withFinalized(
true);
339 $member = $member->withGrading($grading);
340 $this->getObject()->membersStorage()->updateMember($member);
343 $this->redirect(
'edit');
347 if ($this->object->isActiveLP()) {
352 $member->maybeSendNotification($this->notificator);
355 $this->redirect(
'edit');
359 ilUtil::sendSuccess($this->lng->txt(
'iass_membership_finalized'),
true);
360 $this->redirect(
'view');
365 if (!$this->mayBeEdited()) {
366 $this->handleAccessViolation();
370 $message = $this->lng->txt(
'iass_finalize_user_qst');
371 $this->ctrl->setParameterByClass(self::class,
'usr_id', $this->getExaminee()->getId());
372 $finalize = $this->ctrl->getFormActionByClass(self::class, self::CMD_FINALIZE);
373 $cancel = $this->ctrl->getFormActionByClass(self::class, self::CMD_EDIT);
374 $this->ctrl->clearParameterByClass(self::class,
'usr_id');
377 $this->button_factory->standard($this->lng->txt(
'iass_confirm_finalize'), $finalize),
378 $this->button_factory->standard($this->lng->txt(
'iass_cancel'), $cancel)
381 $message_box = $this->messagebox_factory->confirmation(
$message)->withButtons($buttons);
383 $this->tpl->setContent($this->renderer->render($message_box));
388 bool $keep_examiner =
false,
391 $member = $this->getMember()
392 ->withGrading($grading)
396 $member = $member->withChangerId($this->
user->getId());
399 if (!$keep_examiner) {
400 $member = $member->withExaminerId($this->
user->getId());
402 $this->getObject()->membersStorage()->updateMember($member);
416 $this->upload->process();
417 $array = $this->upload->getResults();
421 $identifier = $this->uploadFile(
$result);
422 $status = HandlerResult::STATUS_OK;
425 $status = HandlerResult::STATUS_FAILED;
435 $status = HandlerResult::STATUS_FAILED;
436 $message = $this->lng->txt(
'iass_file_deleted');
438 if ($this->getFileName() == $identifier) {
440 $member = $this->getMember();
441 $grading = $member->getGrading()->
withFile(
null);
442 $member = $member->withGrading($grading);
443 $this->getObject()->membersStorage()->updateMember($member);
444 $status = HandlerResult::STATUS_OK;
458 throw new LogicException(
"Wrong filename $identifier");
461 $file_size = filesize($this->getFilePath());
463 $this->getFileIdentifierParameterName(),
476 $name = $this->getFileName();
478 $ids = array_filter($file_ids,
function ($id) {
485 if (is_null(
$name) || count($ids) === 0) {
489 if (!in_array(
$name, $file_ids)) {
490 throw new LogicException(
"Wrong filename " . $this->getFileName());
495 $this->getFileIdentifierParameterName(),
517 $this->ctrl->setParameter($this,
'usr_id', $this->getExaminee()->getId());
518 $link = $this->ctrl->getLinkTarget($this, self::CMD_UPLOAD);
519 $this->ctrl->setParameter($this,
'usr_id',
null);
529 $this->ctrl->setParameter($this,
'usr_id', $this->getExaminee()->getId());
530 $link = $this->ctrl->getLinkTarget($this, self::CMD_INFO);
531 $this->ctrl->setParameter($this,
'usr_id',
null);
541 $this->ctrl->setParameter($this,
'usr_id', $this->getExaminee()->getId());
542 $this->ctrl->setParameter($this, $this->getFileIdentifierParameterName(), $this->getFileName());
543 $link = $this->ctrl->getLinkTarget($this, self::CMD_REMOVE);
544 $this->ctrl->setParameter($this,
'usr_id',
null);
545 $this->ctrl->setParameter($this, $this->getFileIdentifierParameterName(),
null);
552 $storage = $this->getUserFileStorage();
554 $storage->deleteCurrentFile();
557 return $storage->getFileName();
562 $storage = $this->getUserFileStorage();
563 $storage->deleteCurrentFile();
568 $path = $this->getFilePath();
569 if (is_null($path)) {
573 return end(explode(
'/', $path));
578 $storage = $this->getUserFileStorage();
579 if ($storage->isEmpty()) {
583 return $storage->getFilePath();
588 $this->ctrl->setParameterByClass(self::class,
'usr_id', $this->getExaminee()->getId());
589 $this->ctrl->redirect($this, $cmd);
594 $this->
object = $object;
599 return $this->object;
604 $this->parent_gui = $parent_gui;
609 return $this->parent_gui;
614 if (is_null($this->iass_access)) {
615 $this->iass_access = $this->getObject()->accessHandler();
617 return $this->iass_access;
627 $storage = $this->getObject()->getFileStorage();
628 $storage->
setUserId($this->getExaminee()->getId());
634 return $this->getObject()->membersStorage()->loadMember(
642 $member = $this->getMember();
643 if ($member->fileName() !=
'') {
645 $btn->setCaption(
'download_assessment_paper');
646 $this->ctrl->setParameter($this,
'usr_id', $this->getExaminee()->getId());
647 $btn->setUrl($this->ctrl->getLinkTarget($this, self::CMD_DOWNLOAD_FILE,
false,
true));
648 $this->ctrl->setParameter($this,
'usr_id',
null);
649 $this->toolbar->addButtonInstance($btn);
655 return $this->getAccessHandler()->isSystemAdmin() || (!$this->isFinalized() && $this->userMayGrade());
661 $this->getAccessHandler()->isSystemAdmin() ||
662 ($this->isFinalized() && ($this->userMayGrade() || $this->userMayView()))
668 return $this->getAccessHandler()->isSystemAdmin() || ($this->isFinalized() && $this->userMayAmend());
674 $this->getAccessHandler()->isSystemAdmin() ||
675 (!$this->targetWasEditedByOtherUser($this->getMember()) && $this->getAccessHandler()->mayGradeUser())
681 return $this->getAccessHandler()->isSystemAdmin() || $this->getAccessHandler()->mayViewUser();
686 return $this->getAccessHandler()->isSystemAdmin() || $this->getAccessHandler()->mayAmendGradeUser();
699 return $this->getMember()->finalized();
704 $this->error_object->raiseError($this->txt(
"msg_no_perm_read"), $this->error_object->WARNING);
An exception for terminatinating execution or to throw for unit testing.
Builds a Color from either hex- or rgb values.
Class ilCtrlAwareUploadHandler.
Class BasicFileInfoResult.
Class BasicHandlerResult.
This class provides processing control methods.
Class ilGlobalPageTemplate.
Deal with ilias rbac-system
Handles the fileupload and folder creation for files uploaded in grading form.
setUserId($user_id)
Set the user id for an extra folder of each participant in the IA.
static updateLPStatusOfMember(ilIndividualAssessmentMember $member)
buildForm(string $form_action, bool $may_be_edited, bool $amend=false)
getInfoForExistingFiles(array $file_ids)
@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)
getFormActionForCommand(string $cmd)
getUploadURL()
@inheritDoc
getFileIdentifierParameterName()
@inheritDoc
saveMember(ilIndividualAssessmentUserGrading $grading, bool $keep_examiner=false, bool $amend=false)
setObject(ilObjIndividualAssessment $object)
getFileRemovalURL()
@inheritDoc
setParentGUI(ilIndividualAssessmentMembersGUI $parent_gui)
executeCommand()
Since this is a ilCtrl aware UploadHandler executeCommand MUST be implemented.
getInfoResult(string $identifier)
@inheritDoc
getExistingFileInfoURL()
@inheritDoc
targetWasEditedByOtherUser(ilIndividualAssessmentMember $member)
const CMD_FINALIZE_CONFIRMATION
getRemoveResult(string $identifier)
uploadFile(UploadResult $result)
Edit the record of a user, set LP.
For the purpose of streamlining the grading and learning-process status definition outside of tests,...
Notificate user using internal mail system.
For the purpose of streamlining the grading and learning-process status definition outside of tests,...
static sendFailure($a_info="", $a_keep=false)
Send Failure Message to Screen.
static deliverFile( $a_file, $a_filename, $a_mime='', $isInline=false, $removeAfterDelivery=false, $a_exit_after=true)
deliver file for download via browser.
Interface FileInfoResult.
A component is the most general form of an entity in the UI.
An entity that renders components to a string output.
__construct(Container $dic, ilPlugin $plugin)
@inheritDoc
Class ChatMainBarProvider \MainMenu\Provider.