ILIAS  release_10 Revision v10.1-43-ga1241a92c2f
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 ()
 
 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 Member Functions

 getNow ()
 
 log (string $msg)
 

Protected Attributes

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

Private Attributes

const ID = 'prg_user_not_restarted'
 

Detailed Description

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

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

Constructor & Destructor Documentation

◆ __construct()

ilPrgUserNotRestartedCronJob::__construct ( )

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

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

36  {
37  global $DIC;
38  $this->log = $DIC['ilLog'];
39  $this->lng = $DIC['lng'];
40  $this->lng->loadLanguageModule('prg');
41 
43  $this->assignment_repo = $dic['repo.assignment'];
44  $this->adapter = $dic['cron.notRestarted'];
45  }
global $DIC
Definition: shib_login.php:25
$dic
Definition: ltiresult.php:33
+ Here is the call graph for this function:

Member Function Documentation

◆ getDefaultScheduleType()

ilPrgUserNotRestartedCronJob::getDefaultScheduleType ( )

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

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

◆ getDefaultScheduleValue()

ilPrgUserNotRestartedCronJob::getDefaultScheduleValue ( )

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

77  : ?int
78  {
79  return 1;
80  }

◆ getDescription()

ilPrgUserNotRestartedCronJob::getDescription ( )

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

References ILIAS\Repository\lng().

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

◆ getId()

ilPrgUserNotRestartedCronJob::getId ( )

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

57  : string
58  {
59  return self::ID;
60  }

◆ getNow()

ilPrgUserNotRestartedCronJob::getNow ( )
protected

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

Referenced by run().

123  {
124  return new DateTimeImmutable();
125  }
+ Here is the caller graph for this function:

◆ getTitle()

ilPrgUserNotRestartedCronJob::getTitle ( )

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

References ILIAS\Repository\lng().

47  : string
48  {
49  return $this->lng->txt('prg_user_not_restarted_title');
50  }
+ Here is the call graph for this function:

◆ hasAutoActivation()

ilPrgUserNotRestartedCronJob::hasAutoActivation ( )

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

62  : bool
63  {
64  return true;
65  }

◆ hasFlexibleSchedule()

ilPrgUserNotRestartedCronJob::hasFlexibleSchedule ( )

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

67  : bool
68  {
69  return true;
70  }

◆ log()

ilPrgUserNotRestartedCronJob::log ( string  $msg)
protected

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

Referenced by __construct(), and run().

127  : void
128  {
129  $this->log->write($msg);
130  }
+ Here is the caller graph for this function:

◆ run()

ilPrgUserNotRestartedCronJob::run ( )

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

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

Referenced by ilStudyProgrammeCronAboutToExpireTest\testAboutToExpireEvents().

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

◆ $lng

ilLanguage ilPrgUserNotRestartedCronJob::$lng
protected

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

◆ $log

ilComponentLogger ilPrgUserNotRestartedCronJob::$log
protected

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

◆ ID

const ilPrgUserNotRestartedCronJob::ID = 'prg_user_not_restarted'
private

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


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