Changeset 1333
- Timestamp:
- Sep 8, 2010, 10:15:27 AM (11 years ago)
- Location:
- cpc/trunk/project
- Files:
-
- 16 added
- 23 edited
Legend:
- Unmodified
- Added
- Removed
-
cpc/trunk/project/apps/frontend/modules/circonscription/templates/listSuccess.php
r937 r1333 1 <h1 >Toutes les circonscriptions électorales</h1><?php1 <h1 class="list_inter">Toutes les circonscriptions électorales</h1><?php 2 2 $sf_response->setTitle('Toutes les circonscriptions électorales'); ?> 3 3 <h2>Carte des circonscriptions</h2> -
cpc/trunk/project/apps/frontend/modules/circonscription/templates/showSuccess.php
r1275 r1333 1 <h1 >Les députés par circonscriptions</h1>1 <h1 class="list_inter">Les députés par circonscriptions</h1> 2 2 <h2><?php echo $circo.' ('.$departement_num.')'; ?></h2> 3 3 <?php $sf_response->setTitle($circo.' ('.$departement_num.') : Les députés par circonscriptions'); ?> -
cpc/trunk/project/apps/frontend/modules/citoyen/templates/indexSuccess.php
r1275 r1333 1 1 <?php use_helper('Text') ?> 2 <h1 ><?php echo $title; ?></h1>2 <h1 class="list_com"><?php echo $title; ?></h1> 3 3 <?php $total = $pager->getNbResults(); 4 4 $ct = 0; -
cpc/trunk/project/apps/frontend/modules/parlementaire/templates/_list.php
r253 r1333 5 5 ?> 6 6 <ul><?php foreach($parlementaires as $inter) : ?> 7 <li><?php echo link_to($inter['Parlementaire']['nom'], $route.$inter['Parlementaire']['slug']). " (".$inter['nb']." intervention"; if ($inter['nb'] > 1) echo "s"; ?>)7 <li><?php echo link_to($inter['Parlementaire']['nom'], $route.$inter['Parlementaire']['slug']).' (<span class="list_inter">'.$inter['nb']." intervention"; if ($inter['nb'] > 1) echo "s"; ?></span>) 8 8 <?php endforeach; ?> 9 9 </ul> -
cpc/trunk/project/apps/frontend/modules/parlementaire/templates/listSuccess.php
r1275 r1333 1 1 <?php if (!preg_match('/^([A-ZÉ]|all)$/', $search)) { ?> 2 <h1 >Recherche de députés</h1>2 <h1 class="list_inter">Recherche de députés</h1> 3 3 <?php $sf_response->setTitle('Recherche de députés "'.$search.'"'); ?> 4 4 <p><?php $nResults = count($parlementaires); echo $nResults; ?> parlementaire<?php if ($nResults > 1) echo 's'; ?> trouvé<?php if ($nResults > 1) echo 's'; ?> pour <em>"<?php echo $search; ?>"</em></p> 5 5 <?php } else { ?> 6 <h1 >La liste de tous les députés par ordre alphabétique</h1>6 <h1 class="list_inter">La liste de tous les députés par ordre alphabétique</h1> 7 7 <?php $sf_response->setTitle('La liste de tous les députés'); ?> 8 8 <p>Les <?php echo $total; ?> députés de la législature (<?php echo $actifs; ?> en cours de mandat) :</p> -
cpc/trunk/project/apps/frontend/modules/parlementaire/templates/showSuccess.php
r1255 r1333 102 102 <?php echo include_component('section', 'parlementaire', array('parlementaire' => $parlementaire, 'limit' => 5, 'order' => 'date')); ?> 103 103 <p class="suivant"><?php echo link_to('Tous ses dossiers', '@parlementaire_textes?slug='.$parlementaire->slug); ?></p> 104 <h3 ><?php echo link_to('Travaux en commissions','@parlementaire_interventions?slug='.$parlementaire->getSlug().'&type=commission'); ?></h3>105 <h3 ><?php echo link_to('Travaux en hémicycle','@parlementaire_interventions?slug='.$parlementaire->getSlug().'&type=loi'); ?></h3>106 <h3 ><?php echo link_to('Toutes ses interventions','@parlementaire_interventions?slug='.$parlementaire->getSlug().'&type=all'); ?></h3>104 <h3 class="list_inter"><?php echo link_to('Travaux en commissions','@parlementaire_interventions?slug='.$parlementaire->getSlug().'&type=commission'); ?></h3> 105 <h3 class="list_inter"><?php echo link_to('Travaux en hémicycle','@parlementaire_interventions?slug='.$parlementaire->getSlug().'&type=loi'); ?></h3> 106 <h3 class="list_inter"><?php echo link_to('Toutes ses interventions','@parlementaire_interventions?slug='.$parlementaire->getSlug().'&type=all'); ?></h3> 107 107 <h3><?php echo link_to('Tous ses amendements','@parlementaire_amendements?slug='.$parlementaire->getSlug()); ?></h3> 108 108 </div> … … 115 115 116 116 <div class="bas_depute"> 117 <h2 >Derniers commentaires concernant <?php echo $parlementaire->nom; ?> <span class="rss"><a href="<?php echo url_for('@parlementaire_rss_commentaires?slug='.$parlementaire->slug); ?>"><?php echo image_tag('xneth/rss.png', 'alt="Flux rss"'); ?></a></span></h2>117 <h2 class="list_com">Derniers commentaires concernant <?php echo $parlementaire->nom; ?> <span class="rss"><a href="<?php echo url_for('@parlementaire_rss_commentaires?slug='.$parlementaire->slug); ?>"><?php echo image_tag('xneth/rss.png', 'alt="Flux rss"'); ?></a></span></h2> 118 118 <?php if ($parlementaire->nb_commentaires == 0) echo '<p>Le travail de ce député n\'a pas encore inspiré de commentaire aux utilisateurs.</p>'; 119 119 else { -
cpc/trunk/project/apps/frontend/modules/parlementaire/templates/tagSuccess.php
r728 r1333 12 12 <?php $sf_response->setTitle('Les députés spécialistes de "'.$tag.'"'); 13 13 foreach($parlementaires as $inter) { 14 echo '<li>'.link_to($inter['Parlementaire']['nom'], '@tag_parlementaire_interventions?parlementaire='.$inter['Parlementaire']['slug'].'&tags='.$tag).' ( '.$inter['nb'].' interventions)</li>';14 echo '<li>'.link_to($inter['Parlementaire']['nom'], '@tag_parlementaire_interventions?parlementaire='.$inter['Parlementaire']['slug'].'&tags='.$tag).' (<span class="list_inter">'.$inter['nb'].' interventions</span>)</li>'; 15 15 } 16 16 ?></ul> -
cpc/trunk/project/apps/frontend/modules/section/actions/actions.class.php
r1274 r1333 41 41 public function executeShow(sfWebRequest $request) 42 42 { 43 $this->section = Doctrine::getTable('Section')->find($request->getParameter('id')); 43 $secid = $request->getParameter('id'); 44 $this->forward404Unless($secid); 45 if ($option = Doctrine::getTable('VariableGlobale')->findOneByChamp('linkdossiers')) { 46 $links = unserialize($option->getValue()); 47 if (isset($links[$secid])) 48 $secid = $links[$secid]; 49 } 50 $this->section = Doctrine::getTable('Section')->find($secid); 44 51 $this->forward404Unless($this->section); 45 52 46 $this->lois = $this->section->getTags(array('is_triple' => true, 47 'namespace' => 'loi', 48 'key' => 'numero', 49 'return' => 'value')); 50 $amdmts_lois = Doctrine_Query::create()->select('distinct(a.texteloi_id)')->from('Amendement a')->whereIn('a.texteloi_id', $this->lois)->fetchArray(); 53 $lois = $this->section->getTags(array('is_triple' => true, 54 'namespace' => 'loi', 55 'key' => 'numero', 56 'return' => 'value')); 57 $qtextes = Doctrine_Query::create() 58 ->select('t.id, t.type, t.type_details, t.titre') 59 ->from('Texteloi t') 60 ->whereIn('t.numero', $lois); 61 if ($this->section->url_an) 62 $qtextes->orWhere('t.url_an = ?', $this->section->url_an); 63 $qtextes->orderBy('t.numero, t.annexe'); 64 $textes = $qtextes->fetchArray(); 65 66 $textes_loi = Doctrine_Query::create() 67 ->select('t.texteloi_id, t.titre') 68 ->from('TitreLoi t') 69 ->whereIn('t.texteloi_id', $lois) 70 ->andWhere('t.chapitre IS NULL') 71 ->andWhere('t.section is NULL') 72 ->orderBy('t.texteloi_id') 73 ->fetchArray(); 74 75 $this->docs = array(); 76 foreach ($textes_loi as $doc) 77 $this->docs[$doc['texteloi_id']] = $doc; 78 foreach ($textes as $texte) 79 $this->docs[$texte['id']] = $texte; 80 foreach ($lois as $loi) { 81 $loi = sprintf("%04d", $loi); 82 if (!isset($this->docs["$loi"])) 83 $this->docs["$loi"] = null; 84 } 85 86 $amdmts_lois = Doctrine_Query::create()->select('distinct(a.texteloi_id)')->from('Amendement a')->whereIn('a.texteloi_id', $lois)->fetchArray(); 51 87 $this->lois_amendees = array(); 52 88 foreach($amdmts_lois as $loi) 53 89 array_push($this->lois_amendees, $loi['distinct']); 54 90 sort($this->lois_amendees); 55 56 $this->textes_loi = Doctrine_Query::create()->select('t.texteloi_id, t.titre')->from('TitreLoi t')->whereIn('t.texteloi_id', $this->lois)->andWhere('t.chapitre IS NULL')->andWhere('t.section is NULL')->orderBy('t.texteloi_id')->fetchArray();57 sort($this->lois);58 sort($this->textes_loi);59 91 60 92 $inters = Doctrine_Query::create() … … 86 118 ->andWhere('((i.fonction != ? AND i.fonction != ? ) OR i.fonction IS NULL)', array('président', 'présidente')) 87 119 ->groupBy('p.id') 88 ;120 ->limit(30); 89 121 if (count($interventions)) 90 122 $this->ptag->whereIn('i.id', $interventions); … … 103 135 ->andWhere('s.nb_interventions > 5'); 104 136 if ($this->order == 'date') { 105 $query->orderBy('s.m in_date DESC');137 $query->orderBy('s.max_date DESC'); 106 138 $this->titre = 'Les derniers dossiers à l\'Assemblée'; 107 139 } else if ($this->order == 'plus') { 108 140 $query->orderBy('s.nb_interventions DESC'); 109 141 $this->titre = 'Les dossiers les plus discutés à l\'Assemblée'; 110 } 111 else forward404(); 112 $this->getResponse()->setTitle($this->titre); 142 } else if ($this->order == 'coms') { 143 $query->orderBy('s.nb_commentaires DESC'); 144 $this->titre = 'Les dossiers de l\'Assemblée les plus commentés par les citoyens'; 145 } else $this->forward404(); 146 $this->getResponse()->setTitle(str_replace('Assemblée', 'Assemblée nationale', $this->titre)." - NosDéputés.fr"); 113 147 $this->sections = $query->execute(); 114 148 -
cpc/trunk/project/apps/frontend/modules/section/templates/_simplifions.php
r1295 r1333 3 3 <ul> 4 4 <?php foreach($lois as $l) : ?> 5 <li><?php echo link_to(strip_tags($l['titre']), "@loi?loi=".$l['texteloi_id']); if ($l['nb_commentaires'] > 0) { echo ' ( '.$l['nb_commentaires'].' commentaire'; if ($l['nb_commentaires'] > 1) echo 's'; echo ')'; } ?></li>5 <li><?php echo link_to(strip_tags($l['titre']), "@loi?loi=".$l['texteloi_id']); if ($l['nb_commentaires'] > 0) { echo ' (<span class="list_com">'.$l['nb_commentaires'].' commentaire'; if ($l['nb_commentaires'] > 1) echo 's'; echo '</span>)'; } ?></li> 6 6 <?php endforeach; ?> 7 7 </ul> 8 8 </div> 9 -
cpc/trunk/project/apps/frontend/modules/section/templates/listSuccess.php
r1275 r1333 1 1 <div class="travaux_parlementaires"> 2 <h1 >Les dossiers parlementaires</h1>2 <h1 class="orange">Les dossiers parlementaires</h1> 3 3 <?php include_component('section', 'simplifions', array()); ?> 4 4 <h2><?php echo $titre; ?></h2> … … 7 7 foreach($sections as $s) if ($s->titre) { 8 8 if (preg_match('/(questions?\s|ordre\sdu\sjour|nomination|suspension\sde\séance|rappels?\sau\srèglement)/i', $s->titre)) continue; 9 $moisactuel = myTools::displayDateMoisAnnee($s->m in_date);9 $moisactuel = myTools::displayDateMoisAnnee($s->max_date); 10 10 if ($order == 'date' && $mois != $moisactuel) { 11 11 if ($mois != "") echo '</ul></li><li>'; … … 14 14 } 15 15 echo '<li>'.link_to(ucfirst($s->titre), '@section?id='.$s->id); 16 echo ' ( '.$s->nb_interventions.'intervention';16 echo ' (<span class="list_inter">'.$s->nb_interventions.' intervention'; 17 17 if ($s->nb_interventions > 1) echo 's'; 18 if ($s->nb_commentaires > 0) echo ', <span class="list_com">'.$s->nb_commentaires.' commentaire'; 18 echo '</span>'; 19 if ($s->nb_commentaires > 0) echo ', <span class="list_com">'.$s->nb_commentaires.' commentaire'; 19 20 if ($s->nb_commentaires > 1) echo 's'; 20 21 if ($s->nb_commentaires > 0) echo '</span>'; 21 22 if ($order == 'plus') echo ', '.$moisactuel; 23 if ($s->url_an) echo myTools::getLinkDossier($s->url_an); 24 if (!$s->url_an && !preg_match('/dé(bat|claration) /i', $s->titre)) echo '<strong style="color: #FF0000;">! ! ! !</strong>'; 22 25 echo ')</li>'; 23 26 } -
cpc/trunk/project/apps/frontend/modules/section/templates/showSuccess.php
r1275 r1333 1 <h1><?php1 <h1 class="orange"><?php 2 2 $titre = ''; 3 3 if ($section->getSection()) { … … 11 11 else echo '</h1>'; 12 12 ?> 13 <?php if ($section->url_an) echo '<span class="source">'.myTools::getLinkDossier($section->url_an)."</span>"; ?> 13 14 <div class="numeros_textes"> 14 15 <?php if ($section->nb_commentaires) { ?> 15 16 <div class="source"><span class="list_com"><a href="#commentaires">Voir le<?php if ($section->nb_commentaires > 1) echo 's '.$section->nb_commentaires; ?> commentaire<?php if ($section->nb_commentaires > 1) echo 's'; ?></a></span></div> 16 <?php }17 if ($lois && ! preg_match('/(questions?\s|ordre\sdu\sjour|nomination|suspension\sde\séance|rappels?\sau\srèglement)/i', $section->titre)) { ?>18 <span><?php if (count($textes_loi)) foreach ($textes_loi as $texte) echo link_to(strip_tags($texte['titre']), '@loi?loi='.$texte['texteloi_id']); else { echo 'Texte'; if (count($lois) > 1) echo 's'; echo ' N°'; foreach ($lois as $loi) echo myTools::getLinkLoi($loi).' '; echo '('.link_to('tous les amendements à ce dossier', '@find_amendements_by_loi_and_numero?loi='.urlencode(implode(',',$lois_amendees)).'&numero=all').')'; } ?></span>19 17 <?php } ?> 18 <p> 19 <?php $curid = 0; 20 if ($docs) foreach ($docs as $id => $doc) { 21 $shortid = preg_replace('/^(\d{4}).*$/', '\\1', $id); 22 if ($curid != $shortid) { 23 $curid = $shortid; 24 if (isset($doc['texteloi_id'])) 25 echo link_to(strip_tags($doc['titre']), '@loi?loi='.$doc['id']); 26 else if (isset($doc['id'])) 27 echo $doc['type']." ".$doc['type_details']." ".$doc['titre']." (".$doc['id'].")"; 28 else 29 echo 'Texte N° '.myTools::getLinkLoi($doc); 30 echo "<br/>"; 31 } 32 } 33 echo link_to('Tous les amendements à ce dossier', '@find_amendements_by_loi_and_numero?loi='.urlencode(implode(',',$lois_amendees)).'&numero=all')."</p>"; 34 ?> 20 35 </div> 21 36 <div class="resume"> … … 32 47 </div> 33 48 </div> 34 49 <div class="clear"/> 35 50 <?php $sommaire = $section->getSubSections(); 36 51 if (count($sommaire)) { ?> … … 67 82 </div> 68 83 <div class="orateurs_dossier"> 69 <h2> Tous lesorateurs sur ce dossier :</h2>84 <h2>Les principaux orateurs sur ce dossier :</h2> 70 85 <?php echo include_component('parlementaire', 'list', array('parlementairequery' => $ptag, 'route'=>'@parlementaire_texte?id='.$section->id.'&slug=')); ?> 71 86 </div> … … 74 89 <div class="stopfloat"></div> 75 90 <div class="commentaires" id="commentaires"> 76 <h2 >Derniers commentaires sur <?php echo $section->titre; ?> <span class="rss"><a href="<?php echo url_for('@section_rss_commentaires?id='.$section->id); ?>"><?php echo image_tag('xneth/rss.png', 'alt="Flux rss"'); ?></a></span></h2>91 <h2 class="list_com">Derniers commentaires sur <?php echo $section->titre; ?> <span class="rss"><a href="<?php echo url_for('@section_rss_commentaires?id='.$section->id); ?>"><?php echo image_tag('xneth/rss.png', 'alt="Flux rss"'); ?></a></span></h2> 77 92 <?php echo include_component('commentaire', 'lastObject', array('object' => $section, 'presentation' => 'nodossier')); 78 93 if ($section->nb_commentaires > 4) -
cpc/trunk/project/apps/frontend/templates/layout.php
r1329 r1333 109 109 <ul> 110 110 <li><a href="<?php echo url_for('@sections?order=date'); ?>">Les derniers dossiers</a> <strong>|</strong></li> 111 <li><a href="<?php echo url_for('@sections?order=plus'); ?>">Les dossiers les plus discutés</a></li> 111 <li><a href="<?php echo url_for('@sections?order=plus'); ?>">Les dossiers les plus discutés</a> <strong>|</strong></li> 112 <li><a href="<?php echo url_for('@sections?order=coms'); ?>">Les dossiers les plus commentés</a></li> 112 113 </ul> 113 114 </div> -
cpc/trunk/project/bin/loadupdate
r1252 r1333 82 82 cd - 83 83 fi 84 echo Rapports et Textes de lois 85 echo ========================== 86 cd batch/documents ; bash compute_latest.sh ; cd - 84 87 85 88 … … 129 132 done; 130 133 fi 134 echo Load Documents 135 echo ======================= 136 while ls batch/documents/out | grep [a-z] > /dev/null ; do 137 php symfony cc --env=test --app=frontend > /dev/null 138 php symfony load:Documents 139 done; 140 131 141 132 142 -
cpc/trunk/project/config/doctrine/schema.yml
r1328 r1333 163 163 section_id: integer 164 164 min_date: string(15) 165 max_date: date 165 166 timestamp: integer 166 167 nb_interventions: integer 168 url_an: string(255) 167 169 inheritance: 168 170 extends: ObjectCommentable … … 235 237 type: string(255) 236 238 legislature: integer 237 texteloi_id: string( 8)239 texteloi_id: string(12) 238 240 numero: string(8) 239 241 rectif: integer … … 254 256 refClass: ParlementaireAmendement 255 257 foreignAlias: Amendements 258 Texteloi: 259 foreignAlias: Texteloi 256 260 inheritance: 257 261 extends: ObjectCommentable … … 484 488 unique: false 485 489 columns: 486 texteloi_id: string( 8)490 texteloi_id: string(12) 487 491 titre: string(16) 488 492 ordre: integer … … 496 500 class: TitreLoi 497 501 foreignAlias: Articles 502 Texteloi: 503 foreignAlias: Texteloi 498 504 inheritance: 499 505 extends: ObjectCommentable … … 510 516 Timestampable: 511 517 columns: 512 texteloi_id: string( 8)518 texteloi_id: string(12) 513 519 article_loi_id: integer 514 520 numero: integer … … 520 526 class: ArticleLoi 521 527 foreignAlias: Alineas 528 Texteloi: 529 foreignAlias: Texteloi 522 530 inheritance: 523 531 extends: ObjectCommentable … … 532 540 Timestampable: 533 541 columns: 534 texteloi_id: string( 8)542 texteloi_id: string(12) 535 543 chapitre: string(8) 536 544 section: string(8) … … 554 562 TitreLoi: 555 563 foreignAlias: SousSections 564 Texteloi: 565 foreignAlias: Texteloi 566 567 Texteloi: 568 actAs: 569 Timestampable: 570 columns: 571 id: 572 type: string(12) 573 unique: true 574 legislature: integer 575 numero: integer 576 annexe: string(12) 577 type: 578 type: enum 579 values: ['Proposition de loi', 'Proposition de résolution', 'Projet de loi', 'Texte de la commission', 'Lettre', 'Rapport', "Rapport d'information", 'Avis'] 580 type_details: string(512) 581 categorie: string(128) 582 url_an: string(255) 583 titre: string(512) 584 date: date 585 source: 586 type: string(128) 587 unique: true 588 organisme_id: integer 589 signataires: string 590 relations: 591 Parlementaires: 592 class: Parlementaire 593 refClass: ParlementaireTexteloi 594 foreignAlias: Textelois 595 Organisme: 596 foreignAlias: Textelois 597 inheritance: 598 extends: ObjectCommentable 599 type: concrete 600 601 ParlementaireTexteloi: 602 actAs: 603 Timestampable: 604 columns: 605 parlementaire_id: integer 606 texteloi_id: string(12) 607 importance: integer 608 fonction: string(255) 609 relations: 610 Parlementaire: 611 foreignAlias: ParlementaireTextelois 612 Texteloi: 613 foreignAlias: ParlementaireTextelois 556 614 557 615 Alerte: … … 575 633 foreignAlias: Alertes 576 634 577 -
cpc/trunk/project/lib/model/doctrine/Intervention.class.php
r1327 r1333 106 106 } 107 107 108 public function setContexte($context, $date = null, $timestamp = null) { 109 return $this->setSection(Doctrine::getTable('Section')->findOneByContexteOrCreateIt($context, $date, $timestamp)); 108 public function setContexte($contexte, $date = null, $timestamp = null, $tlois = null, $debug = 0) { 109 $tlois = preg_replace('/[^,\d]+/', '', $tlois); 110 $tlois = preg_replace('/\s+,/', ',', $tlois); 111 $tlois = preg_replace('/,\s+/', ',', $tlois); 112 $lois = explode(',', $tlois); 113 $loisstring = ""; 114 foreach($lois as $loi) if ($loi) { 115 $tag = 'loi:numero='.$loi; 116 $this->addTag($tag); 117 if ($loisstring == "") $loisstring = "t.numero = $loi"; 118 else $loisstring .= " OR t.numero = $loi"; 119 } 120 if ($lois[0]) { 121 $urls = Doctrine_Query::create() 122 ->select('distinct(t.url_an)') 123 ->from('Texteloi t') 124 ->where('t.type = ? OR t.type = ? OR t.type = ? OR t.type = ?', array("Proposition de loi", "Proposition de résolution", "Projet de loi", "Texte de la commission")) 125 ->andWhere($loisstring) 126 ->fetchArray(); 127 $ct = count($urls); 128 if ($ct == 0) $urls = Doctrine_Query::create() 129 ->select('distinct(t.url_an)') 130 ->from('Texteloi t') 131 ->where($loisstring) 132 ->fetchArray(); 133 $ct = count($urls); 134 if ($ct > 1) { 135 $this->setSection(Doctrine::getTable('Section')->findOneByContexteOrCreateIt($contexte, $date, $timestamp)); 136 if ($debug) { 137 print "WARNING : Intervention $this->id has tags lois corresponding to multiple url_ans : "; 138 foreach ($urls as $url) 139 print $url['distinct']." ; "; 140 print " => Saving to section $this->Section->id\n"; 141 $debug = 0; 142 } 143 return $debug; 144 } 145 if ($ct == 0) $this->setSection(Doctrine::getTable('Section')->findOneByContexteOrCreateIt($contexte, $date, $timestamp)); 146 else if ($ct == 1) { 147 $section1 = Doctrine::getTable('Section')->findOneByContexte($contexte); 148 $section2 = Doctrine::getTable('Section')->findOneByUrlAn($urls[0]['distinct']); 149 if ($section2) { 150 if (!$section1) 151 $this->setSection(Doctrine::getTable('Section')->findOneByContexteOrCreateIt(str_replace(trim(preg_replace('/^([^>])(>.*)?$/', '\\1', $contexte)), $section2->titre, $contexte), $date, $timestamp)); 152 else if ($section1->section_id == $section2->id) 153 $this->setSection(Doctrine::getTable('Section')->findOneByContexteOrCreateIt($section1->titre_complet, $date, $timestamp)); 154 else { 155 $this->setSection(Doctrine::getTable('Section')->findOneByContexteOrCreateIt($contexte, $date, $timestamp)); 156 if ($debug) { 157 print "WARNING : Intervention $this->id has tags lois corresponding to another section $section2->id"; 158 print " => Saving to section $this->Section->id\n"; 159 $debug = 0; 160 } 161 return $debug; 162 } 163 } 164 else { 165 $section1 = Doctrine::getTable('Section')->findOneByContexteOrCreateIt($contexte, $date, $timestamp); 166 $this->setSection($section1); 167 $section1->setUrlAn($urls[0]['distinct']); 168 $section1->save(); 169 } 170 } 171 if ($this->section_id != 1) { 172 $titre = $this->Section->Section->getTitre(); 173 if (!(preg_match('/(cloture|ouverture|question|ordre du jour|calendrier|élection.*nouveau|démission|cessation.*mandat|proclamation|souhaits)/i', $titre))) { 174 foreach($lois as $loi) { 175 $tag = 'loi:numero='.$loi; 176 $this->Section->addTag($tag); 177 if ($this->Section->section_id && $this->Section->Section->id && $this->Section->section_id != $this->section_id) 178 $this->Section->Section->addTag($tag); 179 } 180 } 181 } 182 return $debug; 183 } else { 184 $this->setSection(Doctrine::getTable('Section')->findOneByContexteOrCreateIt($contexte, $date, $timestamp)); 185 return $debug; 186 } 110 187 } 111 188 … … 116 193 $tag = 'loi:amendement='.$amend; 117 194 $this->addTag($tag); 118 if ($this->Section->section_id && $this->Section->Section->id) { 119 $this->Section->Section->addTag($tag); 120 } 121 } 122 } 123 public function setLois($tlois) { 124 $tlois = preg_replace('/[^,\d]+/', '', $tlois); 125 $lois = preg_split('/\s*,\s*/', $tlois); 126 foreach($lois as $loi) { 127 $tag = 'loi:numero='.$loi; 128 $this->addTag($tag); 129 $this->Section->addTag($tag); 130 if ($this->Section->section_id && $this->Section->Section->id) { 131 $this->Section->Section->addTag($tag); 132 } 133 } 134 } 195 } 196 } 197 135 198 public function setIntervention($s) { 136 199 $this->_set('nb_mots', str_word_count($s)); -
cpc/trunk/project/lib/model/doctrine/OrganismeTable.class.php
r1274 r1333 5 5 class OrganismeTable extends Doctrine_Table 6 6 { 7 public function findOneByNom OrCreateIt($nom, $type) {7 public function findOneByNomType($nom, $type) { 8 8 $nom = strtolower($nom); 9 9 $nom = preg_replace('/(’|\')/', '’', $nom); … … 55 55 if ($org) 56 56 return $org; 57 57 return null; 58 } 59 60 public function findOneByNomOrCreateIt($nom, $type) { 61 $org = $this->findOneByNomType($nom, $type); 62 if ($org) 63 return $org; 58 64 $org = new Organisme(); 59 65 $org->type = $type; -
cpc/trunk/project/lib/model/doctrine/ParlementaireTable.class.php
r906 r1333 5 5 class ParlementaireTable extends PersonnaliteTable 6 6 { 7 public function findOneByNomSexeGroupeCirco($nom, $sexe = null, $groupe = null, $circo = null, $ amendement = null) {7 public function findOneByNomSexeGroupeCirco($nom, $sexe = null, $groupe = null, $circo = null, $document = null) { 8 8 $depute = null; 9 9 $memeNom = $this->findByNom($nom); … … 26 26 $query = $this->createQuery('p') 27 27 ->where('p.nom_de_famille = ?' , $nom); 28 if ($ amendement) $query->andWhere('p.fin_mandat is null or p.fin_mandat > ?', $amendement->getDate());28 if ($document) $query->andWhere('p.fin_mandat is null or p.fin_mandat > ?', $document->getDate()); 29 29 $memeNom = $query->execute(); 30 30 } -
cpc/trunk/project/lib/model/doctrine/Section.class.php
r1274 r1333 74 74 } 75 75 76 public function getOrigTitre() { 77 return $this->_get('titre'); 78 } 79 80 public function setMaxDate($date) { 81 if ($this->max_date && $date <= $this->max_date) 82 return; 83 $this->_set('max_date', $date); 84 $this->save(); 85 } 86 76 87 } 88 ?> -
cpc/trunk/project/lib/model/doctrine/SectionTable.class.php
r233 r1333 6 6 { 7 7 public function findOneByContexteOrCreateIt($contexte, $date = '', $timestamp = '') { 8 $contexte = preg_replace('/[\/\|\)\(«]/', '', strtolower($contexte)); 9 $contexte = preg_replace('/\&\#8217\;/', '\'', $contexte); 10 $contexte = preg_replace('/\&\#\d+\;/', '', $contexte); 11 $contexte = preg_replace('/\,/', ' ', $contexte); 12 $contexte = preg_replace('/\s+/', ' ', $contexte); 13 $contexte = preg_replace('/\s+$/', '', preg_replace('/^\s+/', '', $contexte)); 8 $contexte = self::cleanContexte($contexte); 14 9 $section = $this->findOneByMd5(md5($contexte)); 15 10 if (!$section) { … … 18 13 } 19 14 if ($date && (! $section->min_date || $section->min_date > $date)) 20 $section->min_date = $date; 15 $section->min_date = $date; 21 16 if ($timestamp && (! $section->timestamp || $section->timestamp > $timestamp)) 22 17 $section->timestamp = $timestamp; 18 if ($date && $shortdate = preg_replace('/\d{2}:\d{2}/', '', $date)) 19 $section->setMaxDate($shortdate); 23 20 $section->save(); 24 21 return $section; 25 22 } 23 24 public function findOneByContexte($contexte) { 25 $contexte = self::cleanContexte($contexte); 26 return $this->findOneByMd5(md5($contexte)); 27 } 28 29 private static function cleanContexte($contexte) { 30 $contexte = preg_replace('/[\/\|\)\(«]/', '', strtolower($contexte)); 31 $contexte = preg_replace('/\&\#8217\;/', '\'', $contexte); 32 $contexte = preg_replace('/\&\#\d+\;/', '', $contexte); 33 $contexte = preg_replace('/\,/', ' ', $contexte); 34 $contexte = preg_replace('/\s+/', ' ', $contexte); 35 $contexte = preg_replace('/\s+$/', '', preg_replace('/^\s+/', '', $contexte)); 36 return $contexte; 37 } 38 26 39 } -
cpc/trunk/project/lib/model/doctrine/myTools.class.php
r1265 r1333 74 74 } 75 75 76 public static function getLinkDossier($urlan) { 77 return link_to('Dossier sur le site de l\'Assemblée', "http://www.assemblee-nationale.fr/13/dossiers/".$urlan.".asp"); 78 } 79 76 80 public static function getLinkLoi($id) { 77 81 return link_to($id, "http://recherche2.assemblee-nationale.fr/resultats-avancee.jsp?11AUTPropositions=&11AUTRap-enq=&11AUTRap-info=&11AUTRapports=&12AUTPropositions=&12AUTRap-enq=&12AUTRap-info=&12AUTRap-infoLoi=&12AUTRapports=&13AUTComptesRendusReunions=&13AUTComptesRendusReunionsDeleg=&13AUTPropositions=&13AUTRap-info=&13AUTRap-infoLoi=&13AUTRapports=&legislature=13&legisnum=&num_init_11=&num_init_12=&num_init_13=".$id."&searchadvanced=Rechercher&searchtype=&texterecherche=&type=13ProjetsLoi"); -
cpc/trunk/project/lib/task/fuseDossiersTask.class.php
r1112 r1333 29 29 } 30 30 31 print " - Gère les sous-sections\n";31 #print " - Gère les sous-sections\n"; 32 32 $n_itv = 0; 33 33 foreach ($bad->SubSections as $sub) { 34 34 if ($sub->id == $bad->id) continue; 35 print " + ".$sub->titre_complet."\n";36 $exist = Doctrine::getTable('Section')->createQuery('s')->where('s.section_id = ?', $good->id)->andWhere('s.titre = ?', $sub-> titre)->fetchOne();35 print "\n + $sub->titre_complet"; 36 $exist = Doctrine::getTable('Section')->createQuery('s')->where('s.section_id = ?', $good->id)->andWhere('s.titre = ?', $sub->getOrigTitre())->fetchOne(); 37 37 if (isset($exist->section_id)) { 38 print "existe déjà pour la section d'accueil, met-à-jour\n";38 #print " existe déjà pour la section d'accueil, met-à-jour\n"; 39 39 40 40 $this->updateTags($sub, $exist); … … 47 47 ->where('s.id = ?', $sub->id); 48 48 if (! $query->execute()) { 49 print 'Suppression impossible de la sous-section '.$sub->id."\n";49 print "\n -> Suppression impossible de la sous-section $sub->id\n"; 50 50 return; 51 } else print " Ancienne sous-sectionfusionnée et supprimée\n";51 } #else print " fusionnée et supprimée\n"; 52 52 53 53 } else { 54 print " change le titre et le numéro de section mère\n"; 55 $sub->setTitreComplet(str_replace($sub->titre, $good->titre, $sub->titre_complet)); 54 $sub->setTitreComplet(str_replace($bad->getOrigTitre(), $good->getOrigTitre(), $sub->titre_complet)); 56 55 $sub->section_id = $good->id; 56 print " -> $sub->titre_complet"; 57 57 $sub->save(); 58 58 $n_itv += $sub->nb_interventions; … … 66 66 $this->updateMinDate($bad, $good); 67 67 68 $corresp = array(strtolower($bad-> titre) => strtolower($good->titre));69 print " Enregistre la correspondance en base :\n";68 $corresp = array(strtolower($bad->getOrigTitre()) => strtolower($good->getOrigTitre())); 69 print "\nEnregistre la correspondance en base :\n"; 70 70 $option = Doctrine::getTable('VariableGlobale')->findOneByChamp('dossiers'); 71 71 if (!$option) { … … 75 75 } else $option->setValue(serialize(array_merge(unserialize($option->getValue()), $corresp))); 76 76 $option->save(); 77 print_r(unserialize($option->getValue())); 78 print "\n"; 77 print_r($corresp); 78 print " "; 79 $option = Doctrine::getTable('VariableGlobale')->findOneByChamp('linkdossiers'); 80 if (!$option) { 81 $option = new VariableGlobale(); 82 $option->setChamp('linkdossiers'); 83 $option->setValue(serialize(array("$bad->id" => "$good->id"))); 84 } else { 85 $value = unserialize($option->getValue()); 86 $value["$bad->id"] = "$good->id"; 87 $option->setValue(serialize($value)); 88 } 89 $option->save(); 90 print "$bad->id => $good->id\n"; 79 91 80 92 $query = Doctrine_Query::create() … … 83 95 if (! $query->execute()) { 84 96 print 'Suppression impossible de la section '.$bad->id."\n"; 85 } else print "Done\n";97 } 86 98 } 87 99 88 100 private static function updateTags($b, $g) { 89 print " Gère les tags\n";101 #print " Gère les tags\n"; 90 102 foreach(Doctrine::getTable('Tagging')->createQuery('t')->where('t.taggable_model = ?', 'Section')->andWhere('t.taggable_id = ?', $b->id)->execute() as $tag) { 91 print $tag->tag_id." ";92 if ( Doctrine::getTable('Tagging')->createQuery('t')->where('t.taggable_model = ?', 'Section')->andWhere('t.taggable_id = ?', $g->id)->andWhere('t.tag_id = ?', $tag->tag_id)) {103 #print $tag->tag_id." "; 104 if (count(Doctrine::getTable('Tagging')->createQuery('t')->where('t.taggable_model = ?', 'Section')->andWhere('t.taggable_id = ?', $g->id)->andWhere('t.tag_id = ?', $tag->tag_id)->execute()) > 0) { 93 105 $query = Doctrine_Query::create() 94 106 ->delete('Tagging t') … … 102 114 } 103 115 } 104 print "\n";105 116 } 106 117 107 118 private static function updateInterv($b, $g, $base = 0) { 108 print " Gère les interventions\n";119 #print " Gère les interventions\n"; 109 120 $ct = 0; 110 121 foreach(Doctrine::getTable('Intervention')->createQuery('i')->where('i.section_id = ?', $b->id)->execute() as $itv) { 111 print $itv->id." ";122 #print $itv->id." "; 112 123 $itv->section_id = $g->id; 113 124 $itv->save(); … … 121 132 ->execute(); 122 133 } 123 print " / total : ".$ct."\n";134 #print " / total : ".$ct."\n"; 124 135 return $ct; 125 136 } 126 137 127 138 private static function updateComments($b, $g) { 128 print " Gère les commentaires\n";139 #print " Gère les commentaires\n"; 129 140 $ct = 0; 130 141 foreach(Doctrine::getTable('CommentaireObject')->createQuery('c')->where('c.object_type = ?', 'Section')->andWhere('c.object_id = ?', $b->id)->execute() as $com) { 131 print $com->id." ";142 #print $com->id." "; 132 143 $com->object_id = $g->id; 133 144 $com->save(); … … 142 153 ->execute(); 143 154 } 144 print "\n";155 #print "\n"; 145 156 } 146 157 -
cpc/trunk/project/lib/task/loadHemicycleTask.class.php
r1274 r1333 25 25 continue; 26 26 echo "$dir$file\n"; 27 $debug = 1; 27 28 foreach(file($dir.$file) as $line) { 28 29 $json = json_decode($line); … … 33 34 continue; 34 35 } 35 $id = md5($json->intervention.$json->date.$json->heure.'hemicyle'.$json->context.$json->timestamp); 36 $date = $json->date; 37 $id = md5($json->intervention.$json->date.$json->heure.'hemicyle'.$json->timestamp); 36 38 $intervention = Doctrine::getTable('Intervention')->findOneByMd5($id); 37 39 if(!$intervention) { … … 47 49 $intervention->setSource($json->source); 48 50 $intervention->setTimestamp($json->timestamp); 49 if ($json->timestamp)50 $intervention->setContexte($json->contexte, $json->date.$json->heure, $json->timestamp);51 51 } 52 if ($json->numeros_loi)53 $intervention->setLois($json->numeros_loi);52 if ($json->timestamp) 53 $debug = $intervention->setContexte($json->contexte, $json->date.$json->heure, $json->timestamp, $json->numeros_loi, $debug); 54 54 if ($json->amendements) 55 55 $intervention->setAmendements($json->amendements); … … 57 57 $p = null; 58 58 if ($json->intervenant_url) { 59 $p = Doctrine::getTable('Parlementaire')59 $p = Doctrine::getTable('Parlementaire') 60 60 ->findOneByUrlAn($json->intervenant_url); 61 if ($p) {62 $intervention->setParlementaire($p);63 $intervention->setFonction($json->fonction);64 }61 if ($p) { 62 $intervention->setParlementaire($p); 63 $intervention->setFonction($json->fonction); 64 } 65 65 } 66 66 if (!$p) { 67 $intervention->setPersonnaliteByNom($json->intervenant, $json->fonction);67 $intervention->setPersonnaliteByNom($json->intervenant, $json->fonction); 68 68 } else $p->free(); 69 69 } … … 73 73 $intervention->free(); 74 74 } 75 foreach(array_values($sections) as $section) 75 foreach(array_values($sections) as $section) { 76 76 $section->updateNbInterventions(); 77 if ($section) { 77 $section->setMaxDate($date); 78 } 79 if ($section) { 78 80 $section->free(); 79 81 } -
cpc/trunk/project/web/css/xneth/style.css
r1317 r1333 271 271 272 272 /* Tags */ 273 .internal_tag_cloud a:link {color:# 6F6F6F;}273 .internal_tag_cloud a:link {color:#D4963E;} 274 274 .tag_level_0 {font-size: 0.8em;} 275 275 .tag_level_1 {font-size: 0.9em;} … … 277 277 .tag_level_3 {font-size: 1.5em;} 278 278 .tag_level_4 {font-size: 1.7em;} 279 .tag_level_4 a {color: #FFF;}280 279 /**/ 281 280 … … 587 586 } 588 587 #sous_menu_2 .elements_sous_menu { 589 padding-left: 260px;588 padding-left: 134px; 590 589 } 591 590 #sous_menu_3 .elements_sous_menu { … … 617 616 padding:0; 618 617 margin:0; 619 margin-left: 4px;618 margin-left:2px; 620 619 } 621 620 … … 1568 1567 color: #158EAF; 1569 1568 } 1569 .list_inter { 1570 color: #7AA925; 1571 } 1570 1572 1571 1573 .solr .facets
Note: See TracChangeset
for help on using the changeset viewer.