ILIAS  release_5-4 Revision v5.4.26-12-gabc799a52e6
class.ilCopyDefinition.php
Go to the documentation of this file.
1 <?php
2 
5 
6 /* Copyright (c) 1998-2010 ILIAS open source, Extended GPL, see docs/LICENSE */
7 
15 {
16  const COPY_SOURCE_DIR = 'source';
17  const COPY_TARGET_DIR = 'target';
23  private $copy_definitions = [];
29  private $temp_dir;
35  private $object_ref_ids = [];
41  private $num_files = 0;
47  private $sum_file_sizes = 0;
53  private $adheres_to_limit = false;
54 
55 
61  public function getCopyDefinitions()
62  {
64  }
65 
66 
72  public function setCopyDefinitions($a_definitions)
73  {
74  $this->copy_definitions = $a_definitions;
75  }
76 
77 
83  public function getTempDir()
84  {
85  return $this->temp_dir;
86  }
87 
88 
94  public function setTempDir($temp_dir)
95  {
96  $this->temp_dir = $temp_dir;
97  }
98 
99 
103  public function getObjectRefIds()
104  {
105  return $this->object_ref_ids;
106  }
107 
108 
113  public function setObjectRefIds($object_ref_ids, $append = false)
114  {
115  if ($append) {
116  array_merge($this->object_ref_ids, $object_ref_ids);
117  } else {
118  $this->object_ref_ids = $object_ref_ids;
119  }
120  }
121 
122 
126  public function getNumFiles()
127  {
128  return $this->num_files;
129  }
130 
131 
135  public function setNumFiles($num_files)
136  {
137  $this->num_files = $num_files;
138  }
139 
140 
144  public function getSumFileSizes()
145  {
146  return $this->sum_file_sizes;
147  }
148 
149 
154  {
155  $this->sum_file_sizes = $sum_file_sizes;
156  }
157 
158 
162  public function getAdheresToLimit()
163  {
165  }
166 
167 
172  {
173  $this->adheres_to_limit = $adheres_to_limit;
174  }
175 
176 
183  public function addCopyDefinition($a_source, $a_target)
184  {
185  $this->copy_definitions[]
186  = [
187  self::COPY_SOURCE_DIR => $a_source,
188  self::COPY_TARGET_DIR => $a_target,
189  ];
190  }
191 
192 
200  public function equals(Value $other)
201  {
202  return strcmp($this->getHash(), $other->getHash());
203  }
204 
205 
211  public function getHash()
212  {
213  return md5($this->serialize());
214  }
215 
216 
220  public function serialize()
221  {
222  return serialize(
223  [
224  "copy_definition" => $this->getCopyDefinitions(),
225  "temp_dir" => $this->getTempDir(),
226  "object_ref_ids" => implode(",", $this->getObjectRefIds()),
227  "num_files" => $this->getNumFiles(),
228  "sum_file_sizes" => $this->getSumFileSizes(),
229  "adheres_to_limit" => $this->getAdheresToLimit(),
230  ]
231  );
232  }
233 
234 
240  public function setValue($value)
241  {
242  $this->copy_definitions = $value;
243  }
244 
245 
251  public function unserialize($serialized)
252  {
253  $elements = unserialize($serialized);
254 
255  $this->setCopyDefinitions($elements["copy_definition"]);
256  $this->setTempDir($elements['temp_dir']);
257  $this->setObjectRefIds(explode(",", $elements["object_ref_ids"]));
258  $this->setNumFiles($elements["num_files"]);
259  $this->setSumFileSizes($elements["sum_file_sizes"]);
260  $this->setAdheresToLimit($elements["adheres_to_limit"]);
261  }
262 }
serialize()
Serialize content.
getCopyDefinitions()
Get copy definitions.
unserialize($serialized)
Unserialize definitions.
setAdheresToLimit($adheres_to_limit)
getTempDir()
Get directory name located in /temp/ directory.
setTempDir($temp_dir)
Set directory name located in /temp/ directory.
setCopyDefinitions($a_definitions)
Set copy definitions.
Description of class class.
setObjectRefIds($object_ref_ids, $append=false)
setValue($value)
Set value.
setSumFileSizes($sum_file_sizes)
equals(Value $other)
Check equality.
$copy_definitions
Copy Jobs: source file => relative target file in zip directory.
addCopyDefinition($a_source, $a_target)
Add copy definition.