}
$sj = new CRM_Core_JobManager();
- $rows = $temp = [];
+ $rows = [];
foreach ($sj->jobs as $job) {
$action = array_sum(array_keys($this->links()));
// update enable/disable links.
// CRM-9868- remove enable action for jobs that should never be run automatically via execute action or runjobs url
- if ($job->api_action == 'process_membership_reminder_date' || $job->api_action == 'update_greeting') {
+ if ($job->api_action === 'process_membership_reminder_date' || $job->api_action === 'update_greeting') {
$action -= CRM_Core_Action::ENABLE;
$action -= CRM_Core_Action::DISABLE;
}
$action -= CRM_Core_Action::DISABLE;
}
- $job->action = CRM_Core_Action::formLink(self::links(), $action,
- array('id' => $job->id),
+ $job->action = CRM_Core_Action::formLink($this->links(), $action,
+ ['id' => $job->id],
ts('more'),
FALSE,
'job.manage.action',
* @return array
* ($id => CRM_Core_ScheduledJob)
*/
- private function _getJobs() {
+ private function _getJobs(): array {
$jobs = [];
$dao = new CRM_Core_DAO_Job();
$dao->orderBy('name');
$dao->domain_id = CRM_Core_Config::domainID();
$dao->find();
while ($dao->fetch()) {
- $temp = [];
+ $temp = ['class' => NULL, 'parameters' => NULL, 'last_run' => NULL];
CRM_Core_DAO::storeValues($dao, $temp);
$jobs[$dao->id] = new CRM_Core_ScheduledJob($temp);
}
<th ></th>
</tr>
{foreach from=$rows item=row}
- <tr id="job-{$row.id}" class="crm-entity {cycle values="odd-row,even-row"} {if !empty($row.class)}{$row.class}{/if}{if NOT $row.is_active} disabled{/if}">
+ <tr id="job-{$row.id}" class="crm-entity {cycle values="odd-row,even-row"} {$row.class}{if NOT $row.is_active} disabled{/if}">
<td class="crm-job-name"><strong><span data-field="name">{$row.name}</span></strong> ({$row.run_frequency})<br/>
{$row.description}<br />
{ts}API Entity:{/ts} {$row.api_entity}<br/>
{ts}API Action:{/ts} <strong>{$row.api_action}</strong><br/>
</td>
- <td class="crm-job-name">{if isset($row.parameters)}{if $row.parameters eq null}<em>{ts}no parameters{/ts}</em>{else}<pre>{$row.parameters}</pre>{/if}{/if}</td>
- <td class="crm-job-name">{if isset($row.last_run)}{if $row.last_run eq null}never{else}{$row.last_run|crmDate:$config->dateformatDatetime}{/if}{/if}</td>
+ <td class="crm-job-name">{if $row.parameters eq null}<em>{ts}no parameters{/ts}</em>{else}<pre>{$row.parameters}</pre>{/if}</td>
+ <td class="crm-job-name">{if $row.last_run eq null}never{else}{$row.last_run|crmDate:$config->dateformatDatetime}{/if}</td>
<td id="row_{$row.id}_status" class="crm-job-is_active">{if $row.is_active eq 1} {ts}Yes{/ts} {else} {ts}No{/ts} {/if}</td>
<td>{$row.action|replace:'xx':$row.id}</td>
</tr>
}
/**
- * Dataprovider for testOpeningForms().
+ * Data provider for testOpeningForms().
* TODO: Add more forms!
*
* @return array
'Message Templates' => [
'civicrm/admin/messageTemplates?reset=1',
],
+ 'Scheduled Jobs' => [
+ 'civicrm/admin/job?reset=1',
+ ],
];
}