ILIAS  trunk Revision v11.0_alpha-3011-gc6b235a2e85
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 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_risky_to_fail'
 

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 25 of file class.ilPrgUserRiskyToFailCronJob.php.

Constructor & Destructor Documentation

◆ __construct()

ilPrgUserRiskyToFailCronJob::__construct ( )

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

35 {
36 global $DIC;
37 $this->log = $DIC['ilLog'];
38 $this->lng = $DIC['lng'];
39 $this->lng->loadLanguageModule('prg');
40
42 $this->assignment_repo = $dic['repo.assignment'];
43 $this->adapter = $dic['cron.riskyToFail'];
44 }
$dic
Definition: ltiresult.php:33
global $DIC
Definition: shib_login.php:26

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 ILIAS\Cron\CronJob.

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

72 {
73 return JobScheduleType::IN_DAYS;
74 }

◆ getDefaultScheduleValue()

ilPrgUserRiskyToFailCronJob::getDefaultScheduleValue ( )

Reimplemented from ILIAS\Cron\CronJob.

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

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

◆ getDescription()

ilPrgUserRiskyToFailCronJob::getDescription ( )

Reimplemented from ILIAS\Cron\CronJob.

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

51 : string
52 {
53 return $this->lng->txt('prg_user_risky_to_fail_desc');
54 }

References ILIAS\Repository\lng().

+ Here is the call graph for this function:

◆ getId()

ilPrgUserRiskyToFailCronJob::getId ( )

Reimplemented from ILIAS\Cron\CronJob.

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

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

References ID.

◆ getNow()

ilPrgUserRiskyToFailCronJob::getNow ( )
protected

Reimplemented in ilPrgUserRiskyToFailCronJobMock.

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

125 : \DateTimeImmutable
126 {
127 return new DateTimeImmutable();
128 }

Referenced by run().

+ Here is the caller graph for this function:

◆ getTitle()

ilPrgUserRiskyToFailCronJob::getTitle ( )

Reimplemented from ILIAS\Cron\CronJob.

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

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

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 ILIAS\Cron\CronJob.

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

61 : bool
62 {
63 return true;
64 }

◆ hasFlexibleSchedule()

ilPrgUserRiskyToFailCronJob::hasFlexibleSchedule ( )

Reimplemented from ILIAS\Cron\CronJob.

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

66 : bool
67 {
68 return true;
69 }

◆ log()

ilPrgUserRiskyToFailCronJob::log ( string  $msg)
protected

Reimplemented in ilPrgUserRiskyToFailCronJobMock.

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

130 : void
131 {
132 $this->log->write($msg);
133 }

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 ILIAS\Cron\CronJob.

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

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

References getNow(), and log().

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 31 of file class.ilPrgUserRiskyToFailCronJob.php.

◆ $lng

ilLanguage ilPrgUserRiskyToFailCronJob::$lng
protected

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

◆ $log

ilComponentLogger ilPrgUserRiskyToFailCronJob::$log
protected

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

◆ ID

const ilPrgUserRiskyToFailCronJob::ID = 'prg_user_risky_to_fail'
private

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

Referenced by getId().


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