Révision 812f173f
Ajouté par Jocelyn Delande il y a environ 11 ans
class/site_point.class.php | ||
---|---|---|
25 | 25 |
} |
26 | 26 |
closedir($dir_fd); |
27 | 27 |
if ($this->prefix === false) return false; |
28 |
$this->parse_and_store_params();
|
|
28 |
$this->parse_and_cache_params();
|
|
29 | 29 |
} |
30 | 30 |
|
31 |
private function params_path() {
|
|
31 |
public function params_path() {
|
|
32 | 32 |
return $this->base_dir.'/'.$this->prefix.'.params'; |
33 | 33 |
} |
34 | 34 |
|
35 |
private function parse_and_store_params() {
|
|
35 |
private function parse_and_cache_params() {
|
|
36 | 36 |
if (is_file($this->params_path())) { |
37 | 37 |
$this->params = @parse_ini_file($this->params_path()); |
38 | 38 |
} |
... | ... | |
43 | 43 |
if (isset($this->params)) { |
44 | 44 |
return $this->params; |
45 | 45 |
} else { |
46 |
return parse_and_store_params();
|
|
46 |
return parse_and_cache_params();
|
|
47 | 47 |
} |
48 | 48 |
} |
49 | 49 |
|
50 |
public function has_params(){ |
|
50 |
public function save_params() { |
|
51 |
$o = ''; |
|
52 |
$p = $this->get_params(); |
|
53 |
foreach ($this->get_params() as $k => $v) { |
|
54 |
$o.= "$k = $v\n"; |
|
55 |
} |
|
56 |
file_put_contents($this->params_path(), $o); |
|
57 |
} |
|
58 |
|
|
59 |
public function set_param($key, $value) { |
|
51 | 60 |
$p = $this->get_params(); |
52 |
return (isset($prm['latitude'], $prm['longitude'], |
|
53 |
$prm['altitude'], $prm['titre'])) |
|
61 |
$this->params[$key] = $value; |
|
62 |
if ($key == 'titre') { |
|
63 |
$this->name = $value; |
|
64 |
} |
|
54 | 65 |
} |
55 |
if ($oname != $name && ) { |
|
56 | 66 |
|
67 |
public function has_params(){ |
|
68 |
$p = $this->get_params(); |
|
69 |
return (isset($p['latitude'], $p['longitude'], |
|
70 |
$p['altitude'], $p['titre'])); |
|
71 |
} |
|
57 | 72 |
|
58 | 73 |
public function get_name() { |
59 | 74 |
return basename($this->base_dir); |
... | ... | |
109 | 124 |
return array($d, $cap*180/M_PI, $e*180/M_PI); // les résultats sont en degrés |
110 | 125 |
} |
111 | 126 |
|
112 |
public function get_url() { |
|
113 |
return sprintf('panorama.php?dir=%s&panorama=%s', |
|
114 |
'tiles', $this->get_name()); |
|
127 |
public function get_url($cap=false, $ele=false) { |
|
128 |
$o = sprintf('panorama.php?dir=%s&panorama=%s', |
|
129 |
PANORAMA_FOLDER, $this->get_name()); |
|
130 |
if ($cap && $ele) { |
|
131 |
$o .= sprintf("&to_cap=%.3f&to_ele=%.3f", $cap, $ele); |
|
132 |
} |
|
133 |
return $o; |
|
115 | 134 |
} |
116 | 135 |
|
117 | 136 |
public static function get($name) { |
Formats disponibles : Unified diff
make use of constants