ILIAS  trunk Revision v11.0_alpha-3011-gc6b235a2e85
ilSurveyCronNotification Class Reference

Cron for survey notifications (reminder to paricipate in the survey) More...

+ Inheritance diagram for ilSurveyCronNotification:
+ Collaboration diagram for ilSurveyCronNotification:

Public Member Functions

 __construct ()
 
 getId ()
 
 getTitle ()
 
 getDescription ()
 
 getDefaultScheduleType ()
 
 getDefaultScheduleValue ()
 
 hasAutoActivation ()
 Is to be activated on "installation", does only work for ILIAS core cron jobs. More...
 
 hasFlexibleSchedule ()
 
 run ()
 
- Public Member Functions inherited from ILIAS\Cron\CronJob
 setDateTimeProvider (?\Closure $date_time_provider)
 
 isDue (?\DateTimeImmutable $last_run, ?JobScheduleType $schedule_type, ?int $schedule_value, bool $is_manually_executed=false)
 
 getScheduleType ()
 Get current schedule type (if flexible) More...
 
 getScheduleValue ()
 Get current schedule value (if flexible) More...
 
 setSchedule (?JobScheduleType $a_type, ?int $a_value)
 Update current schedule (if flexible) More...
 
 getAllScheduleTypes ()
 Get all available schedule types. More...
 
 getScheduleTypesWithValues ()
 
 getValidScheduleTypes ()
 Returns a collection of all valid schedule types for a specific job. More...
 
 isManuallyExecutable ()
 
 hasCustomSettings ()
 
 usesLegacyForms ()
 
 getCustomConfigurationInput (\ILIAS\UI\Factory $ui_factory, \ILIAS\Refinery\Factory $factory, \ilLanguage $lng)
 
 addCustomSettingsToForm (\ilPropertyFormGUI $a_form)
 
 saveCustomConfiguration (mixed $form_data)
 
 saveCustomSettings (\ilPropertyFormGUI $a_form)
 
 addToExternalSettingsForm (int $a_form_id, array &$a_fields, bool $a_is_active)
 
 activationWasToggled (\ilDBInterface $db, \ilSetting $setting, bool $a_currently_active)
 Important: This method is (also) called from the setup process, where the constructor of an ilCronJob ist NOT executed. More...
 
 getId ()
 
 getTitle ()
 
 getDescription ()
 
 hasAutoActivation ()
 Is to be activated on "installation", does only work for ILIAS core cron jobs. More...
 
 hasFlexibleSchedule ()
 
 getDefaultScheduleType ()
 
 getDefaultScheduleValue ()
 
 run ()
 

Protected Attributes

const MAX_MESSAGE_LENGTH = 397
 
ilLanguage $lng
 
ilTree $tree
 
- Protected Attributes inherited from ILIAS\Cron\CronJob
JobScheduleType $schedule_type = null
 
int $schedule_value = null
 
Closure $date_time_provider = null
 

Detailed Description

Cron for survey notifications (reminder to paricipate in the survey)

Author
Jörg Lützenkirchen luetz.nosp@m.enki.nosp@m.rchen.nosp@m.@lei.nosp@m.fos.c.nosp@m.om

Definition at line 29 of file class.ilSurveyCronNotification.php.

Constructor & Destructor Documentation

◆ __construct()

ilSurveyCronNotification::__construct ( )

Definition at line 36 of file class.ilSurveyCronNotification.php.

37 {
38 global $DIC;
39
40 $this->lng = $DIC->language();
41 if (isset($DIC["tree"])) {
42 $this->tree = $DIC->repositoryTree();
43 }
44 }
global $DIC
Definition: shib_login.php:26

References $DIC, and ILIAS\Repository\lng().

+ Here is the call graph for this function:

Member Function Documentation

◆ getDefaultScheduleType()

ilSurveyCronNotification::getDefaultScheduleType ( )

Reimplemented from ILIAS\Cron\CronJob.

Definition at line 67 of file class.ilSurveyCronNotification.php.

68 {
69 return JobScheduleType::DAILY;
70 }

◆ getDefaultScheduleValue()

ilSurveyCronNotification::getDefaultScheduleValue ( )

Reimplemented from ILIAS\Cron\CronJob.

Definition at line 72 of file class.ilSurveyCronNotification.php.

72 : ?int
73 {
74 return null;
75 }

◆ getDescription()

ilSurveyCronNotification::getDescription ( )

