ILIAS  release_8 Revision v8.23
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 ()
 
 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
 This will be replaced with an ENUM in ILIAS 9 More...
 
const SCHEDULE_TYPE_IN_MINUTES = 2
 This will be replaced with an ENUM in ILIAS 9 More...
 
const SCHEDULE_TYPE_IN_HOURS = 3
 This will be replaced with an ENUM in ILIAS 9 More...
 
const SCHEDULE_TYPE_IN_DAYS = 4
 This will be replaced with an ENUM in ILIAS 9 More...
 
const SCHEDULE_TYPE_WEEKLY = 5
 This will be replaced with an ENUM in ILIAS 9 More...
 
const SCHEDULE_TYPE_MONTHLY = 6
 This will be replaced with an ENUM in ILIAS 9 More...
 
const SCHEDULE_TYPE_QUARTERLY = 7
 This will be replaced with an ENUM in ILIAS 9 More...
 
const SCHEDULE_TYPE_YEARLY = 8
 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.

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

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
+ Here is the call graph for this function:

Member Function Documentation

◆ getDefaultScheduleType()

ilPrgUserRiskyToFailCronJob::getDefaultScheduleType ( )

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

67  : int
68  {
69  return self::SCHEDULE_TYPE_IN_DAYS;
70  }

◆ getDefaultScheduleValue()

ilPrgUserRiskyToFailCronJob::getDefaultScheduleValue ( )

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

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

◆ getDescription()

ilPrgUserRiskyToFailCronJob::getDescription ( )

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

References ILIAS\Repository\lng().

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

◆ getId()

ilPrgUserRiskyToFailCronJob::getId ( )

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

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

◆ getNow()

ilPrgUserRiskyToFailCronJob::getNow ( )
protected

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

Referenced by run().

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

◆ getTitle()

ilPrgUserRiskyToFailCronJob::getTitle ( )

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

References ILIAS\Repository\lng().

42  : string
43  {
44  return $this->lng->txt('prg_user_risky_to_fail_title');
45  }
+ Here is the call graph for this function:

◆ hasAutoActivation()

ilPrgUserRiskyToFailCronJob::hasAutoActivation ( )

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

57  : bool
58  {
59  return true;
60  }

◆ hasFlexibleSchedule()

ilPrgUserRiskyToFailCronJob::hasFlexibleSchedule ( )

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

62  : bool
63  {
64  return true;
65  }

◆ log()

ilPrgUserRiskyToFailCronJob::log ( string  $msg)
protected

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

Referenced by __construct(), and run().

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

◆ run()

ilPrgUserRiskyToFailCronJob::run ( )

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

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

Referenced by ilStudyProgrammeCronRiskyToFailTest\testRiskyToFailEvents().

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  }
+ 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.


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