17 require_once SQ_PACKAGES_PATH.
'/bulkmail/bulkmail_post_office/bulkmail_post_office_edit_fns.inc';
45 parent::__construct();
47 unset($this->static_screens[
'settings']);
48 unset($this->static_screens[
'preview']);
49 unset($this->static_screens[
'lookupValues']);
50 unset($this->static_screens[
'metadata']);
51 unset($this->static_screens[
'metadataSchemas']);
52 unset($this->static_screens[
'workflow']);
53 unset($this->static_screens[
'tagging']);
54 unset($this->static_screens[
'dependants']);
55 unset($this->static_screens[
'linking']);
56 unset($this->static_screens[
'roles']);
57 unset($this->static_screens[
'permissions']);
58 unset($this->static_screens[
'layouts']);
75 $write_access = $asset->writeAccess(
'attributes');
78 $jobs = $asset->getQueuedJobs();
99 $write_access = $asset->writeAccess(
'attributes');
101 if (!$write_access)
return;
103 $jobs = $asset->getQueuedJobs();
122 $bulkmail_manager = $GLOBALS[
'SQ_SYSTEM']->am->getSystemAsset(
'bulkmail_manager');
124 foreach ($jobs as $job_id => $job_info) {
125 $prefix = $asset->getPrefix();
126 if (!empty($_REQUEST[$prefix.
'_'.$job_id])) {
127 switch ($_REQUEST[$prefix.
'_'.$job_id]) {
129 $bulkmail_manager->updateJob($job_id, BML_JOB_STATE_NOT_RUNNING);
132 $bulkmail_manager->updateJob($job_id, BML_JOB_STATE_PAUSED);
136 $job_id_parts = explode(
':', $job_id);
137 if (!isset($job_id_parts[1])) {
139 'user_id' => $GLOBALS[
'SQ_SYSTEM']->currentUserId(),
141 $ms = $GLOBALS[
'SQ_SYSTEM']->getMessagingService();
142 $message = $ms->newMessage(Array(),
'bulkmail.job.cancelled', $msg_reps);
143 $message->parameters[
'assetid'] = $job_id;
146 $bulkmail_manager->deleteJob($job_id);
149 $GLOBALS[
'SQ_SYSTEM']->am->forgetAsset($bulkmail_manager);
171 if (empty($jobs))
return;
173 $write_access = $asset->writeAccess(
'attributes');
175 $bulkmail_manager = $GLOBALS[
'SQ_SYSTEM']->am->getSystemAsset(
'bulkmail_manager');
178 <table
class=
"sq-backend-table">
180 <th
class=
"sq-backend-table-header"><?php echo translate(
'bm_job_table_header_id'); ?></th>
181 <th
class=
"sq-backend-table-header"><?php echo translate(
'bm_job_table_header_job'); ?></th>
182 <th
class=
"sq-backend-table-header"><?php echo translate(
'bm_job_table_header_post_office'); ?></th>
183 <th
class=
"sq-backend-table-header"><?php echo translate(
'bm_job_table_header_state'); ?></th>
184 <th
class=
"sq-backend-table-header"><?php echo translate(
'bm_job_table_header_progress'); ?></th>
187 ?><th
class=
"sq-backend-table-header"><?php echo translate(
'bm_job_table_header_control'); ?></th><?php
192 foreach ($jobs as $jobid => $job_info) {
193 $jobid_parts = explode(
':', $jobid);
194 if (isset($jobid_parts[1])) {
195 $name = translate(
'bm_adhoc_job_name');
197 $asset_info = $GLOBALS[
'SQ_SYSTEM']->am->getAssetInfo(Array($jobid), Array(), TRUE,
'name');
198 $name = array_shift($asset_info);
201 $progress = $job_info[
'progress'];
202 $progress_string = translate(
'bm_job_progress_none');
203 if (!empty($progress) && $progress[
'total_count'] != 0) {
204 $percent_done = round(($progress[
'current_count'] / $progress[
'total_count']) * 100, 2).
'%';
205 $progress_string = translate(
'bm_job_progress', number_format($progress[
'current_count']), number_format($progress[
'total_count']), $percent_done);
209 <td align=
"left" class=
"sq-backend-table-cell"><?php echo $jobid; ?></td>
210 <td align=
"left" class=
"sq-backend-table-cell"><?php echo $name; ?></td>
211 <td align=
"left" class=
"sq-backend-table-cell"><?php echo get_asset_tag_line($job_info[
'po_id']); ?></td>
212 <td align=
"left" class=
"sq-backend-table-cell">
214 switch ($job_info[
'status']) {
215 case BML_JOB_STATE_RUNNING:
216 echo translate(
'bm_state_running');
218 case BML_JOB_STATE_NOT_RUNNING:
219 echo translate(
'bm_state_not_running');
221 case BML_JOB_STATE_PAUSED:
222 echo translate(
'bm_state_paused');
224 case BML_JOB_STATE_SLEEPING:
225 echo translate(
'bm_state_sleeping');
228 echo translate(
'bm_state_unknown');
233 <td align=
"left" class=
"sq-backend-table-cell"><?php echo $progress_string; ?></td>
237 <td align=
"left" class=
"sq-backend-table-cell">
241 'cancel' => translate(
'bm_state_action_cancel'),
243 switch ($job_info[
'status']) {
244 case BML_JOB_STATE_RUNNING:
245 case BML_JOB_STATE_NOT_RUNNING:
246 $options[
'pause'] = translate(
'bm_state_action_pause');
248 case BML_JOB_STATE_PAUSED:
249 $options[
'resume'] = translate(
'bm_state_action_resume');
254 combo_box($asset->getPrefix().
'_'.$jobid, $options, FALSE,
'');
262 $GLOBALS[
'SQ_SYSTEM']->am->forgetAsset($post_office);
282 $jobs = $asset->getQueuedJobs();
283 return (empty($jobs) ? FALSE : TRUE);
300 $write_access = $asset->writeAccess(
'attributes');
301 $use_bm_threshold = $asset->attr(
'use_bm_threshold');
305 check_box($prefix.
'_use_bm_threshold', TRUE, $use_bm_threshold);
308 <img src=
"<?php echo sq_web_path('lib'); ?>/web/images/<?php echo $use_bm_threshold ? 'tick' : 'cross'; ?>.gif" width=
"15" height=
"15" />
312 return $write_access;
329 if (!$asset->writeAccess(
'attributes'))
return FALSE;
331 $use_bm_threshold = isset($_POST[$prefix.
'_use_bm_threshold']);
332 $asset->setAttrValue(
'use_bm_threshold', $use_bm_threshold);