ILIAS  release_7 Revision v7.30-3-g800a261c036
All Data Structures Namespaces Files Functions Variables Modules Pages
ilPrgUserNotRestartedCronJob Class Reference

Inform a user, that her qualification is about to expire. More...

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

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_not_restarted'
 
- 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 ()
 
 getAssignmentRepository ()
 
 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

Inform a user, that her qualification is about to expire.

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

Constructor & Destructor Documentation

◆ __construct()

ilPrgUserNotRestartedCronJob::__construct ( )

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

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

40  {
41  global $DIC;
42  $this->log = $DIC['ilLog'];
43  $this->lng = $DIC['lng'];
44  $this->lng->loadLanguageModule('prg');
45 
46  $this->dic = ilStudyProgrammeDIC::dic();
47  }
global $DIC
Definition: goto.php:24
+ Here is the call graph for this function:

Member Function Documentation

◆ getAssignmentRepository()

ilPrgUserNotRestartedCronJob::getAssignmentRepository ( )
protected

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

185  {
186  return $this->dic['ilStudyProgrammeUserAssignmentDB'];
187  }

◆ getDefaultScheduleType()

ilPrgUserNotRestartedCronJob::getDefaultScheduleType ( )

Get schedule type.

Returns
int

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

105  {
106  return self::SCHEDULE_TYPE_IN_DAYS;
107  }

◆ getDefaultScheduleValue()

ilPrgUserNotRestartedCronJob::getDefaultScheduleValue ( )

Get schedule value.

Returns
int|array

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

115  {
116  return 1;
117  }

◆ getDescription()

ilPrgUserNotRestartedCronJob::getDescription ( )

Get description.

Returns
string

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

65  {
66  return $this->lng->txt('prg_user_not_restarted_desc');
67  }

◆ getEvents()

ilPrgUserNotRestartedCronJob::getEvents ( )
protected

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

Referenced by run().

190  {
191  return $this->dic['ilStudyProgrammeEvents'];
192  }
+ Here is the caller graph for this function:

◆ getId()

ilPrgUserNotRestartedCronJob::getId ( )

Get id.

Returns
string

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

75  {
76  return self::ID;
77  }

◆ getNow()

ilPrgUserNotRestartedCronJob::getNow ( )
protected

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

Referenced by run().

169  : \DateTimeImmutable
170  {
171  return new DateTimeImmutable();
172  }
+ Here is the caller graph for this function:

◆ getProgressRepository()

ilPrgUserNotRestartedCronJob::getProgressRepository ( )
protected

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

Referenced by run().

180  {
181  return $this->dic['ilStudyProgrammeUserProgressDB'];
182  }
+ Here is the caller graph for this function:

◆ getSettingsRepository()

ilPrgUserNotRestartedCronJob::getSettingsRepository ( )
protected

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

Referenced by run().

175  {
176  return $this->dic['model.Settings.ilStudyProgrammeSettingsRepository'];
177  }
+ Here is the caller graph for this function:

◆ getTitle()

ilPrgUserNotRestartedCronJob::getTitle ( )

Get title.

Returns
string

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

55  {
56  return $this->lng->txt('prg_user_not_restarted_title');
57  }

◆ hasAutoActivation()

ilPrgUserNotRestartedCronJob::hasAutoActivation ( )

Is to be activated on "installation".

Returns
boolean

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

85  {
86  return true;
87  }

◆ hasFlexibleSchedule()

ilPrgUserNotRestartedCronJob::hasFlexibleSchedule ( )

Can the schedule be configured?

Returns
boolean

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

95  {
96  return true;
97  }

◆ log()

ilPrgUserNotRestartedCronJob::log ( string  $msg)
protected

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

Referenced by __construct(), and run().

194  : void
195  {
196  $this->log->write($msg);
197  }
+ Here is the caller graph for this function:

◆ run()

ilPrgUserNotRestartedCronJob::run ( )

Run job.

Returns
ilCronJobResult
Exceptions
Exception

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

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

126  {
127  $result = new ilCronJobResult();
129 
130  $programmes_to_send = $this->getSettingsRepository()
131  ->getProgrammeIdsWithMailsForExpiringValidity();
132 
133  if (count($programmes_to_send) == 0) {
134  return $result;
135  }
136 
137  $today = $this->getNow();
138  $programmes_and_due = [];
139  foreach ($programmes_to_send as $programme_obj_id => $days_offset_mail) {
140  $interval = new DateInterval('P' . $days_offset_mail . 'D');
141  $due = $today->add($interval);
142  $programmes_and_due[$programme_obj_id] = $due;
143  }
144 
145  $progresses = $this->getProgressRepository()
146  ->getAboutToExpire($programmes_and_due, true);
147 
148  if (count($progresses) == 0) {
149  return $result;
150  }
151 
152  $events = $this->getEvents();
153  foreach ($progresses as $progress) {
154  $this->log(
155  sprintf(
156  'PRG, UserNotRestarted: user %s\'s qualification is about to expire at progress %s (prg obj_id %s)',
157  $progress->getUserId(),
158  $progress->getId(),
159  $progress->getNodeId()
160  )
161  );
162 
163  $events->informUserByMailToRestart($progress);
164  }
166  return $result;
167  }
$result
Cron job result data container.
+ Here is the call graph for this function:

Field Documentation

◆ $dic

ilPrgUserNotRestartedCronJob::$dic
protected

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

◆ $events

ilPrgUserNotRestartedCronJob::$events
protected

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

Referenced by run().

◆ $lng

ilPrgUserNotRestartedCronJob::$lng
protected

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

◆ $programme_settings_db

ilPrgUserNotRestartedCronJob::$programme_settings_db
protected

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

◆ $user_progress_db

ilPrgUserNotRestartedCronJob::$user_progress_db
protected

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

◆ ID

const ilPrgUserNotRestartedCronJob::ID = 'prg_user_not_restarted'

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


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