ILIAS  release_8 Revision v8.24
ilExerciseManagementCollectFilesJob Class Reference
+ Inheritance diagram for ilExerciseManagementCollectFilesJob:
+ Collaboration diagram for ilExerciseManagementCollectFilesJob:

Public Member Functions

 __construct ()
 Constructor. More...
 
 getInputTypes ()
 
 getOutputType ()
 
 isStateless ()
 
 run (array $input, Observer $observer)
 run the job More...
 
 copyFileToSubDirectory (string $a_directory, string $a_file)
 Copy a file in the Feedback_files directory TODO use the new filesystem. More...
 
 getExpectedTimeOfTaskInSeconds ()
 
 getExtraColumnsForSubmissionFiles (int $a_obj_id, int $a_ass_id)
 Get the number of max amount of files submitted by a single user in the assignment. More...
 
 addLink (int $a_row, int $a_col, array $a_submission_file)
 
 getAssignmentMembersIds ()
 get ONLY the members ids for this assignment More...
 
- Public Member Functions inherited from ILIAS\BackgroundTasks\Implementation\Tasks\AbstractJob
 getInput ()
 
Returns
Value[]
More...
 
- Public Member Functions inherited from ILIAS\BackgroundTasks\Implementation\Tasks\AbstractTask
 setInput (array $values)
 
 getOutput ()
 
 getInput ()
 
 getType ()
 
 unfoldTask ()
 Unfold the task. More...
 
 getRemoveOption ()
 
Returns
Option An Option to remove the current task and do some cleanup if possible. This Option is displayed if the Bucket is completed. You do not have to provide an additional Option to remove in your UserInteraction, the remove-Option is added to the list of Options (last position)
See also
self::getAbortOption();
More...
 
 getAbortOption ()
 
Returns
Option In case a Job is failed or did not respond for some time, an Abort-Option is displayed. There is already a Standard-Abort-Option registered, you can override with your own and do some cleanup if possible.
More...
 
 getType ()
 
 getInputTypes ()
 
 getOutputType ()
 
 getOutput ()
 
 setInput (array $values)
 
 getInput ()
 
 unfoldTask ()
 
 getRemoveOption ()
 
 getAbortOption ()
 
 run (array $input, Observer $observer)
 
 isStateless ()
 
 getInput ()
 
 getExpectedTimeOfTaskInSeconds ()
 

Data Fields

const FBK_DIRECTORY = "Feedback_files"
 
const LINK_COLOR = "0,0,255"
 
const BG_COLOR = "255,255,255"
 
const PARTICIPANT_LASTNAME_COLUMN = 0
 
const PARTICIPANT_FIRSTNAME_COLUMN = 1
 
const PARTICIPANT_LOGIN_COLUMN = 2
 
const SUBMISSION_DATE_COLUMN = 3
 
const FIRST_DEFAULT_SUBMIT_COLUMN = 4
 
const FIRST_DEFAULT_REVIEW_COLUMN = 5
 
- Data Fields inherited from ILIAS\BackgroundTasks\Implementation\Tasks\AbstractTask
const MAIN_REMOVE = 'bt_main_remove'
 
const MAIN_ABORT = 'bt_main_abort'
 

Protected Member Functions

 addColumnTitles ()
 Set the Excel column titles. More...
 
 createUniqueTempDirectory ()
 
 createTargetDirectory ()
 Create the directory with the assignment title. More...
 
 createSubmissionsDirectory ()
 Create the directory with the assignment title. More...
 
 isExcelNeeded (int $a_ass_type, bool $a_has_fbk)
 
 getFeedbackDirectory (int $participant_id, int $feedback_giver)
 see also bug https://mantis.ilias.de/view.php?id=30999 More...
 
 collectAssignmentData (int $assignment_id)
 write assignment data to excel file More...
 
- Protected Member Functions inherited from ILIAS\BackgroundTasks\Implementation\Tasks\AbstractTask
 checkTypes ($values)
 
 extractType ($value)
 

Protected Attributes

ilLogger $logger
 
string $target_directory = ""
 
string $submissions_directory = ""
 
ilExAssignment $assignment
 
int $user_id = 0
 
int $exercise_id = 0
 
int $exercise_ref_id = 0
 
string $temp_dir = null
 
ilLanguage $lng
 
string $sanitized_title = ""
 
ilExcel $excel
 
array $criteria_items = []
 
