27 require_once
"./Services/Container/classes/class.ilContainer.php";
50 public function __construct($a_id = 0, $a_call_by_reference =
true)
54 $this->tree = $DIC->repositoryTree();
55 $this->lng = $DIC->language();
56 $this->rbacsystem = $DIC->rbac()->system();
57 $this->access = $DIC->access();
59 parent::__construct($a_id, $a_call_by_reference);
60 $this->lng->loadLanguageModule(
'fold');
65 $this->folder_tree = &$a_tree;
76 public function cloneObject($a_target_id, $a_copy_id = 0, $a_omit_tree =
false)
78 $new_obj = parent::cloneObject($a_target_id, $a_copy_id, $a_omit_tree);
81 include_once(
'Services/Tracking/classes/class.ilLPObjSettings.php');
83 $obj_settings->cloneSettings($new_obj->getId());
97 if (!is_object($this->folder_tree)) {
98 $this->folder_tree = &
$tree;
103 $this->folder_tree->insertNode($this->
getRefId(), $a_parent);
106 $this->folder_tree->insertNode($this->
getId(), $a_parent);
120 parent::cloneDependencies($a_target_id, $a_copy_id);
122 include_once(
'Services/Object/classes/class.ilObjectActivation.php');
147 $tree = $DIC->repositoryTree();
148 $ilAccess = $DIC->access();
152 $temp_fs = $DIC->filesystem()->temp();
153 $temp_fs->createDir($tmpdir);
155 $subtree =
$tree->getChildsByTypeFilter(
$ref_id, array(
'fold',
'file'));
157 $storage_fs = $DIC->filesystem()->storage();
159 foreach ($subtree as $child) {
160 if (!$ilAccess->checkAccess(
'read',
'', $child[
'ref_id'])) {
166 if ($child[
'type'] ===
'fold') {
172 $new_filename =
$sanitizer->sanitize($new_filename);
173 if ($temp_fs->has($new_filename)) {
174 $new_filename = self::renameDuplicateFile($new_filename);
179 if ($storage_fs->has($relative_path_of_file)) {
180 $s = $storage_fs->readStream($relative_path_of_file);
182 throw new ilFileException(
'Could not copy ' . $relative_path_of_file .
' to ' . $new_filename);
184 $temp_fs->writeStream($new_filename,
$s);
204 $duplicate_has_array_entry =
false;
205 foreach (self::$duplicate_files as &$duplicate_file) {
206 if ($duplicate_file[
'file_name'] == $duplicate_filename) {
207 $duplicate_has_array_entry =
true;
208 $copy_number = $duplicate_file[
'copy_number'];
210 $duplicate_file[
'copy_number']++;
216 if (!$duplicate_has_array_entry) {
217 self::$duplicate_files[] = [
218 'file_name' => $duplicate_filename,
224 $path = pathinfo($duplicate_filename, PATHINFO_DIRNAME);
225 $filename = pathinfo($duplicate_filename, PATHINFO_FILENAME);
226 $extension = pathinfo($duplicate_filename, PATHINFO_EXTENSION);
227 $new_filename =
$path .
"/" .
$filename .
" (" . $copy_number .
")." . $extension;
229 return $new_filename;
237 if (!$ilAccess->checkAccess(
"read",
"", $this->getRefId())) {
238 $this->ilErr->raiseError(get_class($this) .
"::downloadFolder(): missing read permission!", $this->ilErr->WARNING);
241 $this->ilErr->raiseError(get_class($this) .
"::downloadFolder(): object is trashed!", $this->ilErr->WARNING);
246 $basename = ilUtil::getAsciiFilename($this->
getTitle());
247 $deliverFilename = $basename .
".zip";
248 $zipbasedir = $tmpdir . DIRECTORY_SEPARATOR . $basename;
249 $tmpzipfile = $tmpdir . DIRECTORY_SEPARATOR . $deliverFilename;
273 $container_ref_id =
$tree->checkForParentType($this->ref_id,
'grp');
274 if (!$container_ref_id) {
275 $container_ref_id =
$tree->checkForParentType($this->ref_id,
'crs');
277 if ($container_ref_id) {
278 include_once(
"./Modules/Course/classes/class.ilObjCourseAccess.php");
296 include_once
'./Services/Object/classes/class.ilObjectActivation.php';
314 include_once(
'./Services/Container/classes/class.ilContainerSortingSettings.php');
__construct($a_id=0, $a_call_by_reference=true)
Constructor public.
withReferences()
determines wehter objects are referenced or not (got ref ids or not)
putInTree($a_parent)
insert folder into grp_tree
static _isInTrash($a_ref_id)
checks wether object is in trash
static getASCIIFilename($a_filename)
convert utf8 to ascii filename
static recurseFolder($ref_id, $title, $tmpdir)
private functions which iterates through all folders and files and create an according file structure...
static sendInfo($a_info="", $a_keep=false)
Send Info Message to Screen.
static addAdditionalSubItemInformation(array &$a_item)
Parse item data for list entries.
getId()
get object id public
read()
Overwritten read method.
cloneObject($a_target_id, $a_copy_id=0, $a_omit_tree=false)
Clone folder.
static _lookupObjId($a_id)
if(empty( $files_to_scan)) $sanitizer
addAdditionalSubItemInformation(&$a_item_data)
Add additional information to sub item, e.g.
getTitle()
get object title public
getViewMode()
Get container view mode.
Class to report exception.
cloneDependencies($a_target_id, $a_copy_id)
Clone object dependencies (crs items, preconditions)
static zip($a_dir, $a_file, $compress_content=false)
zips given directory/file into given zip.file
static makeDir($a_dir)
creates a new directory and inherits all filesystem permissions of the parent directory You may pass ...
static ilTempnam($a_temp_path=null)
Returns a unique and non existing Path for e temporary file or directory.
static cloneDependencies($a_ref_id, $a_target_id, $a_copy_id)
Clone dependencies.
static _lookupAbsolutePath($obj_id, $a_version=null)
getRefId()
get reference id public
static _lookupSortMode($a_obj_id)
lookup sort mode
static delDir($a_dir, $a_clean_only=false)
removes a dir and all its content (subdirs and files) recursively
static renameDuplicateFile($duplicate_filename)
bugfix mantis 24309: add "_copy_" followed by a number to the filename (in front of the file-type-ext...
static deliverFile( $a_file, $a_filename, $a_mime='', $isInline=false, $removeAfterDelivery=false, $a_exit_after=true)
deliver file for download via browser.
static _lookupViewMode($a_id)
Lookup view mode.