ILIAS  release_6 Revision v6.24-5-g0c8bfefb3b8
ilConsultationHourCron Class Reference

Reminders for consultation hours. More...

+ Inheritance diagram for ilConsultationHourCron:
+ Collaboration diagram for ilConsultationHourCron:

Public Member Functions

 getId ()
 Get id. More...
 
 getTitle ()
 Get title. More...
 
 getDescription ()
 Get description. More...
 
 getDefaultScheduleType ()
 Get schedule type. More...
 
 getDefaultScheduleValue ()
 Get schedule value. More...
 
 hasAutoActivation ()
 Is to be activated on "installation". More...
 
 hasFlexibleSchedule ()
 Can the schedule be configured? More...
 
 hasCustomSettings ()
 Has cron job any custom setting which can be edited? More...
 
 run ()
 Run job. More...
 
 addCustomSettingsToForm (ilPropertyFormGUI $a_form)
 Add custom settings to form. More...
 
 saveCustomSettings (ilPropertyFormGUI $a_form)
 Save custom settings. More...
 
- Public Member Functions inherited from ilCronJob
 isActive ($a_ts_last_run, $a_schedule_type, $a_schedule_value, $a_manual=false)
 Is job currently active? More...
 
 getScheduleType ()
 Get current schedule type (if flexible) More...
 
 getScheduleValue ()
 Get current schedule value (if flexible) More...
 
 setSchedule ($a_type, $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...
 
 getTitle ()
 Get title. More...
 
 getDescription ()
 Get description. More...
 
 isManuallyExecutable ()
 Defines whether or not a cron job can be started manually. More...
 
 hasCustomSettings ()
 Has cron job any custom setting which can be edited? More...
 
 addCustomSettingsToForm (ilPropertyFormGUI $a_form)
 Add custom settings to form. More...
 
 saveCustomSettings (ilPropertyFormGUI $a_form)
 Save custom settings. More...
 
 addToExternalSettingsForm ($a_form_id, array &$a_fields, $a_is_active)
 Add external settings to form. More...
 
 activationWasToggled ($a_currently_active)
 Cron job status was changed. More...
 
 getId ()
 Get id. More...
 
 hasAutoActivation ()
 Is to be activated on "installation". More...
 
 hasFlexibleSchedule ()
 Can the schedule be configured? More...
 
 getDefaultScheduleType ()
 Get schedule type. More...
 
 getDefaultScheduleValue ()
 Get schedule value. More...
 
 run ()
 Run job. More...
 

Additional Inherited Members

- Data Fields inherited from ilCronJob
const SCHEDULE_TYPE_DAILY = 1
 
const SCHEDULE_TYPE_IN_MINUTES = 2
 
const SCHEDULE_TYPE_IN_HOURS = 3
 
const SCHEDULE_TYPE_IN_DAYS = 4
 
const SCHEDULE_TYPE_WEEKLY = 5
 
const SCHEDULE_TYPE_MONTHLY = 6
 
const SCHEDULE_TYPE_QUARTERLY = 7
 
const SCHEDULE_TYPE_YEARLY = 8
 
- Protected Member Functions inherited from ilCronJob
 checkSchedule ($a_ts_last_run, $a_schedule_type, $a_schedule_value)
 

Detailed Description

Reminders for consultation hours.

Author
Stefan Meyer smeye.nosp@m.r.il.nosp@m.ias@g.nosp@m.mx.d.nosp@m.e

Definition at line 11 of file class.ilConsultationHourCron.php.

Member Function Documentation

◆ addCustomSettingsToForm()

ilConsultationHourCron::addCustomSettingsToForm ( ilPropertyFormGUI  $a_form)

Add custom settings to form.

Parameters
ilPropertyFormGUI$a_form

Reimplemented from ilCronJob.

Definition at line 112 of file class.ilConsultationHourCron.php.

113 {
114 global $DIC;
115
116 $lng = $DIC['lng'];
117 $ilSetting = $DIC['ilSetting'];
118
119 $lng->loadLanguageModule('dateplaner');
120
121 $consultation_days = new ilNumberInputGUI($lng->txt('cal_ch_cron_reminder_days'), 'ch_reminder_days');
122 $consultation_days->setMinValue(1);
123 $consultation_days->setMaxLength(2);
124 $consultation_days->setSize(2);
125 $consultation_days->setValue($ilSetting->get('ch_reminder_days', 2));
126 $consultation_days->setRequired(true);
127 $a_form->addItem($consultation_days);
128 }
This class represents a number property in a property form.
addItem($a_item)
Add Item (Property, SectionHeader).
global $ilSetting
Definition: privfeed.php:17
$lng
$DIC
Definition: xapitoken.php:46

References $DIC, $ilSetting, $lng, and ilPropertyFormGUI\addItem().

+ Here is the call graph for this function:

◆ getDefaultScheduleType()

ilConsultationHourCron::getDefaultScheduleType ( )

Get schedule type.

Returns
int

Reimplemented from ilCronJob.

Definition at line 38 of file class.ilConsultationHourCron.php.

39 {
41 }
const SCHEDULE_TYPE_DAILY

References ilCronJob\SCHEDULE_TYPE_DAILY.

◆ getDefaultScheduleValue()

ilConsultationHourCron::getDefaultScheduleValue ( )

Get schedule value.

Returns
int|array

Reimplemented from ilCronJob.

Definition at line 43 of file class.ilConsultationHourCron.php.

44 {
45 return;
46 }

◆ getDescription()

ilConsultationHourCron::getDescription ( )

Get description.

Returns
string

Reimplemented from ilCronJob.

Definition at line 28 of file class.ilConsultationHourCron.php.

29 {
30 global $DIC;
31
32 $lng = $DIC['lng'];
33
34 $lng->loadLanguageModule('dateplaner');
35 return $lng->txt("cal_ch_cron_reminder_info");
36 }

References $DIC, and $lng.

◆ getId()

ilConsultationHourCron::getId ( )

Get id.

Returns
string

Reimplemented from ilCronJob.

Definition at line 13 of file class.ilConsultationHourCron.php.

14 {
15 return "cal_consultation";
16 }

◆ getTitle()

ilConsultationHourCron::getTitle ( )

Get title.

Returns
string

Reimplemented from ilCronJob.

Definition at line 18 of file class.ilConsultationHourCron.php.

19 {
20 global $DIC;
21
22 $lng = $DIC['lng'];
23
24 $lng->loadLanguageModule('dateplaner');
25 return $lng->txt("cal_ch_cron_reminder");
26 }

References $DIC, and $lng.

◆ hasAutoActivation()

ilConsultationHourCron::hasAutoActivation ( )

Is to be activated on "installation".

Returns
boolean

Reimplemented from ilCronJob.

Definition at line 48 of file class.ilConsultationHourCron.php.

49 {
50 return false;
51 }

◆ hasCustomSettings()

ilConsultationHourCron::hasCustomSettings ( )

Has cron job any custom setting which can be edited?

Returns
boolean

Reimplemented from ilCronJob.

Definition at line 58 of file class.ilConsultationHourCron.php.

59 {
60 return true;
61 }

◆ hasFlexibleSchedule()

ilConsultationHourCron::hasFlexibleSchedule ( )

Can the schedule be configured?

Returns
boolean

Reimplemented from ilCronJob.

Definition at line 53 of file class.ilConsultationHourCron.php.

54 {
55 return false;
56 }

◆ run()

ilConsultationHourCron::run ( )

Run job.

Returns
ilCronJobResult

Reimplemented from ilCronJob.

Definition at line 63 of file class.ilConsultationHourCron.php.

64 {
65 global $DIC;
66
67 $ilSetting = $DIC['ilSetting'];
68 $ilDB = $DIC['ilDB'];
69
71
72 $days_before = $ilSetting->get('ch_reminder_days');
73 $now = new ilDateTime(time(), IL_CAL_UNIX);
74
75 $limit = clone $now;
76 $limit->increment(IL_CAL_DAY, $days_before);
77
78 $counter = 0;
79
80 $query = 'SELECT * FROM booking_user ' .
81 'JOIN cal_entries ON entry_id = cal_id ' .
82 'WHERE notification_sent = ' . $ilDB->quote(0, 'integer') . ' ' .
83 'AND starta > ' . $ilDB->quote($now->get(IL_CAL_DATETIME, '', ilTimeZone::UTC), 'timestamp') . ' ' .
84 'AND starta <= ' . $ilDB->quote($limit->get(IL_CAL_DATETIME, '', ilTimeZone::UTC), 'timestamp');
85 $res = $ilDB->query($query);
86 while ($row = $res->fetchRow(ilDBConstants::FETCHMODE_OBJECT)) {
87 include_once 'Services/Calendar/classes/class.ilCalendarMailNotification.php';
88 $mail = new ilCalendarMailNotification();
89 $mail->setAppointmentId($row->entry_id);
90 $mail->setRecipients(array($row->user_id));
92 $mail->send();
93
94 // update notification
95 $query = 'UPDATE booking_user ' .
96 'SET notification_sent = ' . $ilDB->quote(1, 'integer') . ' ' .
97 'WHERE user_id = ' . $ilDB->quote($row->user_id, 'integer') . ' ' .
98 'AND entry_id = ' . $ilDB->quote($row->entry_id, 'integer');
99 $ilDB->manipulate($query);
100
101 $counter++;
102 }
103
104 if ($counter) {
106 }
107 $result = new ilCronJobResult();
108 $result->setStatus($status);
109 return $result;
110 }
$result
const IL_CAL_UNIX
const IL_CAL_DATETIME
const IL_CAL_DAY
Distributes calendar mail notifications.
Cron job result data container.
@classDescription Date and time handling
$query
foreach($_POST as $key=> $value) $res
global $ilDB

References $DIC, $ilDB, $ilSetting, $query, $res, $result, ilDBConstants\FETCHMODE_OBJECT, IL_CAL_DATETIME, IL_CAL_DAY, IL_CAL_UNIX, ilCronJobResult\STATUS_NO_ACTION, ilCronJobResult\STATUS_OK, ilCalendarMailNotification\TYPE_BOOKING_REMINDER, and ilTimeZone\UTC.

◆ saveCustomSettings()

ilConsultationHourCron::saveCustomSettings ( ilPropertyFormGUI  $a_form)

Save custom settings.

Parameters
ilPropertyFormGUI$a_form
Returns
boolean

Reimplemented from ilCronJob.

Definition at line 130 of file class.ilConsultationHourCron.php.

131 {
132 global $DIC;
133
134 $ilSetting = $DIC['ilSetting'];
135
136 $ilSetting->set('ch_reminder_days', $a_form->getInput('ch_reminder_days'));
137
138 return true;
139 }
getInput($a_post_var, $ensureValidation=true)
Returns the value of a HTTP-POST variable, identified by the passed id.

References $DIC, $ilSetting, and ilPropertyFormGUI\getInput().

+ Here is the call graph for this function:

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