/[scire]/scire/jobs.php
Gentoo

Contents of /scire/jobs.php

Parent Directory Parent Directory | Revision Log Revision Log


Revision 186 - (show annotations) (download)
Sat Mar 17 03:23:00 2007 UTC (11 years, 6 months ago) by codeman
File size: 1944 byte(s)
adding a line to grab/use the default value if none is already set.

1 <?php
2 include('.lib/common.php');
3
4 $smarty->assign('leftbar', "on");
5 $leftbar_menu = array();
6 $leftbar_submenu = array();
7 $template = "jobs.tpl";
8 $error_msg = "";
9
10 ############################################
11 ## Deal with submitted forms first.
12
13 #Set information about the fields (display name, sortable)
14 $f_attr = get_jobs_fields();
15 $smarty->assign('f_attr', $f_attr);
16
17 if (!$_GET['sorton']) {
18 $_GET['sorton'] = 'jobid';
19 }
20 if (!$_GET['sortdir']) {
21 $_GET['sortdir'] = 'asc';
22 }
23 $smarty->assign('sorton', $_GET['sorton']);
24 $smarty->assign('sortdir', $_GET['sortdir']);
25
26 #Grab the field list.
27 if ($_SESSION['settings']['jobs_page_fields']) {
28 $fields = explode(',', $_SESSION['settings']['jobs_page_fields']);
29 } else {
30 $fields = explode(',', get_default_jobs_fields());
31 }
32 #$fields = array("hostname", "ip", "mac", "digest", "status", "installtime");
33 $smarty->assign('fields',$fields);
34
35 $jobs = get_scire_jobs($_GET['sorton'], $_GET['sortdir'], 'All');
36 $smarty->assign('jobs', $jobs);
37
38
39 #$jobs = $db->select(array("c.hostname", "j.*"), #FROM
40 # "clients c, jobs j, jobs_clients jc", #WHERE
41 # "j.jobid = jc.jobid AND jc.clientid = c.clientid");
42 #print "<pre>";
43 #pre_var_dump($jobs); #For debugging.
44 #$client_groups = array();
45 foreach( $jobs as $key => $job) {
46 $id = $acl->get_object_id("clients",$job['hostname'],'AXO');
47 $groups = $acl->get_object_groups($id,'AXO');
48 $group_string = "";
49 foreach ($groups as $group) {
50 $group_data = $acl->get_group_data($group, 'AXO');
51 $group_string .= $group_data[3]. " | ";
52 $client_groups["$group"] = $group_data[3];
53 }
54 $jobs[$key]['groups'] = $group_string;
55 }
56 #print "</pre>";
57
58 $smarty->assign('jobs', $jobs);
59
60 if ($_POST['searchfield']) {
61 $error_msg .= "Um, yeah... not done yet.";
62 }
63
64 #Gather groups of clients. it's a phpgacl command.
65
66 $smarty->assign('client_groups', $client_groups);
67 $smarty->display('jobs.tpl');
68 ?>

Properties

Name Value
svn:executable *

  ViewVC Help
Powered by ViewVC 1.1.20