ILIAS  trunk Revision v11.0_alpha-1723-g8e69f309bab
All Data Structures Namespaces Files Functions Variables Enumerations Enumerator 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, ?array $selected_participants=null)
 
 run ()
 

Protected Member Functions

 getParticipantBucketTitle ()
 

Protected Attributes

array $selected_participants
 
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,
?array  $selected_participants = null 
)

PhpUndefinedMethodInspection

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

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

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

Member Function Documentation

◆ getParticipantBucketTitle()

ilDownloadSubmissionsBackgroundTask::getParticipantBucketTitle ( )
protected

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

References ilObjUser\_lookupName().

Referenced by run().

114  : string
115  {
116  $name = ilObjUser::_lookupName($this->participant_id);
117  return ucfirst($name['lastname']) . ", " . ucfirst($name['firstname']);
118  }
static _lookupName(int $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 63 of file class.ilDownloadSubmissionsBackgroundTask.php.

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

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

◆ $selected_participants

array ilDownloadSubmissionsBackgroundTask::$selected_participants
protected

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

Referenced by __construct().

◆ $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: