Changeset 2594 for cpc/trunk/project
- Timestamp:
- Jan 10, 2012, 6:55:16 AM (9 years ago)
- Location:
- cpc/trunk/project
- Files:
-
- 8 edited
Legend:
- Unmodified
- Added
- Removed
-
cpc/trunk/project/apps/frontend/modules/api/actions/actions.class.php
r2557 r2594 103 103 $this->multi['adresse'] = 1; 104 104 $this->multi['mandat'] = 1; 105 $this->multi['site'] = 1; 105 106 } 106 107 $deputes = $query->execute(); … … 152 153 $this->multi['adresse'] = 1; 153 154 $this->multi['mandat'] = 1; 155 $this->multi['site'] = 1; 154 156 $this->champ = 'depute'; 155 157 $this->breakline = ''; … … 167 169 $res['prenom'] = $parl->getPrenom(); 168 170 $res['sexe'] = $parl->sexe; 171 $res['date_naissance'] = $parl->date_naissance; 172 $res['lieu_naissance'] = $parl->lieu_naissance; 169 173 $res['num_deptmt'] = $parl->getNumDepartement(); 170 174 $res['nom_circo'] = $parl->nom_circo; … … 179 183 $res['responsabilites'] = self::array2hash($parl->getResponsabilites(), 'responsabilite'); 180 184 $res['responsabilites_extra_parlementaires'] = self::array2hash($parl->getExtras(), 'responsabilite'); 181 $res['site_web'] = $parl->site_web; 185 $res['groupes_parlementaires'] = self::array2hash($parl->getGroupes(), 'responsabilite'); 186 $res['sites_web'] = self::array2hash(unserialize($parl->sites_web), 'site'); 182 187 $res['url_an'] = $parl->url_an; 183 188 $res['emails'] = self::array2hash(unserialize($parl->mails), 'email'); 184 189 $res['adresses'] = self::array2hash(unserialize($parl->adresses), 'adresse'); 190 $res['anciens_mandats'] = self::array2hash(unserialize($parl->anciens_mandats), 'mandat'); 185 191 $res['autres_mandats'] = self::array2hash(unserialize($parl->autres_mandats), 'mandat'); 192 $res['anciens_autres_mandats'] = self::array2hash(unserialize($parl->anciens_autres_mandats), 'mandat'); 186 193 $res['profession'] = $parl->profession; 187 194 $res['place_en_hemicycle'] = $parl->place_hemicycle; -
cpc/trunk/project/apps/frontend/modules/parlementaire/templates/_fiche.php
r1783 r2594 8 8 <li>Mandat clos rempli du <?php echo myTools::displayDate($parlementaire->debut_mandat); ?> au <?php echo myTools::displayDate($parlementaire->fin_mandat); ?></li> 9 9 <?php else : ?> 10 <li>Mandat en cours depuis le <?php echo myTools::displayDate($parlementaire->debut_mandat); ?></li> 11 <?php endif; 10 <li>Mandat en cours depuis le <?php echo myTools::displayDate($parlementaire->debut_mandat); ?> 11 <?php foreach ($missions as $resp) 12 if (preg_match('/^Mission temporaire/', $resp->getNom())) { 13 echo '<br/> (en cours de mission pour le gouvernement)'; 14 break; 15 } ?> 16 </li> 17 <?php endif; 18 if ($parlementaire->suppleant_de_id && $supplee = $parlementaire->getSuppleantDe()) 19 echo '<li>Suppléant'.($parlementaire->sexe == "F" ? 'e' : '').' de : '.link_to($supplee->nom, "@parlementaire?slug=".$supplee->slug).'</li>'; 12 20 if ($parlementaire->groupe_acronyme != "") : ?> 13 21 <li>Groupe politique : <?php echo link_to(Organisme::getNomByAcro($parlementaire->groupe_acronyme), '@list_parlementaires_groupe?acro='.$parlementaire->groupe_acronyme); ?> (<?php echo $parlementaire->getgroupe()->getFonction(); ?>)</li> … … 16 24 <li><?php echo link_to('Fiche sur le site de l\'Assemblée nationale', $parlementaire->url_an, array('title' => 'Lien externe', 'rel'=>'nofollow')); ?></li> 17 25 <li><a href="http://fr.wikipedia.org/wiki/<?php echo rawurlencode($parlementaire->nom); ?>">Page sur Wikipédia</a></li> 18 <?php if ($parlementaire->site_web) : ?> 19 <li><?php echo link_to('Site web', $parlementaire->site_web, array('title' => 'Lien externe', 'rel'=>'nofollow')); ?></li> 20 <?php endif; ?> 26 <?php if ($parlementaire->sites_web) { 27 $moreweb = ""; 28 foreach (unserialize($parlementaire->sites_web) as $site) if ($site) { 29 $nomsite = "Site web"; 30 if (preg_match('/twitter/', $site)) $nomsite = "Sur Twitter"; 31 else if (preg_match('/facebook/', $site)) $nomsite = "Sur Facebook"; 32 $link = "<li>".link_to($nomsite, $site, array('title' => 'Lien externe', 'rel'=>'nofollow'))."</li>"; 33 if (preg_match('/twitter|facebook/', $site)) $moreweb .= $link; 34 else echo $link; 35 } 36 echo $moreweb; 37 } ?> 21 38 </ul> 22 39 <?php if ($parlementaire->fin_mandat == null || $parlementaire->fin_mandat < $parlementaire->debut_mandat) : ?> … … 43 60 </li> 44 61 <?php } ?> 62 <?php // if ($parlementaire->getGroupes()) { 63 // echo "<li>Groupes d'études et d'amitié interparlementaires :<ul>"; 64 // foreach ($parlementaire->getGroupes() as $groupe) 65 // echo "<li>".link_to($groupe->getNom(),'@list_parlementaires_organisme?slug='.$groupe->getSlug())." (".$groupe->getFonction().")</li>"; 66 // echo "</ul></li>"; 67 // } ?> 45 68 </ul> 46 69 <?php endif; ?> <!-- else : ajouter les infos venant de parsing ancien (anciennes responsabilités) et avant les respon actuelles de ministre machin via les personnalites get fonctions? --> -
cpc/trunk/project/batch/depute/parse_tous.sh
r1297 r2594 17 17 echo $ID; 18 18 fi 19 perl parse_depute.pl html/$ID.asp > out/$ID.xml 19 # perl parse_depute.pl html/$ID.asp > out/$ID.xml 20 perl parse_depute.new html/$ID.asp > out/$ID.xml 20 21 done -
cpc/trunk/project/config/doctrine/schema.yml
r1708 r2594 17 17 type: enum 18 18 values: ['H', 'F'] 19 date_naissance: date 20 lieu_naissance: string(255) 19 21 inheritance: 20 22 extends: ObjectCommentable … … 28 30 description: [villes] 29 31 moretags: [profession] 32 date: debut_mandat 30 33 columns: 31 34 nom_circo: string(255) 32 35 num_circo: integer 33 site _web: string(255)36 sites_web: string 34 37 debut_mandat: date 35 38 fin_mandat: date … … 46 49 groupe_acronyme: string(8) 47 50 adresses: string 51 suppleant_de_id: integer 52 anciens_mandats: string 48 53 autres_mandats: string 54 anciens_autres_mandats: string 49 55 mails: string 50 56 top: string … … 58 64 refClass: ParlementaireOrganisme 59 65 foreignAlias: Parlementaires 66 SuppleantDe: 67 class: Parlementaire 68 local: suppleant_de_id 69 foreignAlias: Suppleants 60 70 indexes: 61 71 uniq_url: … … 87 97 type: 88 98 type: enum 89 values: ['parlementaire', 'groupe', 'extra' ]99 values: ['parlementaire', 'groupe', 'extra', 'groupes'] 90 100 91 101 ParlementaireOrganisme: -
cpc/trunk/project/lib/model/doctrine/OrganismeTable.class.php
r1367 r2594 23 23 $org = $this->createQuery('o') 24 24 ->where('o.nom LIKE ?', $nom.'%') 25 ->andWhere('o.type = ?', $type) 25 26 ->orderBy('LENGTH(o.nom) DESC') 26 27 ->fetchOne(); 27 if ($type != 'parlementaire' || strlen($org->nom) < 50)28 if ($type != 'parlementaire' || !$org || strlen($org->nom) < 50) 28 29 $org = $this->findOneByNom($nom); 29 30 … … 37 38 } 38 39 // echo "- $nom (pas trouve)\n"; 39 40 40 41 41 $orgs = Doctrine::getTable('Organisme')->createQuery('o')->where('type = ?', $type)->execute(); … … 67 67 $nom = strtolower($nom); 68 68 $nom = preg_replace('/(’|\')/', '’', $nom); 69 $nom = preg_replace('/ \W+$/', '', $nom);69 $nom = preg_replace('/[^a-zàâéèêëîïôùûü]+$/', '', $nom); 70 70 $nom = preg_replace('/\([^\)]*\)/', '', $nom); 71 71 $nom = preg_replace('/\([^\)]*$/', '', $nom); -
cpc/trunk/project/lib/model/doctrine/Parlementaire.class.php
r2546 r2594 118 118 public function setGroupe($array) { 119 119 return $this->setPOrganisme('groupe', $array); 120 } 121 public function setGroupes($array) { 122 return $this->setPOrganisme('groupes', $array); 120 123 } 121 124 … … 183 186 $this->_set('autres_mandats', serialize($array)); 184 187 } 188 public function setAnciensMandats($array) { 189 $this->_set('anciens_mandats', serialize($array)); 190 } 191 public function setAnciensAutresMandats($array) { 192 $this->_set('anciens_autres_mandats', serialize($array)); 193 } 194 public function setSuppleantDe($nom) { 195 if ($p = doctrine::getTable('Parlementaire')->findOneByNomSexeGroupeCirco($nom)) 196 $this->_set('SuppleantDe', $p); 197 } 185 198 public function setMails($array) { 186 199 $this->_set('mails', serialize($array)); 200 } 201 public function setSitesWeb($array) { 202 $this->_set('sites_web', serialize($array)); 187 203 } 188 204 public function setAdresses($array) { … … 202 218 if ($po->type == 'extra') 203 219 array_push($res, $po); 220 } 221 return $res; 222 } 223 public function getGroupes() { 224 $res = array(); 225 foreach($this->getParlementaireOrganismes() as $po) { 226 if ($po->type == 'groupes') 227 array_push($res, $po); 204 228 } 205 229 return $res; -
cpc/trunk/project/lib/model/doctrine/Personnalite.class.php
r1157 r2594 20 20 return null; 21 21 } 22 23 public function setDateNaissance($str) { 24 if (preg_match('/(\d{2})\/(\d{2})\/(\d{4})/', $str, $m)) { 25 $this->_set('date_naissance', $m[3].'-'.$m[2].'-'.$m[1]); 26 } 27 } 28 22 29 } -
cpc/trunk/project/lib/task/updateDeputesTask.class.php
r2100 r2594 51 51 $parl->sexe = $json->sexe; 52 52 } 53 if ($json->date_naissance) 54 $parl->date_naissance = $json->date_naissance; 55 if ($json->lieu_naissance) 56 $parl->lieu_naissance = $json->lieu_naissance; 53 57 if ($json->circonscription) 54 58 $parl->circonscription = $json->circonscription; 55 59 if (count($json->adresses)) 56 60 $parl->adresses = $json->adresses; 61 if (count($json->premiers_mandats)) 62 $parl->anciens_mandats = $json->premiers_mandats; 57 63 if (count($json->autresmandats)) 58 64 $parl->autres_mandats = $json->autresmandats; 65 if (count($json->anciensmandats)) 66 $parl->anciens_autres_mandats = $json->anciensmandats; 59 67 if ($json->groupe) 60 68 $parl->groupe = $this->splitArrayJson($json->groupe); 69 if (count($json->fonctions)) 70 $parl->fonctions = $this->splitArrayJson($json->fonctions); 61 71 if (count($json->extras)) 62 72 $parl->extras = $this->splitArrayJson($json->extras); 63 if (count($json-> fonctions))64 $parl-> fonctions = $this->splitArrayJson($json->fonctions);73 if (count($json->groupes)) 74 $parl->groupes = $this->splitArrayJson($json->groupes); 65 75 $parl->debut_mandat = $json->debut_mandat; 66 76 $parl->fin_mandat = $json->fin_mandat; 67 77 if ($json->id_an) 68 $parl->id_an = $json->id_ an;78 $parl->id_an = $json->id_institution; 69 79 if (count($json->mails)) 70 80 $parl->mails = $json->mails; … … 75 85 if ($json->profession) 76 86 $parl->profession = $json->profession; 77 if ( $json->site_web)78 $parl->site _web = $json->site_web;87 if (count($json->sites_web)) 88 $parl->sites_web = $json->sites_web; 79 89 if ($json->url_an) 80 $parl->url_an = $json->url_an; 90 $parl->url_an = $json->url_institution; 91 if ($json->suppleant_de) 92 $parl->setSuppleantDe($json->suppleant_de); 81 93 $parl->villes = $villes->{$parl->getNumDepartement()}->{$parl->num_circo}; 82 94 $parl->save(); 95 if ($json->suppleant) { 96 $suppl = Doctrine::getTable('Parlementaire')->findOneByNom(preg_replace('/^\s*M[.mle]* /', '', $json->suppleant)); 97 if ($suppl) { 98 $suppl->setSuppleantDe($parl->nom); 99 $suppl->save(); 100 } 101 } 83 102 } 84 103 }
Note: See TracChangeset
for help on using the changeset viewer.