ILIAS  release_7 Revision v7.30-3-g800a261c036
All Data Structures Namespaces Files Functions Variables Modules Pages
class.ilPrgInvalidateExpiredProgressesCronJob.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 
16  {
17  const ID = 'prg_invalidate_expired_progresses';
18 
22  protected $user_progress_db;
23 
27  protected $log;
28 
32  protected $lng;
33 
34  public function __construct()
35  {
36  global $DIC;
37 
38  $this->user_progress_db = ilStudyProgrammeDIC::dic()['model.Progress.ilStudyProgrammeProgressRepository'];
39  $this->log = $DIC['ilLog'];
40  $this->lng = $DIC['lng'];
41  $this->lng->loadLanguageModule('prg');
42  }
43 
49  public function getTitle()
50  {
51  return $this->lng->txt('prg_invalidate_expired_progresses_title');
52  }
53 
59  public function getDescription()
60  {
61  return $this->lng->txt('prg_invalidate_expired_progresses_desc');
62  }
63 
69  public function getId()
70  {
71  return self::ID;
72  }
73 
79  public function hasAutoActivation()
80  {
81  return true;
82  }
83 
89  public function hasFlexibleSchedule()
90  {
91  return true;
92  }
93 
99  public function getDefaultScheduleType()
100  {
101  return self::SCHEDULE_TYPE_IN_DAYS;
102  }
103 
109  public function getDefaultScheduleValue()
110  {
111  return 1;
112  }
113 
119  public function run()
120  {
121  $result = new ilCronJobResult();
122  foreach ($this->user_progress_db->getExpiredSuccessfull() as $progress) {
123  try {
124  $progress->invalidate();
125  } catch (ilException $e) {
126  $this->log->write('an error occured: ' . $e->getMessage());
127  }
128  }
130  return $result;
131  }
132  }
$result
Cron job application base class.
global $DIC
Definition: goto.php:24
This ivalidates a successful progress if validityOfQualification is reached.
Cron job result data container.