Changeset 2751


Ignore:
Timestamp:
May 20, 2012, 2:14:42 AM (8 years ago)
Author:
teymour
Message:

Si l'utilisateur vient de windows et à cliqué sur le CSV depuis la synthèse alors on le redirige vers l'option withBOM

Location:
cpc/trunk/project/apps/frontend/modules/api
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • cpc/trunk/project/apps/frontend/modules/api/actions/actions.class.php

    r2732 r2751  
    7777
    7878  public function executeTopSynthese(sfWebRequest $request) {
     79    $format = $request->getParameter('format');
     80    $bom = $request->getParameter('withBOM');
     81    if ($format == 'csv' && !$bom && preg_match('/windows/i', $_SERVER['HTTP_USER_AGENT']) && $_SERVER['HTTP_REFERER']) {
     82      return $this->redirect('api/topSynthese?format=csv&withBOM=true');
     83    }
    7984    $qp = Doctrine::getTable('Parlementaire')->createQuery('p');
    8085    $fin = myTools::isFinLegislature();
     
    9297      if ($fin && $tops['nb_mois'] < 4)
    9398        continue;
    94       $depute = $this->getParlementaireArray($p, $request->getParameter('format'), 2);
     99      $depute = $this->getParlementaireArray($p, $format, 2);
    95100      if ($fin)
    96101        $depute["nb_mois"] = $tops['nb_mois'];
    97       if ($request->getParameter('format') == 'csv')
     102      if ($format == 'csv')
    98103       foreach(array_keys($depute) as $key)
    99104        if (!isset($this->champs[$key]))
  • cpc/trunk/project/apps/frontend/modules/api/templates/csvSuccess.php

    r2556 r2751  
    11<?php
     2if (isset($GET['withBOM']) && $GET['withBOM']) {
     3  printf("\xef\xbb\xbf");
     4}
    25if (!isset($multi)) {
    36  $multi = array();
Note: See TracChangeset for help on using the changeset viewer.