ILIAS  trunk Revision v11.0_alpha-1769-g99a433fe2dc
All Data Structures Namespaces Files Functions Variables Enumerations Enumerator Modules Pages
class.ilCalendarCopyDefinition.php
Go to the documentation of this file.
1 <?php
2 
19 declare(strict_types=1);
20 
23 
29 {
30  public const COPY_SOURCE_DIR = 'source';
31  public const COPY_TARGET_DIR = 'target';
32 
37  private array $copy_definitions = [];
38 
43  private string $temp_dir;
44 
49  public function getCopyDefinitions(): array
50  {
52  }
53 
58  public function setCopyDefinitions(array $a_definitions): void
59  {
60  $this->copy_definitions = $a_definitions;
61  }
62 
67  public function getTempDir(): string
68  {
69  return $this->temp_dir;
70  }
71 
76  public function setTempDir(string $temp_dir): void
77  {
78  $this->temp_dir = $temp_dir;
79  }
80 
84  public function addCopyDefinition(string $a_source, string $a_target): void
85  {
86  $this->copy_definitions[] =
87  [
88  self::COPY_SOURCE_DIR => $a_source,
89  self::COPY_TARGET_DIR => $a_target
90  ];
91  }
92 
96  public function equals(Value $other): bool
97  {
98  return strcmp($this->getHash(), $other->getHash()) === 0;
99  }
100 
104  public function getHash(): string
105  {
106  return md5($this->serialize());
107  }
108 
112  public function serialize()
113  {
114  return serialize(
115  [
116  "copy_definition" => $this->getCopyDefinitions(),
117  "temp_dir" => $this->getTempDir()
118  ]
119  );
120  }
121 
125  public function setValue($value): void
126  {
127  $this->copy_definitions = $value;
128  }
129 
133  public function unserialize($serialized)
134  {
135  $elements = unserialize($serialized);
136 
137  $this->setCopyDefinitions($elements["copy_definition"]);
138  $this->setTempDir($elements['temp_dir']);
139  }
140 }
getCopyDefinitions()
Get copy definitions.
setCopyDefinitions(array $a_definitions)
Set copy definitions.
setTempDir(string $temp_dir)
Set directory name located in /temp/ directory.
addCopyDefinition(string $a_source, string $a_target)
Add copy definition.
array $copy_definitions
Copy Jobs: source file => relative target file in zip directory.
getTempDir()
Get directory name located in /temp/ directory.