Subversion Repositories slis

Rev

Rev 5301 | Details | Compare with Previous | Last modification | View Log | RSS feed

Rev Author Line No. Line
738 xav 1
<?PHP
2
/* $Id: monitor_check_list.php 1 2004-12-21 09:09:43Z xav $
3
 
4
This script has been written by Xavier LANGLOIS
5
Copyright (C) 2004 Xavier LANGLOIS <xavier.l@iwall.fr>
6
 
7
This script is released under GNU Public Licence (GPL)
8
http://www.gnu.org/licenses/gpl.html
9
 
10
This script is part of the SLIS Project initiated by
11
the CARMI-Internet (Academie de Grenoble - France 38).
12
 
13
SLIS : Serveur de communications Linux pour l'Internet Scolaire.
14
Copyright (C) 1998-2001 Bruno Bzeznik
15
 
16
--------------------------------------------------------------*/
17
 
1073 xav 18
// level = 1
1381 xav 19
// right = manage_check
738 xav 20
// name = Monitor check list
21
// desc = Monitor check list
22
 
23
include_once("general.php");
24
include_once("gui/Form.php");
25
include_once("gui/FormField.php");
26
include_once("gui/OptionField.php");
27
include_once("gui/HiddenField.php");
28
include_once("gui/CheckboxField.php");
29
include_once("gui/Table.php");
30
include_once("gui/LinkField.php");
31
include_once("gui/LineField.php");
32
include_once("gui/HelpButton.php");
33
include_once("gui/Button.php");
34
include_once("gui/ButtonForm.php");
35
 
36
include_once("objects/AccessHistory.php");
37
include_once("objects/Monitor_check.php");
1073 xav 38
include_once("objects/Monitor_global.php");
1106 xav 39
include_once("objects/Monitor_list.php");
5301 plb 40
include_once("objects/VersionSlis.php");
738 xav 41
 
42
/*if ($new)    {
43
        html_redirect("monitor_check_edit.php");
44
}*/
45
 
1382 xav 46
if (!$slim_user->has_right("manage_check")) {
47
        html_error ("Operation not allowed");
48
        exit();
49
}
1249 xav 50
 
51
global $with_record_count;
52
$with_record_count = &$_SESSION['with_record_count'];
53
 
5302 plb 54
global $with_check_version;
55
$with_check_version = &$_SESSION['with_check_version'];
56
 
57
$save_user_config = false;
58
 
1249 xav 59
if (isset($_GET["with_record_count"])){
60
  $with_record_count= $_GET["with_record_count"];
5302 plb 61
  $save_user_config = true;
62
}
63
if (isset($_GET["with_check_version"])){
64
  $with_check_version= $_GET["with_check_version"];
65
  $save_user_config = true;
66
}
67
 
68
if ($save_user_config) {
1249 xav 69
        // save the config_slim of the user in DB
70
        $config =  $_SESSION['config_slim'];
71
        $config['with_record_count']=$with_record_count;
5302 plb 72
        $config['with_check_version']=$with_check_version;
73
 
1249 xav 74
        $slim_user->config_slim = base64_encode(wddx_serialize_value($config));
75
        $slim_user->modify();
76
 
77
}
78
 
5302 plb 79
 
80
 
738 xav 81
print html_header($slis->name);
82
 
