ILIAS  release_6 Revision v6.24-5-g0c8bfefb3b8
class.ilWorkspaceCopyDefinition.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';
18
23 private $copy_definitions = [];
24
29 private $temp_dir;
30
35 private $object_wsp_ids = [];
36
41 private $num_files = 0;
42
47 private $sum_file_sizes = 0;
48
53 private $adheres_to_limit = false;
54
55
56
61 public function getCopyDefinitions()
62 {
64 }
65
70 public function setCopyDefinitions($a_definitions)
71 {
72 $this->copy_definitions = $a_definitions;
73 }
74
79 public function getTempDir()
80 {
81 return $this->temp_dir;
82 }
83
88 public function setTempDir($temp_dir)
89 {
90 $this->temp_dir = $temp_dir;
91 }
92
96 public function getObjectWspIds()
97 {
99 }
100
105 public function setObjectWspIds($object_wps_ids, $append = false)
106 {
107 if ($append) {
108 array_merge($this->object_wsp_ids, $object_wps_ids);
109 } else {
110 $this->object_wsp_ids = $object_wps_ids;
111 }
112 }
113
117 public function getNumFiles()
118 {
119 return $this->num_files;
120 }
121
125 public function setNumFiles($num_files)
126 {
127 $this->num_files = $num_files;
128 }
129
133 public function getSumFileSizes()
134 {
136 }
137
142 {
143 $this->sum_file_sizes = $sum_file_sizes;
144 }
145
149 public function getAdheresToLimit()
150 {
152 }
153
158 {
159 $this->adheres_to_limit = $adheres_to_limit;
160 }
161
162
168 public function addCopyDefinition($a_source, $a_target)
169 {
170 $this->copy_definitions[] =
171 [
172 self::COPY_SOURCE_DIR => $a_source,
173 self::COPY_TARGET_DIR => $a_target
174 ];
175 }
176
177
183 public function equals(Value $other)
184 {
185 return strcmp($this->getHash(), $other->getHash());
186 }
187
188
193 public function getHash()
194 {
195 return md5($this->serialize());
196 }
197
201 public function serialize()
202 {
203 return serialize(
204 [
205 "copy_definition" => $this->getCopyDefinitions(),
206 "temp_dir" => $this->getTempDir(),
207 "object_wsp_ids" => implode(",", $this->getObjectWspIds()),
208 "num_files" => $this->getNumFiles(),
209 "sum_file_sizes" => $this->getSumFileSizes(),
210 "adheres_to_limit" => $this->getAdheresToLimit()
211 ]
212 );
213 }
214
219 public function setValue($value)
220 {
221 $this->copy_definitions = $value;
222 }
223
228 public function unserialize($serialized)
229 {
230 $elements = unserialize($serialized);
231
232 $this->setCopyDefinitions($elements["copy_definition"]);
233 $this->setTempDir($elements['temp_dir']);
234 $this->setObjectWspIds(explode(",", $elements["object_wsp_ids"]));
235 $this->setNumFiles($elements["num_files"]);
236 $this->setSumFileSizes($elements["sum_file_sizes"]);
237 $this->setAdheresToLimit($elements["adheres_to_limit"]);
238 }
239}
An exception for terminatinating execution or to throw for unit testing.
Copy definition for worspace folders.
setCopyDefinitions($a_definitions)
Set copy definitions.
addCopyDefinition($a_source, $a_target)
Add copy definition.
getTempDir()
Get directory name located in /temp/ directory.
setTempDir($temp_dir)
Set directory name located in /temp/ directory.
$copy_definitions
Copy Jobs: source file => relative target file in zip directory.
unserialize($serialized)
Unserialize definitions.
setObjectWspIds($object_wps_ids, $append=false)