ILIAS  release_8 Revision v8.24
ilPrgUserRiskyToFailCronJob 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 ilPrgUserRiskyToFailCronJob:
+ Collaboration diagram for ilPrgUserRiskyToFailCronJob:

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_risky_to_fail'
 

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

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

Constructor & Destructor Documentation

◆ __construct()

ilPrgUserRiskyToFailCronJob::__construct ( )

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

31 {
32 global $DIC;
33 $this->log = $DIC['ilLog'];
34 $this->lng = $DIC['lng'];
35 $this->lng->loadLanguageModule('prg');
36
38 $this->assignment_repo = $dic['repo.assignment'];
39 $this->adapter = $dic['cron.riskyToFail'];
40 }
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()

ilPrgUserRiskyToFailCronJob::getDefaultScheduleType ( )

Reimplemented from ilCronJob.

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

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

References ilCronJob\SCHEDULE_TYPE_IN_DAYS.

◆ getDefaultScheduleValue()

ilPrgUserRiskyToFailCronJob::getDefaultScheduleValue ( )

Reimplemented from ilCronJob.

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

72 : ?int
73 {
74 return 1;
75 }

◆ getDescription()

ilPrgUserRiskyToFailCronJob::getDescription ( )

Reimplemented from ilCronJob.

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

47 : string
48 {
49 return $this->lng->txt('prg_user_risky_to_fail_desc');
50 }

References ILIAS\Repository\lng().

+ Here is the call graph for this function:

◆ getId()

ilPrgUserRiskyToFailCronJob::getId ( )

Reimplemented from ilCronJob.

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

52 : string
53 {
54 return self::ID;
55 }

References ID.

◆ getNow()

ilPrgUserRiskyToFailCronJob::getNow ( )
protected

Reimplemented in ilPrgUserRiskyToFailCronJobMock.

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

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

Referenced by run().

+ Here is the caller graph for this function:

◆ getTitle()

ilPrgUserRiskyToFailCronJob::getTitle ( )

Reimplemented from ilCronJob.

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

42 : string
43 {
44 return $this->lng->txt('prg_user_risky_to_fail_title');
45 }

References ILIAS\Repository\lng().

+ Here is the call graph for this function:

◆ hasAutoActivation()

ilPrgUserRiskyToFailCronJob::hasAutoActivation ( )

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

Reimplemented from ilCronJob.

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

57 : bool
58 {
59 return true;
60 }

◆ hasFlexibleSchedule()

ilPrgUserRiskyToFailCronJob::hasFlexibleSchedule ( )

Reimplemented from ilCronJob.

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

62 : bool
63 {
64 return true;
65 }

◆ log()

ilPrgUserRiskyToFailCronJob::log ( string  $msg)
protected

Reimplemented in ilPrgUserRiskyToFailCronJobMock.

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

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

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

Reimplemented from ilCronJob.

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

78 {
79 $result = new ilCronJobResult();
80 $result->setStatus(ilCronJobResult::STATUS_NO_ACTION);
81
82 $programmes_to_send = $this->adapter->getRelevantProgrammeIds();
83 if (count($programmes_to_send) == 0) {
84 return $result;
85 }
86
87 $today = $this->getNow();
88 $programmes_and_due = [];
89 foreach ($programmes_to_send as $programme_obj_id => $days_offset_mail) {
90 $interval = new DateInterval('P' . $days_offset_mail . 'D');
91 $due = $today->add($interval);
92 $programmes_and_due[$programme_obj_id] = $due;
93 }
94
95
96 //root-assignments for any node that has deadline = $due and was not sent before;
97 $assignments = $this->assignment_repo->getRiskyToFail($programmes_and_due, true);
98
99 if (count($assignments) == 0) {
100 return $result;
101 }
102
103 foreach ($assignments as $ass) {
104 $pgs = $ass->getProgressTree();
105 $this->log(
106 sprintf(
107 'PRG, RiskyToFail: user %s at progress %s (prg obj_id %s)',
108 $ass->getUserId(),
109 $ass->getId(),
110 $pgs->getNodeId()
111 )
112 );
113
114 $this->adapter->actOnSingleAssignment($ass);
115 $this->assignment_repo->storeRiskyToFailSentFor($ass);
116 }
117 $result->setStatus(ilCronJobResult::STATUS_OK);
118 return $result;
119 }

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

Referenced by ilStudyProgrammeCronRiskyToFailTest\testRiskyToFailEvents().

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

Field Documentation

◆ $adapter

ilPrgCronJobAdapter ilPrgUserRiskyToFailCronJob::$adapter
protected

◆ $assignment_repo

ilPRGAssignmentDBRepository ilPrgUserRiskyToFailCronJob::$assignment_repo
protected

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

◆ $lng

ilLanguage ilPrgUserRiskyToFailCronJob::$lng
protected

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

◆ $log

ilComponentLogger ilPrgUserRiskyToFailCronJob::$log
protected

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

◆ ID

const ilPrgUserRiskyToFailCronJob::ID = 'prg_user_risky_to_fail'
private

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

Referenced by getId().


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