ILIAS  trunk Revision v11.0_alpha-3011-gc6b235a2e85
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, \ILIAS\Exercise\PeerReview\Criteria\CriteriaFile $file)
 Copy a file in the Feedback_files directory TODO use the new filesystem. More...
 
 getExpectedTimeOfTaskInSeconds ()
 
 collectSubmissionFiles ()
 Store the zip file which contains all submission files in the target directory. More...
 
 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, Submission $sub)
 
 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 (array $values)
 
 extractType ($value)
 

Protected Attributes

ILIAS Exercise PeerReview DomainService $peer_review
 
InternalDomainService $domain
 
ILIAS Exercise Team TeamManager $team
 
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
 
array $selected_participants = null
 
- Protected Attributes inherited from ILIAS\BackgroundTasks\Implementation\Tasks\AbstractTask
array $input = []
 
Value $output
 

Detailed Description

Constructor & Destructor Documentation

◆ __construct()

ilExerciseManagementCollectFilesJob::__construct ( )

Constructor.

@noinspection PhpUndefinedMethodInspection

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

69 {
70 global $DIC;
71 $this->lng = $DIC->language();
72 $this->lng->loadLanguageModule('exc');
73 //TODO will be deprecated when use the new assignment type interface
74 $this->ass_types_with_files = array(
79 );
81 $this->logger = $DIC->logger()->exc();
82 $this->domain = $DIC->exercise()->internal()->domain();
83 $this->peer_review = $this->domain->peerReview();
84 $this->team = $DIC->exercise()->internal()->domain()->team();
85 }
const TYPE_UPLOAD
direct checks against const should be avoided, use type objects instead
global $DIC
Definition: shib_login.php:26

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 191 of file class.ilExerciseManagementCollectFilesJob.php.

191 : void
192 {
193 $col = 0;
194 foreach ($this->title_columns as $title) {
195 $this->excel->setCell(1, $col, $title);
196 $col++;
197 }
198 }

◆ addLink()

ilExerciseManagementCollectFilesJob::addLink ( int  $a_row,
int  $a_col,
Submission  $sub 
)

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

411 : void {
412 $user_id = $sub->getUserId();
414
415 $filepath = './' . $this->lng->txt("exc_ass_submission_zip") . DIRECTORY_SEPARATOR . $targetdir . DIRECTORY_SEPARATOR;
416 switch ($this->assignment->getType()) {
418 $filepath .= $sub->getTitle();
419 break;
420
422 $wsp_tree = new ilWorkspaceTree($user_id);
423 // #12939
424 if (!$wsp_tree->getRootId()) {
425 $wsp_tree->createTreeForUser($user_id);
426 }
427 $node = $wsp_tree->getNodeData((int) $sub->getTitle());
428 $filepath .= "blog_" . $node['obj_id'] . DIRECTORY_SEPARATOR . "index.html";
429 break;
430
432 $filepath .= "prt_" . $sub->getTitle() . DIRECTORY_SEPARATOR . "index.html";
433 break;
434
435 default:
436 $filepath = "";
437 }
438 $this->excel->addLink($a_row, $a_col, $filepath);
439 }
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 450 of file class.ilExerciseManagementCollectFilesJob.php.

