ILIAS  release_9 Revision v9.13-25-g2c18ec4c24f
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
array returns the input array
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...
 

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

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 = []
 
ILIAS BackgroundTasks Value $output
 

Detailed Description

Constructor & Destructor Documentation

◆ __construct()

ilExerciseManagementCollectFilesJob::__construct ( )

Constructor.

PhpUndefinedMethodInspection

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

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

65  {
66  global $DIC;
67  $this->lng = $DIC->language();
68  $this->lng->loadLanguageModule('exc');
69  //TODO will be deprecated when use the new assignment type interface
70  $this->ass_types_with_files = array(
75  );
77  $this->logger = $DIC->logger()->exc();
78  $this->team = $DIC->exercise()->internal()->domain()->team();
79  }
const TYPE_UPLOAD
direct checks against const should be avoided, use type objects instead
global $DIC
Definition: feed.php:28
+ Here is the call graph for this function:

Member Function Documentation

◆ addColumnTitles()

ilExerciseManagementCollectFilesJob::addColumnTitles ( )
protected

Set the Excel column titles.

Exceptions

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

Referenced by collectAssignmentData().

182  : void
183  {
184  $col = 0;
185  foreach ($this->title_columns as $title) {
186  $this->excel->setCell(1, $col, $title);
187  $col++;
188  }
189  }
+ Here is the caller graph for this function:

◆ addLink()

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

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

References ilExSubmission\getDirectoryNameFromUserData(), ILIAS\Repository\lng(), ilExAssignment\TYPE_BLOG, ilExAssignment\TYPE_PORTFOLIO, and ilExAssignment\TYPE_UPLOAD.

Referenced by collectAssignmentData().

422  : void {
423  $user_id = $a_submission_file['user_id'];
425 
426  $filepath = './' . $this->lng->txt("exc_ass_submission_zip") . DIRECTORY_SEPARATOR . $targetdir . DIRECTORY_SEPARATOR;
427  switch ($this->assignment->getType()) {
429  $filepath .= $a_submission_file['filetitle'];
430  break;
431 
433  $wsp_tree = new ilWorkspaceTree($user_id);
434  // #12939
435  if (!$wsp_tree->getRootId()) {
436  $wsp_tree->createTreeForUser($user_id);
437  }
438  $node = $wsp_tree->getNodeData((int) $a_submission_file['filetitle']);
439  $filepath .= "blog_" . $node['obj_id'] . DIRECTORY_SEPARATOR . "index.html";
440  break;
441 
443  $filepath .= "prt_" . $a_submission_file['filetitle'] . DIRECTORY_SEPARATOR . "index.html";
444  break;
445 
446  default:
447  $filepath = "";
448  }
449  $this->excel->addLink($a_row, $a_col, $filepath);
450  }
const TYPE_UPLOAD
direct checks against const should be avoided, use type objects instead
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
static getDirectoryNameFromUserData(int $a_user_id)
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ collectAssignmentData()

ilExerciseManagementCollectFilesJob::collectAssignmentData ( int  $assignment_id)
protected

write assignment data to excel file

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

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

References $participant_id, ilObjUser\_lookupName(), addColumnTitles(), addLink(), createSubmissionsDirectory(), createTargetDirectory(), createUniqueTempDirectory(), ilFileUtils\getASCIIFilename(), getAssignmentMembersIds(), getExtraColumnsForSubmissionFiles(), isExcelNeeded(), ILIAS\Repository\lng(), ilExAssignment\TYPE_BLOG, ilExAssignment\TYPE_PORTFOLIO, ilExAssignment\TYPE_TEXT, ilExAssignment\TYPE_UPLOAD, and ilExAssignment\TYPE_UPLOAD_TEAM.

Referenced by run().

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

References ilFileUtils\makeDirParents().

Referenced by isExcelNeeded().

157  : void
158  {
159  $dir = $this->target_directory . "/" . $a_directory;
160 
161  if (!is_dir($dir)) {
163  }
164 
165  copy($a_file, $dir . "/" . basename($a_file));
166 
167  /*global $DIC;
168  $fs = $DIC->filesystem();
169 
170  $fs->storage()->copy($a_file, $this->temp_dir."/".basename($a_file));*/
171  }
static makeDirParents(string $a_dir)
Create a new directory and all parent directories.
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ createSubmissionsDirectory()

ilExerciseManagementCollectFilesJob::createSubmissionsDirectory ( )
protected

Create the directory with the assignment title.

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

References $exercise, ilObject\_exists(), ilFileUtils\createDirectory(), ilExSubmission\downloadAllAssignmentFiles(), ilObjectFactory\getInstanceByObjId(), ILIAS\Repository\lng(), and ILIAS\Repository\logger().

Referenced by collectAssignmentData().

218  : void
219  {
220  $this->logger->dump("lang key => " . $this->lng->getLangKey());
221  $this->submissions_directory = $this->target_directory . DIRECTORY_SEPARATOR . $this->lng->txt("exc_ass_submission_zip");
222  ilFileUtils::createDirectory($this->submissions_directory);
223  }
static createDirectory(string $a_dir, int $a_mod=0755)
create directory
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ createTargetDirectory()

ilExerciseManagementCollectFilesJob::createTargetDirectory ( )
protected

Create the directory with the assignment title.

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

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

Referenced by collectAssignmentData().

204  : void
205  {
206  $path = $this->temp_dir . DIRECTORY_SEPARATOR;
207  if ($this->participant_id > 0) {
208  $user_dir = ilExSubmission::getDirectoryNameFromUserData($this->participant_id);
209  $path .= $user_dir . DIRECTORY_SEPARATOR;
210  }
211  $this->target_directory = $path . $this->sanitized_title;
212  ilFileUtils::makeDirParents($this->target_directory);
213  }
static makeDirParents(string $a_dir)
Create a new directory and all parent directories.
$path
Definition: ltiservices.php:32
static getDirectoryNameFromUserData(int $a_user_id)
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ createUniqueTempDirectory()

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

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

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

