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));
194 $this->ctrl->setParameterByClass(self::class,
'usr_id', $this->
getExaminee()->getId());
195 $action = $this->ctrl->getFormAction($this,
'update');
196 $this->ctrl->clearParameterByClass(self::class,
'usr_id');
200 $this->tpl->setContent($this->renderer->render($form));
203 protected function update()
206 ->buildForm($this->ctrl->getFormAction($this, self::CMD_UPDATE),
true)
207 ->withRequest($this->request)
211 $grading = $form->getData();
212 if (!is_null($grading)) {
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);
243 $this->ctrl->setParameterByClass(self::class,
'usr_id', $this->
getExaminee()->getId());
244 $action = $this->ctrl->getFormAction($this, self::CMD_SAVE_AMEND);
245 $this->ctrl->clearParameterByClass(self::class,
'usr_id');
248 $form = $this->
buildForm($action,
true,
true);
249 $this->tpl->setContent($this->renderer->render($form));
255 $file_name = $this->
getMember()->fileName();
267 ->buildForm($this->ctrl->getFormAction($this, self::CMD_AMEND),
true,
true)
268 ->withRequest($this->request)
271 $grading = $form->getData();
273 if (!is_null($grading)) {
274 if ($grading->getFile() ==
'') {
276 $storage->deleteCurrentFile();
285 ilUtil::sendSuccess($this->lng->txt(
'iass_amend_saved'),
true);
296 $this->input_factory->field(),
298 $this->refinery_factory,
301 (bool) $this->
getObject()->getSettings()->isEventTimePlaceRequired(),
306 $form = $this->input_factory->container()->form()->standard($form_action, [
$section]);
307 $form = $form->withAdditionalTransformation(
308 $this->refinery_factory->custom()->transformation(
309 function ($values) use ($amend) {
310 return array_shift($values);
319 if (!$this->mayBeEdited()) {
320 $this->handleAccessViolation();
324 $member = $this->getMember();
325 if (!$member->mayBeFinalized()) {
327 $this->redirect(
'edit');
332 $grading = $member->getGrading()->withFinalized(
true);
333 $member = $member->withGrading($grading);
334 $this->getObject()->membersStorage()->updateMember($member);
337 $this->redirect(
'edit');
341 if ($this->object->isActiveLP()) {
346 $member->maybeSendNotification($this->notificator);
349 $this->redirect(
'edit');
353 ilUtil::sendSuccess($this->lng->txt(
'iass_membership_finalized'),
true);
354 $this->redirect(
'view');
359 if (!$this->mayBeEdited()) {
360 $this->handleAccessViolation();
364 $message = $this->lng->txt(
'iass_finalize_user_qst');
365 $this->ctrl->setParameterByClass(self::class,
'usr_id', $this->getExaminee()->getId());
366 $finalize = $this->ctrl->getFormActionByClass(self::class, self::CMD_FINALIZE);
367 $cancel = $this->ctrl->getFormActionByClass(self::class, self::CMD_EDIT);
368 $this->ctrl->clearParameterByClass(self::class,
'usr_id');
371 $this->button_factory->standard($this->lng->txt(
'iass_confirm_finalize'), $finalize),
372 $this->button_factory->standard($this->lng->txt(
'iass_cancel'), $cancel)
375 $message_box = $this->messagebox_factory->confirmation(
$message)->withButtons($buttons);
377 $this->tpl->setContent($this->renderer->render($message_box));
382 bool $keep_examiner =
false,
385 $member = $this->getMember()
386 ->withGrading($grading)
390 $member = $member->withChangerId($this->
user->getId());
393 if (!$keep_examiner) {
394 $member = $member->withExaminerId($this->
user->getId());
396 $this->getObject()->membersStorage()->updateMember($member);
410 $this->upload->process();
411 $array = $this->upload->getResults();
415 $identifier = $this->uploadFile(
$result);
416 $status = HandlerResult::STATUS_OK;
419 $status = HandlerResult::STATUS_FAILED;
429 $status = HandlerResult::STATUS_FAILED;
430 $message = $this->lng->txt(
'iass_file_deleted');
432 if ($this->getFileName() == $identifier) {
434 $member = $this->getMember();
435 $grading = $member->getGrading()->
withFile(
null);
436 $member = $member->withGrading($grading);
437 $this->getObject()->membersStorage()->updateMember($member);
438 $status = HandlerResult::STATUS_OK;
452 throw new LogicException(
"Wrong filename $identifier");
455 $file_size = filesize($this->getFilePath());
457 $this->getFileIdentifierParameterName(),
470 $name = $this->getFileName();
472 $ids = array_filter($file_ids,
function ($id) {
479 if (is_null(
$name) || count($ids) === 0) {
483 if (!in_array(
$name, $file_ids)) {
484 throw new LogicException(
"Wrong filename " . $this->getFileName());
489 $this->getFileIdentifierParameterName(),
511 $this->ctrl->setParameter($this,
'usr_id', $this->getExaminee()->getId());
512 $link = $this->ctrl->getLinkTarget($this, self::CMD_UPLOAD);
513 $this->ctrl->setParameter($this,
'usr_id',
null);
523 $this->ctrl->setParameter($this,
'usr_id', $this->getExaminee()->getId());
524 $link = $this->ctrl->getLinkTarget($this, self::CMD_INFO);
525 $this->ctrl->setParameter($this,
'usr_id',
null);
535 $this->ctrl->setParameter($this,
'usr_id', $this->getExaminee()->getId());
536 $this->ctrl->setParameter($this, $this->getFileIdentifierParameterName(), $this->getFileName());
537 $link = $this->ctrl->getLinkTarget($this, self::CMD_REMOVE);
538 $this->ctrl->setParameter($this,
'usr_id',
null);
539 $this->ctrl->setParameter($this, $this->getFileIdentifierParameterName(),
null);
546 $storage = $this->getUserFileStorage();
548 $storage->deleteCurrentFile();
556 $storage = $this->getUserFileStorage();
557 $storage->deleteCurrentFile();
562 $path = $this->getFilePath();
563 if (is_null($path)) {
567 return end(explode(
'/', $path));
572 $storage = $this->getUserFileStorage();
573 if ($storage->isEmpty()) {
577 return $storage->getFilePath();
582 $this->ctrl->setParameterByClass(self::class,
'usr_id', $this->getExaminee()->getId());
583 $this->ctrl->redirect($this, $cmd);
588 $this->
object = $object;
593 return $this->object;
598 $this->parent_gui = $parent_gui;
603 return $this->parent_gui;
608 if (is_null($this->iass_access)) {
609 $this->iass_access = $this->getObject()->accessHandler();
611 return $this->iass_access;
621 $storage = $this->getObject()->getFileStorage();
622 $storage->
setUserId($this->getExaminee()->getId());
628 return $this->getObject()->membersStorage()->loadMember(
636 $member = $this->getMember();
637 if ($member->fileName() !=
'') {
639 $btn->setCaption(
'download_assessment_paper');
640 $this->ctrl->setParameter($this,
'usr_id', $this->getExaminee()->getId());
641 $btn->setUrl($this->ctrl->getLinkTarget($this, self::CMD_DOWNLOAD_FILE,
false,
true));
642 $this->ctrl->setParameter($this,
'usr_id',
null);
643 $this->toolbar->addButtonInstance($btn);
649 return $this->getAccessHandler()->isSystemAdmin() || (!$this->isFinalized() && $this->userMayGrade());
655 $this->getAccessHandler()->isSystemAdmin() ||
656 ($this->isFinalized() && ($this->userMayGrade() || $this->userMayView()))
662 return $this->getAccessHandler()->isSystemAdmin() || ($this->isFinalized() && $this->userMayAmend());
668 $this->getAccessHandler()->isSystemAdmin() ||
669 (!$this->targetWasEditedByOtherUser($this->getMember()) && $this->getAccessHandler()->mayGradeUser())
675 return $this->getAccessHandler()->isSystemAdmin() || $this->getAccessHandler()->mayViewUser();
680 return $this->getAccessHandler()->isSystemAdmin() || $this->getAccessHandler()->mayAmendGradeUser();
693 return $this->getMember()->finalized();
698 $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.
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)
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.