49         $this->
logger = $DIC->logger()->cal();
    71         return new SingleType(ilCopyDefinition::class);
    90         $this->
logger->debug(
'Start collecting files!');
    91         $this->
logger->dump($input);
    92         $definition = $input[0];
    93         $initiated_by_folder_action = $input[1]->getValue();
    94         $object_ref_ids = $definition->getObjectRefIds();
    97         foreach ($object_ref_ids as $object_ref_id) {
    99             $object_type = $object->getType();
   100             $object_name = $object->getTitle();
   101             $object_temp_dir = 
""; 
   103             if ($object_type === 
"fold" || $object_type === 
"crs") {
   105                 $files_from_folder = $this->
recurseFolder($object_ref_id, $object_name, $object_temp_dir, $num_recursions, $initiated_by_folder_action);
   106                 $files = array_merge($files, $files_from_folder);
   107             } elseif (($object_type === 
"file") && (($file_dirs = $this->
getFileDirs(
   112                 $files[] = $file_dirs;
   115         $this->
logger->debug(
'Collected files:');
   116         $this->
logger->dump($files);
   119         foreach ($files as $file) {
   120             $definition->addCopyDefinition($file[
'source_dir'], $file[
'target_dir']);
   121             $this->
logger->debug(
'Added new copy definition: ' . $file[
'source_dir'] . 
' -> ' . $file[
'target_dir']);
   124             $is_empty_folder = preg_match_all(
"/\/$/", $file[
'target_dir']);
   125             if (!$is_empty_folder) {
   129         $definition->setObjectRefIds($object_ref_ids);
   130         $definition->setNumFiles($num_files);
   142     private function getFileDirs($a_ref_id, $a_file_name, $a_temp_dir)
   146         $user = $DIC->user();
   147         $ilAccess = $DIC->access();
   148         if ($ilAccess->checkAccessOfUser($user->getId(), 
"read", 
"", $a_ref_id)) {
   150             $source_dir = $file->getFile();
   152             if (@!is_file($source_dir)) {
   156             $filname_with_suffix = $this->
ensureSuffix($a_file_name, $file->getFileExtension());
   158             $target_dir = $a_temp_dir . 
'/' . $filname_with_suffix;
   163             if (isset(self::$targets[$target_dir])) {
   164                 $target_info = pathinfo($target_dir);
   166                 $extension = isset($target_info[
"extension"]) ? 
"." . $target_info[
"extension"] : 
"";
   167                 $target_dir = $a_temp_dir . 
$filename . 
" (" . ++self::$targets[$target_dir] . 
")" . $extension;
   169                 self::$targets[$target_dir] = 0;
   173                 "source_dir" => $source_dir,
   174                 "target_dir" => $target_dir,
   189     private function recurseFolder($a_ref_id, $a_folder_name, $a_temp_dir, $a_num_recursions, $a_initiated_by_folder_action): array
   193         $num_recursions = $a_num_recursions + 1;
   194         $tree = $DIC->repositoryTree();
   195         $ilAccess = $DIC->access();
   200         if ($num_recursions <= 1 && $a_initiated_by_folder_action) {
   201             $temp_dir = $a_temp_dir;
   206         $subtree = $tree->getChildsByTypeFilter($a_ref_id, array(
"fold", 
"file"));
   208         foreach ($subtree as $child) {
   209             if (!$ilAccess->checkAccess(
"read", 
"", $child[
"ref_id"])) {
   215             if ($child[
"type"] == 
"fold") {
   216                 $files_from_folder = $this->
recurseFolder($child[
"ref_id"], $child[
'title'], $temp_dir, $num_recursions, $a_initiated_by_folder_action);
   217                 $files = array_merge($files, $files_from_folder);
   219                 if (($child[
"type"] === 
"file") && (($dirs = $this->
getFileDirs($child[
"ref_id"], $child[
'title'], $temp_dir)) !== 
false)) {
   225         if (empty($subtree)) {
   228                 "target_dir" => $temp_dir . 
'/',
 
Description of class class. 
 
Class ChatMainBarProvider . 
 
getFileDirs($a_ref_id, $a_file_name, $a_temp_dir)
 
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
 
run(array $input, \ILIAS\BackgroundTasks\Observer $observer)
 
static getASCIIFilename(string $a_filename)
 
recurseFolder($a_ref_id, $a_folder_name, $a_temp_dir, $a_num_recursions, $a_initiated_by_folder_action)
 
static _isInTrash(int $ref_id)
 
static getInstanceByRefId(int $ref_id, bool $stop_on_error=true)
get an instance of an Ilias object by reference id 
 
trait ilObjFileSecureString
Trait ilObjFileSecureString. 
 
getExpectedTimeOfTaskInSeconds()
int the amount of seconds this task usually taskes. If your task-duration scales with the the amount ...
 
ensureSuffix(string $title, ?string $suffix=null)