Projet

Général

Profil

Révision ea08a2a7

Ajouté par Jocelyn Delande il y a plus de 10 ans

adds a rm_reference.php webservice and fixed the typing from/to ini files

Voir les différences:

class/site_point.class.php
1 1
<?php
2 2
require_once(dirname(__FILE__).'/../constants.inc.php');
3
require_once(dirname(__FILE__).'/utils.class.php');
3 4

  
4 5
//
5 6
class PanoramaFormatException extends Exception {
......
40 41
	    $params = parse_ini_file($this->params_path());
41 42
	    if ($params) {
42 43
		    $this->params = $params;
44
		    foreach ($params[self::$REF_KEY] as $ref => $vals) {
45
			    $bits = explode(',',$vals);
46
			    $this->params[self::$REF_KEY][$ref] = array(floatval($bits[0]),
47
			                                          floatval($bits[1]));
48
		    }
49
		    if (isset($params['image_loop'])) {
50
			    $this->params['image_loop'] = (bool)($params['image_loop']);
51
		    }
43 52
		    return $params;
44 53
	    }
45 54
    }
......
66 75
				               $refv[0], $refv[1]);
67 76
			  }
68 77
		  } else {
69
			  $o.= "$k = $v\n";
78
			  $o.= "$k = ".utils::php2ini($v)."\n";
70 79
		  }
71 80
	  }
72 81
	  file_put_contents($this->params_path(), $o);
......
171 180
	  $this->params[self::$REF_KEY][$ref_name] = array($x, $y);
172 181
  }
173 182

  
183
  public function unset_reference($ref_point) {
184
	  /**
185
	   * Unregisters a reference, within a panorama.
186
	   * does nothing if the RefPoint is not registered.
187
	   *
188
	   * @param $ref_point a RefPoint instance
189
	   */
190
	  $p = $this->get_params();
191
	  $ref_name = $ref_point->name;
192
	  if (isset($p[self::$REF_KEY]) &&
193
	      isset($p[self::$REF_KEY][$ref_name])) {
194
		  unset($this->params[self::$REF_KEY][$ref_name]);
195
	  }
196
  }
197

  
198

  
199

  
174 200
  public static function get($name) {
175 201
	  /** Instantiate a site_point, given its name
176 202
	   */

Formats disponibles : Unified diff