array $title_columns = []
 
array $ass_types_with_files = []
 
int $participant_id = 0
 
- Protected Attributes inherited from ILIAS\BackgroundTasks\Implementation\Tasks\AbstractTask
array $input = []
 
ILIAS BackgroundTasks Value $output
 

Detailed Description

Constructor & Destructor Documentation

◆ __construct()

ilExerciseManagementCollectFilesJob::__construct ( )

Constructor.

@noinspection PhpUndefinedMethodInspection

Definition at line 62 of file class.ilExerciseManagementCollectFilesJob.php.

63 {
64 global $DIC;
65 $this->lng = $DIC->language();
66 $this->lng->loadLanguageModule('exc');
67 //TODO will be deprecated when use the new assignment type interface
68 $this->ass_types_with_files = array(
73 );
75 $this->logger = $DIC->logger()->exc();
76 }
const TYPE_UPLOAD
direct checks against const should be avoided, use type objects instead
global $DIC
Definition: feed.php:28

References $DIC, ILIAS\Repository\lng(), ILIAS\Repository\logger(), ilExAssignment\TYPE_BLOG, ilExAssignment\TYPE_PORTFOLIO, ilExAssignment\TYPE_UPLOAD, and ilExAssignment\TYPE_UPLOAD_TEAM.

+ Here is the call graph for this function:

Member Function Documentation

◆ addColumnTitles()

ilExerciseManagementCollectFilesJob::addColumnTitles ( )
protected

Set the Excel column titles.

Exceptions

PhpOffice\PhpSpreadsheet\Exception

Definition at line 171 of file class.ilExerciseManagementCollectFilesJob.php.

171 : void
172 {
173 $col = 0;
174 foreach ($this->title_columns as $title) {
175 $this->excel->setCell(1, $col, $title);
176 $col++;
177 }
178 }

◆ addLink()

ilExerciseManagementCollectFilesJob::addLink ( int  $a_row,
int  $a_col,
array  $a_submission_file 
)

Definition at line 404 of file class.ilExerciseManagementCollectFilesJob.php.

408 : void {
409 $user_id = $a_submission_file['user_id'];
411
412 $filepath = './' . $this->lng->txt("exc_ass_submission_zip") . DIRECTORY_SEPARATOR . $targetdir . DIRECTORY_SEPARATOR;
413 switch ($this->assignment->getType()) {
415 $filepath .= $a_submission_file['filetitle'];
416 break;
417
419 $wsp_tree = new ilWorkspaceTree($user_id);
420 // #12939
421 if (!$wsp_tree->getRootId()) {
422 $wsp_tree->createTreeForUser($user_id);
423 }
424 $node = $wsp_tree->getNodeData((int) $a_submission_file['filetitle']);
425 $filepath .= "blog_" . $node['obj_id'] . DIRECTORY_SEPARATOR . "index.html";
426 break;
427
429 $filepath .= "prt_" . $a_submission_file['filetitle'] . DIRECTORY_SEPARATOR . "index.html";
430 break;
431
432 default:
433 $filepath = "";
434 }
435 $this->excel->addLink($a_row, $a_col, $filepath);
436 }
static getDirectoryNameFromUserData(int $a_user_id)
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...

◆ collectAssignmentData()

ilExerciseManagementCollectFilesJob::collectAssignmentData ( int  $assignment_id)
protected

write assignment data to excel file

Todo:
Refactoring needed, long method...
Parameters
int$assignment_id
Exceptions

PhpOffice\PhpSpreadsheet\Exception

Exceptions
ilDatabaseException
ilExerciseException
ilObjectNotFoundException

Definition at line 447 of file class.ilExerciseManagementCollectFilesJob.php.

