Project

General

Profile

Paste
Download (2.53 KB) Statistics
| Branch: | Revision:

root / panoInfo.php @ 6156a9b6

1
<?php
2
require_once('class/site_point.class.php');
3
require_once('class/FormValidator.class.php');
4

    
5
$fields_spec = array('name' => array('required', 'basename'));
6

    
7
$validator = new FormValidator($fields_spec);
8

    
9
$is_valid = $validator->validate($_GET);
10

    
11

    
12

    
13
if ($is_valid) {
14
  $input = $validator->sane_values();
15
  $pano = site_point::get($input['name']);
16
  
17
  if ($pano->has_params()) {
18
    $params = $pano->get_params();
19
    $title = $params['titre'];
20
    $lat = $params['latitude'];
21
    $lon = $params['longitude'];
22
  } else {
23
    $title = $input['name'];
24
  }
25

    
26

    
27
  $has_tiles = $pano->has_tiles();//TODO
28
  $has_params = $pano->has_params();
29
  $src_path = $pano->src_path();
30
} else {
31
  $validation_errors = $validator->errors();
32
}
33
 ?>
34

    
35
<!DOCTYPE html>
36
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="fr" lang="fr">
37
  <head>
38
    <meta http-equiv="Content-type" content="text/html; charset=UTF-8"/>
39
    <title>Liste des panoramas</title>
40
    <link rel="stylesheet" media="screen" href="css/base.css"/>
41
  </head>
42
  <body>
43
    <header>
44
      <h1><img src="images/tetaneutral.svg" alt="tetaneutral.net"/></h1>
45
    </header>
46
    <section id="main">
47
<?php if ($is_valid) { ?>
48
      <h2><?php echo $title ?></h2>
49
      <ul id="pano-list">
50
        <li>
51
          <?php if ($has_tiles) { ?>
52
          <a href="<?php echo $pano->get_url();?>">Visualiser</a>
53
          (généré)
54
          <?php } else { ?>
55
          Tuiles non générées 
56
            <?php if ($src_path) {?>
57
              <a href="<?php echo $pano->get_generate_url(basename($src_path))?>">Générer</a>
58
            <?php } else  {?>
59
              (la source n'est plus disponible)
60
            <?php } ?>
61
          <?php } ?>
62
        </li>
63
        <li>
64
          <?php if ($has_params) { ?>
65
          <a href="<?php echo $pano->get_map_url();?>">Voir sur la carte</a>
66
          (<?php printf('%.5f,%.5f', $lat, $lon) ?>)
67
          <?php } else { ?>
68
          Non paramétré
69
            <?php if ($has_tiles) {?>
70
              <a href="<?php echo $pano->get_url();?>">Paramétrer</a>
71
            <?php } ?>
72
          <?php } ?>
73
        </li>
74
      </ul>
75
<?php } else { 
76
  $validator->print_errors(); 
77
}?>
78
    </section>
79
    <footer class="validators"><samp>
80
      page validée par
81
      <a href="http://validator.w3.org/check?uri=referer"><img src="images/valid_xhtml.svg"
82
                                                               alt="Valid XHTML" title="xHTML validé !"/></a>
83
      <a href="http://jigsaw.w3.org/css-validator/check/referer"><img src="images/valid_css.svg"
84
                                                                      alt="CSS validé !" title="CSS validé !"/></a>
85
    </samp></footer>
86
  </body>
87
</html>