- Timestamp:
- Sep 28, 2010, 8:05:13 AM (10 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
cpc/trunk/project/apps/frontend/modules/plot/actions/components.class.php
r1439 r1463 151 151 } 152 152 153 public function executeNewGroupes() { 154 } 155 156 public function executeGetGroupesData() { 157 $this->data = array(); 158 $this->data['groupes'] = array('UMP' => array(),'NC' => array(),'SRC' => array(),'GDR' => array(), 'NI' => array()); 159 $this->data['titres'] = array("Députés", "Interventions", "Amendements", "Propositions", "Quest. Orales", "Quest. Écrites"); 160 $n = count($this->data['titres']); 161 $stats = unserialize(Doctrine::getTable('VariableGlobale')->findOneByChamp('stats_groupes')->value); 162 $amdmts = Doctrine_Query::create() 163 ->select('p.groupe_acronyme, count(DISTINCT(a.id)) as ct') 164 ->from('Parlementaire p, p.ParlementaireAmendements pa, pa.Amendement a') 165 ->where('a.date > ?', date('Y-m-d', time()-60*60*24*365)) 166 ->groupBy('p.groupe_acronyme') 167 ->fetchArray(); 168 $props = Doctrine_Query::create() 169 ->select('p.groupe_acronyme, count(DISTINCT(t.id)) as ct') 170 ->from('Parlementaire p, p.ParlementaireTextelois pt, pt.Texteloi t') 171 ->where('t.date > ?', date('Y-m-d', time()-60*60*24*365)) 172 ->andWhere('pt.importance = 1') 173 ->andWhere('t.type LIKE ?', "proposition%") 174 ->groupBy('p.groupe_acronyme') 175 ->fetchArray(); 176 foreach ($this->data['groupes'] as $groupe => $arr) if ($stats[$groupe]) { 177 $this->data['groupes'][$groupe][] = $stats[$groupe]['groupe']['nb']; 178 $this->data['groupes'][$groupe][] = $stats[$groupe]['hemicycle_interventions']['somme']+$stats[$groupe]['commission_interventions']['somme']; 179 } 180 foreach ($amdmts as $amdt) 181 $this->data['groupes'][$amdt['groupe_acronyme']][] = $amdt['ct']; 182 foreach ($props as $pro) 183 $this->data['groupes'][$pro['groupe_acronyme']][] = $pro['ct']; 184 foreach ($this->data['groupes'] as $groupe => $arr) if ($stats[$groupe]) { 185 $this->data['groupes'][$groupe][] = $stats[$groupe]['questions_ecrites']['somme']; 186 $this->data['groupes'][$groupe][] = $stats[$groupe]['questions_orales']['somme']; 187 } 188 $this->data['totaux'] = array(); 189 for ($i=0;$i<$n;$i++) 190 $this->data['totaux'][] = 0; 191 foreach ($this->data['groupes'] as $groupe => $arr) 192 for ($i=0;$i<$n;$i++) 193 $this->data['totaux'][$i] += $this->data['groupes'][$groupe][$i]; 194 foreach ($this->data['groupes'] as $groupe => $arr) 195 for ($i=0;$i<$n;$i++) 196 $this->data['groupes'][$groupe][$i] = $this->data['groupes'][$groupe][$i] / $this->data['totaux'][$i] * 100; 197 } 198 153 199 public function executeGroupes() { 154 200 $this->empty = 0; … … 163 209 $this->time = 'lastyear'; 164 210 foreach($this->labels as $groupe) if ($groupes[$groupe]) { 165 $this->presences[] = $groupes[$groupe]['semaine ']['somme'];166 $this->presences_moy[] = $groupes[$groupe]['semaine ']['somme']/$groupes[$groupe]['groupe']['nb'];211 $this->presences[] = $groupes[$groupe]['semaines_presence']['somme']; 212 $this->presences_moy[] = $groupes[$groupe]['semaines_presence']['somme']/$groupes[$groupe]['groupe']['nb']; 167 213 $this->interventions[] = $groupes[$groupe]['hemicycle_interventions']['somme']; 168 214 $this->interventions_moy[] = $groupes[$groupe]['hemicycle_interventions']['somme']/$groupes[$groupe]['groupe']['nb'];
Note: See TracChangeset
for help on using the changeset viewer.