1381 xav 83
if ($slim_user->has_right("manage_check")) {
738 xav 84
 
1106 xav 85
        if ($slis_name) {
86
                $checks = $Monitor_list->select("slis_name='$slis_name'");
87
 
88
                foreach($checks as $check) {
89
                        if ($cond) $cond.=" and ";
90
                        $cond.= "id_check!=$check->id_check";
91
                }
92
                $cond.= " and priority!=0 and priority!=100 ";
93
                $notusesd = $Monitor_check->select($cond,"priority");
94
 
95
                $mcs = $Monitor_check->select($cond, "priority,name");
96
 
97
                $table = new Table(1);
98
                $table->set_title("Monitor check");
99
                $table->add_field(new Field("priority", "Priorité"));
1109 xav 100
                $table->add_field(new Field("", "Nom","","get_slis_link"));
1106 xav 101
                $table->add_field(new Field("comment", "Commentaire"));
102
                print $table->build_code($notusesd);   
103
 
104
        } else {
105
 
1073 xav 106
                $cond="";
5301 plb 107
                $mcs = array();
5302 plb 108
                if (isset($with_check_version) && $with_check_version != "") {
109
                    $mcs = $Monitor_check->select_by_version($with_check_version,$cond,"priority,name");
5301 plb 110
                }
111
                else {
112
                    $mcs = $Monitor_check->select($cond, "priority,name");
113
                }
738 xav 114
 
115
                $table = new Table(1);
5301 plb 116
    $table->set_no_i8n();      
5302 plb 117
                if (isset($with_check_version) && $with_check_version != "") {
118
                    $title = __("Monitor checks for the version: ") . $with_check_version;
5301 plb 119
                }
120
                else {
121
                    $title = __("Monitor checks for all versions");
122
                }
123
                $table->set_title($title);
1106 xav 124
 
738 xav 125
 
1106 xav 126
                $table->add_field(new Field("priority", "Priorité"));
127
                $table->add_field(new LinkField("name", "Nom","","","getLink_1","",""));
128
                $table->add_field(new Field("comment", "Commentaire"));
1249 xav 129
 
1290 xav 130
                $table->add_field(new Field("", "by default","","is_default"));
131
 
1249 xav 132
                if ($with_record_count=="yes") {
133
                        $table->add_field(new Field("", "Record count","","getRecordCount"));
134
                }
135
 
1138 xav 136
                $table->add_field(new Field("min_age", "Min age"));
137
                $table->add_field(new Field("min_record", "Min record"));
1123 xav 138
                $table->add_field(new Field("max_age", "Max age"));
139
                $table->add_field(new Field("max_record", "Max record"));
5301 plb 140
 
141
                $vs = $VersionSlis->select("");
142
                print "<p>\n";
5302 plb 143
                $link = html_link("?with_check_version=","All Versions");
144
                if (!isset($with_check_version) || $with_check_version == "") {
5301 plb 145
                  print "<b>".$link."</b>";
146
                } else {
147
                  print $link;
148
                }
149
                foreach($vs as $v) {
150
                    print " | ";
5302 plb 151
                    $link = html_link("?with_check_version=".$v->version_name,$v->version_name);
152
                    if (isset($with_check_version) && $with_check_version == $v->version_name) {
5301 plb 153
                      print "<b>".$link."</b>";
154
                    } else {
155
                      print $link;
156
                    }
157
                }
158
                print "</p>\n";
159
 
1106 xav 160
                print $table->build_code($mcs);
1073 xav 161
 
1106 xav 162
                $button_form = new ButtonForm(new Button("New script", "new"),"monitor_check_edit.php");
163
                print "<p>\n";
164
                print $button_form->build_code();
1249 xav 165
 
166
                if ($with_record_count=="yes") {
167
                        echo html_link("?with_record_count=no",__("Hide record counts") );
168
                } else {
169
                        echo html_link("?with_record_count=yes",__("Show record counts") );
170
                }
738 xav 171
 
1106 xav 172
                print "<HR>\n";
173
 
174
                $mgs = $Monitor_global->select("", "name");
175
                $table = new Table(1);
1138 xav 176
                $table->set_title("Global monitor check");
1106 xav 177
        //      $table->add_field(new Field("priority", "Priorite"));
178
                $table->add_field(new LinkField("name", "Nom","","","getLink_1","",""));
179
                $table->add_field(new Field("comment", "Commentaire"));
180
                print $table->build_code($mgs);
181
 
182
                $button_form = new ButtonForm(new Button("New script", "new"),"monitor_global_edit.php");
183
                print "<p>\n";
184
                print $button_form->build_code();
185
        }
186
 
738 xav 187
} else {
1106 xav 188
        html_error ("Operation not allowed");
738 xav 189
}
190
 
191
 
192
print html_footer();
193
 
3740 plb 194
?>