447 : void
448 {
449 $ass_has_feedback = false;
450 $ass_has_criteria = false;
451
452 //assignment object
453 $this->assignment = new ilExAssignment($assignment_id);
454 $assignment_type = $this->assignment->getType();
455
456 //Sanitized title for excel file and target directory.
457 $this->sanitized_title = ilFileUtils::getASCIIFilename($this->assignment->getTitle());
458
459 // directories
460 if (!isset($this->temp_dir)) {
462 }
463 $this->createTargetDirectory();
464
465 //Collect submission files if needed by assignment type.
466 if (in_array($assignment_type, $this->ass_types_with_files)) {
468 $this->collectSubmissionFiles();
469 }
470
471 $first_excel_column_for_review = 0;
472 $col = 0;
473 $peer_review = null;
474 if ($this->assignment->getPeerReview()) {
475 $ass_has_feedback = true;
476 //obj to get the reviews in the foreach below.
477 $peer_review = new ilExPeerReview($this->assignment);
478 //default start column for revisions.
479 $first_excel_column_for_review = self::FIRST_DEFAULT_REVIEW_COLUMN;
480 }
481
482 if ($this->isExcelNeeded($assignment_type, $ass_has_feedback)) {
483 // PhpSpreadsheet object
484 $this->excel = new ilExcel();
485
486 //Excel sheet title
487 $this->excel->addSheet($this->sanitized_title);
488
489 //add common excel Columns
490 #25585
491 $this->title_columns = array(
492 $this->lng->txt('lastname'),
493 $this->lng->txt('firstname'),
494 $this->lng->txt('login'),
495 $this->lng->txt('exc_last_submission')
496 );
497 switch ($assignment_type) {
499 $this->title_columns[] = $this->lng->txt("exc_submission_text");
500 break;
503 if ($assignment_type === ilExAssignment::TYPE_UPLOAD_TEAM) {
504 $first_excel_column_for_review++;
505 $this->title_columns[] = $this->lng->txt("exc_team");
506 }
507 $num_columns_submission = $this->getExtraColumnsForSubmissionFiles($this->exercise_id, $assignment_id);
508 if ($num_columns_submission > 1) {
509 for ($i = 1; $i <= $num_columns_submission; $i++) {
510 $this->title_columns[] = $this->lng->txt("exc_submission_file") . " " . $i;
511 }
512 } else {
513 $this->title_columns[] = $this->lng->txt("exc_submission_file");
514 }
515
516 $first_excel_column_for_review += $num_columns_submission - 1;
517 break;
518 default:
519 $this->title_columns[] = $this->lng->txt("exc_submission");
520 break;
521 }
522 if ($ass_has_feedback) {
523 $this->title_columns[] = $this->lng->txt("exc_peer_review_giver");
524 $this->title_columns[] = $this->lng->txt('exc_last_submission');
525 }
526
527 //criteria
528 //Notice:getPeerReviewCriteriaCatalogueItems can return just an empty instance without data.
529 if ($this->criteria_items = $this->assignment->getPeerReviewCriteriaCatalogueItems()) {
530 $ass_has_criteria = true;
531 }
532
533 if ($this->participant_id > 0) {
534 $participants = array($this->participant_id);
535 } else {
536 $participants = $this->getAssignmentMembersIds();
537 }
538
539 $filter = new ilExerciseMembersFilter($this->exercise_ref_id, $participants, $this->user_id);
540 $participants = $filter->filterParticipantsByAccess();
541
542 $row = 2;
543 // Fill the excel
544 foreach ($participants as $participant_id) {
545 $submission = new ilExSubmission($this->assignment, $participant_id);
546 $submission_files = $submission->getFiles();
547
548 if ($submission_files !== []) {
549 $participant_name = ilObjUser::_lookupName($participant_id);
550 $this->excel->setCell($row, self::PARTICIPANT_LASTNAME_COLUMN, $participant_name['lastname']);
551 $this->excel->setCell($row, self::PARTICIPANT_FIRSTNAME_COLUMN, $participant_name['firstname']);
552 $this->excel->setCell($row, self::PARTICIPANT_LOGIN_COLUMN, $participant_name['login']);
553
554 //Get the submission Text
555 if (!in_array($assignment_type, $this->ass_types_with_files)) {
556 foreach ($submission_files as $submission_file) {
557 $this->excel->setCell($row, self::SUBMISSION_DATE_COLUMN, $submission_file['timestamp']);
558 $this->excel->setCell($row, self::FIRST_DEFAULT_SUBMIT_COLUMN, $submission_file['atext']);
559 }
560 } else {
562 if ($assignment_type === ilExAssignment::TYPE_UPLOAD_TEAM) {
563 $team_id = ilExAssignmentTeam::getTeamId($this->assignment->getId(), $participant_id, false);
564 $this->excel->setCell($row, $col, (string) $team_id);
565 $col++;
566 }
567 foreach ($submission_files as $submission_file) {
568 $this->excel->setCell($row, self::SUBMISSION_DATE_COLUMN, $submission_file['timestamp']);
569
570 if ($assignment_type == ilExAssignment::TYPE_PORTFOLIO || $assignment_type == ilExAssignment::TYPE_BLOG) {
571 $this->excel->setCell($row, $col, $this->lng->txt("open"));
572 } else {
573 $this->excel->setCell($row, $col, $submission_file['filetitle']);
574 }
575 $this->excel->setColors($this->excel->getCoordByColumnAndRow($col, $row), self::BG_COLOR, self::LINK_COLOR);
576 if ($assignment_type != ilExAssignment::TYPE_UPLOAD_TEAM) {
577 $this->addLink($row, $col, $submission_file);
578 }
579 $col++; //does not affect blogs and portfolios.
580 }
581 }
582
583 if ($ass_has_feedback) {
584 if ($col < $first_excel_column_for_review) {
585 $col = $first_excel_column_for_review;
586 }
587 $reviews = [];
588 if ($peer_review !== null) {
589 $reviews = $peer_review->getPeerReviewsByPeerId($participant_id);
590 }
591
592 //extra lines
593 $current_review_row = 0;
594 foreach ($reviews as $review) {
595 //not all reviews are done, we check it via date of review.
596 if ($review['tstamp']) {
597 $current_review_row++;
598 if ($current_review_row > 1) {
599 for ($i = 0; $i < $first_excel_column_for_review; $i++) {
600 $cell_to_copy = $this->excel->getCell($row, $i);
601 $this->excel->setCell($row + 1, $i, $cell_to_copy);
602 if ($i >= self::FIRST_DEFAULT_SUBMIT_COLUMN) {
603 $this->excel->setColors($this->excel->getCoordByColumnAndRow($i, $row + 1), self::BG_COLOR, self::LINK_COLOR);
604 }
605 }
606 ++$row;
607 }
608
609 $feedback_giver = $review['giver_id']; // user who made the review.
610
611 $feedback_giver_name = ilObjUser::_lookupName($feedback_giver);
612
613 $this->excel->setCell(
614 $row,
615 $col,
616 $feedback_giver_name['lastname'] . ", " . $feedback_giver_name['firstname'] . " [" . $feedback_giver_name['login'] . "]"
617 );
618
619 $this->excel->setCell($row, $col + 1, $review['tstamp']);
620
621 if ($ass_has_criteria) {
622 $this->addCriteriaToExcel($feedback_giver, $participant_id, $row, $col + 1);
623 }
624 }
625 }
626 }
627
628 $row++;
629 }
630 }
631
632 $this->addColumnTitles();
633 $this->excel->writeToFile($this->target_directory . "/" . $this->sanitized_title);
634 }
635 }
static getTeamId(int $a_assignment_id, int $a_user_id, bool $a_create_on_demand=false)
Exercise assignment.
Exercise peer review.
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
getExtraColumnsForSubmissionFiles(int $a_obj_id, int $a_ass_id)
Get the number of max amount of files submitted by a single user in the assignment.
getAssignmentMembersIds()
get ONLY the members ids for this assignment
createTargetDirectory()
Create the directory with the assignment title.
createSubmissionsDirectory()
Create the directory with the assignment title.
addLink(int $a_row, int $a_col, array $a_submission_file)
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
static getASCIIFilename(string $a_filename)
static _lookupName(int $a_user_id)
lookup user name
$i
Definition: metadata.php:41