450 : void
451 {
452 $ass_has_feedback = false;
453 $ass_has_criteria = false;
454
455 //assignment object
456 $this->assignment = new ilExAssignment($assignment_id);
457 $assignment_type = $this->assignment->getType();
458
459 //Sanitized title for excel file and target directory.
460 $this->sanitized_title = ilFileUtils::getASCIIFilename($this->assignment->getTitle());
461
462 // directories
463 if (!isset($this->temp_dir)) {
465 }
466 $this->createTargetDirectory();
467
468 //Collect submission files if needed by assignment type.
469 if (in_array($assignment_type, $this->ass_types_with_files)) {
471 $this->collectSubmissionFiles();
472 }
473
474 $first_excel_column_for_review = 0;
475 $col = 0;
476 $peer_review = null;
477 if ($this->assignment->getPeerReview()) {
478 $ass_has_feedback = true;
479 //obj to get the reviews in the foreach below.
480 $peer_review = new ilExPeerReview($this->assignment);
481 //default start column for revisions.
482 $first_excel_column_for_review = self::FIRST_DEFAULT_REVIEW_COLUMN;
483 }
484
485 if ($this->isExcelNeeded($assignment_type, $ass_has_feedback)) {
486 // PhpSpreadsheet object
487 $this->excel = new ilExcel();
488
489 //Excel sheet title
490 $this->excel->addSheet($this->sanitized_title);
491
492 //add common excel Columns
493 #25585
494 $this->title_columns = array(
495 $this->lng->txt('lastname'),
496 $this->lng->txt('firstname'),
497 $this->lng->txt('login'),
498 $this->lng->txt('exc_last_submission')
499 );
500 switch ($assignment_type) {
502 $this->title_columns[] = $this->lng->txt("exc_submission_text");
503 break;
506 if ($assignment_type === ilExAssignment::TYPE_UPLOAD_TEAM) {
507 $first_excel_column_for_review++;
508 $this->title_columns[] = $this->lng->txt("exc_team");
509 }
510 $num_columns_submission = $this->getExtraColumnsForSubmissionFiles($this->exercise_id, $assignment_id);
511 if ($num_columns_submission > 1) {
512 for ($i = 1; $i <= $num_columns_submission; $i++) {
513 $this->title_columns[] = $this->lng->txt("exc_submission_file") . " " . $i;
514 }
515 } else {
516 $this->title_columns[] = $this->lng->txt("exc_submission_file");
517 }
518
519 $first_excel_column_for_review += $num_columns_submission - 1;
520 break;
521 default:
522 $this->title_columns[] = $this->lng->txt("exc_submission");
523 break;
524 }
525 if ($ass_has_feedback) {
526 $this->title_columns[] = $this->lng->txt("exc_peer_review_giver");
527 $this->title_columns[] = $this->lng->txt('exc_last_submission');
528 }
529
530 //criteria
531 //Notice:getPeerReviewCriteriaCatalogueItems can return just an empty instance without data.
532 if ($this->criteria_items = $this->assignment->getPeerReviewCriteriaCatalogueItems()) {
533 $ass_has_criteria = true;
534 }
535
536 if ($this->participant_id > 0) {
537 $participants = array($this->participant_id);
538 } else {
539 $participants = $this->getAssignmentMembersIds();
540 }
541
542 $filter = new ilExerciseMembersFilter($this->exercise_ref_id, $participants, $this->user_id);
543 $participants = $filter->filterParticipantsByAccess();
544
545 $row = 2;
546 // Fill the excel
547 foreach ($participants as $participant_id) {
548 if (!is_null($this->selected_participants) && !in_array($participant_id, $this->selected_participants)) {
549 continue;
550 }
551
552 $submissions = $this->domain->submission($this->assignment->getId())
553 ->getSubmissionsOfUser($participant_id);
554
555 if ($submissions->current()) {
556 $participant_name = ilObjUser::_lookupName($participant_id);
557 $this->excel->setCell($row, self::PARTICIPANT_LASTNAME_COLUMN, $participant_name['lastname']);
558 $this->excel->setCell($row, self::PARTICIPANT_FIRSTNAME_COLUMN, $participant_name['firstname']);
559 $this->excel->setCell($row, self::PARTICIPANT_LOGIN_COLUMN, $participant_name['login']);
560
561 //Get the submission Text
562 if (!in_array($assignment_type, $this->ass_types_with_files)) {
563 foreach ($submissions as $sub) {
564 $this->excel->setCell($row, self::SUBMISSION_DATE_COLUMN, $sub->getTimestamp());
565 $this->excel->setCell($row, self::FIRST_DEFAULT_SUBMIT_COLUMN, $sub->getText());
566 }
567 } else {
569 if ($assignment_type === ilExAssignment::TYPE_UPLOAD_TEAM) {
570 $team_id = $this->team->getTeamForMember($this->assignment->getId(), $participant_id);
571 $this->excel->setCell($row, $col, (string) $team_id);
572 $col++;
573 }
574 foreach ($submissions as $sub) {
575 $this->excel->setCell($row, self::SUBMISSION_DATE_COLUMN, $sub->getTimestamp());
576
577 if ($assignment_type == ilExAssignment::TYPE_PORTFOLIO || $assignment_type == ilExAssignment::TYPE_BLOG) {
578 $this->excel->setCell($row, $col, $this->lng->txt("open"));
579 } else {
580 $this->excel->setCell($row, $col, $sub->getTitle());
581 }
582 $this->excel->setColors($this->excel->getCoordByColumnAndRow($col, $row), self::BG_COLOR, self::LINK_COLOR);
583 if ($assignment_type != ilExAssignment::TYPE_UPLOAD_TEAM) {
584 $this->addLink($row, $col, $sub);
585 }
586 $col++; //does not affect blogs and portfolios.
587 }
588 }
589
590 if ($ass_has_feedback) {
591 if ($col < $first_excel_column_for_review) {
592 $col = $first_excel_column_for_review;
593 }
594 $reviews = [];
595 if ($peer_review !== null) {
596 $reviews = $peer_review->getPeerReviewsByPeerId($participant_id);
597 }
598
599 //extra lines
600 $current_review_row = 0;
601 foreach ($reviews as $review) {
602 //not all reviews are done, we check it via date of review.
603 if ($review['tstamp']) {
604 $current_review_row++;
605 if ($current_review_row > 1) {
606 for ($i = 0; $i < $first_excel_column_for_review; $i++) {
607 $cell_to_copy = $this->excel->getCell($row, $i);
608 $this->excel->setCell($row + 1, $i, $cell_to_copy);
609 if ($i >= self::FIRST_DEFAULT_SUBMIT_COLUMN) {
610 $this->excel->setColors($this->excel->getCoordByColumnAndRow($i, $row + 1), self::BG_COLOR, self::LINK_COLOR);
611 }
612 }
613 ++$row;
614 }
615
616 $feedback_giver = $review['giver_id']; // user who made the review.
617
618 $feedback_giver_name = ilObjUser::_lookupName($feedback_giver);
619
620 $this->excel->setCell(
621 $row,
622 $col,
623 $feedback_giver_name['lastname'] . ", " . $feedback_giver_name['firstname'] . " [" . $feedback_giver_name['login'] . "]"
624 );
625
626 $this->excel->setCell($row, $col + 1, $review['tstamp']);
627
628 if ($ass_has_criteria) {
629 $this->addCriteriaToExcel($feedback_giver, $participant_id, $row, $col + 1);
630 }
631 }
632 }
633 }
634
635 $row++;
636 }
637 }
638
639 $this->addColumnTitles();
640 $this->excel->writeToFile($this->target_directory . "/" . $this->sanitized_title);
641 }
642 }
Exercise assignment.
Exercise peer review.
ILIAS Exercise PeerReview DomainService $peer_review
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.
collectSubmissionFiles()
Store the zip file which contains all submission files in the target directory.
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.
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)

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

