ILIAS  release_5-4 Revision v5.4.26-12-gabc799a52e6
ilDownloadSubmissionsBackgroundTask Class Reference

Download submissions and feedback for exercises. More...

+ Collaboration diagram for ilDownloadSubmissionsBackgroundTask:

Public Member Functions

 __construct ($a_usr_id, $a_exc_ref_id, $a_exc_id, $a_ass_id, $a_participant_id)
 Constructor. More...
 
 run ()
 

Protected Member Functions

 getParticipantBucketTitle ()
 

Protected Attributes

 $exc_ref_id
 
 $exc_id
 
 $ass_id
 
 $participant_id
 
 $user_id
 
 $task_factory = null
 
 $task_manager = null
 
 $lng
 

Private Attributes

 $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 10 of file class.ilDownloadSubmissionsBackgroundTask.php.

Constructor & Destructor Documentation

◆ __construct()

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

Constructor.

Parameters
integer$a_usr_id
integer$a_exc_ref_id
integer$a_exc_id
integer$a_ass_id
integer$a_participant_id

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

References $DIC.

66  {
67  global $DIC;
68 
69  $this->user_id = $a_usr_id;
70  $this->exc_ref_id = $a_exc_ref_id;
71  $this->exc_id = $a_exc_id;
72  $this->ass_id = $a_ass_id;
73  $this->participant_id = $a_participant_id;
74 
75  $this->task_factory = $DIC->backgroundTasks()->taskFactory();
76  $this->task_manager = $DIC->backgroundTasks()->taskManager();
77  $this->logger = $DIC->logger()->exc();
78  }
global $DIC
Definition: saml.php:7

Member Function Documentation

◆ getParticipantBucketTitle()

ilDownloadSubmissionsBackgroundTask::getParticipantBucketTitle ( )
protected

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

References $name, $title, and ilObjUser\_lookupName().

Referenced by run().

128  {
129  $name = ilObjUser::_lookupName($this->participant_id);
130  $title = ucfirst($name['lastname']) . ", " . ucfirst($name['firstname']);
131  return $title;
132  }
static _lookupName($a_user_id)
lookup user name
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ run()

ilDownloadSubmissionsBackgroundTask::run ( )

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

References ilUtil\getASCIIFilename(), ilExSubmission\getDirectoryNameFromUserData(), getParticipantBucketTitle(), and ilExAssignment\lookupTitle().

81  {
82  $bucket = new BasicBucket();
83  $bucket->setUserId($this->user_id);
84 
85  $this->logger->debug("* Create task 'collect_data_job' using the following values:");
86  $this->logger->debug("job class = " . ilExerciseManagementCollectFilesJob::class);
87  $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 = " . (int) $this->user_id);
88 
89  $collect_data_job = $this->task_factory->createTask(
90  ilExerciseManagementCollectFilesJob::class,
91  [
92  (int) $this->exc_id,
93  (int) $this->exc_ref_id,
94  (int) $this->ass_id,
95  (int) $this->participant_id,
96  (int) $this->user_id
97  ]
98  );
99 
100  $this->logger->debug("* Create task 'zip job' using the following values:");
101  $this->logger->debug("job class = " . ilSubmissionsZipJob::class);
102  $this->logger->debug("sending as input the task called->collect_data_job");
103 
104  $zip_job = $this->task_factory->createTask(ilSubmissionsZipJob::class, [$collect_data_job]);
105 
106  if ($this->participant_id > 0) {
107  $download_name = ilExSubmission::getDirectoryNameFromUserData($this->participant_id);
108  $bucket->setTitle($this->getParticipantBucketTitle());
109  } else {
110  $download_name = ilUtil::getASCIIFilename(ilExAssignment::lookupTitle($this->ass_id));
111  $bucket->setTitle($download_name);
112  }
113 
114 
115  $this->logger->debug("* Create task 'download_interaction' using the following values:");
116  $this->logger->debug("job class = " . ilExDownloadSubmissionsZipInteraction::class);
117  $this->logger->debug("download_name which is the same as bucket title = " . $download_name . " + the zip_job task");
118  // see comments here -> https://github.com/leifos-gmbh/ILIAS/commit/df6fc44a4c85da33bd8dd5b391a396349e7fa68f
119  $download_interaction = $this->task_factory->createTask(ilExDownloadSubmissionsZipInteraction::class, [$zip_job, $download_name]);
120 
121  //download name
122  $bucket->setTask($download_interaction);
123  $this->task_manager->run($bucket);
124  return true;
125  }
static getASCIIFilename($a_filename)
convert utf8 to ascii filename
static getDirectoryNameFromUserData($a_user_id)
static lookupTitle($a_id)
Lookup title.
+ Here is the call graph for this function:

Field Documentation

◆ $ass_id

ilDownloadSubmissionsBackgroundTask::$ass_id
protected

◆ $exc_id

ilDownloadSubmissionsBackgroundTask::$exc_id
protected

◆ $exc_ref_id

ilDownloadSubmissionsBackgroundTask::$exc_ref_id
protected

◆ $lng

ilDownloadSubmissionsBackgroundTask::$lng
protected

◆ $logger

ilDownloadSubmissionsBackgroundTask::$logger = null
private

◆ $participant_id

ilDownloadSubmissionsBackgroundTask::$participant_id
protected

◆ $task_factory

ilDownloadSubmissionsBackgroundTask::$task_factory = null
protected

◆ $task_manager

ilDownloadSubmissionsBackgroundTask::$task_manager = null
protected

◆ $user_id

ilDownloadSubmissionsBackgroundTask::$user_id
protected

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