ILIAS  trunk Revision v12.0_alpha-1540-g00f839d5fa1
ObjectInstructions.php
Go to the documentation of this file.
1<?php
2
19declare(strict_types=1);
20
21namespace ILIAS\WebDAV\Mount;
22
23use ilObject;
24use ilSetting;
25
27{
28 protected int $obj_id;
29 protected string $obj_title;
30
31 public function __construct(
32 Repository $a_repo,
33 UriBuilder $a_uri_builder,
34 ilSetting $a_settings,
35 string $language,
36 protected int $ref_id
37 ) {
38 parent::__construct($a_repo, $a_uri_builder, $a_settings, $language);
39
40 // TODO: Change this to be more unit testable!
41 $this->obj_id = ilObject::_lookupObjectId($this->ref_id);
42 $this->obj_title = ilObject::_lookupTitle($this->obj_id);
43 }
44
45 protected function fillPlaceholdersForMountInstructions(array $mount_instructions): array
46 {
47 foreach ($mount_instructions as $title => $mount_instruction) {
48 $mount_instruction = str_replace(
49 [
50 '[WEBFOLDER_ID]',
51 '[WEBFOLDER_TITLE]',
52 '[WEBFOLDER_URI]',
53 '[WEBFOLDER_URI_KONQUEROR]',
54 '[WEBFOLDER_URI_NAUTILUS]',
55 '[ADMIN_MAIL]',
56 ],
57 [
58 (string) $this->ref_id,
59 $this->obj_title,
60 $this->uri_builder->getWebDavDefaultUri($this->ref_id),
61 $this->uri_builder->getWebDavKonquerorUri($this->ref_id),
62 $this->uri_builder->getWebDavNautilusUri($this->ref_id),
63 $this->settings->get('admin_email'),
64 ],
65 $mount_instruction
66 );
67
68 $mount_instructions[$title] = $mount_instruction;
69 }
70
71 return $mount_instructions;
72 }
73}
__construct(Repository $a_repo, UriBuilder $a_uri_builder, ilSetting $a_settings, string $language, protected int $ref_id)
fillPlaceholdersForMountInstructions(array $mount_instructions)
Class ilObject Basic functions for all objects.
static _lookupObjectId(int $ref_id)
static _lookupTitle(int $obj_id)
ILIAS Setting Class.
$ref_id
Definition: ltiauth.php:66
__construct(Container $dic, ilPlugin $plugin)
@inheritDoc