Elgg  Version 4.3
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 $period_hd = elgg_echo('admin:cron:period');
52 $friendly_hd = elgg_echo('admin:cron:friendly');
53 $date_hd = elgg_echo('admin:cron:date');
54 $msg_hd = elgg_echo('admin:cron:msg');
55 
56 $table = <<<HTML
57 <table class="elgg-table">
58  <thead>
59  <tr>
60  <th>$period_hd</th>
61  <th>$friendly_hd</th>
62  <th>$date_hd</th>
63  <th>$msg_hd</th>
64  </tr>
65  </thead>
66  <tbody>
68  </tbody>
69 </table>
70 HTML;
71 
72 echo elgg_view_module('info', elgg_echo('admin:cron:record'), $table);
$periods
Definition: cron.php:7
$table_content
Definition: cron.php:9
$date_hd
Definition: cron.php:53
elgg_echo($message_key, array $args=[], $language="")
Elgg language module Functions to manage language and translations.
Definition: languages.php:18
$friendly_hd
Definition: cron.php:52
$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:179
$msg_hd
Definition: cron.php:54
elgg_in_context($context)
Check if this context exists anywhere in the stack.
Definition: context.php:78
elgg_format_element($tag_name, array $attributes=[], $text= '', array $options=[])
Format an HTML element.
Definition: output.php:135
elgg_view_module($type, $title, $body, array $vars=[])
Wrapper function for the module display pattern.
Definition: views.php:944
elgg_view_friendly_time($time, $time_updated=null)
Displays a UNIX timestamp in a friendly way.
Definition: views.php:859
$ts
CSRF security token view for use with secure forms.
_elgg_services()
Get the global service provider.
Definition: elgglib.php:638
elgg echo
Translates a string.
Definition: deprecated.js:530
foreach($periods as $period) $period_hd
Definition: cron.php:51
elgg_view($view, $vars=[], $viewtype= '')
Return a parsed view.
Definition: views.php:179
$table
Definition: cron.php:56