ILIAS  release_9 Revision v9.13-25-g2c18ec4c24f
ilPrgInvalidateExpiredProgressesCronJob Class Reference
+ Inheritance diagram for ilPrgInvalidateExpiredProgressesCronJob:
+ Collaboration diagram for ilPrgInvalidateExpiredProgressesCronJob:

Public Member Functions

 __construct ()
 
 getTitle ()
 
 getDescription ()
 
 getId ()
 
 hasAutoActivation ()
 
 hasFlexibleSchedule ()
 
 getDefaultScheduleType ()
 
 getDefaultScheduleValue ()
 
 run ()
 
- Public Member Functions inherited from ilCronJob
 setDateTimeProvider (?Closure $date_time_provider)
 
 isDue (?DateTimeImmutable $last_run, ?CronJobScheduleType $schedule_type, ?int $schedule_value, bool $is_manually_executed=false)
 
 getScheduleType ()
 Get current schedule type (if flexible) More...
 
 getScheduleValue ()
 Get current schedule value (if flexible) More...
 
 setSchedule (?CronJobScheduleType $a_type, ?int $a_value)
 Update current schedule (if flexible) More...
 
 getAllScheduleTypes ()
 Get all available schedule types. More...
 
 getScheduleTypesWithValues ()
 
 getValidScheduleTypes ()
 Returns a collection of all valid schedule types for a specific job. More...
 
 isManuallyExecutable ()
 
 hasCustomSettings ()
 
 addCustomSettingsToForm (ilPropertyFormGUI $a_form)
 
 saveCustomSettings (ilPropertyFormGUI $a_form)
 
 addToExternalSettingsForm (int $a_form_id, array &$a_fields, bool $a_is_active)
 
 activationWasToggled (ilDBInterface $db, ilSetting $setting, bool $a_currently_active)
 Important: This method is (also) called from the setup process, where the constructor of an ilCronJob ist NOT executed. More...
 
 getId ()
 
 getTitle ()
 
 getDescription ()
 
 hasAutoActivation ()
 Is to be activated on "installation", does only work for ILIAS core cron jobs. More...
 
 hasFlexibleSchedule ()
 
 getDefaultScheduleType ()
 
 getDefaultScheduleValue ()
 
 run ()
 

Protected Attributes

ilComponentLogger $log
 
ilLanguage $lng
 
ilPRGAssignmentDBRepository $assignment_repo
 
ilStudyProgrammeSettingsDBRepository $settings_repo
 
- Protected Attributes inherited from ilCronJob
CronJobScheduleType $schedule_type = null
 
int $schedule_value = null
 
Closure $date_time_provider = null
 

Private Attributes

const ID = 'prg_invalidate_expired_progresses'
 

Detailed Description

Constructor & Destructor Documentation

◆ __construct()

ilPrgInvalidateExpiredProgressesCronJob::__construct ( )

Definition at line 39 of file class.ilPrgInvalidateExpiredProgressesCronJob.php.

References $DIC, $dic, ilStudyProgrammeDIC\dic(), and ILIAS\Repository\lng().

40  {
41  global $DIC;
42  $this->log = $DIC['ilLog'];
43  $this->lng = $DIC['lng'];
44  $this->lng->loadLanguageModule('prg');
45 
47  $this->assignment_repo = $dic['repo.assignment'];
48  $this->settings_repo = $dic['model.Settings.ilStudyProgrammeSettingsRepository'];
49  }
global $DIC
Definition: feed.php:28
$dic
Definition: result.php:32
+ Here is the call graph for this function:

Member Function Documentation

◆ getDefaultScheduleType()

ilPrgInvalidateExpiredProgressesCronJob::getDefaultScheduleType ( )

Definition at line 76 of file class.ilPrgInvalidateExpiredProgressesCronJob.php.

77  {
78  return CronJobScheduleType::SCHEDULE_TYPE_IN_DAYS;
79  }
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...

◆ getDefaultScheduleValue()

ilPrgInvalidateExpiredProgressesCronJob::getDefaultScheduleValue ( )

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

81  : ?int
82  {
83  return 1;
84  }

◆ getDescription()

ilPrgInvalidateExpiredProgressesCronJob::getDescription ( )

Definition at line 56 of file class.ilPrgInvalidateExpiredProgressesCronJob.php.

References ILIAS\Repository\lng().

56  : string
57  {
58  return $this->lng->txt('prg_invalidate_expired_progresses_desc');
59  }
+ Here is the call graph for this function:

◆ getId()

ilPrgInvalidateExpiredProgressesCronJob::getId ( )

Definition at line 61 of file class.ilPrgInvalidateExpiredProgressesCronJob.php.

61  : string
62  {
63  return self::ID;
64  }

◆ getTitle()

ilPrgInvalidateExpiredProgressesCronJob::getTitle ( )

Definition at line 51 of file class.ilPrgInvalidateExpiredProgressesCronJob.php.

References ILIAS\Repository\lng().

51  : string
52  {
53  return $this->lng->txt('prg_invalidate_expired_progresses_title');
54  }
+ Here is the call graph for this function:

◆ hasAutoActivation()

ilPrgInvalidateExpiredProgressesCronJob::hasAutoActivation ( )

Definition at line 66 of file class.ilPrgInvalidateExpiredProgressesCronJob.php.

66  : bool
67  {
68  return true;
69  }

◆ hasFlexibleSchedule()

ilPrgInvalidateExpiredProgressesCronJob::hasFlexibleSchedule ( )

Definition at line 71 of file class.ilPrgInvalidateExpiredProgressesCronJob.php.

71  : bool
72  {
73  return true;
74  }

◆ run()

ilPrgInvalidateExpiredProgressesCronJob::run ( )

Definition at line 86 of file class.ilPrgInvalidateExpiredProgressesCronJob.php.

References Vendor\Package\$e, ilCronJobResult\STATUS_FAIL, ilCronJobResult\STATUS_NO_ACTION, and ilCronJobResult\STATUS_OK.

87  {
88  $result = new ilCronJobResult();
89  $expired = $this->assignment_repo->getExpiredAndNotInvalidated();
90 
91  if ($expired === []) {
92  $result->setStatus(ilCronJobResult::STATUS_NO_ACTION);
93  return $result;
94  }
95 
96  foreach ($expired as $assignment) {
97  try {
98  $assignment = $assignment->invalidate($this->settings_repo);
99  $this->assignment_repo->store($assignment);
100  } catch (ilException $e) {
101  $this->log->write('an error occured: ' . $e->getMessage());
102  $result->setStatus(ilCronJobResult::STATUS_FAIL);
103  return $result;
104  }
105  }
106 
107  $result->setStatus(ilCronJobResult::STATUS_OK);
108  return $result;
109  }
final const STATUS_NO_ACTION

Field Documentation

◆ $assignment_repo

ilPRGAssignmentDBRepository ilPrgInvalidateExpiredProgressesCronJob::$assignment_repo
protected

◆ $lng

ilLanguage ilPrgInvalidateExpiredProgressesCronJob::$lng
protected

◆ $log

ilComponentLogger ilPrgInvalidateExpiredProgressesCronJob::$log
protected

◆ $settings_repo

ilStudyProgrammeSettingsDBRepository ilPrgInvalidateExpiredProgressesCronJob::$settings_repo
protected

◆ ID

const ilPrgInvalidateExpiredProgressesCronJob::ID = 'prg_invalidate_expired_progresses'
private

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