ILIAS  trunk Revision v11.0_alpha-1831-g8615d53dadb
All Data Structures Namespaces Files Functions Variables Enumerations Enumerator Modules Pages
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 ILIAS\Cron\CronJob
 setDateTimeProvider (?\Closure $date_time_provider)
 
 isDue (?\DateTimeImmutable $last_run, ?JobScheduleType $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 (?JobScheduleType $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 ()
 
 usesLegacyForms ()
 
 getCustomConfigurationInput (\ILIAS\UI\Factory $ui_factory, \ILIAS\Refinery\Factory $factory, \ilLanguage $lng)
 
 addCustomSettingsToForm (\ilPropertyFormGUI $a_form)
 
 saveCustomConfiguration (mixed $form_data)
 
 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 ILIAS\Cron\CronJob
JobScheduleType $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 41 of file class.ilPrgInvalidateExpiredProgressesCronJob.php.

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

42  {
43  global $DIC;
44  $this->log = $DIC['ilLog'];
45  $this->lng = $DIC['lng'];
46  $this->lng->loadLanguageModule('prg');
47 
49  $this->assignment_repo = $dic['repo.assignment'];
50  $this->settings_repo = $dic['model.Settings.ilStudyProgrammeSettingsRepository'];
51  }
global $DIC
Definition: shib_login.php:22
$dic
Definition: result.php:31
+ Here is the call graph for this function:

Member Function Documentation

◆ getDefaultScheduleType()

ilPrgInvalidateExpiredProgressesCronJob::getDefaultScheduleType ( )

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

79  {
80  return JobScheduleType::IN_DAYS;
81  }

◆ getDefaultScheduleValue()

ilPrgInvalidateExpiredProgressesCronJob::getDefaultScheduleValue ( )

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

83  : ?int
84  {
85  return 1;
86  }

◆ getDescription()

ilPrgInvalidateExpiredProgressesCronJob::getDescription ( )

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

References ILIAS\Repository\lng().

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

◆ getId()

ilPrgInvalidateExpiredProgressesCronJob::getId ( )

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

63  : string
64  {
65  return self::ID;
66  }

◆ getTitle()

ilPrgInvalidateExpiredProgressesCronJob::getTitle ( )

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

References ILIAS\Repository\lng().

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

◆ hasAutoActivation()

ilPrgInvalidateExpiredProgressesCronJob::hasAutoActivation ( )

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

68  : bool
69  {
70  return true;
71  }

◆ hasFlexibleSchedule()

ilPrgInvalidateExpiredProgressesCronJob::hasFlexibleSchedule ( )

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

73  : bool
74  {
75  return true;
76  }

◆ run()

ilPrgInvalidateExpiredProgressesCronJob::run ( )

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

References Vendor\Package\$e.

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

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: