/[scire]/trunk/scire/jobs.php
Gentoo

Contents of /trunk/scire/jobs.php

Parent Directory Parent Directory | Revision Log Revision Log


Revision 352 - (show annotations) (download)
Wed Jan 16 02:46:18 2008 UTC (6 years, 5 months ago) by codeman
File size: 2183 byte(s)
fixing up the jobs stuff.  halfway there i'd say.

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

Properties

Name Value
svn:executable *

  ViewVC Help
Powered by ViewVC 1.1.20