ILIAS  release_8 Revision v8.24
class.ilCalendarCopyDefinition.php
Go to the documentation of this file.
1<?php
2
3declare(strict_types=1);
4
7
8/* Copyright (c) 1998-2010 ILIAS open source, Extended GPL, see docs/LICENSE */
9
15{
16 public const COPY_SOURCE_DIR = 'source';
17 public const COPY_TARGET_DIR = 'target';
18
23 private array $copy_definitions = [];
24
29 private string $temp_dir;
30
35 public function getCopyDefinitions(): array
36 {
38 }
39
44 public function setCopyDefinitions(array $a_definitions): void
45 {
46 $this->copy_definitions = $a_definitions;
47 }
48
53 public function getTempDir(): string
54 {
55 return $this->temp_dir;
56 }
57
62 public function setTempDir(string $temp_dir): void
63 {
64 $this->temp_dir = $temp_dir;
65 }
66
70 public function addCopyDefinition(string $a_source, string $a_target): void
71 {
72 $this->copy_definitions[] =
73 [
74 self::COPY_SOURCE_DIR => $a_source,
75 self::COPY_TARGET_DIR => $a_target
76 ];
77 }
78
82 public function equals(Value $other): bool
83 {
84 return strcmp($this->getHash(), $other->getHash()) === 0;
85 }
86
90 public function getHash(): string
91 {
92 return md5($this->serialize());
93 }
94
98 public function serialize()
99 {
100 return serialize(
101 [
102 "copy_definition" => $this->getCopyDefinitions(),
103 "temp_dir" => $this->getTempDir()
104 ]
105 );
106 }
107
111 public function setValue($value): void
112 {
113 $this->copy_definitions = $value;
114 }
115
119 public function unserialize($serialized)
120 {
121 $elements = unserialize($serialized);
122
123 $this->setCopyDefinitions($elements["copy_definition"]);
124 $this->setTempDir($elements['temp_dir']);
125 }
126}
setTempDir(string $temp_dir)
Set directory name located in /temp/ directory.
array $copy_definitions
Copy Jobs: source file => relative target file in zip directory.
setCopyDefinitions(array $a_definitions)
Set copy definitions.
addCopyDefinition(string $a_source, string $a_target)
Add copy definition.
getTempDir()
Get directory name located in /temp/ directory.