+ Here is the call graph for this function:

◆ collectSubmissionFiles()

ilExerciseManagementCollectFilesJob::collectSubmissionFiles ( )

Store the zip file which contains all submission files in the target directory.

TODO -> put the reference of the original code. Possible TODO -> extract this to another BT job.

Exceptions
ilDatabaseException
ilExerciseException
ilObjectNotFoundException

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

242 : void
243 {
244 $members = array();
245
246 $exercise = new ilObjExercise($this->exercise_id, false);
247
248 if ($this->participant_id > 0) {
249 $exc_members_id = array($this->participant_id);
250 } else {
251 $exc_members_id = $exercise->members_obj->getMembers();
252 }
253
254 $filter = new ilExerciseMembersFilter($this->exercise_ref_id, $exc_members_id, $this->user_id);
255 $exc_members_id = $filter->filterParticipantsByAccess();
256
257 $user_ids = [];
258 foreach ($exc_members_id as $member_id) {
259 if (!is_null($this->selected_participants) && !in_array($member_id, $this->selected_participants)) {
260 continue;
261 }
262 $user_ids[] = $member_id;
263 }
264
265 $this->domain->submission($this->assignment->getId())
266 ->copySubmissionsToDir(
267 $user_ids,
268 $this->submissions_directory
269 );
270 }
Class ilObjExercise.

References $exercise.

◆ copyFileToSubDirectory()

ilExerciseManagementCollectFilesJob::copyFileToSubDirectory ( string  $a_directory,
\ILIAS\Exercise\PeerReview\Criteria\CriteriaFile  $file 
)

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

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

163 : void
164 {
165 $crit_file_manager = $this->peer_review->criteriaFile($this->assignment->getId());
166 $dir = $this->target_directory . "/" . $a_directory;
167
168 if (!is_dir($dir)) {
170 }
171
172 $f = fopen($dir . "/" . basename($file->getTitle()), 'wb');
173 fwrite($f, $crit_file_manager->getStream($file->getRid())->getContents());
174 fclose($f);
175
176 /*global $DIC;
177 $fs = $DIC->filesystem();
178
179 $fs->storage()->copy($a_file, $this->temp_dir."/".basename($a_file));*/
180 }
static makeDirParents(string $a_dir)
Create a new directory and all parent directories.

References Vendor\Package\$f, and ilFileUtils\makeDirParents().

+ Here is the call graph for this function:

◆ createSubmissionsDirectory()

ilExerciseManagementCollectFilesJob::createSubmissionsDirectory ( )
protected

Create the directory with the assignment title.

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

227 : void
228 {
229 $this->logger->dump("lang key => " . $this->lng->getLangKey());
230 $this->submissions_directory = $this->target_directory . DIRECTORY_SEPARATOR . $this->lng->txt("exc_ass_submission_zip");
231 ilFileUtils::createDirectory($this->submissions_directory);
232 }
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 213 of file class.ilExerciseManagementCollectFilesJob.php.

213 : void
214 {
215 $path = $this->temp_dir . DIRECTORY_SEPARATOR;
216 if ($this->participant_id > 0) {
217 $user_dir = ilExSubmission::getDirectoryNameFromUserData($this->participant_id);
218 $path .= $user_dir . DIRECTORY_SEPARATOR;
219 }
220 $this->target_directory = $path . $this->sanitized_title;
221 ilFileUtils::makeDirParents($this->target_directory);
222 }
$path
Definition: ltiservices.php:30

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 204 of file class.ilExerciseManagementCollectFilesJob.php.

