ILIAS  release_8 Revision v8.24
ilPrgUserNotRestartedCronJob Class Reference

This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Learning e.V. More...

+ Inheritance diagram for ilPrgUserNotRestartedCronJob:
+ Collaboration diagram for ilPrgUserNotRestartedCronJob:

Public Member Functions

 __construct ()
 
 getTitle ()
 
 getDescription ()
 
 getId ()
 
 hasAutoActivation ()
 Is to be activated on "installation", does only work for ILIAS core cron jobs. More...
 
 hasFlexibleSchedule ()
 
 getDefaultScheduleType ()
 
 getDefaultScheduleValue ()
 
 run ()
 
- Public Member Functions inherited from ilCronJob
 setDateTimeProvider (?Closure $date_time_provider)
 
 isDue (?DateTimeImmutable $last_run, ?int $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 (?int $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 Member Functions

 getNow ()
 
 log (string $msg)
 

Protected Attributes

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

Private Attributes

const ID = 'prg_user_not_restarted'
 

Additional Inherited Members

- Data Fields inherited from ilCronJob
const SCHEDULE_TYPE_DAILY = 1
 @depracated This will be replaced with an ENUM in ILIAS 9 More...
 
const SCHEDULE_TYPE_IN_MINUTES = 2
 @depracated This will be replaced with an ENUM in ILIAS 9 More...
 
const SCHEDULE_TYPE_IN_HOURS = 3
 @depracated This will be replaced with an ENUM in ILIAS 9 More...
 
const SCHEDULE_TYPE_IN_DAYS = 4
 @depracated This will be replaced with an ENUM in ILIAS 9 More...
 
const SCHEDULE_TYPE_WEEKLY = 5
 @depracated This will be replaced with an ENUM in ILIAS 9 More...
 
const SCHEDULE_TYPE_MONTHLY = 6
 @depracated This will be replaced with an ENUM in ILIAS 9 More...
 
const SCHEDULE_TYPE_QUARTERLY = 7
 @depracated This will be replaced with an ENUM in ILIAS 9 More...
 
const SCHEDULE_TYPE_YEARLY = 8
 @depracated This will be replaced with an ENUM in ILIAS 9 More...
 

Detailed Description

This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Learning e.V.

ILIAS is licensed with the GPL-3.0, see https://www.gnu.org/licenses/gpl-3.0.en.html You should have received a copy of said license along with the source code, too.

If this is not the case or you just want to try ILIAS, you'll find us at: https://www.ilias.de https://github.com/ILIAS-eLearning Inform a user, that her qualification is about to expire

Definition at line 24 of file class.ilPrgUserNotRestartedCronJob.php.

Constructor & Destructor Documentation

◆ __construct()

ilPrgUserNotRestartedCronJob::__construct ( )

Definition at line 33 of file class.ilPrgUserNotRestartedCronJob.php.

34 {
35 global $DIC;
36 $this->log = $DIC['ilLog'];
37 $this->lng = $DIC['lng'];
38 $this->lng->loadLanguageModule('prg');
39
41 $this->assignment_repo = $dic['repo.assignment'];
42 $this->adapter = $dic['cron.notRestarted'];
43 }
global $DIC
Definition: feed.php:28
$dic
Definition: result.php:32

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

+ Here is the call graph for this function:

Member Function Documentation

◆ getDefaultScheduleType()

ilPrgUserNotRestartedCronJob::getDefaultScheduleType ( )

Reimplemented from ilCronJob.

Definition at line 70 of file class.ilPrgUserNotRestartedCronJob.php.

70 : int
71 {
73 }
const SCHEDULE_TYPE_IN_DAYS
@depracated This will be replaced with an ENUM in ILIAS 9

References ilCronJob\SCHEDULE_TYPE_IN_DAYS.

◆ getDefaultScheduleValue()

ilPrgUserNotRestartedCronJob::getDefaultScheduleValue ( )

Reimplemented from ilCronJob.

Definition at line 75 of file class.ilPrgUserNotRestartedCronJob.php.

75 : ?int
76 {
77 return 1;
78 }

◆ getDescription()

ilPrgUserNotRestartedCronJob::getDescription ( )

Reimplemented from ilCronJob.

Definition at line 50 of file class.ilPrgUserNotRestartedCronJob.php.

50 : string
51 {
52 return $this->lng->txt('prg_user_not_restarted_desc');
53 }

References ILIAS\Repository\lng().

+ Here is the call graph for this function:

◆ getId()

ilPrgUserNotRestartedCronJob::getId ( )

Reimplemented from ilCronJob.

Definition at line 55 of file class.ilPrgUserNotRestartedCronJob.php.

55 : string
56 {
57 return self::ID;
58 }

References ID.

◆ getNow()

ilPrgUserNotRestartedCronJob::getNow ( )
protected

Reimplemented in ilPrgUserNotRestartedCronJobMock.

Definition at line 120 of file class.ilPrgUserNotRestartedCronJob.php.

120 : DateTimeImmutable
121 {
122 return new DateTimeImmutable();
123 }

Referenced by run().

+ Here is the caller graph for this function:

◆ getTitle()

ilPrgUserNotRestartedCronJob::getTitle ( )

Reimplemented from ilCronJob.

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

45 : string
46 {
47 return $this->lng->txt('prg_user_not_restarted_title');
48 }

References ILIAS\Repository\lng().

+ Here is the call graph for this function:

◆ hasAutoActivation()

ilPrgUserNotRestartedCronJob::hasAutoActivation ( )

Is to be activated on "installation", does only work for ILIAS core cron jobs.

Reimplemented from ilCronJob.

Definition at line 60 of file class.ilPrgUserNotRestartedCronJob.php.

60 : bool
61 {
62 return true;
63 }

◆ hasFlexibleSchedule()

ilPrgUserNotRestartedCronJob::hasFlexibleSchedule ( )

Reimplemented from ilCronJob.

Definition at line 65 of file class.ilPrgUserNotRestartedCronJob.php.

65 : bool
66 {
67 return true;
68 }

◆ log()

ilPrgUserNotRestartedCronJob::log ( string  $msg)
protected

Reimplemented in ilPrgUserNotRestartedCronJobMock.

Definition at line 125 of file class.ilPrgUserNotRestartedCronJob.php.

125 : void
126 {
127 $this->log->write($msg);
128 }

References log().

Referenced by __construct(), log(), and run().

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

◆ run()

ilPrgUserNotRestartedCronJob::run ( )

Reimplemented from ilCronJob.

Definition at line 80 of file class.ilPrgUserNotRestartedCronJob.php.

81 {
82 $result = new ilCronJobResult();
83 $result->setStatus(ilCronJobResult::STATUS_NO_ACTION);
84
85 $programmes_to_send = $this->adapter->getRelevantProgrammeIds();
86 if (count($programmes_to_send) == 0) {
87 return $result;
88 }
89
90 $today = $this->getNow();
91 $programmes_and_due = [];
92 foreach ($programmes_to_send as $programme_obj_id => $days_offset_mail) {
93 $interval = new DateInterval('P' . $days_offset_mail . 'D');
94 $due = $today->add($interval);
95 $programmes_and_due[$programme_obj_id] = $due;
96 }
97
98 $assignments = $this->assignment_repo->getAboutToExpire($programmes_and_due, true);
99
100 if (count($assignments) == 0) {
101 return $result;
102 }
103 foreach ($assignments as $ass) {
104 $pgs = $ass->getProgressTree();
105 $this->log(
106 sprintf(
107 'PRG, UserNotRestarted: user %s\'s qualification is about to expire at assignment %s (prg obj_id %s)',
108 $ass->getUserId(),
109 $ass->getId(),
110 $pgs->getNodeId()
111 )
112 );
113 $this->adapter->actOnSingleAssignment($ass);
114 $this->assignment_repo->storeExpiryInfoSentFor($ass);
115 }
116 $result->setStatus(ilCronJobResult::STATUS_OK);
117 return $result;
118 }

References getNow(), log(), ilCronJobResult\STATUS_NO_ACTION, and ilCronJobResult\STATUS_OK.

Referenced by ilStudyProgrammeCronAboutToExpireTest\testAboutToExpireEvents().

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

Field Documentation

◆ $adapter

ilPrgCronJobAdapter ilPrgUserNotRestartedCronJob::$adapter
protected

◆ $assignment_repo

ilPRGAssignmentDBRepository ilPrgUserNotRestartedCronJob::$assignment_repo
protected

Definition at line 30 of file class.ilPrgUserNotRestartedCronJob.php.

◆ $lng

ilLanguage ilPrgUserNotRestartedCronJob::$lng
protected

Definition at line 29 of file class.ilPrgUserNotRestartedCronJob.php.

◆ $log

ilComponentLogger ilPrgUserNotRestartedCronJob::$log
protected

Definition at line 28 of file class.ilPrgUserNotRestartedCronJob.php.

◆ ID

const ilPrgUserNotRestartedCronJob::ID = 'prg_user_not_restarted'
private

Definition at line 26 of file class.ilPrgUserNotRestartedCronJob.php.

Referenced by getId().


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