ILIAS  release_6 Revision v6.24-5-g0c8bfefb3b8
class.ilPrgRestartAssignmentsCronJob.php
Go to the documentation of this file.
1 <?php
2 
3 /* Copyright (c) 2019 Denis Klöpfer <denis.kloepfer@concepts-and-training.de> Extended GPL, see docs/LICENSE */
4 /* Copyright (c) 2019 Stefan Hecken <stefan.hecken@concepts-and-training.de> Extended GPL, see docs/LICENSE */
5 
6 declare(strict_types=1);
7 
9 {
14 
18  protected $log;
19 
23  protected $lng;
24 
25  public function __construct()
26  {
27  global $DIC;
28 
29  $this->user_assignments_db = ilStudyProgrammeDIC::dic()['ilStudyProgrammeUserAssignmentDB'];
30  $this->log = $DIC['ilLog'];
31  $this->lng = $DIC['lng'];
32  $this->lng->loadLanguageModule("prg");
33  }
34 
35  const ID = 'prg_restart_assignments_temporal_progress';
36 
42  public function getTitle()
43  {
44  return $this->lng->txt('prg_restart_assignments_temporal_progress_title');
45  }
46 
52  public function getDescription()
53  {
54  return $this->lng->txt('prg_restart_assignments_temporal_progress_desc');
55  }
61  public function getId()
62  {
63  return self::ID;
64  }
65 
71  public function hasAutoActivation()
72  {
73  return true;
74  }
75 
81  public function hasFlexibleSchedule()
82  {
83  return true;
84  }
85 
91  public function getDefaultScheduleType()
92  {
93  return self::SCHEDULE_TYPE_IN_DAYS;
94  }
95 
101  public function getDefaultScheduleValue()
102  {
103  return 1;
104  }
105 
111  public function run()
112  {
113  $result = new ilCronJobResult();
115  foreach ($this->user_assignments_db->getDueToRestartInstances() as $assignment) {
116  try {
117  $assignment->restartAssignment();
118  } catch (ilException $e) {
119  $this->log->write('an error occured: ' . $e->getMessage());
120  }
121  }
122  return $result;
123  }
124 }
$result
Cron job application base class.
hasAutoActivation()
Is to be activated on "installation".
$DIC
Definition: xapitoken.php:46
Cron job result data container.
hasFlexibleSchedule()
Can the schedule be configured?