204 : void
205 {
206 $this->temp_dir = ilFileUtils::ilTempnam();
207 ilFileUtils::makeDirParents($this->temp_dir);
208 }
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 648 of file class.ilExerciseManagementCollectFilesJob.php.

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

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 182 of file class.ilExerciseManagementCollectFilesJob.php.

182 : int
183 {
184 return 30;
185 }

◆ 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 398 of file class.ilExerciseManagementCollectFilesJob.php.

398 : int
399 {
400 $subm = $this->domain->submission($a_ass_id);
401 return $subm->getMaxAmountOfSubmittedFiles(
402 $this->participant_id
403 );
404 }

◆ getFeedbackDirectory()

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

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

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

386 : string
387 {
388 $dir = self::FBK_DIRECTORY . DIRECTORY_SEPARATOR .
390 "from_" . ilExSubmission::getDirectoryNameFromUserData($feedback_giver);
391 return $dir;
392 }

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 90 of file class.ilExerciseManagementCollectFilesJob.php.

90 : array
91 {
92 return
93 [
94 new SingleType(IntegerValue::class),
95 new SingleType(IntegerValue::class),
96 new SingleType(IntegerValue::class),
97 new SingleType(IntegerValue::class),
98 new SingleType(IntegerValue::class),
99 new SingleType(StringValue::class),
100 ];
101 }

◆ getOutputType()

ilExerciseManagementCollectFilesJob::getOutputType ( )

Implements ILIAS\BackgroundTasks\Task.

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

103 : Type
104 {
105 return new SingleType(StringValue::class);
106 }

◆ isExcelNeeded()

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

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

272 : bool
273 {
274 if ($a_ass_type == ilExAssignment::TYPE_TEXT || $a_ass_type == ilExAssignment::TYPE_UPLOAD
275 || $a_ass_type == ilExAssignment::TYPE_UPLOAD_TEAM) {
276 return true;
277 } elseif ($a_has_fbk && $a_ass_type != ilExAssignment::TYPE_UPLOAD_TEAM) {
278 return true;
279 }
280 return false;
281 }

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 108 of file class.ilExerciseManagementCollectFilesJob.php.

108 : bool
109 {
110 return true;
111 }

◆ 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 121 of file class.ilExerciseManagementCollectFilesJob.php.

124 : Value {
125 $this->exercise_id = $input[0]->getValue();
126 $this->exercise_ref_id = $input[1]->getValue();
127 $assignment_id = $input[2]->getValue();
128 $participant_id = $input[3]->getValue();
129 $this->user_id = $input[4]->getValue();
130 $selected_participants = $input[5]->getValue();
131 $this->logger->debug("Collect files. assignment id: " . $assignment_id . ", selected participants: " . $selected_participants);
132 if (trim($selected_participants) === "") {
133 $this->selected_participants = null;
134 } else {
135 $this->selected_participants = explode(",", $selected_participants);
136 }
137 $final_directory = "";
138
139 //if we have assignment
140 if ($assignment_id > 0) {
141 $this->collectAssignmentData($assignment_id);
142 $final_directory = $this->target_directory;
143 }
144
145 if ($participant_id > 0) {
146 $this->participant_id = $participant_id;
147 $assignments = ilExAssignment::getInstancesByExercise($this->exercise_id);
148 foreach ($assignments as $assignment) {
149 $this->collectAssignmentData($assignment->getId());
150 }
151 $final_directory = $this->temp_dir . DIRECTORY_SEPARATOR . ilExSubmission::getDirectoryNameFromUserData($participant_id);
152 }
153
154 $out = new StringValue();
155 $out->setValue($final_directory);
156 return $out;
157 }
$out
Definition: buildRTE.php:24
static getInstancesByExercise(int $a_exc_id)
collectAssignmentData(int $assignment_id)
write assignment data to excel file

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

◆ $domain

InternalDomainService ilExerciseManagementCollectFilesJob::$domain
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

◆ $peer_review

ILIAS Exercise PeerReview DomainService ilExerciseManagementCollectFilesJob::$peer_review
protected

◆ $sanitized_title

string ilExerciseManagementCollectFilesJob::$sanitized_title = ""
protected

◆ $selected_participants

array ilExerciseManagementCollectFilesJob::$selected_participants = null
protected

◆ $submissions_directory

string ilExerciseManagementCollectFilesJob::$submissions_directory = ""
protected

◆ $target_directory

string ilExerciseManagementCollectFilesJob::$target_directory = ""
protected

◆ $team

ILIAS Exercise Team TeamManager ilExerciseManagementCollectFilesJob::$team
protected

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