ILIAS  release_9 Revision v9.13-25-g2c18ec4c24f
class.ilSurveyCronNotification.php
Go to the documentation of this file.
1 <?php
2 
20 
28 {
29  protected ilLanguage $lng;
30  protected ilTree $tree;
31 
32  public function __construct()
33  {
34  global $DIC;
35 
36  $this->lng = $DIC->language();
37  if (isset($DIC["tree"])) {
38  $this->tree = $DIC->repositoryTree();
39  }
40  }
41 
42  public function getId(): string
43  {
44  return "survey_notification";
45  }
46 
47  public function getTitle(): string
48  {
49  $lng = $this->lng;
50 
51  $lng->loadLanguageModule("survey");
52  return $lng->txt("survey_reminder_cron");
53  }
54 
55  public function getDescription(): string
56  {
57  $lng = $this->lng;
58 
59  $lng->loadLanguageModule("survey");
60  return $lng->txt("survey_reminder_cron_info");
61  }
62 
64  {
65  return CronJobScheduleType::SCHEDULE_TYPE_DAILY;
66  }
67 
68  public function getDefaultScheduleValue(): ?int
69  {
70  return null;
71  }
72 
73  public function hasAutoActivation(): bool
74  {
75  return true;
76  }
77 
78  public function hasFlexibleSchedule(): bool
79  {
80  return false;
81  }
82 
83  public function run(): ilCronJobResult
84  {
85  global $tree;
86 
88  $log->debug("start");
89 
91  $message = array();
92 
93  $root = $tree->getNodeData(ROOT_FOLDER_ID);
94  foreach ($tree->getSubTree($root, false, ["svy"]) as $svy_ref_id) {
95  $svy = new ilObjSurvey($svy_ref_id);
96  $num = $svy->checkReminder();
97  if (!is_null($num)) {
98  $message[] = $svy_ref_id . "(" . $num . ")";
100  }
101  }
102 
103  $result = new ilCronJobResult();
104  $result->setStatus($status);
105 
106  if (count($message)) {
107  $result->setMessage("Ref-Ids: " . implode(", ", $message) . ' / ' . "#" . count($message));
108  }
109  $log->debug("end");
110  return $result;
111  }
112 }
static getLogger(string $a_component_id)
Get component logger.
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
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
Cron for survey notifications (reminder to paricipate in the survey)
$log
Definition: result.php:33
final const STATUS_NO_ACTION
$message
Definition: xapiexit.php:32