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;
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)
129 case self::SCHEDULE_TYPE_DAILY:
130 $last =
date(
"Y-m-d", $a_ts_last_run);
131 $ref =
date(
"Y-m-d", $now);
132 return ($last != $ref);
134 case self::SCHEDULE_TYPE_WEEKLY:
135 $last =
date(
"Y-W", $a_ts_last_run);
136 $ref =
date(
"Y-W", $now);
137 return ($last != $ref);
139 case self::SCHEDULE_TYPE_MONTHLY:
140 $last =
date(
"Y-n", $a_ts_last_run);
141 $ref =
date(
"Y-n", $now);
142 return ($last != $ref);
144 case self::SCHEDULE_TYPE_QUARTERLY:
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);
149 case self::SCHEDULE_TYPE_YEARLY:
150 $last =
date(
"Y", $a_ts_last_run);
151 $ref =
date(
"Y", $now);
152 return ($last != $ref);
154 case self::SCHEDULE_TYPE_IN_MINUTES:
155 $diff = floor(($now-$a_ts_last_run)/60);
156 return ($diff >= $a_schedule_value);
158 case self::SCHEDULE_TYPE_IN_HOURS:
159 $diff = floor(($now-$a_ts_last_run)/(60*60));
160 return ($diff >= $a_schedule_value);
162 case self::SCHEDULE_TYPE_IN_DAYS:
163 $diff = floor(($now-$a_ts_last_run)/(60*60*24));
164 return ($diff >= $a_schedule_value);
275 abstract public function getId();
310 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)