ILIAS  release_5-3 Revision v5.3.23-19-g915713cf615
ilConsultationHourCron Class Reference

Reminders for consultation hours. More...

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

Public Member Functions

 getId ()
 
 getTitle ()
 
 getDescription ()
 
 getDefaultScheduleType ()
 
 getDefaultScheduleValue ()
 
 hasAutoActivation ()
 
 hasFlexibleSchedule ()
 
 hasCustomSettings ()
 
 run ()
 
 addCustomSettingsToForm (ilPropertyFormGUI $a_form)
 
 saveCustomSettings (ilPropertyFormGUI $a_form)
 
- 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...
 
 getValidScheduleTypes ()
 Get all available schedule types. 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)

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

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

106  {
107  global $lng, $ilSetting;
108 
109  $lng->loadLanguageModule('dateplaner');
110 
111  $consultation_days = new ilNumberInputGUI($lng->txt('cal_ch_cron_reminder_days'), 'ch_reminder_days');
112  $consultation_days->setMinValue(1);
113  $consultation_days->setMaxLength(2);
114  $consultation_days->setSize(2);
115  $consultation_days->setValue($ilSetting->get('ch_reminder_days', 2));
116  $consultation_days->setRequired(true);
117  $a_form->addItem($consultation_days);
118  }
addItem($a_item)
Add Item (Property, SectionHeader).
setMinValue($a_minvalue, $a_display_always=false)
Set Minimum Value.
This class represents a number property in a property form.
global $ilSetting
Definition: privfeed.php:17
global $lng
Definition: privfeed.php:17
+ Here is the call graph for this function:

◆ getDefaultScheduleType()

ilConsultationHourCron::getDefaultScheduleType ( )

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

35  {
36  return self::SCHEDULE_TYPE_DAILY;
37  }

◆ getDefaultScheduleValue()

ilConsultationHourCron::getDefaultScheduleValue ( )

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

40  {
41  return;
42  }

◆ getDescription()

ilConsultationHourCron::getDescription ( )

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

References $lng.

27  {
28  global $lng;
29 
30  $lng->loadLanguageModule('dateplaner');
31  return $lng->txt("cal_ch_cron_reminder_info");
32  }
global $lng
Definition: privfeed.php:17

◆ getId()

ilConsultationHourCron::getId ( )

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

14  {
15  return "cal_consultation";
16  }

◆ getTitle()

ilConsultationHourCron::getTitle ( )

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

References $lng.

19  {
20  global $lng;
21 
22  $lng->loadLanguageModule('dateplaner');
23  return $lng->txt("cal_ch_cron_reminder");
24  }
global $lng
Definition: privfeed.php:17

◆ hasAutoActivation()

ilConsultationHourCron::hasAutoActivation ( )

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

45  {
46  return false;
47  }

◆ hasCustomSettings()

ilConsultationHourCron::hasCustomSettings ( )

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

55  {
56  return true;
57  }

◆ hasFlexibleSchedule()

ilConsultationHourCron::hasFlexibleSchedule ( )

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

50  {
51  return false;
52  }

◆ run()

ilConsultationHourCron::run ( )

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

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

60  {
61  global $ilSetting, $ilDB;
62 
64 
65  $days_before = $ilSetting->get('ch_reminder_days');
66  $now = new ilDateTime(time(), IL_CAL_UNIX);
67 
68  $limit = clone $now;
69  $limit->increment(IL_CAL_DAY, $days_before);
70 
71  $counter = 0;
72 
73  $query = 'SELECT * FROM booking_user ' .
74  'JOIN cal_entries ON entry_id = cal_id ' .
75  'WHERE notification_sent = ' . $ilDB->quote(0, 'integer') . ' ' .
76  'AND starta > ' . $ilDB->quote($now->get(IL_CAL_DATETIME, '', ilTimeZone::UTC), 'timestamp') . ' ' .
77  'AND starta <= ' . $ilDB->quote($limit->get(IL_CAL_DATETIME, '', ilTimeZone::UTC), 'timestamp');
78  $res = $ilDB->query($query);
79  while ($row = $res->fetchRow(ilDBConstants::FETCHMODE_OBJECT)) {
80  include_once 'Services/Calendar/classes/class.ilCalendarMailNotification.php';
81  $mail = new ilCalendarMailNotification();
82  $mail->setAppointmentId($row->entry_id);
83  $mail->setRecipients(array($row->user_id));
85  $mail->send();
86 
87  // update notification
88  $query = 'UPDATE booking_user ' .
89  'SET notification_sent = ' . $ilDB->quote(1, 'integer') . ' ' .
90  'WHERE user_id = ' . $ilDB->quote($row->user_id, 'integer') . ' ' .
91  'AND entry_id = ' . $ilDB->quote($row->entry_id, 'integer');
92  $ilDB->manipulate($query);
93 
94  $counter++;
95  }
96 
97  if ($counter) {
99  }
100  $result = new ilCronJobResult();
101  $result->setStatus($status);
102  return $result;
103  }
const IL_CAL_DATETIME
$result
Distributes calendar mail notifications.
const IL_CAL_UNIX
$counter
const IL_CAL_DAY
foreach($_POST as $key=> $value) $res
Date and time handling
$query
Create styles array
The data for the language used.
global $ilSetting
Definition: privfeed.php:17
global $ilDB
Add data(end) time
Method that wraps PHPs time in order to allow simulations with the workflow.
Cron job result data container.

◆ saveCustomSettings()

ilConsultationHourCron::saveCustomSettings ( ilPropertyFormGUI  $a_form)

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

References $ilSetting, and ilPropertyFormGUI\getInput().

121  {
122  global $ilSetting;
123 
124  $ilSetting->set('ch_reminder_days', $a_form->getInput('ch_reminder_days'));
125 
126  return true;
127  }
getInput($a_post_var, $ensureValidation=true)
Returns the value of a HTTP-POST variable, identified by the passed id.
global $ilSetting
Definition: privfeed.php:17
+ Here is the call graph for this function:

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