source: trunk/web/addons/toga/search.php @ 140

Last change on this file since 140 was 140, checked in by bastiaans, 19 years ago

web/addons/toga/templates/header.tpl:

  • Use block to include link to archive search

web/addons/toga/templates/overview.tpl:

  • Cleanup
  • Javascript moved to seperate .js file

web/addons/toga/templates/search.tpl:

  • Added search results and future showhosts block section

web/addons/toga/index.php:

  • Use block instead of include for archive search link

web/addons/toga/search.php:

  • Setup of working search style

web/addons/toga/libtoga.php:

  • searchDbase() will return a list of jobids matching the criteria
File size: 1.9 KB
RevLine 
[130]1<?php
2
3global $clustername, $tpl;
4
[138]5function 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
[130]32function makeSearchPage() {
[138]33        global $clustername, $tpl, $id, $user, $name, $start_from_time, $start_to_time, $queue;
[140]34        global $end_from_time, $end_to_time, $filter;
[130]35
[138]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
[140]48                $tpl->newBlock( "search_results" );
[138]49                $tdb = new TarchDbase();
[140]50                $search_ids = $tdb->searchDbase( $id, $queue, $user, $name, $start_from_time, $start_to_time, $end_from_time, $end_to_time );
[138]51
[140]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
[138]64                // show search results
65
66        }
[130]67}
68?>
Note: See TracBrowser for help on using the repository browser.