/adei/trunk

To get this branch, use:
bzr branch http://darksoft.org/webbzr/adei/trunk
1 by Suren A. Chilingaryan
Initial import
1
<?php 
2
require("adei.php");
3
4
header("Content-Type: text/html; charset=UTF-8");
5
header("Cache-Control: no-cache, must-revalidate");
6
header("Expires: Mon, 26 Jul 1997 05:00:00 GMT");
7
8
?>
9
<html>
10
<head>
11
 <style type="text/css">
12
    .header {
13
    }
14
    .header a {
15
	padding: 5px;
16
	margin-bottom: 2px;
17
	color: #000055;
18
	background: #F0F0F0;
19
	font-weight: bold;
20
	border: 1px solid #C0C0C0;
21
	text-decoration: none;
22
    }
23
    .header a:hover {
24
	border: 1px #007000 solid; 
25
	background: #FDD;
26
    }
27
 </style>
28
</head>
29
<body>
30
<?
31
79 by Suren A. Chilingaryan
New version of dhtmlxmenu and dhtmlxtree is added
32
33
function GetQueryString(REQUEST $sreq) {
34
    global $ADEI_SETUP;
35
    
36
    $req = $sreq->GetQueryString();
37
    
38
    if ($req) $req .= "&";
39
    else $req = "";
40
	
41
    $req .= "setup=" . $ADEI_SETUP;
42
43
    return $req;
44
}
45
1 by Suren A. Chilingaryan
Initial import
46
function data_link(&$req, $grname, $format, $from, $to) {
47
    global $FORMATS;
48
    
49
    $props = array();
50
    $props["experiment"] = "$from-$to";
51
    $props["window"] = "0";
52
    $props["format"] = $format;    
53
54
    if ($FORMATS[$format]["title"]) $title = $FORMATS[$format]["title"];
55
    else $title = $format;
56
    if ($FORMATS[$format]["extension"]) $ext = $FORMATS[$format]["extension"];
57
    else $ext = $format;
58
59
    
60
//    $props["filename"] =  preg_replace("/[^\w\d]/", "_", $grname) . "__" . round($from) . "_" . round($to) . "." . $ext;
61
    
79 by Suren A. Chilingaryan
New version of dhtmlxmenu and dhtmlxtree is added
62
#    if (isset($_GET['setup'])) $props["setup"] = $_GET['setup'];
1 by Suren A. Chilingaryan
Initial import
63
    $query = $req->GetQueryString($props);
64
    
65
    echo "<a href=\"services/getdata.php?$query\">" . $title . "</a>";
66
}
67
79 by Suren A. Chilingaryan
New version of dhtmlxmenu and dhtmlxtree is added
68
if (isset($_GET['period'])) {
69
    $period = $_GET['period'] * 3600;
70
} else {
71
    $period = 86400;
72
}
73
74
1 by Suren A. Chilingaryan
Initial import
75
try {
76
    $req = new SOURCERequest();
77
} catch (ADEIException $e) {
78
    $req = new REQUEST();
79
    $nodata = 1;
80
}
81
82
35 by Suren A. Chilingaryan
Minor refactoring: REQUEST/READER/CACHE listing flags, REQUEST listing functions, eliminating FETCH_BOTH fetches in DATABASE, support for partial menu generation
83
$list = $req->GetSources(REQUEST::LIST_ALL);
1 by Suren A. Chilingaryan
Initial import
84
?><div class="header"><?
85
foreach ($list as $sreq) {
79 by Suren A. Chilingaryan
New version of dhtmlxmenu and dhtmlxtree is added
86
    ?><a href="download.php?<?echo GetQueryString($sreq);?>"><?echo $sreq->props['db_server'];?>.<?echo $sreq->props['db_name'];?></a> <?
1 by Suren A. Chilingaryan
Initial import
87
}
88
?><a href="csvmerge.php">Merge Groups</a></div><?
89
if ($nodata) exit;
90
91
92
?><h3>Server: <?echo $req->props['db_server'];?>, DataBase: <?echo $req->props['db_name'];?></h3><?
93
94
95
//$props = array("db_server"=>"katrin", "db_name"=>"HS");
96
$reader = $req->CreateReader();
35 by Suren A. Chilingaryan
Minor refactoring: REQUEST/READER/CACHE listing flags, REQUEST listing functions, eliminating FETCH_BOTH fetches in DATABASE, support for partial menu generation
97
$groups = $reader->GetGroupList(REQUEST::NEED_INFO);
1 by Suren A. Chilingaryan
Initial import
98
35 by Suren A. Chilingaryan
Minor refactoring: REQUEST/READER/CACHE listing flags, REQUEST listing functions, eliminating FETCH_BOTH fetches in DATABASE, support for partial menu generation
99
$list = $req->GetGroups();
1 by Suren A. Chilingaryan
Initial import
100
foreach ($list as $gid => $greq) {
101
    $group = $groups[$gid];
102
    ?><div style="background-color: grey">
103
	<h3><?echo $group["name"];?></h3>
104
	<?echo $group["comment"];?>
105
	<br/><br/>
106
	<?
107
	$first = $group["first"];
108
	$last = $group["last"];
109
	
110
	$first = floor($first);
111
	$last = ceil($last);
112
79 by Suren A. Chilingaryan
New version of dhtmlxmenu and dhtmlxtree is added
113
	$first_day = $first - ($first % $period);
114
	if ($last%$period) $last_day = $last + $period - ($last % $period);
115
	else $last_day = $last - ($last % $period);
116
117
118
	for ($i=$first_day; $i<$last_day; $i += $period) {
1 by Suren A. Chilingaryan
Initial import
119
	    echo date("d.m.Y", $i) . "(";
120
121
	    $first_flag = 1;
122
	    
123
	    foreach ($EXPORT_FORMATS as $format => $fattr) {
124
		if ($first_flag) $first_flag = 0;
125
		else  echo ", ";
126
		
79 by Suren A. Chilingaryan
New version of dhtmlxmenu and dhtmlxtree is added
127
		data_link($greq, $group["name"], $format, ($i>$first)?$i:$first, (($i + $period)>$last)?$last:($i + $period));
1 by Suren A. Chilingaryan
Initial import
128
	    }
129
	    echo ") ";
130
	}
131
	
132
133
	echo "Everything (";
134
        $first_flag = 1;
135
136
	foreach ($EXPORT_FORMATS as $format => $fname) {
137
	    if ($first_flag) $first_flag = 0;
138
	    else  echo ", ";
139
		
140
	    data_link($greq, $group["name"], $format, $first, $last);
141
	}
142
	echo ") ";
143
    ?></div><br/><br/><?
144
}
145
146
147
?>
148
(*) the GMT days are used
149
</body></html>