Changeset 2706


Ignore:
Timestamp:
May 14, 2012, 12:22:18 AM (8 years ago)
Author:
goya
Message:

gestion des plots sur toute la législature, reste à débugger les cas de mandats intermittents et les ministres qui parlent hors mandat

Location:
cpc/trunk/project
Files:
4 edited

Legend:

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

    r2700 r2706  
    99    static $seuil_invective = 20;
    1010    $this->data = array();
     11    $this->data['fin'] = myTools::isFinLegislature();
    1112    if (!isset($this->session)) $this->session = 'lastyear';
    1213    if ($this->session === 'lastyear') {
    13       if (isset($this->parlementaire->fin_mandat) && $this->parlementaire->fin_mandat > $this->parlementaire->debut_mandat) {
     14      if (!$this->data['fin'] && isset($this->parlementaire->fin_mandat) && $this->parlementaire->fin_mandat > $this->parlementaire->debut_mandat) {
    1415        $date = strtotime($this->parlementaire->fin_mandat);
    1516        $this->data['mandat_clos'] = true;
    1617      } else $date = time();
    1718      $annee = date('Y', $date); $sem = date('W', $date);
    18       $last_year = $date - 32054400;
     19      if ($this->data['fin'])
     20        $last_year = strtotime(myTools::getDebutLegislature());
     21      else $last_year = $date - 32054400;
    1922      $date_debut = date('Y-m-d', $last_year);
    2023      $annee0 = date('Y', $last_year); $sem0 = date('W', $last_year);
     
    4245      $n_weeks = ($annee - $annee0)*53 + $sem - $sem0 + 1;
    4346    }
    44     $this->data['labels'] = $this->getLabelsSemaines($n_weeks, $annee0, $sem0);
     47    if ($this->data['fin'])
     48      $this->data['labels'] = $this->getLabelsMois($n_weeks, $annee0, $sem0);
     49    else $this->data['labels'] = $this->getLabelsSemaines($n_weeks, $annee0, $sem0);
    4550    $this->data['vacances'] = $this->getVacances($n_weeks, $annee0, $sem0, strtotime($this->parlementaire->debut_mandat));
    4651
     
    8893    }
    8994    unset($participations);
    90 
     95   if (!$this->data['fin']) {
    9196    $query3 = Doctrine_Query::create()
    9297      ->select('count(distinct s.id) as nombre, i.id, s.annee, s.numero_semaine')
     
    113118    }
    114119    unset($questionsorales);
     120   }
     121   
    115122  }
    116123
     
    145152    }
    146153    if ($sem < 3 && $sem != 0) $labels[54] = "Jan";
     154    return $labels;
     155  }
     156
     157  public static function getLabelsMois($n_weeks, $annee, $sem) {
     158    $hashmap = array('4'  => "Jan #AN#", '22' => "Mai", '38' => "Sep");
     159    $labels = array_fill(1, $n_weeks, "");
     160    for ($i = 1; $i <= $n_weeks; $i++) {
     161      $index = $i + $sem;
     162      $an = sprintf('%02d', $annee + floor($index/53) - 2000);
     163      $index %= 53;
     164      if (isset($hashmap[$index]) && !(($index == 3) && ($sem < 3 && $sem > 1))) $labels[$i] = str_replace('#AN#', $an, $hashmap[$index]);
     165    }
    147166    return $labels;
    148167  }
  • cpc/trunk/project/apps/frontend/modules/plot/templates/_plotParlementaire.php

    r2695 r2706  
    3131echo "<span style='background-color: rgb(255,200,0);'>&nbsp;</span>&nbsp;Participations&nbsp;&nbsp;&nbsp;";
    3232echo "<span style='background-color: rgb(0,255,0);'>&nbsp;</span>&nbsp;Mots prononcés (x&nbsp;10&nbsp;000)&nbsp;&nbsp;&nbsp;";
    33 if ($questions === 'true' && $type != 'commission')
     33if (!myTools::isFinLegislature() && $questions === 'true' && $type != 'commission')
    3434    echo "<span style='background-color: rgb(0,0,255);'>&nbsp;</span>&nbsp;Questions orales&nbsp;&nbsp;&nbsp;";
    3535echo "<span style='background-color: rgb(150,150,150);'>&nbsp;</span>&nbsp;Vacances parlementaires";
  • cpc/trunk/project/apps/frontend/modules/plot/templates/generatePlotParlementaireSuccess.php

    r2107 r2706  
    7878$DataSet2->SetAbsciseLabelSerie("Serie1");
    7979
    80 if ($questions === 'true' && $type != 'commission') {
     80if (!$data['fin'] && $questions === 'true' && $type != 'commission') {
    8181  $DataSet3 = new xsPData();
    8282  $DataSet3->AddPoint($data['labels'], "Serie1");
     
    104104$Test->setFixedScale(0,$scale,$scale/$ticks);
    105105$Test->xsSetFontProperties("tahoma.ttf",$font);
    106 $Test->drawScale($Data,$DataDescr,SCALE_NORMAL,50,50,50,TRUE,0,0,FALSE,1,FALSE);
     106$ticks = TRUE;
     107if ($data['fin']) $ticks = FALSE;
     108$Test->drawScale($Data,$DataDescr,SCALE_NORMAL,50,50,50,$ticks,0,0,FALSE,1,FALSE);
    107109if ($link === 'true') {
    108110  $Test->setColorPalette(0,255,255,255);
     
    119121$Test->setColorPalette(2,0,255,0);
    120122$Test->drawFilledLineGraph($Data,$DataDescr,78);
    121 if ($questions === 'true' && $type != 'commission') {
     123if (!$data["fin"] && $questions === 'true' && $type != 'commission') {
    122124  $Test->setColorPalette(0,0,0,255);
    123125  $Test->drawOverlayBarGraph($Data3,$DataDescr3,85,25);
  • cpc/trunk/project/plugins/xsPChartPlugin/lib/pChart/pChart/pChart.class

    r1788 r2706  
    430430     $this->DataCount = count($Data);
    431431
    432      if ( $DrawTicks == FALSE )
    433       return(0);
     432#     if ( $DrawTicks == FALSE )
     433#      return(0);
    434434
    435435     $YPos = $this->GArea_Y2; $XMin = NULL;
     
    482482       if ( $ID % $SkipLabels == 0 )
    483483        {
    484          $this->drawLine(floor($XPos),$YAxisPos,floor($XPos),$YAxisPos+$YAxisOrt*5,$R,$G,$B);
     484         if ($DrawTicks == TRUE)
     485           $this->drawLine(floor($XPos),$YAxisPos,floor($XPos),$YAxisPos+$YAxisOrt*5,$R,$G,$B);
    485486         $Value      = $Data[$Key][$DataDescription["Position"]];
    486487         if ( $DataDescription["Format"]["X"] == "number" )
Note: See TracChangeset for help on using the changeset viewer.