27 require_once
"./Services/Container/classes/class.ilContainer.php";
52 public function __construct($a_id = 0, $a_call_by_reference =
true)
56 $this->tree = $DIC->repositoryTree();
57 $this->lng = $DIC->language();
58 $this->rbacsystem = $DIC->rbac()->system();
59 $this->access = $DIC->access();
61 parent::__construct($a_id, $a_call_by_reference);
62 $this->lng->loadLanguageModule(
'fold');
68 $this->folder_tree =&$a_tree;
81 public function cloneObject($a_target_id, $a_copy_id = 0, $a_omit_tree =
false)
83 $new_obj = parent::cloneObject($a_target_id, $a_copy_id, $a_omit_tree);
86 include_once(
'Services/Tracking/classes/class.ilLPObjSettings.php');
88 $obj_settings->cloneSettings($new_obj->getId());
103 if (!is_object($this->folder_tree)) {
104 $this->folder_tree =&
$tree;
109 $this->folder_tree->insertNode($this->
getRefId(), $a_parent);
112 $this->folder_tree->insertNode($this->
getId(), $a_parent);
128 parent::cloneDependencies($a_target_id, $a_copy_id);
130 include_once(
'Services/Object/classes/class.ilObjectActivation.php');
155 $tree = $DIC->repositoryTree();
156 $ilAccess = $DIC->access();
160 $temp_fs = $DIC->filesystem()->temp();
161 $temp_fs->createDir($tmpdir);
165 foreach ($subtree as $child) {
166 if (!$ilAccess->checkAccess(
"read",
"", $child[
"ref_id"])) {
172 if ($child[
"type"] ==
"fold") {
184 if (file_exists($new_filename)) {
185 $new_filename = self::renameDuplicateFile($new_filename);
190 $new_filename =
$sanitizer->sanitize($new_filename);
194 if (!copy($old_filename, $new_filename)) {
195 throw new ilFileException(
"Could not copy " . $old_filename .
" to " . $new_filename);
197 touch($new_filename, filectime($old_filename));
217 $duplicate_has_array_entry =
false;
218 foreach (self::$duplicate_files as &$duplicate_file) {
219 if ($duplicate_file[
'file_name'] == $duplicate_filename) {
220 $duplicate_has_array_entry =
true;
221 $copy_number = $duplicate_file[
'copy_number'];
223 $duplicate_file[
'copy_number']++;
229 if (!$duplicate_has_array_entry) {
230 self::$duplicate_files[] = [
231 'file_name' => $duplicate_filename,
237 $path = pathinfo($duplicate_filename, PATHINFO_DIRNAME);
238 $filename = pathinfo($duplicate_filename, PATHINFO_FILENAME);
239 $extension = pathinfo($duplicate_filename, PATHINFO_EXTENSION);
240 $new_filename =
$path .
"/" .
$filename .
" (" . $copy_number .
")." . $extension;
242 return $new_filename;
250 if (!$ilAccess->checkAccess(
"read",
"", $this->getRefId())) {
251 $this->ilErr->raiseError(get_class($this) .
"::downloadFolder(): missing read permission!", $this->ilErr->WARNING);
254 $this->ilErr->raiseError(get_class($this) .
"::downloadFolder(): object is trashed!", $this->ilErr->WARNING);
259 $basename = ilUtil::getAsciiFilename($this->
getTitle());
260 $deliverFilename = $basename .
".zip";
261 $zipbasedir = $tmpdir . DIRECTORY_SEPARATOR . $basename;
262 $tmpzipfile = $tmpdir . DIRECTORY_SEPARATOR . $deliverFilename;
287 $container_ref_id =
$tree->checkForParentType($this->ref_id,
'grp');
288 if (!$container_ref_id) {
289 $container_ref_id =
$tree->checkForParentType($this->ref_id,
'crs');
291 if ($container_ref_id) {
292 include_once(
"./Modules/Course/classes/class.ilObjCourseAccess.php");
312 include_once
'./Services/Object/classes/class.ilObjectActivation.php';
333 include_once(
'./Services/Container/classes/class.ilContainerSortingSettings.php');
__construct($a_id=0, $a_call_by_reference=true)
Constructor.
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
Create styles array
The data for the language used.
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)
Create a temporary file in an ILIAS writable directory.
static getDataDir()
get data directory (outside webspace)
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.