References $i, ilObjUser\_lookupName(), ilFileUtils\getASCIIFilename(), ilExAssignmentTeam\getTeamId(), ILIAS\Repository\lng(), ilExAssignment\TYPE_BLOG, ilExAssignment\TYPE_PORTFOLIO, ilExAssignment\TYPE_TEXT, ilExAssignment\TYPE_UPLOAD, and ilExAssignment\TYPE_UPLOAD_TEAM.

Referenced by run().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ copyFileToSubDirectory()

ilExerciseManagementCollectFilesJob::copyFileToSubDirectory ( string  $a_directory,
string  $a_file 
)

Copy a file in the Feedback_files directory TODO use the new filesystem.

Definition at line 146 of file class.ilExerciseManagementCollectFilesJob.php.

146 : void
147 {
148 $dir = $this->target_directory . "/" . $a_directory;
149
150 if (!is_dir($dir)) {
152 }
153
154 copy($a_file, $dir . "/" . basename($a_file));
155
156 /*global $DIC;
157 $fs = $DIC->filesystem();
158
159 $fs->storage()->copy($a_file, $this->temp_dir."/".basename($a_file));*/
160 }
static makeDirParents(string $a_dir)
Create a new directory and all parent directories.

References ilFileUtils\makeDirParents().

+ Here is the call graph for this function:

