Révision 1aebc2ec
Ajouté par Jocelyn Delande il y a environ 11 ans
class/site_point.class.php | ||
---|---|---|
1 | 1 |
<?php |
2 |
require_once(dirname(__FILE__).'/../constants.inc.php'); |
|
2 | 3 |
class site_point { |
3 |
private $base_dir; |
|
4 |
/** Defines a point, with a panorama |
|
5 |
*/ |
|
6 |
private $base_dir; // dir of tiles for that panorama |
|
4 | 7 |
private $name = false; |
5 | 8 |
private $prefix = false; |
6 | 9 |
private $params = false; |
... | ... | |
15 | 18 |
while (false !== ($file = readdir($dir_fd))) { |
16 | 19 |
|
17 | 20 |
if (preg_match('/(.*)_[0-9]+_[0-9]+_[0-9]+\.jpg$/', $file, $reg)) { |
18 |
$this->prefix = $reg[1]; |
|
21 |
$this->prefix = $reg[1];
|
|
19 | 22 |
|
20 |
break; |
|
23 |
break;
|
|
21 | 24 |
} |
22 | 25 |
} |
23 | 26 |
closedir($dir_fd); |
... | ... | |
44 | 47 |
} |
45 | 48 |
} |
46 | 49 |
|
50 |
public function has_params(){ |
|
51 |
$p = $this->get_params(); |
|
52 |
return (isset($prm['latitude'], $prm['longitude'], |
|
53 |
$prm['altitude'], $prm['titre'])) |
|
54 |
} |
|
55 |
if ($oname != $name && ) { |
|
56 |
|
|
57 |
|
|
47 | 58 |
public function get_name() { |
48 | 59 |
return basename($this->base_dir); |
49 | 60 |
} |
... | ... | |
102 | 113 |
return sprintf('panorama.php?dir=%s&panorama=%s', |
103 | 114 |
'tiles', $this->get_name()); |
104 | 115 |
} |
116 |
|
|
117 |
public static function get($name) { |
|
118 |
/** Instantiate a site_point, given its name |
|
119 |
*/ |
|
120 |
$pano_dir = PANORAMA_PATH.'/'.$name; |
|
121 |
return new site_point($pano_dir); |
|
122 |
} |
|
123 |
|
|
124 |
public static function get_all() { |
|
125 |
$panos = array_diff(scandir(PANORAMA_PATH), array('..', '.')); |
|
126 |
$pano_instances = array(); |
|
127 |
foreach ($panos as $pano_name) { |
|
128 |
$pano_instances[] = site_point::get($pano_name); |
|
129 |
} |
|
130 |
return $pano_instances; |
|
131 |
} |
|
105 | 132 |
} |
Formats disponibles : Unified diff
has_params and get_all for site_point