ILIAS  release_7 Revision v7.30-3-g800a261c036
ilPrgUserRiskyToFailCronJob Class Reference
+ Inheritance diagram for ilPrgUserRiskyToFailCronJob:
+ Collaboration diagram for ilPrgUserRiskyToFailCronJob:

Public Member Functions

 __construct ()
 
 getTitle ()
 Get title. More...
 
 getDescription ()
 Get description. More...
 
 getId ()
 Get id. More...
 
 hasAutoActivation ()
 Is to be activated on "installation". More...
 
 hasFlexibleSchedule ()
 Can the schedule be configured? More...
 
 getDefaultScheduleType ()
 Get schedule type. More...
 
 getDefaultScheduleValue ()
 Get schedule value. More...
 
 run ()
 Run job. More...
 
- Public Member Functions inherited from ilCronJob
 isActive ($a_ts_last_run, $a_schedule_type, $a_schedule_value, $a_manual=false)
 Is job currently active? More...
 
 getScheduleType ()
 Get current schedule type (if flexible) More...
 
 getScheduleValue ()
 Get current schedule value (if flexible) More...
 
 setSchedule ($a_type, $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...
 
 getTitle ()
 Get title. More...
 
 getDescription ()
 Get description. More...
 
 isManuallyExecutable ()
 Defines whether or not a cron job can be started manually. More...
 
 hasCustomSettings ()
 Has cron job any custom setting which can be edited? More...
 
 addCustomSettingsToForm (ilPropertyFormGUI $a_form)
 Add custom settings to form. More...
 
 saveCustomSettings (ilPropertyFormGUI $a_form)
 Save custom settings. More...
 
 addToExternalSettingsForm ($a_form_id, array &$a_fields, $a_is_active)
 Add external settings to form. More...
 
 activationWasToggled ($a_currently_active)
 Cron job status was changed. More...
 
 getId ()
 Get id. More...
 
 hasAutoActivation ()
 Is to be activated on "installation". More...
 
 hasFlexibleSchedule ()
 Can the schedule be configured? More...
 
 getDefaultScheduleType ()
 Get schedule type. More...
 
 getDefaultScheduleValue ()
 Get schedule value. More...
 
 run ()
 Run job. More...
 

Data Fields

const ID = 'prg_user_risky_to_fail'
 
- Data Fields inherited from ilCronJob
const SCHEDULE_TYPE_DAILY = 1
 
const SCHEDULE_TYPE_IN_MINUTES = 2
 
const SCHEDULE_TYPE_IN_HOURS = 3
 
const SCHEDULE_TYPE_IN_DAYS = 4
 
const SCHEDULE_TYPE_WEEKLY = 5
 
const SCHEDULE_TYPE_MONTHLY = 6
 
const SCHEDULE_TYPE_QUARTERLY = 7
 
const SCHEDULE_TYPE_YEARLY = 8
 

Protected Member Functions

 getNow ()
 
 getSettingsRepository ()
 
 getProgressRepository ()
 
 getEvents ()
 
 log (string $msg)
 
- Protected Member Functions inherited from ilCronJob
 checkSchedule ($a_ts_last_run, $a_schedule_type, $a_schedule_value)
 

Protected Attributes

 $programme_settings_db
 
 $user_progress_db
 
 $events
 
 $dic
 
 $lng
 

Detailed Description

Definition at line 9 of file class.ilPrgUserRiskyToFailCronJob.php.

Constructor & Destructor Documentation

◆ __construct()

ilPrgUserRiskyToFailCronJob::__construct ( )

Definition at line 38 of file class.ilPrgUserRiskyToFailCronJob.php.

39 {
40 global $DIC;
41 $this->log = $DIC['ilLog'];
42 $this->lng = $DIC['lng'];
43 $this->lng->loadLanguageModule('prg');
44
45 $this->dic = ilStudyProgrammeDIC::dic();
46 }
global $DIC
Definition: goto.php:24

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

+ Here is the call graph for this function:

Member Function Documentation

◆ getDefaultScheduleType()

ilPrgUserRiskyToFailCronJob::getDefaultScheduleType ( )

Get schedule type.

Returns
int

Reimplemented from ilCronJob.

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

104 {
106 }
const SCHEDULE_TYPE_IN_DAYS

References ilCronJob\SCHEDULE_TYPE_IN_DAYS.

◆ getDefaultScheduleValue()

ilPrgUserRiskyToFailCronJob::getDefaultScheduleValue ( )

Get schedule value.

Returns
int|array

Reimplemented from ilCronJob.

Definition at line 113 of file class.ilPrgUserRiskyToFailCronJob.php.

114 {
115 return 1;
116 }

◆ getDescription()

ilPrgUserRiskyToFailCronJob::getDescription ( )

Get description.

Returns
string

Reimplemented from ilCronJob.

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

64 {
65 return $this->lng->txt('prg_user_risky_to_fail_desc');
66 }

◆ getEvents()

ilPrgUserRiskyToFailCronJob::getEvents ( )
protected

Definition at line 176 of file class.ilPrgUserRiskyToFailCronJob.php.

177 {
178 return $this->dic['ilStudyProgrammeEvents'];
179 }

Referenced by run().

+ Here is the caller graph for this function:

◆ getId()

ilPrgUserRiskyToFailCronJob::getId ( )

Get id.

Returns
string

Reimplemented from ilCronJob.

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

References ID.

◆ getNow()

ilPrgUserRiskyToFailCronJob::getNow ( )
protected

Definition at line 161 of file class.ilPrgUserRiskyToFailCronJob.php.

161 : \DateTimeImmutable
162 {
163 return new DateTimeImmutable();
164 }

Referenced by run().

+ Here is the caller graph for this function:

◆ getProgressRepository()

ilPrgUserRiskyToFailCronJob::getProgressRepository ( )
protected

Definition at line 171 of file class.ilPrgUserRiskyToFailCronJob.php.

172 {
173 return $this->dic['ilStudyProgrammeUserProgressDB'];
174 }

Referenced by run().

+ Here is the caller graph for this function:

◆ getSettingsRepository()

ilPrgUserRiskyToFailCronJob::getSettingsRepository ( )
protected

Definition at line 166 of file class.ilPrgUserRiskyToFailCronJob.php.

167 {
168 return $this->dic['model.Settings.ilStudyProgrammeSettingsRepository'];
169 }

Referenced by run().

+ Here is the caller graph for this function:

◆ getTitle()

ilPrgUserRiskyToFailCronJob::getTitle ( )

Get title.

Returns
string

Reimplemented from ilCronJob.

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

54 {
55 return $this->lng->txt('prg_user_risky_to_fail_title');
56 }

◆ hasAutoActivation()

ilPrgUserRiskyToFailCronJob::hasAutoActivation ( )

Is to be activated on "installation".

Returns
boolean

Reimplemented from ilCronJob.

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

84 {
85 return true;
86 }

◆ hasFlexibleSchedule()

ilPrgUserRiskyToFailCronJob::hasFlexibleSchedule ( )

Can the schedule be configured?

Returns
boolean

Reimplemented from ilCronJob.

Definition at line 93 of file class.ilPrgUserRiskyToFailCronJob.php.

94 {
95 return true;
96 }

◆ log()

ilPrgUserRiskyToFailCronJob::log ( string  $msg)
protected

Definition at line 181 of file class.ilPrgUserRiskyToFailCronJob.php.

181 : void
182 {
183 $this->log->write($msg);
184 }

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()

ilPrgUserRiskyToFailCronJob::run ( )

Run job.

Returns
ilCronJobResult

Reimplemented from ilCronJob.

Definition at line 118 of file class.ilPrgUserRiskyToFailCronJob.php.

119 {
120 $result = new ilCronJobResult();
122
123 $programmes_to_send = $this->getSettingsRepository()
124 ->getProgrammeIdsWithRiskyToFailSettings();
125
126 if (count($programmes_to_send) == 0) {
127 return $result;
128 }
129
130 $today = $this->getNow();
131 $programmes_and_due = [];
132 foreach ($programmes_to_send as $programme_obj_id => $days_offset_mail) {
133 $interval = new DateInterval('P' . $days_offset_mail . 'D');
134 $due = $today->add($interval);
135 $programmes_and_due[$programme_obj_id] = $due;
136 }
137
138 $progresses = $this->getProgressRepository()
139 ->getRiskyToFail($programmes_and_due);
140
141 if (count($progresses) == 0) {
142 return $result;
143 }
144
145 $events = $this->getEvents();
146 foreach ($progresses as $progress) {
147 $this->log(
148 sprintf(
149 'PRG, RiskyToFail: user %s at progress %s (prg obj_id %s)',
150 $progress->getUserId(),
151 $progress->getId(),
152 $progress->getNodeId()
153 )
154 );
155 $events->userRiskyToFail($progress);
156 }
158 return $result;
159 }
$result
Cron job result data container.

References $events, $result, getEvents(), getNow(), getProgressRepository(), getSettingsRepository(), log(), ilCronJobResult\STATUS_NO_ACTION, and ilCronJobResult\STATUS_OK.

+ Here is the call graph for this function:

Field Documentation

◆ $dic

ilPrgUserRiskyToFailCronJob::$dic
protected

Definition at line 31 of file class.ilPrgUserRiskyToFailCronJob.php.

◆ $events

ilPrgUserRiskyToFailCronJob::$events
protected

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

Referenced by run().

◆ $lng

ilPrgUserRiskyToFailCronJob::$lng
protected

Definition at line 36 of file class.ilPrgUserRiskyToFailCronJob.php.

◆ $programme_settings_db

ilPrgUserRiskyToFailCronJob::$programme_settings_db
protected

Definition at line 16 of file class.ilPrgUserRiskyToFailCronJob.php.

◆ $user_progress_db

ilPrgUserRiskyToFailCronJob::$user_progress_db
protected

Definition at line 21 of file class.ilPrgUserRiskyToFailCronJob.php.

◆ ID

const ilPrgUserRiskyToFailCronJob::ID = 'prg_user_risky_to_fail'

Definition at line 11 of file class.ilPrgUserRiskyToFailCronJob.php.

Referenced by getId().


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