Changeset 1546


Ignore:
Timestamp:
Oct 3, 2010, 3:11:59 AM (10 years ago)
Author:
goya
Message:

correction cartes

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  
    172172
    173173    $paths = $dom->getElementsByTagName('path');
     174    sfProjectConfiguration::getActive()->loadHelpers(array('Url'));
    174175
    175176    foreach ($paths as $path)
     
    294295  }
    295296
    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)
    298298  {
    299299    $dom = self::generateSvgDom($circo, $w, $h);
     
    304304      $regexp = "/^$circo-(0[1-9]|[1-9]\d)$/";
    305305
    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];
    307314    $w = $r['w'];
    308315    $h = $r['h'];
     
    326333     * http://www.php.net/manual/en/function.imagick-setresolution.php
    327334     */
    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'];
    330340
    331341    $im = new Imagick();
  • cpc/trunk/project/apps/frontend/modules/solr/actions/actions.class.php

    r1545 r1546  
    3030      return '<img width="53" src="'.url_for('@photo_citoyen?slug='.$obj->getSlug()).'"/>';
    3131    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").'"/>';
    3339    }
    3440  }
Note: See TracChangeset for help on using the changeset viewer.