Projet

Général

Profil

Paste
Télécharger (1 ko) Statistiques
| Branche: | Révision:

root / ajax / add_reference.php @ e68abb6a

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

    
6
$fields_spec = array('x'         => array('required', 'numeric', 'positive'),
7
                     'y'         => array('required', 'numeric', 'positive'),
8
                     'panorama'  => array('required'),
9
                     'ref_point' => array('required'));
10

    
11

    
12
$validator = new FormValidator($fields_spec);
13
if ($validator->validate($_REQUEST)) {
14
  $vals = $validator->sane_values();
15

    
16
  // temp test code
17
  echo '<h1>pano !</h1>';
18
  $pano = site_point::get($vals['panorama']);
19
  var_dump($pano->get_params());
20

    
21
  echo '<h1>ref point !</h1>';
22
  $ref_point_name = urldecode($vals['ref_point']);
23
  var_dump(RefPoint::get($ref_point_name));
24

    
25
 } else {
26
   echo var_dump($validator->errors());
27
 }
28

    
29
// Test url : clear ;curl 'http://localhost/~jocelyn/panorama/ajax/add_reference.php?x=42&y=42&panorama=pano_couttolenc_bords_jointifs&ref_point=%C3%89glise%20saint-jacques'
30
?>