Reimplemented from ILIAS\Cron\CronJob.

Definition at line 59 of file class.ilSurveyCronNotification.php.

59 : string
60 {
62
63 $lng->loadLanguageModule("survey");
64 return $lng->txt("survey_reminder_cron_info");
65 }
loadLanguageModule(string $a_module)
Load language module.
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...

References $lng, ilLanguage\loadLanguageModule(), and ilLanguage\txt().

+ Here is the call graph for this function:

◆ getId()

ilSurveyCronNotification::getId ( )

Reimplemented from ILIAS\Cron\CronJob.

Definition at line 46 of file class.ilSurveyCronNotification.php.

46 : string
47 {
48 return "survey_notification";
49 }

◆ getTitle()

ilSurveyCronNotification::getTitle ( )

Reimplemented from ILIAS\Cron\CronJob.

Definition at line 51 of file class.ilSurveyCronNotification.php.

51 : string
52 {
54
55 $lng->loadLanguageModule("survey");
56 return $lng->txt("survey_reminder_cron");
57 }

References $lng, ilLanguage\loadLanguageModule(), and ilLanguage\txt().

+ Here is the call graph for this function:

◆ hasAutoActivation()

ilSurveyCronNotification::hasAutoActivation ( )

Is to be activated on "installation", does only work for ILIAS core cron jobs.

Reimplemented from ILIAS\Cron\CronJob.

Definition at line 77 of file class.ilSurveyCronNotification.php.

77 : bool
78 {
79 return true;
80 }

◆ hasFlexibleSchedule()

ilSurveyCronNotification::hasFlexibleSchedule ( )

Reimplemented from ILIAS\Cron\CronJob.

Definition at line 82 of file class.ilSurveyCronNotification.php.

82 : bool
83 {
84 return false;
85 }

◆ run()

ilSurveyCronNotification::run ( )

Reimplemented from ILIAS\Cron\CronJob.

Definition at line 87 of file class.ilSurveyCronNotification.php.

87 : JobResult
88 {
89 global $tree;
90
92 $log->debug("start");
93
94 $status = JobResult::STATUS_NO_ACTION;
95 $message = array();
96
98 foreach ($tree->getSubTree($root, false, ["svy"]) as $svy_ref_id) {
99 $svy = new ilObjSurvey($svy_ref_id);
100 $num = $svy->checkReminder();
101 if (!is_null($num)) {
102 $message[] = $svy_ref_id . "(" . $num . ")";
103 $status = JobResult::STATUS_OK;
104 }
105 }
106
107 $result = new JobResult();
108 $result->setStatus($status);
109
110 if (count($message)) {
111 $full_msg = "Ref-Ids: " . implode(", ", $message) . ' / ' . "#" . count($message);
112
113 if (mb_strlen($full_msg) > self::MAX_MESSAGE_LENGTH) {
114 $short_msg = mb_substr($full_msg, 0, self::MAX_MESSAGE_LENGTH) . '...';
115 $log->info("Notification message was truncated to fit DB limit. Full message: \"$full_msg\"");
116 } else {
117 $short_msg = $full_msg;
118 }
119
120 $result->setMessage($short_msg);
121 }
122
123 $log->debug("end");
124 return $result;
125 }
static getLogger(string $a_component_id)
Get component logger.
getNodeData(int $a_node_id, ?int $a_tree_pk=null)
get all information of a node.
getSubTree(array $a_node, bool $a_with_data=true, array $a_type=[])
get all nodes in the subtree under specified node
const ROOT_FOLDER_ID
Definition: constants.php:32
$log
Definition: ltiresult.php:34
$message
Definition: xapiexit.php:31

References $log, $message, $tree, ilLoggerFactory\getLogger(), ilTree\getNodeData(), ilTree\getSubTree(), and ROOT_FOLDER_ID.

+ Here is the call graph for this function:

Field Documentation

◆ $lng

ilLanguage ilSurveyCronNotification::$lng
protected

Definition at line 33 of file class.ilSurveyCronNotification.php.

Referenced by getDescription(), and getTitle().

◆ $tree

ilTree ilSurveyCronNotification::$tree
protected

Definition at line 34 of file class.ilSurveyCronNotification.php.

Referenced by run().

◆ MAX_MESSAGE_LENGTH

const ilSurveyCronNotification::MAX_MESSAGE_LENGTH = 397
protected

Definition at line 31 of file class.ilSurveyCronNotification.php.


The documentation for this class was generated from the following file: