CMS  Version 3.9
scheduled_task_logs.inc
Go to the documentation of this file.
1 <?php
2 Fakoli::using("scheduled_task");
3 Fakoli::using("data_view");
4 
5 $menu_item = "Scheduled Tasks";
6 
7 $task_id = checkNumeric($_GET["task_id"]);
8 if (!$task_id)
9 {
10  redirect("scheduled_tasks");
11 }
12 
14 
16 $log->filter = new InclusionFilter("log_date");
17 $filterForm = new FilterForm($log);
18 
19 $dateRangeFilter = new DateRangeFilterRenderer($filterForm, "log_date", "", "month");
20 
21 
22 $constraint = $filterForm->getConstraint();
23 $logEntries = $task->LogEntries("$constraint ORDER BY log_date DESC");
24 
25 $table = new DataListView($logEntries, "log_entries");
26 $table->column("Execution Date", "{log_date}", true, "width: 20%")
27  ->column("Status", "<a class='button' style='float: right' href='#' onclick='showTaskLog({task_id}, {log_entry_id}, \"{log_date}\"); return false'>Show Log</a> {status}", true);
28 
29 $table->paginate = true;
30 $table->pageSize = 20;
31 $table->filter = true;
32 $table->sortable = true;
33 $table->excelFile = "scheduled_task_log.xls";
34 $table->emptyMessage = "There are no log files for this task.";
35 
37 
38 $script .= $filterForm->writeScript();
39 $script .= $table->writeScript();
40 $script .= <<<ENDSCRIPT
41 <script type='text/javascript'>
42 function showTaskLog(task_id, log_entry_id, log_date)
43 {
44  modalPopup("Task Log for " + log_date, "/action/scheduled_task/show_log?task_id=" + task_id + "&log_entry_id=" + log_entry_id, '800px', 'auto');
45 }
46 </script>
47 ENDSCRIPT;
48 $tabs->writeHTML();
49 ?>
50 <div class='tab_border'>
51 <h4><?echo $task->format("{component:prettify}: {task_name}");?></h4>
52 <?
53 $filterForm->drawForm();
54 $table->drawView();
55 ?>
56 <br/>
57 <a class='button' href='/action/scheduled_task/run_task?task_id=<?echo $task_id?>'>Run Now</a>
58 </div>
$dateRangeFilter
if(! $task_id) $task
static using()
Import the datamodels, views and manifest for the specified component(s).
Definition: core.inc:116