Changeset 1546
- Timestamp:
- Oct 3, 2010, 3:11:59 AM (10 years ago)
- Location:
- cpc/trunk/project/apps/frontend/modules
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
cpc/trunk/project/apps/frontend/modules/circonscription/actions/actions.class.php
r1544 r1546 172 172 173 173 $paths = $dom->getElementsByTagName('path'); 174 sfProjectConfiguration::getActive()->loadHelpers(array('Url')); 174 175 175 176 foreach ($paths as $path) … … 294 295 } 295 296 296 /* $circo is a three digits string, or "full" for the full map */ 297 public static function echoCircoMap($circo, $w, $h) 297 private static function prepareMap($circo, $w, $h) 298 298 { 299 299 $dom = self::generateSvgDom($circo, $w, $h); … … 304 304 $regexp = "/^$circo-(0[1-9]|[1-9]\d)$/"; 305 305 306 $r = self::compute_areas($dom, $w, $h, $regexp); 306 return array($dom, self::compute_areas($dom, $w, $h, $regexp)); 307 } 308 309 /* $circo is a three digits string, or "full" for the full map */ 310 public static function echoCircoMap($circo, $w, $h) 311 { 312 $arr = self::prepareMap($circo, $w, $h); 313 $r = $arr[1]; 307 314 $w = $r['w']; 308 315 $h = $r['h']; … … 326 333 * http://www.php.net/manual/en/function.imagick-setresolution.php 327 334 */ 328 329 $dom = self::generateSvgDom($circo, $w, $h); 335 $arr = self::prepareMap($circo, $w, $h); 336 $dom = $arr[0]; 337 $r = $arr[1]; 338 $w = $r['w']; 339 $h = $r['h']; 330 340 331 341 $im = new Imagick(); -
cpc/trunk/project/apps/frontend/modules/solr/actions/actions.class.php
r1545 r1546 30 30 return '<img width="53" src="'.url_for('@photo_citoyen?slug='.$obj->getSlug()).'"/>'; 31 31 case 'NonObjectPage': 32 return '<img width="53" src="'.url_for("@circo_image_png?circo=".strtolower(Parlementaire::getNumeroDepartement(str_replace(' ', '_', preg_replace('/^.*\/([^\/]+)$/', '\\1', $obj->getLink()))))."&w=53&h=0").'"/>'; 32 $num = strtolower(Parlementaire::getNumeroDepartement(str_replace(' ', '_', preg_replace('/^.*\/([^\/]+)$/', '\\1', $obj->getLink())))); 33 if (preg_match('/^\d$/', $num)) 34 $num = sprintf("%02d",$num); 35 if (preg_match('/\d[a-z]/i', $num)) 36 $fixednum = '0'.$num; 37 else $fixednum = sprintf('%03d',$num); 38 return '<img width="53" src="'.url_for("@circo_image_png?circo=".$fixednum."&w=53&h=0").'"/>'; 33 39 } 34 40 }
Note: See TracChangeset
for help on using the changeset viewer.