3 declare(strict_types=1);
36 $this->main_tpl = $DIC->ui()->mainTemplate();
38 $this->
logger = $DIC->logger()->cal();
39 $this->user_id = $a_usr_id;
40 $this->task_factory = $DIC->backgroundTasks()->taskFactory();
41 $this->
lng = $DIC->language();
45 throw new DomainException(
'Invalid or deleted user id given: ' . $this->user_id);
52 $this->events = $a_events;
62 $this->bucket_title = $a_title;
74 if (substr($this->bucket_title, 0, 1) ===
"-") {
75 $this->bucket_title = ltrim($this->bucket_title,
"-");
80 public function run(): bool
84 $definition->setTempDir($normalized_name);
88 if (!$this->has_files) {
89 $this->main_tpl->setOnScreenMessage(
'info', $this->
lng->txt(
"cal_down_no_files"),
true);
94 $bucket->setUserId($this->user_id);
97 $copy_job = $this->task_factory->createTask(ilCalendarCopyFilesToTempDirectoryJob::class, [$definition]);
98 $zip_job = $this->task_factory->createTask(ilCalendarZipJob::class, [$copy_job]);
102 $this->
logger->debug(
"Normalized name = " . $normalized_name);
103 $download_name->setValue($normalized_name .
'.zip');
105 $download_interaction = $this->task_factory->createTask(
106 ilCalendarDownloadZipInteraction::class,
107 [$zip_job, $download_name]
111 $bucket->setTask($download_interaction);
115 $task_manager =
$GLOBALS[
'DIC']->backgroundTasks()->taskManager();
116 $task_manager->run($bucket);
127 $obj_id = $cat->getObjId();
129 $this->
logger->debug(
'Handling event: ' . $event[
'event']->getPresentationTitle());
133 $cat->getObjType() ==
'exc' ||
134 !in_array($obj_id, $object_ids)
136 $this->
logger->debug(
'New obj_id..');
137 $object_ids[] = $obj_id;
141 if ($event[
'fullday']) {
149 if ($start_time != $end_time) {
150 $start_time .= (
' - ' . $end_time);
152 $folder_app = $start_time .
' ' .
156 $this->
logger->debug(
"collecting files...event title = " . $folder_app);
158 $this->
logger->debug(
'Current file handler: ' . get_class($file_handler));
160 if ($files = $file_handler->getFiles()) {
161 $this->has_files =
true;
164 $this->
logger->dump($files);
165 foreach ($files as $idx => $file_property) {
166 $this->
logger->debug(
'Filename:' . $file_property->getFileName());
167 $this->
logger->debug(
'Absolute path: ' . $file_property->getAbsolutePath());
170 $file_property->getAbsolutePath(),
171 $folder_date .
'/' . $folder_app .
'/' . $file_property->getFileName()
174 'Added new copy definition: ' .
175 $folder_date .
'/' . $folder_app .
'/' . $file_property->getFileName() .
' => ' .
176 $file_property->getAbsolutePath()
180 $this->
logger->info(
'Ignoring obj_id: ' . $obj_id .
' already processed.');
TaskFactory $task_factory
setBucketTitle(string $a_title)
Description of class class.
static getASCIIFilename(string $a_filename)
addCopyDefinition(string $a_source, string $a_target)
Add copy definition.
ilGlobalTemplateInterface $main_tpl
collectFiles(ilCalendarCopyDefinition $def)
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
if(!defined('PATH_SEPARATOR')) $GLOBALS['_PEAR_default_error_mode']
static getInstanceByObjId(?int $obj_id, bool $stop_on_error=true)
get an instance of an Ilias object by object id
setEvents(array $a_events)
static getInstanceByCategoryId(int $a_cat_id)
Description of class class.
__construct($a_usr_id)
ilDownloadFilesBackgroundTask constructor.
static getInstance(array $a_appointment)