Referenced by collectAssignmentData().

195  : void
196  {
197  $this->temp_dir = ilFileUtils::ilTempnam();
198  ilFileUtils::makeDirParents($this->temp_dir);
199  }
static makeDirParents(string $a_dir)
Create a new directory and all parent directories.
static ilTempnam(?string $a_temp_path=null)
Returns a unique and non existing Path for e temporary file or directory.
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ getAssignmentMembersIds()

ilExerciseManagementCollectFilesJob::getAssignmentMembersIds ( )

get ONLY the members ids for this assignment

Returns
int[]

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

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

Referenced by collectAssignmentData().

658  : array
659  {
660  global $DIC;
661 
662  $ilDB = $DIC->database();
663  $members = array();
664 
665  $set = $ilDB->query("SELECT usr_id" .
666  " FROM exc_mem_ass_status" .
667  " WHERE ass_id = " . $ilDB->quote($this->assignment->getId(), "integer"));
668 
669  while ($rec = $ilDB->fetchAssoc($set)) {
670  if (!\ilObjUser::userExists([(int) $rec['usr_id']])) {
671  continue;
672  }
673  $members[] = $rec['usr_id'];
674  }
675 
676  return $members;
677  }
global $DIC
Definition: feed.php:28
static userExists(array $a_usr_ids=[])
+ Here is the call graph for this function:
+ Here is the caller 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 173 of file class.ilExerciseManagementCollectFilesJob.php.

173  : int
174  {
175  return 30;
176  }

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

References $DIC, $ilDB, and $participant_id.

Referenced by collectAssignmentData().

397  : int
398  {
399  global $DIC;
400  $ilDB = $DIC->database();
401 
402  $and = "";
403  if ($this->participant_id > 0) {
404  $and = " AND user_id = " . $this->participant_id;
405  }
406 
407  $query = "SELECT MAX(max_num) AS max" .
408  " FROM (SELECT COUNT(user_id) AS max_num FROM exc_returned" .
409  " WHERE obj_id=" . $a_obj_id . ". AND ass_id=" . $a_ass_id . $and . " AND mimetype IS NOT NULL" .
410  " GROUP BY user_id) AS COUNTS";
411 
412  $set = $ilDB->query($query);
413  $row = $ilDB->fetchAssoc($set);
414  return (int) $row['max'];
415  }
global $DIC
Definition: feed.php:28
+ Here is the caller graph for this function:

◆ getFeedbackDirectory()

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

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

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

References ilExSubmission\getDirectoryNameFromUserData().

Referenced by isExcelNeeded().

385  : string
386  {
387  $dir = self::FBK_DIRECTORY . DIRECTORY_SEPARATOR .
388  "to_" . ilExSubmission::getDirectoryNameFromUserData($participant_id) . DIRECTORY_SEPARATOR .
389  "from_" . ilExSubmission::getDirectoryNameFromUserData($feedback_giver);
390  return $dir;
391  }
static getDirectoryNameFromUserData(int $a_user_id)
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ getInputTypes()

ilExerciseManagementCollectFilesJob::getInputTypes ( )
Returns
[]

Implements ILIAS\BackgroundTasks\Task.

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

84  : array
85  {
86  return
87  [
88  new SingleType(IntegerValue::class),
89  new SingleType(IntegerValue::class),
90  new SingleType(IntegerValue::class),
91  new SingleType(IntegerValue::class),
92  new SingleType(IntegerValue::class),
93  new SingleType(StringValue::class),
94  ];
95  }

◆ getOutputType()

ilExerciseManagementCollectFilesJob::getOutputType ( )

Implements ILIAS\BackgroundTasks\Task.

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

97  : Type
98  {
99  return new SingleType(StringValue::class);
100  }

◆ isExcelNeeded()

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

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

References $participant_id, copyFileToSubDirectory(), getFeedbackDirectory(), ilExcCriteria\getInstanceById(), ilExcCriteria\getInstanceByType(), ilRating\getRatingForUserAndObject(), ILIAS\Repository\lng(), ilExAssignment\TYPE_TEXT, ilExAssignment\TYPE_UPLOAD, and ilExAssignment\TYPE_UPLOAD_TEAM.

Referenced by collectAssignmentData().

271  : bool
272  {
273  if ($a_ass_type == ilExAssignment::TYPE_TEXT || $a_ass_type == ilExAssignment::TYPE_UPLOAD
274  || $a_ass_type == ilExAssignment::TYPE_UPLOAD_TEAM) {
275  return true;
276  } elseif ($a_has_fbk && $a_ass_type != ilExAssignment::TYPE_UPLOAD_TEAM) {
277  return true;
278  }
279  return false;
280  }
const TYPE_UPLOAD
direct checks against const should be avoided, use type objects instead
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

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

102  : bool
103  {
104  return true;
105  }

◆ run()

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

run the job

Exceptions

Implements ILIAS\BackgroundTasks\Task\Job.

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

References $out, $participant_id, $target_directory, collectAssignmentData(), ilExSubmission\getDirectoryNameFromUserData(), ilExAssignment\getInstancesByExercise(), and ILIAS\Repository\logger().

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

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

Referenced by createTargetDirectory().

◆ $selected_participants

array ilExerciseManagementCollectFilesJob::$selected_participants = null
protected

◆ $submissions_directory

string ilExerciseManagementCollectFilesJob::$submissions_directory = ""
protected

◆ $target_directory

string ilExerciseManagementCollectFilesJob::$target_directory = ""
protected

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

Referenced by run().

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