◆ createSubmissionsDirectory()

ilExerciseManagementCollectFilesJob::createSubmissionsDirectory ( )
protected

Create the directory with the assignment title.

Definition at line 207 of file class.ilExerciseManagementCollectFilesJob.php.

207 : void
208 {
209 $this->logger->dump("lang key => " . $this->lng->getLangKey());
210 $this->submissions_directory = $this->target_directory . DIRECTORY_SEPARATOR . $this->lng->txt("exc_ass_submission_zip");
211 ilFileUtils::createDirectory($this->submissions_directory);
212 }
static createDirectory(string $a_dir, int $a_mod=0755)
create directory

References ilFileUtils\createDirectory(), ILIAS\Repository\lng(), and ILIAS\Repository\logger().

+ Here is the call graph for this function:

◆ createTargetDirectory()

ilExerciseManagementCollectFilesJob::createTargetDirectory ( )
protected

Create the directory with the assignment title.

Definition at line 193 of file class.ilExerciseManagementCollectFilesJob.php.

193 : void
194 {
195 $path = $this->temp_dir . DIRECTORY_SEPARATOR;
196 if ($this->participant_id > 0) {
197 $user_dir = ilExSubmission::getDirectoryNameFromUserData($this->participant_id);
198 $path .= $user_dir . DIRECTORY_SEPARATOR;
199 }
200 $this->target_directory = $path . $this->sanitized_title;
201 ilFileUtils::makeDirParents($this->target_directory);
202 }
$path
Definition: ltiservices.php:32

References $path, ilExSubmission\getDirectoryNameFromUserData(), and ilFileUtils\makeDirParents().

+ Here is the call graph for this function:

◆ createUniqueTempDirectory()

ilExerciseManagementCollectFilesJob::createUniqueTempDirectory ( )
protected
Todo:
refactor to new file system access Create unique temp directory

Definition at line 184 of file class.ilExerciseManagementCollectFilesJob.php.

184 : void
185 {
186 $this->temp_dir = ilFileUtils::ilTempnam();
187 ilFileUtils::makeDirParents($this->temp_dir);
188 }
static ilTempnam(?string $a_temp_path=null)
Returns a unique and non existing Path for e temporary file or directory.

References ilFileUtils\ilTempnam(), and ilFileUtils\makeDirParents().

+ Here is the call graph for this function:

◆ getAssignmentMembersIds()

ilExerciseManagementCollectFilesJob::getAssignmentMembersIds ( )

get ONLY the members ids for this assignment

Returns
int[]

Definition at line 641 of file class.ilExerciseManagementCollectFilesJob.php.

641 : array
642 {
643 global $DIC;
644
645 $ilDB = $DIC->database();
646 $members = array();
647
648 $set = $ilDB->query("SELECT usr_id" .
649 " FROM exc_mem_ass_status" .
650 " WHERE ass_id = " . $ilDB->quote($this->assignment->getId(), "integer"));
651
652 while ($rec = $ilDB->fetchAssoc($set)) {
653 if (!\ilObjUser::userExists([(int) $rec['usr_id']])) {
654 continue;
655 }
656 $members[] = $rec['usr_id'];
657 }
658
659 return $members;
660 }
static userExists(array $a_usr_ids=array())

References $DIC, $ilDB, and ilObjUser\userExists().

+ Here is the call graph for this function:

◆ getExpectedTimeOfTaskInSeconds()

ilExerciseManagementCollectFilesJob::getExpectedTimeOfTaskInSeconds ( )
Returns
int the amount of seconds this task usually taskes. If your task-duration scales with the the amount of data, try to set a possible high value of try to calculate it. If a task duration exceeds this value, it will be displayed as "possibly failed" to the user

Implements ILIAS\BackgroundTasks\Task\Job.

Definition at line 162 of file class.ilExerciseManagementCollectFilesJob.php.

162 : int
163 {
164 return 30;
165 }

◆ getExtraColumnsForSubmissionFiles()

ilExerciseManagementCollectFilesJob::getExtraColumnsForSubmissionFiles ( int  $a_obj_id,
int  $a_ass_id 
)

