ILIAS  release_8 Revision v8.19
All Data Structures Namespaces Files Functions Variables Modules Pages
ilDownloadSubmissionsBackgroundTask Class Reference

Download submissions and feedback for exercises. More...

+ Collaboration diagram for ilDownloadSubmissionsBackgroundTask:

Public Member Functions

 __construct (int $a_usr_id, int $a_exc_ref_id, int $a_exc_id, int $a_ass_id, int $a_participant_id)
 
 run ()
 

Protected Member Functions

 getParticipantBucketTitle ()
 

Protected Attributes

int $exc_ref_id
 
int $exc_id
 
int $ass_id
 
int $participant_id
 
int $user_id
 
TaskFactory $task_factory = null
 
TaskManager $task_manager = null
 
ilLanguage $lng
 
ilLogger $logger = null
 

Detailed Description

Download submissions and feedback for exercises.

Author
Jesús López lopez.nosp@m.@lei.nosp@m.fos.c.nosp@m.om

Definition at line 27 of file class.ilDownloadSubmissionsBackgroundTask.php.

Constructor & Destructor Documentation

◆ __construct()

ilDownloadSubmissionsBackgroundTask::__construct ( int  $a_usr_id,
int  $a_exc_ref_id,
int  $a_exc_id,
int  $a_ass_id,
int  $a_participant_id 
)

PhpUndefinedMethodInspection

Definition at line 39 of file class.ilDownloadSubmissionsBackgroundTask.php.

References $DIC, and ILIAS\Repository\logger().

45  {
46  global $DIC;
47 
48  $this->user_id = $a_usr_id;
49  $this->exc_ref_id = $a_exc_ref_id;
50  $this->exc_id = $a_exc_id;
51  $this->ass_id = $a_ass_id;
52  $this->participant_id = $a_participant_id;
53 
54  $this->task_factory = $DIC->backgroundTasks()->taskFactory();
55  $this->task_manager = $DIC->backgroundTasks()->taskManager();
57  $this->logger = $DIC->logger()->exc();
58  }
global $DIC
Definition: feed.php:28
+ Here is the call graph for this function:

Member Function Documentation

◆ getParticipantBucketTitle()

ilDownloadSubmissionsBackgroundTask::getParticipantBucketTitle ( )
protected

Definition at line 107 of file class.ilDownloadSubmissionsBackgroundTask.php.

References $name, and ilObjUser\_lookupName().

Referenced by run().

107  : string
108  {
109  $name = ilObjUser::_lookupName($this->participant_id);
110  return ucfirst($name['lastname']) . ", " . ucfirst($name['firstname']);
111  }
static _lookupName(int $a_user_id)
lookup user name
if($format !==null) $name
Definition: metadata.php:247
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ run()

ilDownloadSubmissionsBackgroundTask::run ( )

Definition at line 60 of file class.ilDownloadSubmissionsBackgroundTask.php.

References ilFileUtils\getASCIIFilename(), ilExSubmission\getDirectoryNameFromUserData(), getParticipantBucketTitle(), ILIAS\Repository\logger(), and ilExAssignment\lookupTitle().

60  : bool
61  {
62  $bucket = new BasicBucket();
63  $bucket->setUserId($this->user_id);
64 
65  $this->logger->debug("* Create task 'collect_data_job' using the following values:");
66  $this->logger->debug("job class = " . ilExerciseManagementCollectFilesJob::class);
67  $this->logger->debug("exc_id = " . $this->exc_id . ", exc_ref_id = " . $this->exc_ref_id . ", ass_id = " . (int) $this->ass_id . ", participant_id = " . (int) $this->participant_id . ", user_id = " . $this->user_id);
68 
69  $collect_data_job = $this->task_factory->createTask(
70  ilExerciseManagementCollectFilesJob::class,
71  [
72  $this->exc_id,
73  $this->exc_ref_id,
74  (int) $this->ass_id,
75  (int) $this->participant_id,
76  $this->user_id
77  ]
78  );
79 
80  $this->logger->debug("* Create task 'zip job' using the following values:");
81  $this->logger->debug("job class = " . ilSubmissionsZipJob::class);
82  $this->logger->debug("sending as input the task called->collect_data_job");
83 
84  $zip_job = $this->task_factory->createTask(ilSubmissionsZipJob::class, [$collect_data_job]);
85 
86  if ($this->participant_id > 0) {
87  $download_name = ilExSubmission::getDirectoryNameFromUserData($this->participant_id);
88  $bucket->setTitle($this->getParticipantBucketTitle());
89  } else {
90  $download_name = ilFileUtils::getASCIIFilename(ilExAssignment::lookupTitle($this->ass_id));
91  $bucket->setTitle($download_name);
92  }
93 
94 
95  $this->logger->debug("* Create task 'download_interaction' using the following values:");
96  $this->logger->debug("job class = " . ilExDownloadSubmissionsZipInteraction::class);
97  $this->logger->debug("download_name which is the same as bucket title = " . $download_name . " + the zip_job task");
98  // see comments here -> https://github.com/leifos-gmbh/ILIAS/commit/df6fc44a4c85da33bd8dd5b391a396349e7fa68f
99  $download_interaction = $this->task_factory->createTask(ilExDownloadSubmissionsZipInteraction::class, [$zip_job, $download_name]);
100 
101  //download name
102  $bucket->setTask($download_interaction);
103  $this->task_manager->run($bucket);
104  return true;
105  }
static lookupTitle(int $a_id)
static getASCIIFilename(string $a_filename)
static getDirectoryNameFromUserData(int $a_user_id)
+ Here is the call graph for this function:

Field Documentation

◆ $ass_id

int ilDownloadSubmissionsBackgroundTask::$ass_id
protected

◆ $exc_id

int ilDownloadSubmissionsBackgroundTask::$exc_id
protected

◆ $exc_ref_id

int ilDownloadSubmissionsBackgroundTask::$exc_ref_id
protected

◆ $lng

ilLanguage ilDownloadSubmissionsBackgroundTask::$lng
protected

◆ $logger

ilLogger ilDownloadSubmissionsBackgroundTask::$logger = null
protected

◆ $participant_id

int ilDownloadSubmissionsBackgroundTask::$participant_id
protected

◆ $task_factory

TaskFactory ilDownloadSubmissionsBackgroundTask::$task_factory = null
protected

◆ $task_manager

TaskManager ilDownloadSubmissionsBackgroundTask::$task_manager = null
protected

◆ $user_id

int ilDownloadSubmissionsBackgroundTask::$user_id
protected

The documentation for this class was generated from the following file: