Elgg  Version master
cron.php
Go to the documentation of this file.
1 <?php
7 $periods = $cron_service->getConfiguredIntervals(true);
8 
10 foreach ($periods as $period) {
11  $row = [];
12 
13  // name
14  $row[] = elgg_format_element('td', [], elgg_echo("interval:$period"));
15 
16  // last completed (friendly) and full date
17  $ts = $cron_service->getLog('completion', $period);
18  if (!elgg_is_empty($ts)) {
19  $row[] = elgg_format_element('td', [], elgg_view_friendly_time((int) $ts));
20  $row[] = elgg_format_element('td', [], elgg_view('output/date', [
21  'value' => $ts,
22  'format' => DATE_RFC2822,
23  ]));
24  } else {
25  $row[] = elgg_format_element('td', [], elgg_echo('never'));
26  $row[] = elgg_format_element('td', [], '&nbsp;');
27  }
28 
29  // cron output
30  $msg = $cron_service->getLog('output', $period);
31  if (!empty($msg)) {
32  $msg = nl2br($msg);
33 
34  if (elgg_in_context('widgets')) {
35  $msg = elgg_format_element('div', [], $msg);
36  $msg = elgg_view('output/url', [
37  'href' => false,
38  'text' => false,
39  'icon' => 'info',
40  'class' => ['elgg-lightbox'],
41  'data-colorbox-opts' => json_encode(['html' => $msg]),
42  ]);
43  }
44  }
45 
46  $row[] = elgg_format_element('td', [], $msg);
47 
48  $table_content .= elgg_format_element('tr', [], implode(PHP_EOL, $row));
49 }
50 
51 $header = elgg_format_element('th', [], elgg_echo('admin:cron:period'));
52 $header .= elgg_format_element('th', [], elgg_echo('admin:cron:friendly'));
53 $header .= elgg_format_element('th', [], elgg_echo('admin:cron:date'));
54 $header .= elgg_format_element('th', [], elgg_echo('admin:cron:msg'));
56 $header = elgg_format_element('thead', [], $header);
57 
59 
60 $table = elgg_format_element('table', ['class' => 'elgg-table'], $header . $table_content);
61 
62 echo elgg_view_module('info', elgg_echo('admin:cron:record'), $table);
elgg_view_module(string $type, string $title, string $body, array $vars=[])
Wrapper function for the module display pattern.
Definition: views.php:940
$periods
Definition: cron.php:7
elgg_in_context(string $context)
Check if this context exists anywhere in the stack.
Definition: context.php:78
elgg_echo(string $message_key, array $args=[], string $language= '')
Elgg language module Functions to manage language and translations.
Definition: languages.php:17
$table_content
Definition: cron.php:9
$cron_service
Cron statistics.
Definition: cron.php:6
elgg_is_empty($value)
Check if a value isn&#39;t empty, but allow 0 and &#39;0&#39;.
Definition: input.php:176
elgg_view(string $view, array $vars=[], string $viewtype= '')
Return a parsed view.
Definition: views.php:177
elgg_view_friendly_time($time, $time_updated=null)
Displays a UNIX timestamp in a friendly way.
Definition: views.php:853
$ts
CSRF security token view for use with secure forms.
foreach($periods as $period) $header
Definition: cron.php:51
_elgg_services()
Get the global service provider.
Definition: elgglib.php:346
elgg_format_element(string $tag_name, array $attributes=[], string $text= '', array $options=[])
Format an HTML element.
Definition: output.php:130
$table
Definition: cron.php:60