ILIAS  Release_4_4_x_branch Revision 61816
 All Data Structures Namespaces Files Functions Variables Groups Pages
ilConsultationHourCron Class Reference

Reminders for consultation hours. More...

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

Public Member Functions

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

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

ilConsultationHourCron::addCustomSettingsToForm ( ilPropertyFormGUI  $a_form)

Add custom settings to form.

Parameters
ilPropertyFormGUI$a_form

Reimplemented from ilCronJob.

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

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

{
global $lng, $ilSetting;
$lng->loadLanguageModule('dateplaner');
$consultation_days = new ilNumberInputGUI($lng->txt('cal_ch_cron_reminder_days'),'ch_reminder_days');
$consultation_days->setMinValue(1);
$consultation_days->setMaxLength(2);
$consultation_days->setSize(2);
$consultation_days->setValue($ilSetting->get('ch_reminder_days',2));
$consultation_days->setRequired(true);
$a_form->addItem($consultation_days);
}

+ Here is the call graph for this function:

ilConsultationHourCron::getDefaultScheduleType ( )

Get schedule type.

Returns
int

Reimplemented from ilCronJob.

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

References ilCronJob\SCHEDULE_TYPE_DAILY.

ilConsultationHourCron::getDefaultScheduleValue ( )

Get schedule value.

Returns
int|array

Reimplemented from ilCronJob.

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

{
return;
}
ilConsultationHourCron::getDescription ( )

Get description.

Returns
string

Reimplemented from ilCronJob.

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

References $lng.

{
global $lng;
$lng->loadLanguageModule('dateplaner');
return $lng->txt("cal_ch_cron_reminder_info");
}
ilConsultationHourCron::getId ( )

Get id.

Returns
string

Reimplemented from ilCronJob.

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

{
return "cal_consultation";
}
ilConsultationHourCron::getTitle ( )

Get title.

Returns
string

Reimplemented from ilCronJob.

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

References $lng.

{
global $lng;
$lng->loadLanguageModule('dateplaner');
return $lng->txt("cal_ch_cron_reminder");
}
ilConsultationHourCron::hasAutoActivation ( )

Is to be activated on "installation".

Returns
boolean

Reimplemented from ilCronJob.

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

{
return false;
}
ilConsultationHourCron::hasCustomSettings ( )

Has cron job any custom setting which can be edited?

Returns
boolean

Reimplemented from ilCronJob.

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

{
return true;
}
ilConsultationHourCron::hasFlexibleSchedule ( )

Can the schedule be configured?

Returns
boolean

Reimplemented from ilCronJob.

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

{
return false;
}
ilConsultationHourCron::run ( )

Run job.

Returns
ilCronJobResult

Reimplemented from ilCronJob.

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

References $ilSetting, $query, $res, $result, $row, DB_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.

{
global $ilSetting, $ilDB;
$days_before = $ilSetting->get('ch_reminder_days');
$now = new ilDateTime(time(),IL_CAL_UNIX);
$limit = clone $now;
$limit->increment(IL_CAL_DAY,$days_before);
$counter = 0;
$query = 'SELECT * FROM booking_user '.
'JOIN cal_entries ON entry_id = cal_id '.
'WHERE notification_sent = '.$ilDB->quote(0,'integer').' '.
'AND starta > '.$ilDB->quote($now->get(IL_CAL_DATETIME,'', ilTimeZone::UTC),'timestamp'). ' '.
'AND starta <= '.$ilDB->quote($limit->get(IL_CAL_DATETIME, '', ilTimeZone::UTC),'timestamp');
$res = $ilDB->query($query);
while($row = $res->fetchRow(DB_FETCHMODE_OBJECT))
{
include_once 'Services/Calendar/classes/class.ilCalendarMailNotification.php';
$mail->setAppointmentId($row->entry_id);
$mail->setRecipients(array($row->user_id));
$mail->send();
// update notification
$query = 'UPDATE booking_user '.
'SET notification_sent = '.$ilDB->quote(1,'integer').' '.
'WHERE user_id = '.$ilDB->quote($row->user_id,'integer').' '.
'AND entry_id = '.$ilDB->quote($row->entry_id,'integer');
$ilDB->manipulate($query);
$counter++;
}
if($counter)
{
}
$result->setStatus($status);
return $result;
}
ilConsultationHourCron::saveCustomSettings ( ilPropertyFormGUI  $a_form)

Save custom settings.

Parameters
ilPropertyFormGUI$a_form
Returns
boolean

Reimplemented from ilCronJob.

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

References $ilSetting, and ilPropertyFormGUI\getInput().

{
global $ilSetting;
$ilSetting->set('ch_reminder_days', $a_form->getInput('ch_reminder_days'));
return true;
}

+ Here is the call graph for this function:


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