1 | <?php |
---|
2 | |
---|
3 | global $clustername, $tpl; |
---|
4 | |
---|
5 | function validateFormInput() { |
---|
6 | global $clustername, $tpl, $id, $user, $name, $start_from_time, $start_to_time, $queue; |
---|
7 | global $end_from_time, $end_to_time; |
---|
8 | |
---|
9 | $error = 0; |
---|
10 | |
---|
11 | $none_set = 0; |
---|
12 | |
---|
13 | //if( $id == '' or $user == '' or $name == '' or $start_from_time == '' or $start_to_time == '' or $queue == '' or $end_from_time == '' or $end_to_time == '') $none_set = 1; |
---|
14 | |
---|
15 | //if (!isset($id) and !isset($user) and !isset($start_from_time) and !isset($start_to_time) and !isset($end_from_time) and !isset($end_to_time) and !isset($queue) ) $none_set = 0; |
---|
16 | |
---|
17 | if( $none_set ) { |
---|
18 | $error = 1; |
---|
19 | $error_msg = "<FONT COLOR=\"red\"><B>No search criteria set!</B></FONT>"; |
---|
20 | } |
---|
21 | |
---|
22 | // doe checks en set error en error_msg in case shit |
---|
23 | |
---|
24 | if( $error) { |
---|
25 | $tpl->assign( "form_error_msg", $error_msg ); |
---|
26 | return 0; |
---|
27 | } else { |
---|
28 | return 1; |
---|
29 | } |
---|
30 | } |
---|
31 | |
---|
32 | function makeSearchPage() { |
---|
33 | global $clustername, $tpl, $id, $user, $name, $start_from_time, $start_to_time, $queue; |
---|
34 | global $end_from_time, $end_to_time, $filter; |
---|
35 | |
---|
36 | $tpl->assign( "cluster", $clustername ); |
---|
37 | $tpl->assign( "id_value", $id ); |
---|
38 | $tpl->assign( "user_value", $user ); |
---|
39 | $tpl->assign( "queue_value", $queue ); |
---|
40 | $tpl->assign( "name_value", $name ); |
---|
41 | $tpl->assign( "start_from_value", rawurldecode( $start_from_time ) ); |
---|
42 | $tpl->assign( "start_to_value", rawurldecode( $start_to_time ) ); |
---|
43 | $tpl->assign( "end_from_value", rawurldecode( $end_from_time ) ); |
---|
44 | $tpl->assign( "end_to_value", rawurldecode( $end_to_time ) ); |
---|
45 | |
---|
46 | if( validateFormInput() ) { |
---|
47 | |
---|
48 | $tpl->newBlock( "search_results" ); |
---|
49 | $tdb = new TarchDbase(); |
---|
50 | $search_ids = $tdb->searchDbase( $id, $queue, $user, $name, $start_from_time, $start_to_time, $end_from_time, $end_to_time ); |
---|
51 | |
---|
52 | foreach( $search_ids as $foundid ) { |
---|
53 | |
---|
54 | printf("found job %s\n", $foundid ); |
---|
55 | //output jobzooi |
---|
56 | |
---|
57 | } |
---|
58 | |
---|
59 | if( count( $search_ids ) == 1 ) { |
---|
60 | |
---|
61 | $tpl->newBlock( "showhosts" ); |
---|
62 | } |
---|
63 | |
---|
64 | // show search results |
---|
65 | |
---|
66 | } |
---|
67 | } |
---|
68 | ?> |
---|