Ignore:
Timestamp:
Sep 26, 2010, 9:40:24 PM (10 years ago)
Author:
roux
Message:

legende over sur graphes, laborieeux sur multigraphes donc retiré

File:
1 edited

Legend:

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

    r1002 r1439  
    44{
    55  public function executeParlementaire() {
     6  }
     7 
     8  public function executeGetParlData() {
    69    static $seuil_invective = 20;
     10    $this->data = array();
    711    if (!isset($this->options)) $this->options = array();
    812    if (!isset($this->options['session'])) $this->options['session'] = 'lastyear';
     
    1014      if (isset($this->parlementaire->fin_mandat) && $this->parlementaire->fin_mandat > $this->parlementaire->debut_mandat) {
    1115        $date = strtotime($this->parlementaire->fin_mandat);
    12         $this->mandat_clos = true;
     16        $this->data['mandat_clos'] = true;
    1317      } else $date = time();
    1418      $annee = date('Y', $date); $sem = date('W', $date);
     
    4145      $n_weeks = ($annee - $annee0)*53 + $sem - $sem0 + 1;
    4246    }
    43     $this->labels = $this->getLabelsSemaines($n_weeks, $annee, $sem);
    44     $this->vacances = $this->getVacances($n_weeks, $annee0, $sem0, strtotime($this->parlementaire->debut_mandat));
     47    $this->data['labels'] = $this->getLabelsSemaines($n_weeks, $annee, $sem);
     48    $this->data['vacances'] = $this->getVacances($n_weeks, $annee0, $sem0, strtotime($this->parlementaire->debut_mandat));
    4549
    4650    $query = Doctrine_Query::create()
     
    5559    $presences = $query->fetchArray();
    5660
    57     $this->n_presences = array('commission' => array_fill(1, $n_weeks, 0),
     61    $this->data['n_presences'] = array('commission' => array_fill(1, $n_weeks, 0),
    5862                               'hemicycle' => array_fill(1, $n_weeks, 0));
    5963    foreach ($presences as $presence) {
    6064      $n = ($presence['Seance']['annee'] - $annee0)*53 + $presence['Seance']['numero_semaine'] - $sem0 + 1;
    61       if ($n <= $n_weeks) $this->n_presences[$presence['Seance']['type']][$n] += $presence['nombre'];
     65      if ($n <= $n_weeks) $this->data['n_presences'][$presence['Seance']['type']][$n] += $presence['nombre'];
    6266    }
    6367    unset($presences);
     
    7579    $participations = $query2->fetchArray();
    7680
    77     $this->n_participations = array('commission' => array_fill(1, $n_weeks, 0),
     81    $this->data['n_participations'] = array('commission' => array_fill(1, $n_weeks, 0),
    7882                                    'hemicycle' => array_fill(1, $n_weeks, 0));
    79     $this->n_mots = array('commission' => array_fill(1, $n_weeks, 0),
     83    $this->data['n_mots'] = array('commission' => array_fill(1, $n_weeks, 0),
    8084                          'hemicycle' => array_fill(1, $n_weeks, 0));
    81     $this->fonctions = array('commission' => 0, 'hemicycle' => 0);
    8285    foreach ($participations as $participation) {
    8386      $n = ($participation['Seance']['annee'] - $annee0)*53 + $participation['Seance']['numero_semaine'] - $sem0 + 1;
    8487      if ($n <= $n_weeks) {
    85         $this->n_participations[$participation['Seance']['type']][$n] += $participation['nombre'];
    86         $this->n_mots[$participation['Seance']['type']][$n] += $participation['mots']/10000;
    87         if ($participation['fonction'] != "") $this->fonctions[$participation['Seance']['type']] += $participation['nombre'];
     88        $this->data['n_participations'][$participation['Seance']['type']][$n] += $participation['nombre'];
     89        $this->data['n_mots'][$participation['Seance']['type']][$n] += $participation['mots']/10000;
    8890      }
    8991    }
    9092    unset($participations);
    9193
    92     if (isset($this->options['questions'])) {
    93       $query3 = Doctrine_Query::create()
    94         ->select('count(distinct s.id) as nombre, i.id, s.annee, s.numero_semaine')
    95         ->from('Intervention i')
    96         ->where('i.parlementaire_id = ?', $this->parlementaire->id)
    97         ->andWhere('i.type = ?', 'question')
    98         ->andWhere('i.fonction NOT LIKE ?', 'président%')
    99         ->andWhere('i.nb_mots > ?', 2*$seuil_invective)
    100         ->leftJoin('i.Seance s');
    101       if ($this->options['session'] == 'lastyear')
    102         $query3->andWhere('s.date > ?', $date_debut);
    103       else $query3->andWhere('s.session = ?', $this->options['session']);
    104       $query3->groupBy('s.annee, s.numero_semaine');
    105       $questionsorales = $query3->fetchArray();
    106 
    107       $this->n_questions = array_fill(1, $n_weeks, 0);
    108       foreach ($questionsorales as $question) {
    109         $n = ($question['Seance']['annee'] - $annee0)*53 + $question['Seance']['numero_semaine'] - $sem0 + 1;
    110         if ($n <= $n_weeks) {
    111           if ($this->n_questions[$n] == 0)
    112             $this->n_questions[$n] -= 0.15;
    113           $this->n_questions[$n] += $question['nombre'];
    114         }
    115       }
    116       unset($questionsorales);
    117     }
     94    $query3 = Doctrine_Query::create()
     95      ->select('count(distinct s.id) as nombre, i.id, s.annee, s.numero_semaine')
     96      ->from('Intervention i')
     97      ->where('i.parlementaire_id = ?', $this->parlementaire->id)
     98      ->andWhere('i.type = ?', 'question')
     99      ->andWhere('i.fonction NOT LIKE ?', 'président%')
     100      ->andWhere('i.nb_mots > ?', 2*$seuil_invective)
     101      ->leftJoin('i.Seance s');
     102    if ($this->options['session'] == 'lastyear')
     103      $query3->andWhere('s.date > ?', $date_debut);
     104    else $query3->andWhere('s.session = ?', $this->options['session']);
     105    $query3->groupBy('s.annee, s.numero_semaine');
     106    $questionsorales = $query3->fetchArray();
     107
     108    $this->data['n_questions'] = array_fill(1, $n_weeks, 0);
     109    foreach ($questionsorales as $question) {
     110      $n = ($question['Seance']['annee'] - $annee0)*53 + $question['Seance']['numero_semaine'] - $sem0 + 1;
     111      if ($n <= $n_weeks) {
     112        if ($this->data['n_questions'][$n] == 0)
     113          $this->data['n_questions'][$n] -= 0.15;
     114        $this->data['n_questions'][$n] += $question['nombre'];
     115      }
     116    }
     117    unset($questionsorales);
    118118  }
    119119
Note: See TracChangeset for help on using the changeset viewer.