4 declare(strict_types=1);
50 $this->webDirectory = $DIC->filesystem()->web();
51 $this->logger = $DIC->logger()->otpl();
63 $this->logger->warning(
'File upload already processed: ' . $e->getMessage());
88 $this->webDirectory->write(
89 self::WEBDIR_PREFIX .
'/' . $this->
settings->getId() .
'.svg',
95 $this->logger->warning(
'Error writing svg image from xml: ' . $e->getMessage());
104 if ($this->webDirectory->has(self::WEBDIR_PREFIX .
'/' . $this->settings->getIconIdentifier() .
'.svg')) {
118 $this->webDirectory->copy(
120 self::WEBDIR_PREFIX .
'/' . $this->
settings->getId() .
'.svg' 123 $this->logger->warning(
'Copying icon failed with message: ' . $e->getMessage());
128 $this->
settings->setIconIdentifier((
string) 0 );
136 public function delete()
138 if ($this->webDirectory->has(self::WEBDIR_PREFIX .
'/' . $this->settings->getIconIdentifier() .
'.svg')) {
140 $this->webDirectory->delete(self::WEBDIR_PREFIX .
'/' . $this->
settings->getIconIdentifier() .
'.svg');
141 $this->
settings->setIconIdentifier(
'');
144 $this->logger->warning(
'Deleting icon dfailed with message: ' . $e->getMessage());
154 if (!$this->webDirectory->has(self::WEBDIR_PREFIX)) {
156 $this->webDirectory->createDir(self::WEBDIR_PREFIX);
158 $this->logger->error(
'Creating icon directory failed with message: ' . $e->getMessage());
160 $this->logger->warning(
'Creating icon directory failed with message: ' . $e->getMessage());
171 if ($this->
settings->getIconIdentifier()) {
173 if ($this->webDirectory->has(self::WEBDIR_PREFIX .
'/' . $this->settings->getIconIdentifier() .
'.svg')) {
174 $writer->
xmlElement(
'icon', [], $this->webDirectory->read(
175 self::WEBDIR_PREFIX .
'/' . $this->settings->getIconIdentifier() .
'.svg' 179 $this->logger->warning(
'Export xml failed with message: ' . $e->getMessage());
process()
Invokes all preprocessors for each uploaded file in the sequence they got registered.
Class IOException Indicates general problems with the input or output operations. ...
Class IllegalStateException The IllegalStateException indicates a wrong state of the object...
hasUploads()
Return (bool)true if one ore more file-uploads are in the current request, (bool)false if not...
moveOneFileTo(UploadResult $UploadResult, $destination, $location=Location::STORAGE, $file_name='', $override_existing=false)
Moves a single File (the attributes, metadata and upload-status of which are contained in UploadResul...
initWebDir()
Init web directory.
__construct(ilDidacticTemplateSetting $setting)
ilDidacticTemplateIconHandler constructor.
getResults()
Returns the results of the processing and moving operation of the uploaded files. ...
handleUpload(FileUpload $upload, string $tmpname)
Icon handler for didactic template custom icons.
xmlElement($tag, $attrs=null, $data=null, $encode=true, $escape=true)
Writes a basic element (no children, just textual content)
hasBeenProcessed()
Return (bool)true if the current upload has already been processed.
copy(ilDidacticTemplateSetting $original)
static getWebspaceDir($mode="filesystem")
get webspace directory
toXml(ilXmlWriter $writer)