/
index.php
65 lines (50 loc) · 1.12 KB
/
index.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
<?
require_once('include/controller.php');
require_once('include/command.php');
require_once('form.php');
class Home extends Controller
{
function __construct()
{
parent::__construct();
$this->_dbpath = LOG_PATH;
$this->title = 'Optimization Inspector';
$this->add_script('flot/jquery.flot');
}
function action_index()
{
$this->all_jobs = Command::jobs();
$this->jobs = array();
$form = new Form($this, 'get');
$this->users = array();
$this->user_selected = $form->user_filter;
$toggled = explode(',', $form->toggled);
$toggleitems = array();
foreach ($toggled as $t)
{
$parts = explode(":", $t);
$toggleitems[intval($parts[0])] = array_slice($parts, 1);
}
foreach ($this->all_jobs as $job)
{
if (!in_array($job->user, $this->users))
{
$this->users[] = $job->user;
}
if ($form->user_filter && $form->user_filter != $job->user)
{
continue;
}
if (array_key_exists($job->id, $toggleitems))
{
$job->toggled = $toggleitems[$job->id];
}
$this->jobs[] = $job;
}
sort(&$this->users);
$this->view();
}
}
$controller = new Home();
$controller->run();
?>