Changeset 2559


Ignore:
Timestamp:
Jan 1, 2012, 11:45:41 PM (8 years ago)
Author:
roux
Message:

fix graphes pour NS aussi

File:
1 edited

Legend:

Unmodified
Added
Removed
  • cpc/branches/senat/project/apps/frontend/modules/plot/actions/components.class.php

    r2403 r2559  
    1616      } else $date = time();
    1717      $annee = date('Y', $date); $sem = date('W', $date);
    18       $annee0 = $annee - 1;
    19       $sem0 = $sem;
    20       if ($sem == 53 && date('n', $date) == 1) {
    21         $annee0--;
    22         $sem = 0;
    23       }
    2418      $last_year = $date - 32054400;
    2519      $date_debut = date('Y-m-d', $last_year);
    2620      $date_fin = date('Y-m-d', $date);
     21      $annee0 = date('Y', $last_year); $sem0 = date('W', $last_year);
     22      if ($sem >= 52 && date('n', $date) == 1) $sem = 0;
    2723      $n_weeks = ($annee - $annee0)*53 + $sem - $sem0 + 1;
     24//print "$date ; $annee ; $sem ; $last_year ; $annee0 ; $sem0 ; $date_debut ; $n_weeks";
    2825    } else {
    2926      $query4 = Doctrine_Query::create()
     
    4542      $n_weeks = ($annee - $annee0)*53 + $sem - $sem0 + 1;
    4643    }
    47     $this->data['labels'] = $this->getLabelsSemaines($n_weeks, $annee, $sem0);
     44    $this->data['labels'] = $this->getLabelsSemaines($n_weeks, $annee0, $sem0);
    4845    $debutmandat = $this->parlementaire->debut_mandat;
    4946    foreach (unserialize($this->parlementaire->anciens_mandats) as $ancien)
     
    164161
    165162 public static function getLabelsSemaines($n_weeks, $annee, $sem) {
    166     if ($sem <= 1) $an = $annee - 1;
     163    if ($sem <= 51) $an = $annee + 1;
    167164    else $an = $annee;
    168165    $hashmap = array( '3'  => "Jan ".sprintf('%02d', $an-2000), '6'  => " Fév", '10' => " Mar", '15' => "Avr",
Note: See TracChangeset for help on using the changeset viewer.