ILIAS  trunk Revision v11.0_alpha-1769-g99a433fe2dc
All Data Structures Namespaces Files Functions Variables Enumerations Enumerator 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 ()
 
 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 Member Functions

 getNow ()
 
 log (string $msg)
 

Protected Attributes

ilComponentLogger $log
 
ilLanguage $lng
 
ilPRGAssignmentDBRepository $assignment_repo
 
ilPrgCronJobAdapter $adapter
 
- 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_user_not_restarted'
 

Detailed Description

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

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

Constructor & Destructor Documentation

◆ __construct()

ilPrgUserNotRestartedCronJob::__construct ( )

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

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

38  {
39  global $DIC;
40  $this->log = $DIC['ilLog'];
41  $this->lng = $DIC['lng'];
42  $this->lng->loadLanguageModule('prg');
43 
45  $this->assignment_repo = $dic['repo.assignment'];
46  $this->adapter = $dic['cron.notRestarted'];
47  }
global $DIC
Definition: shib_login.php:22
$dic
Definition: result.php:31
+ Here is the call graph for this function:

Member Function Documentation

◆ getDefaultScheduleType()

ilPrgUserNotRestartedCronJob::getDefaultScheduleType ( )

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

75  {
76  return JobScheduleType::IN_DAYS;
77  }

◆ getDefaultScheduleValue()

ilPrgUserNotRestartedCronJob::getDefaultScheduleValue ( )

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

79  : ?int
80  {
81  return 1;
82  }

◆ getDescription()

ilPrgUserNotRestartedCronJob::getDescription ( )

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

References ILIAS\Repository\lng().

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

◆ getId()

ilPrgUserNotRestartedCronJob::getId ( )

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

59  : string
60  {
61  return self::ID;
62  }

◆ getNow()

ilPrgUserNotRestartedCronJob::getNow ( )
protected

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

Referenced by run().

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

◆ getTitle()

ilPrgUserNotRestartedCronJob::getTitle ( )

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

References ILIAS\Repository\lng().

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

◆ hasAutoActivation()

ilPrgUserNotRestartedCronJob::hasAutoActivation ( )

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

64  : bool
65  {
66  return true;
67  }

◆ hasFlexibleSchedule()

ilPrgUserNotRestartedCronJob::hasFlexibleSchedule ( )

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

69  : bool
70  {
71  return true;
72  }

◆ log()

ilPrgUserNotRestartedCronJob::log ( string  $msg)
protected

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

Referenced by __construct(), and run().

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

◆ run()

ilPrgUserNotRestartedCronJob::run ( )

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

References getNow(), and log().

Referenced by ilStudyProgrammeCronAboutToExpireTest\testAboutToExpireEvents().

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

◆ $lng

ilLanguage ilPrgUserNotRestartedCronJob::$lng
protected

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

◆ $log

ilComponentLogger ilPrgUserNotRestartedCronJob::$log
protected

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

◆ ID

const ilPrgUserNotRestartedCronJob::ID = 'prg_user_not_restarted'
private

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


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