ILIAS  release_8 Revision v8.23
class.ilSurveyCronNotification.php
Go to the documentation of this file.
1 <?php
2 
26 {
27  protected ilLanguage $lng;
28  protected ilTree $tree;
29 
30  public function __construct()
31  {
32  global $DIC;
33 
34  $this->lng = $DIC->language();
35  if (isset($DIC["tree"])) {
36  $this->tree = $DIC->repositoryTree();
37  }
38  }
39 
40  public function getId(): string
41  {
42  return "survey_notification";
43  }
44 
45  public function getTitle(): string
46  {
47  $lng = $this->lng;
48 
49  $lng->loadLanguageModule("survey");
50  return $lng->txt("survey_reminder_cron");
51  }
52 
53  public function getDescription(): string
54  {
55  $lng = $this->lng;
56 
57  $lng->loadLanguageModule("survey");
58  return $lng->txt("survey_reminder_cron_info");
59  }
60 
61  public function getDefaultScheduleType(): int
62  {
63  return self::SCHEDULE_TYPE_DAILY;
64  }
65 
66  public function getDefaultScheduleValue(): ?int
67  {
68  return null;
69  }
70 
71  public function hasAutoActivation(): bool
72  {
73  return true;
74  }
75 
76  public function hasFlexibleSchedule(): bool
77  {
78  return false;
79  }
80 
81  public function run(): ilCronJobResult
82  {
83  global $tree;
84 
86  $log->debug("start");
87 
89  $message = array();
90 
91  $root = $tree->getNodeData(ROOT_FOLDER_ID);
92  foreach ($tree->getSubTree($root, false, ["svy"]) as $svy_ref_id) {
93  $svy = new ilObjSurvey($svy_ref_id);
94  $num = $svy->checkReminder();
95  if (!is_null($num)) {
96  $message[] = $svy_ref_id . "(" . $num . ")";
98  }
99  }
100 
101  $result = new ilCronJobResult();
102  $result->setStatus($status);
103 
104  if (count($message)) {
105  $result->setMessage("Ref-Ids: " . implode(", ", $message) . ' / ' . "#" . count($message));
106  }
107  $log->debug("end");
108  return $result;
109  }
110 }
static getLogger(string $a_component_id)
Get component logger.
txt(string $a_topic, string $a_default_lang_fallback_mod="")
gets the text for a given topic if the topic is not in the list, the topic itself with "-" will be re...
const ROOT_FOLDER_ID
Definition: constants.php:32
loadLanguageModule(string $a_module)
Load language module.
global $DIC
Definition: feed.php:28
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
$log
Definition: result.php:33
$message
Definition: xapiexit.php:32