17 require_once SQ_INCLUDE_PATH.
'/general_occasional.inc';
52 public static function execute($settings, &$state)
55 if (empty($settings[
'status'])) {
60 if (empty($state[
'asset'])) {
62 if (empty($state[
'assetid'])) {
65 $state[
'asset'] = $GLOBALS[
'SQ_SYSTEM']->am->getAsset($state[
'assetid']);
68 $assetid = $state[
'asset']->id;
70 $cron_mgr = $GLOBALS[
'SQ_SYSTEM']->am->getSystemAsset(
'cron_manager');
71 if (is_null($cron_mgr))
return FALSE;
74 $GLOBALS[
'SQ_SYSTEM']->am->includeAsset(
'cron_job_future_status');
76 if (empty($future_status_jobs))
return TRUE;
81 foreach ($future_status_jobs as $job) {
83 $status_desc = $job->statusName();
84 if ($status_desc != $status_list[$settings[
'status']]) {
89 if (!$cron_mgr->removeJob($job)) {
90 trigger_localised_error(
'CORE0261', E_USER_WARNING, $job->id);
113 public static function getInterface($settings, $prefix, $write_access=FALSE)
115 if (empty($settings[
'status'])) {
117 $selected_status = SQ_STATUS_UNDER_CONSTRUCTION;
119 $selected_status = $settings[
'status'];
124 if (!$write_access) {
125 $form_element_extras =
'disabled="disabled"';
127 $form_element_extras =
'';
131 echo translate(
'trigger_delete_future_status');
132 combo_box($prefix.
'[status]', $status_list, FALSE, $selected_status, NULL, $form_element_extras);
133 $html = ob_get_contents();
155 $status = array_get_index($request_data,
'status', NULL);
156 if (is_null($status)) {
157 return 'Status has not been specified';
163 if (!isset($status_list[$status])) {
164 return 'Specified status is invalid';
166 $settings[
'status'] = $status;
184 foreach (get_constant_values(
'SQ_STATUS_') as $status_value) {
185 $status[$status_value] = get_status_description($status_value);