ILIAS  release_6 Revision v6.24-5-g0c8bfefb3b8
class.ilSurveyCronNotification.php
Go to the documentation of this file.
1<?php
2
3/* Copyright (c) 1998-2010 ILIAS open source, Extended GPL, see docs/LICENSE */
4
11{
15 protected $lng;
16
20 protected $tree;
21
22
26 public function __construct()
27 {
28 global $DIC;
29
30 $this->lng = $DIC->language();
31 if (isset($DIC["tree"])) {
32 $this->tree = $DIC->repositoryTree();
33 }
34 }
35
36 public function getId()
37 {
38 return "survey_notification";
39 }
40
41 public function getTitle()
42 {
44
45 $lng->loadLanguageModule("survey");
46 return $lng->txt("survey_reminder_cron");
47 }
48
49 public function getDescription()
50 {
52
53 $lng->loadLanguageModule("survey");
54 return $lng->txt("survey_reminder_cron_info");
55 }
56
57 public function getDefaultScheduleType()
58 {
60 }
61
62 public function getDefaultScheduleValue()
63 {
64 return;
65 }
66
67 public function hasAutoActivation()
68 {
69 return true;
70 }
71
72 public function hasFlexibleSchedule()
73 {
74 return false;
75 }
76
77 public function run()
78 {
80 global $tree;
81
83 $log->debug("start");
84
85 include_once "Modules/Survey/classes/class.ilObjSurvey.php";
86
88 $message = array();
89
91
92 $log->debug(var_export($tutor_res, true));
93
94 $root = $tree->getNodeData(ROOT_FOLDER_ID);
95 foreach ($tree->getSubTree($root, false, "svy") as $svy_ref_id) {
96 $svy = new ilObjSurvey($svy_ref_id);
97 $num = $svy->checkReminder();
98 if ($num !== false) {
99 $message[] = $svy_ref_id . "(" . $num . ")";
101 }
102
103 // separate cron-job?
104 if (in_array($svy->getId(), $tutor_res)) {
105 if ($svy->sendTutorResults()) {
106 $message[] = $svy_ref_id;
108 }
109 }
110 }
111
112 $result = new ilCronJobResult();
113 $result->setStatus($status);
114
115 if (sizeof($message)) {
116 $result->setMessage("Ref-Ids: " . implode(", ", $message));
117 $result->setCode("#" . sizeof($message));
118 }
119 $log->debug("end");
120 return $result;
121 }
122}
$result
An exception for terminatinating execution or to throw for unit testing.
Cron job result data container.
Cron job application base class.
const SCHEDULE_TYPE_DAILY
static getLogger($a_component_id)
Get component logger.
Class ilObjSurvey.
static getSurveysWithTutorResults()
Cron for survey notifications.
hasAutoActivation()
Is to be activated on "installation".
hasFlexibleSchedule()
Can the schedule be configured?
$log
Definition: result.php:15
$message
Definition: xapiexit.php:14
$DIC
Definition: xapitoken.php:46