3declare(strict_types=1);
 
   58        $this->file_upload = $fileupload;
 
   71        $document_already_exists = $this->document->getId() > 0;
 
   72        if ($document_already_exists) {
 
   73            $this->
setTitle($this->
lng->txt(
'webdav_form_edit_doc_head'));
 
   75            $this->
setTitle($this->
lng->txt(
'webdav_form_new_doc_head'));
 
   81        $title->setInfo($this->
lng->txt(
'webdav_form_document_title_info'));
 
   83        $title->setDisabled(!$this->is_editable);
 
   84        $title->setValue($this->document->getTitle());
 
   88        $document_label = $this->
lng->txt(
'webdav_form_document');
 
   89        $document_by_line = $this->
lng->txt(
'webdav_form_document_info');
 
   92            $this->
lng->txt(
'language'),
 
   95        $language_selection->setRequired(
true);
 
   98        foreach ($this->
lng->getInstalledLanguages() as 
$lng) {
 
   99            $options[
$lng] = $this->
lng->txt(
'meta_l_' . $lng, 
'meta');
 
  104        $language_selection->setOptions([
'' => $this->
lng->txt(
'please_choose')] + $options);
 
  105        $language_selection->setValue($this->document->getLanguage());
 
  107        $this->
addItem($language_selection);
 
  109        if ($document_already_exists) {
 
  111            $document_id->setValue((
string) $this->document->getId());
 
  114            $document_upload = 
new ilFileInputGUI($document_label, 
'document');
 
  115            $document_upload->setInfo($document_by_line);
 
  116            $document_upload->setRequired(
true);
 
  117            $document_upload->setDisabled(!$this->is_editable);
 
  118            $document_upload->setSuffixes([
'html', 
'htm', 
'txt']);
 
  119            $this->
addItem($document_upload);
 
  122        if ($this->is_editable) {
 
  131            $this->mount_instructions_repository->createMountInstructionsDocumentEntry($this->document);
 
  132        } 
catch (InvalidArgumentException 
$e) {
 
  134            $this->translated_error .= 
$e->getMessage();
 
  145            $this->mount_instructions_repository->updateMountInstructions($this->document);
 
  146        } 
catch (InvalidArgumentException 
$e) {
 
  148            $this->translated_error .= 
$e->getMessage();
 
  157        return strlen($this->translated_info) > 0;
 
  162        return strlen($this->translated_error) > 0;
 
  178            throw new InvalidArgumentException($this->
lng->txt(
'form_input_not_valid'));
 
  183        if (!$document_already_exists) {
 
  187        if (!$document_already_exists && !$upload_result->isOK()) {
 
  188            throw new InvalidArgumentException($this->
lng->txt(
'form_input_not_valid'));
 
  194        $modification_ts = $document_already_exists ? 
ilUtil::now() : $creation_ts;
 
  196        $last_modified_usr_id = $this->actor->getId();
 
  197        $sorting = $document_already_exists ? 
$document->
getSorting() : $this->mount_instructions_repository->getHighestSortingNumber() + 1;
 
  199        $mount_instruction_for_language_exists = $this->mount_instructions_repository->doMountInstructionsExistByLanguage($language);
 
  201        if (!$document_already_exists && $mount_instruction_for_language_exists) {
 
  202            throw new InvalidArgumentException($this->
lng->txt(
"webdav_choosen_language_already_used"));
 
  206            $mount_instruction_for_language_exists > 0 &&
 
  208            throw new InvalidArgumentException($this->
lng->txt(
"webdav_chosen_language_already_used"));
 
  211        if ($document_already_exists) {
 
  212            $raw_mount_instructions = 
'';
 
  213            $processed_mount_instructions = 
'';
 
  216            $document_processor = $upload_result->getMimeType() == 
'text/html' 
  219            $processed_mount_instructions = $document_processor->processMountInstructions($raw_mount_instructions);
 
  223            : $this->mount_instructions_repository->getNextMountInstructionsDocumentId();
 
  228            $raw_mount_instructions,
 
  229            json_encode($processed_mount_instructions),
 
  234            $last_modified_usr_id,
 
  241        if ($upload_result->
getName() === 
'') {
 
  242            throw new InvalidArgumentException(
'uploaded file has no name');
 
  245        if (!$upload_result->
isOK()) {
 
  247            throw new InvalidArgumentException($this->
lng->txt(
'form_input_not_valid'));
 
  250        $this->file_upload->moveOneFileTo(
 
  252            '/mount_instructions',
 
  258        $path_to_file = 
'/mount_instructions/' . $upload_result->
getName();
 
  259        if (!$this->tmp_filesystem->has($path_to_file)) {
 
  261            throw new InvalidArgumentException($this->
lng->txt(
'form_input_not_valid'));
 
  264        $raw_content = $this->tmp_filesystem->read($path_to_file);
 
  266        $this->tmp_filesystem->delete($path_to_file);
 
  273        if (!$this->file_upload->hasUploads()) {
 
  274            throw new InvalidArgumentException(
"webdav_error_no_upload");
 
  275        } elseif ($this->file_upload->hasBeenProcessed()) {
 
  276            throw new InvalidArgumentException(
"webdav_error_upload_already_processed");
 
  279        $this->file_upload->process();
 
  281        $upload_result = array_values($this->file_upload->getResults())[0];
 
  283        if (!$upload_result) {
 
  285            throw new InvalidArgumentException($this->
lng->txt(
'form_input_not_valid'));
 
  288        return $upload_result;
 
This class represents a text property in a property form.
 
static now()
Return current timestamp in Y-m-d H:i:s format.
 
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...
 
Interface for html sanitizing functionality.
 
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
 
Class FlySystemFileAccessTest \Provider\FlySystem @runTestsInSeparateProcesses @preserveGlobalState d...
 
__construct(Container $dic, ilPlugin $plugin)
@inheritDoc