17 require_once SQ_INCLUDE_PATH.
'/general_occasional.inc';
51 public static function execute($settings, &$state)
54 if (empty($settings[
'permission'])) {
59 if (empty($state[
'asset'])) {
61 if (empty($state[
'assetid'])) {
64 $state[
'asset'] = $GLOBALS[
'SQ_SYSTEM']->am->getAsset($state[
'assetid']);
68 $cron_mgr = $GLOBALS[
'SQ_SYSTEM']->am->getSystemAsset(
'cron_manager');
69 if (is_null($cron_mgr))
return FALSE;
72 $GLOBALS[
'SQ_SYSTEM']->am->includeAsset(
'cron_job_future_permission');
74 if (empty($fp_jobs))
return TRUE;
78 foreach ($fp_jobs as $job) {
79 if ($job->attr(
'permission') == $settings[
'permission']) {
80 if ($cron_mgr->removeJob($job)) {
83 trigger_localised_error(
'CRON0065', E_USER_WARNING, $job->id);
105 public static function getInterface($settings, $prefix, $write_access=FALSE)
107 if (empty($settings[
'permission'])) {
109 $selected_permission = SQ_PERMISSION_READ;
111 $selected_permission = $settings[
'permission'];
114 $permission_list = self::_getPermissionList();
116 if (!$write_access) {
117 $form_element_extras =
'disabled="disabled"';
119 $form_element_extras =
'';
123 echo translate(
'trigger_delete_future_permission').
' ';
124 combo_box($prefix.
'[permission]', $permission_list, FALSE, $selected_permission, NULL, $form_element_extras);
125 echo
' '.translate(
'permission');
126 $html = ob_get_contents();
147 $permission = array_get_index($request_data,
'permission', NULL);
148 if (is_null($permission)) {
149 return 'Permission has not been specified';
152 $permission_list = self::_getPermissionList();
155 if (!isset($permission_list[$permission])) {
156 return 'Specified permission is invalid';
158 $settings[
'permission'] = $permission;
175 return Array(SQ_PERMISSION_READ =>
'Read', SQ_PERMISSION_WRITE =>
'Write', SQ_PERMISSION_ADMIN =>
'Admin');