Get the number of max amount of files submitted by a single user in the assignment.

Used to add columns to the excel.

Definition at line 383 of file class.ilExerciseManagementCollectFilesJob.php.

383 : int
384 {
385 global $DIC;
386 $ilDB = $DIC->database();
387
388 $and = "";
389 if ($this->participant_id > 0) {
390 $and = " AND user_id = " . $this->participant_id;
391 }
392
393 $query = "SELECT MAX(max_num) AS max" .
394 " FROM (SELECT COUNT(user_id) AS max_num FROM exc_returned" .
395 " WHERE obj_id=" . $a_obj_id . ". AND ass_id=" . $a_ass_id . $and . " AND mimetype IS NOT NULL" .
396 " GROUP BY user_id) AS COUNTS";
397
398 $set = $ilDB->query($query);
399 $row = $ilDB->fetchAssoc($set);
400 return (int) $row['max'];
401 }
$query

References $DIC, $ilDB, and $query.

◆ getFeedbackDirectory()

ilExerciseManagementCollectFilesJob::getFeedbackDirectory ( int  $participant_id,
int  $feedback_giver 
)
protected

see also bug https://mantis.ilias.de/view.php?id=30999

Definition at line 371 of file class.ilExerciseManagementCollectFilesJob.php.

371 : string
372 {
373 $dir = self::FBK_DIRECTORY . DIRECTORY_SEPARATOR .
375 "from_" . ilExSubmission::getDirectoryNameFromUserData($feedback_giver);
376 return $dir;
377 }

References ilExSubmission\getDirectoryNameFromUserData().

+ Here is the call graph for this function:

◆ getInputTypes()

ilExerciseManagementCollectFilesJob::getInputTypes ( )
Returns
\ILIAS\BackgroundTasks\Types\SingleType[]

Implements ILIAS\BackgroundTasks\Task.

Definition at line 81 of file class.ilExerciseManagementCollectFilesJob.php.

81 : array
82 {
83 return
84 [
85 new SingleType(IntegerValue::class),
86 new SingleType(IntegerValue::class),
87 new SingleType(IntegerValue::class),
88 new SingleType(IntegerValue::class),
89 new SingleType(IntegerValue::class)
90 ];
91 }

◆ getOutputType()

ilExerciseManagementCollectFilesJob::getOutputType ( )

Implements ILIAS\BackgroundTasks\Task.

Definition at line 93 of file class.ilExerciseManagementCollectFilesJob.php.

93 : Type
94 {
95 return new SingleType(StringValue::class);
96 }

◆ isExcelNeeded()

ilExerciseManagementCollectFilesJob::isExcelNeeded ( int  $a_ass_type,
bool  $a_has_fbk 
)
protected

Definition at line 257 of file class.ilExerciseManagementCollectFilesJob.php.

257 : bool
258 {
259 if ($a_ass_type == ilExAssignment::TYPE_TEXT || $a_ass_type == ilExAssignment::TYPE_UPLOAD
260 || $a_ass_type == ilExAssignment::TYPE_UPLOAD_TEAM) {
261 return true;
262 } elseif ($a_has_fbk && $a_ass_type != ilExAssignment::TYPE_UPLOAD_TEAM) {
263 return true;
264 }
265 return false;
266 }

References ilExAssignment\TYPE_TEXT, ilExAssignment\TYPE_UPLOAD, and ilExAssignment\TYPE_UPLOAD_TEAM.

◆ isStateless()

ilExerciseManagementCollectFilesJob::isStateless ( )
Returns
bool returns true iff the job's output ONLY depends on the input. Stateless task results may be cached!

Implements ILIAS\BackgroundTasks\Task\Job.

Definition at line 98 of file class.ilExerciseManagementCollectFilesJob.php.

98 : bool
99 {
100 return true;
101 }

◆ run()

ilExerciseManagementCollectFilesJob::run ( array  $input,
Observer  $observer 
)

run the job

Exceptions

ILIAS\BackgroundTasks\Exceptions\InvalidArgumentException

Exceptions

PhpOffice\PhpSpreadsheet\Exception

Exceptions
ilDatabaseException
ilExerciseException
ilObjectNotFoundException

Implements ILIAS\BackgroundTasks\Task\Job.

Definition at line 111 of file class.ilExerciseManagementCollectFilesJob.php.

