35 public function isActive($a_ts_last_run, $a_schedule_type, $a_schedule_value, $a_manual =
false)
46 return $this->
checkSchedule($a_ts_last_run, $a_schedule_type, $a_schedule_value);
58 return $this->schedule_type;
71 return $this->schedule_value;
88 $this->schedule_type = $a_type;
89 $this->schedule_value = $a_value;
100 return array(self::SCHEDULE_TYPE_DAILY, self::SCHEDULE_TYPE_IN_MINUTES,
101 self::SCHEDULE_TYPE_IN_HOURS, self::SCHEDULE_TYPE_IN_DAYS,
102 self::SCHEDULE_TYPE_WEEKLY, self::SCHEDULE_TYPE_MONTHLY,
103 self::SCHEDULE_TYPE_QUARTERLY, self::SCHEDULE_TYPE_YEARLY);
114 protected function checkSchedule($a_ts_last_run, $a_schedule_type, $a_schedule_value)
116 if(!$a_schedule_type)
127 switch($a_schedule_type)
130 $last = date(
"Y-m-d", $a_ts_last_run);
131 $ref = date(
"Y-m-d", $now);
132 return ($last != $ref);
135 $last = date(
"Y-W", $a_ts_last_run);
136 $ref = date(
"Y-W", $now);
137 return ($last != $ref);
140 $last = date(
"Y-n", $a_ts_last_run);
141 $ref = date(
"Y-n", $now);
142 return ($last != $ref);
145 $last = date(
"Y", $a_ts_last_run).
"-".ceil(date(
"n", $a_ts_last_run)/3);
146 $ref = date(
"Y", $now).
"-".ceil(date(
"n", $now)/3);
147 return ($last != $ref);
150 $last = date(
"Y", $a_ts_last_run);
151 $ref = date(
"Y", $now);
152 return ($last != $ref);
155 $diff = floor(($now-$a_ts_last_run)/60);
156 return ($diff >= $a_schedule_value);
159 $diff = floor(($now-$a_ts_last_run)/(60*60));
160 return ($diff >= $a_schedule_value);
163 $diff = floor(($now-$a_ts_last_run)/(60*60*24));
164 return ($diff >= $a_schedule_value);
310 abstract public function run();
Cron job application base class.
getScheduleType()
Get current schedule type (if flexible)
const SCHEDULE_TYPE_IN_DAYS
setSchedule($a_type, $a_value)
Update current schedule (if flexible)
getDefaultScheduleType()
Get schedule type.
getDescription()
Get description.
activationWasToggled($a_currently_active)
Cron job status was changed.
addToExternalSettingsForm($a_form_id, array &$a_fields, $a_is_active)
Add external settings to form.
const SCHEDULE_TYPE_IN_HOURS
getDefaultScheduleValue()
Get schedule value.
hasCustomSettings()
Has cron job any custom setting which can be edited?
addCustomSettingsToForm(ilPropertyFormGUI $a_form)
Add custom settings to form.
saveCustomSettings(ilPropertyFormGUI $a_form)
Save custom settings.
checkSchedule($a_ts_last_run, $a_schedule_type, $a_schedule_value)
const SCHEDULE_TYPE_IN_MINUTES
isManuallyExecutable()
Defines whether or not a cron job can be started manually.
getScheduleValue()
Get current schedule value (if flexible)
const SCHEDULE_TYPE_WEEKLY
const SCHEDULE_TYPE_YEARLY
isActive($a_ts_last_run, $a_schedule_type, $a_schedule_value, $a_manual=false)
Is job currently active?
hasAutoActivation()
Is to be activated on "installation".
const SCHEDULE_TYPE_DAILY
hasFlexibleSchedule()
Can the schedule be configured?
const SCHEDULE_TYPE_QUARTERLY
const SCHEDULE_TYPE_MONTHLY
getValidScheduleTypes()
Get all available schedule types.