/adei/ui

To get this branch, use:
bzr branch http://darksoft.org/webbzr/adei/ui

« back to all changes in this revision

Viewing changes to download.php

  • Committer: Suren A. Chilingaryan
  • Date: 2008-04-02 10:23:22 UTC
  • Revision ID: csa@dside.dyndns.org-20080402102322-okib92sicg2dx3o3
Initial import

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
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
 
 
32
function data_link(&$req, $grname, $format, $from, $to) {
 
33
    global $FORMATS;
 
34
    
 
35
    $props = array();
 
36
    $props["experiment"] = "$from-$to";
 
37
    $props["window"] = "0";
 
38
    $props["format"] = $format;    
 
39
 
 
40
    if ($FORMATS[$format]["title"]) $title = $FORMATS[$format]["title"];
 
41
    else $title = $format;
 
42
    if ($FORMATS[$format]["extension"]) $ext = $FORMATS[$format]["extension"];
 
43
    else $ext = $format;
 
44
 
 
45
    
 
46
//    $props["filename"] =  preg_replace("/[^\w\d]/", "_", $grname) . "__" . round($from) . "_" . round($to) . "." . $ext;
 
47
    
 
48
    $query = $req->GetQueryString($props);
 
49
    
 
50
    echo "<a href=\"services/getdata.php?$query\">" . $title . "</a>";
 
51
}
 
52
 
 
53
try {
 
54
    $req = new SOURCERequest();
 
55
} catch (ADEIException $e) {
 
56
    $req = new REQUEST();
 
57
    $nodata = 1;
 
58
}
 
59
 
 
60
 
 
61
$list = $req->GetSourceList(REQUEST::LIST_ALL);
 
62
?><div class="header"><?
 
63
foreach ($list as $sreq) {
 
64
    ?><a href="download.php?<?echo $sreq->GetQueryString();?>"><?echo $sreq->props['db_server'];?>.<?echo $sreq->props['db_name'];?></a> <?
 
65
}
 
66
?><a href="csvmerge.php">Merge Groups</a></div><?
 
67
if ($nodata) exit;
 
68
 
 
69
 
 
70
?><h3>Server: <?echo $req->props['db_server'];?>, DataBase: <?echo $req->props['db_name'];?></h3><?
 
71
 
 
72
 
 
73
//$props = array("db_server"=>"katrin", "db_name"=>"HS");
 
74
$reader = $req->CreateReader();
 
75
$groups = $reader->GetGroupList(READER::NEED_INFO);
 
76
 
 
77
$list = $req->GetGroupList();
 
78
foreach ($list as $gid => $greq) {
 
79
    $group = $groups[$gid];
 
80
    ?><div style="background-color: grey">
 
81
        <h3><?echo $group["name"];?></h3>
 
82
        <?echo $group["comment"];?>
 
83
        <br/><br/>
 
84
        <?
 
85
        $first = $group["first"];
 
86
        $last = $group["last"];
 
87
        
 
88
        $first = floor($first);
 
89
        $last = ceil($last);
 
90
 
 
91
        $first_day = $first - ($first % 86400);
 
92
        if ($last%86400) $last_day = $last + 86400 - ($last % 86400);
 
93
        else $last_day = $last - ($last % 86400);
 
94
 
 
95
 
 
96
        for ($i=$first_day; $i<$last_day; $i += 86400) {
 
97
            echo date("d.m.Y", $i) . "(";
 
98
 
 
99
            $first_flag = 1;
 
100
            
 
101
            foreach ($EXPORT_FORMATS as $format => $fattr) {
 
102
                if ($first_flag) $first_flag = 0;
 
103
                else  echo ", ";
 
104
                
 
105
                data_link($greq, $group["name"], $format, ($i>$first)?$i:$first, (($i + 86400)>$last)?$last:($i + 86400));
 
106
            }
 
107
            echo ") ";
 
108
        }
 
109
        
 
110
 
 
111
        echo "Everything (";
 
112
        $first_flag = 1;
 
113
 
 
114
        foreach ($EXPORT_FORMATS as $format => $fname) {
 
115
            if ($first_flag) $first_flag = 0;
 
116
            else  echo ", ";
 
117
                
 
118
            data_link($greq, $group["name"], $format, $first, $last);
 
119
        }
 
120
        echo ") ";
 
121
    ?></div><br/><br/><?
 
122
}
 
123
 
 
124
 
 
125
?>
 
126
(*) the GMT days are used
 
127
</body></html>
 
 
b'\\ No newline at end of file'