114 : Value {
115 $this->exercise_id = $input[0]->getValue();
116 $this->exercise_ref_id = $input[1]->getValue();
117 $assignment_id = $input[2]->getValue();
118 $participant_id = $input[3]->getValue();
119 $this->user_id = $input[4]->getValue();
120 $final_directory = "";
121
122 //if we have assignment
123 if ($assignment_id > 0) {
124 $this->collectAssignmentData($assignment_id);
125 $final_directory = $this->target_directory;
126 }
127
128 if ($participant_id > 0) {
129 $this->participant_id = $participant_id;
130 $assignments = ilExAssignment::getInstancesByExercise($this->exercise_id);
131 foreach ($assignments as $assignment) {
132 $this->collectAssignmentData($assignment->getId());
133 }
134 $final_directory = $this->temp_dir . DIRECTORY_SEPARATOR . ilExSubmission::getDirectoryNameFromUserData($participant_id);
135 }
136
137 $out = new StringValue();
138 $out->setValue($final_directory);
139 return $out;
140 }
$out
Definition: buildRTE.php:24
static getInstancesByExercise(int $a_exc_id)
collectAssignmentData(int $assignment_id)
write assignment data to excel file

References $target_directory, and collectAssignmentData().

+ Here is the call graph for this function:

Field Documentation

◆ $ass_types_with_files

array ilExerciseManagementCollectFilesJob::$ass_types_with_files = []
protected

◆ $assignment

ilExAssignment ilExerciseManagementCollectFilesJob::$assignment
protected

◆ $criteria_items

array ilExerciseManagementCollectFilesJob::$criteria_items = []
protected

◆ $excel

ilExcel ilExerciseManagementCollectFilesJob::$excel
protected

◆ $exercise_id

int ilExerciseManagementCollectFilesJob::$exercise_id = 0
protected

◆ $exercise_ref_id

int ilExerciseManagementCollectFilesJob::$exercise_ref_id = 0
protected

◆ $lng

ilLanguage ilExerciseManagementCollectFilesJob::$lng
protected

◆ $logger

ilLogger ilExerciseManagementCollectFilesJob::$logger
protected

◆ $participant_id

int ilExerciseManagementCollectFilesJob::$participant_id = 0
protected

◆ $sanitized_title

string ilExerciseManagementCollectFilesJob::$sanitized_title = ""
protected

◆ $submissions_directory

string ilExerciseManagementCollectFilesJob::$submissions_directory = ""
protected

◆ $target_directory

string ilExerciseManagementCollectFilesJob::$target_directory = ""
protected

Definition at line 44 of file class.ilExerciseManagementCollectFilesJob.php.

Referenced by run().

◆ $temp_dir

string ilExerciseManagementCollectFilesJob::$temp_dir = null
protected

◆ $title_columns

array ilExerciseManagementCollectFilesJob::$title_columns = []
protected

◆ $user_id

int ilExerciseManagementCollectFilesJob::$user_id = 0
protected

◆ BG_COLOR

const ilExerciseManagementCollectFilesJob::BG_COLOR = "255,255,255"

◆ FBK_DIRECTORY

const ilExerciseManagementCollectFilesJob::FBK_DIRECTORY = "Feedback_files"

◆ FIRST_DEFAULT_REVIEW_COLUMN

const ilExerciseManagementCollectFilesJob::FIRST_DEFAULT_REVIEW_COLUMN = 5

◆ FIRST_DEFAULT_SUBMIT_COLUMN

const ilExerciseManagementCollectFilesJob::FIRST_DEFAULT_SUBMIT_COLUMN = 4

◆ LINK_COLOR

const ilExerciseManagementCollectFilesJob::LINK_COLOR = "0,0,255"

◆ PARTICIPANT_FIRSTNAME_COLUMN

const ilExerciseManagementCollectFilesJob::PARTICIPANT_FIRSTNAME_COLUMN = 1

◆ PARTICIPANT_LASTNAME_COLUMN

const ilExerciseManagementCollectFilesJob::PARTICIPANT_LASTNAME_COLUMN = 0

◆ PARTICIPANT_LOGIN_COLUMN

const ilExerciseManagementCollectFilesJob::PARTICIPANT_LOGIN_COLUMN = 2

◆ SUBMISSION_DATE_COLUMN

const ilExerciseManagementCollectFilesJob::SUBMISSION_DATE_COLUMN = 3

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