35 public function isActive($a_ts_last_run, $a_schedule_type, $a_schedule_value, $a_manual =
false)
44 return $this->
checkSchedule($a_ts_last_run, $a_schedule_type, $a_schedule_value);
55 return $this->schedule_type;
67 return $this->schedule_value;
84 $this->schedule_value = $a_value;
95 return array(self::SCHEDULE_TYPE_DAILY, self::SCHEDULE_TYPE_IN_MINUTES,
96 self::SCHEDULE_TYPE_IN_HOURS, self::SCHEDULE_TYPE_IN_DAYS,
97 self::SCHEDULE_TYPE_WEEKLY, self::SCHEDULE_TYPE_MONTHLY,
98 self::SCHEDULE_TYPE_QUARTERLY, self::SCHEDULE_TYPE_YEARLY);
109 protected function checkSchedule($a_ts_last_run, $a_schedule_type, $a_schedule_value)
111 if (!$a_schedule_type) {
114 if (!$a_ts_last_run) {
120 switch ($a_schedule_type) {
121 case self::SCHEDULE_TYPE_DAILY:
122 $last =
date(
"Y-m-d", $a_ts_last_run);
123 $ref =
date(
"Y-m-d", $now);
124 return ($last != $ref);
126 case self::SCHEDULE_TYPE_WEEKLY:
127 $last =
date(
"Y-W", $a_ts_last_run);
128 $ref =
date(
"Y-W", $now);
129 return ($last != $ref);
131 case self::SCHEDULE_TYPE_MONTHLY:
132 $last =
date(
"Y-n", $a_ts_last_run);
133 $ref =
date(
"Y-n", $now);
134 return ($last != $ref);
136 case self::SCHEDULE_TYPE_QUARTERLY:
137 $last =
date(
"Y", $a_ts_last_run) .
"-" . ceil(
date(
"n", $a_ts_last_run)/3);
138 $ref =
date(
"Y", $now) .
"-" . ceil(
date(
"n", $now)/3);
139 return ($last != $ref);
141 case self::SCHEDULE_TYPE_YEARLY:
142 $last =
date(
"Y", $a_ts_last_run);
143 $ref =
date(
"Y", $now);
144 return ($last != $ref);
146 case self::SCHEDULE_TYPE_IN_MINUTES:
147 $diff = floor(($now-$a_ts_last_run)/60);
148 return ($diff >= $a_schedule_value);
150 case self::SCHEDULE_TYPE_IN_HOURS:
151 $diff = floor(($now-$a_ts_last_run)/(60*60));
152 return ($diff >= $a_schedule_value);
154 case self::SCHEDULE_TYPE_IN_DAYS:
155 $diff = floor(($now-$a_ts_last_run)/(60*60*24));
156 return ($diff >= $a_schedule_value);
263 abstract public function getId();
298 abstract public function run();
setSchedule($a_type, $a_value)
Update current schedule (if flexible)
getValidScheduleTypes()
Get all available schedule types.
checkSchedule($a_ts_last_run, $a_schedule_type, $a_schedule_value)
addToExternalSettingsForm($a_form_id, array &$a_fields, $a_is_active)
Add external settings to form.
Cron job application base class.
const SCHEDULE_TYPE_IN_MINUTES
getDescription()
Get description.
activationWasToggled($a_currently_active)
Cron job status was changed.
const SCHEDULE_TYPE_MONTHLY
const SCHEDULE_TYPE_WEEKLY
addCustomSettingsToForm(ilPropertyFormGUI $a_form)
Add custom settings to form.
hasFlexibleSchedule()
Can the schedule be configured?
date( 'd-M-Y', $objPHPExcel->getProperties() ->getCreated())
isActive($a_ts_last_run, $a_schedule_type, $a_schedule_value, $a_manual=false)
Is job currently active?
const SCHEDULE_TYPE_IN_DAYS
hasCustomSettings()
Has cron job any custom setting which can be edited?
Create styles array
The data for the language used.
const SCHEDULE_TYPE_YEARLY
getDefaultScheduleType()
Get schedule type.
const SCHEDULE_TYPE_DAILY
getDefaultScheduleValue()
Get schedule value.
saveCustomSettings(ilPropertyFormGUI $a_form)
Save custom settings.
const SCHEDULE_TYPE_QUARTERLY
getScheduleValue()
Get current schedule value (if flexible)
Add data(end) time
Method that wraps PHPs time in order to allow simulations with the workflow.
const SCHEDULE_TYPE_IN_HOURS
hasAutoActivation()
Is to be activated on "installation".
isManuallyExecutable()
Defines whether or not a cron job can be started manually.
getScheduleType()
Get current schedule type (if flexible)