Mise à jour de la recherche historique

This commit is contained in:
Michael RICOIS 2009-10-09 08:13:41 +00:00
parent 096470a5f4
commit 1241dd46a0
2 changed files with 97 additions and 45 deletions

View File

@ -2,28 +2,33 @@
if(isset($_REQUEST['submit']))
{
unset($_SESSION['recherchehisto']);
$firephp->log($_REQUEST, 'REQUEST');
if( isset($_REQUEST['formA']['annee']) ) { $annee = $_REQUEST['formA']['annee']; }
if( !isset($annee) && isset($_REQUEST['formA']['dateparution']) )
{
$annee = str_replace('/', '', $_REQUEST['formA']['dateparution']);
$dateparution = str_replace('/', '', $_REQUEST['formA']['dateparution']);
$jj = substring($annee, 0, 2);
$mm = substring($annee, 2, 2);
$aa = substring($annee, 4, 4);
$annee = $aa.$mm.$jj;
$dateparution = $aa.$mm.$jj;
}
if( isset($_REQUEST['formA']['txt']) )
{
$txt = urlencode($_REQUEST['formA']['txt']);
$txt = $_REQUEST['formA']['txt'];
}
header("Location: ./index.php?page=recherche&vue=annoncelist&txt=$txt&annee=$annee");
$_SESSION['recherchehisto']['annee'] = $annee;
$_SESSION['recherchehisto']['txt'] = $txt;
$_SESSION['recherchehisto']['histo'] = $_REQUEST['formA']['histo'];
header("Location: ./index.php?page=recherche&vue=annoncelist");
exit;
}
$firephp->log($_SESSION, 'SESSION');
?>
<script type="text/javascript" src="./js/jquery-ui.js"></script>
<script type="text/javascript">
function formSource(source)
{
{
var fields = Array( 'bodacc', 'histo', 'date', 'nparution', 'page', 'nannonce', 'naffaire', 'txt' );
switch(source)
{
@ -43,19 +48,25 @@ function formSource(source)
$(document).ready(function()
{
formSource('bodacc');
//Init
formSource($('select[name=formA[source]]').val());
if($('input[type=checkbox][name=formA[histo]]').attr('checked')== true){ $('#txt').css('display','block');
}else{ $('#txt').css('display','none'); }
//Evenement
$("#datepicker").datepicker();
$('select[name=formA[source]]').change(function(){ formSource($(this).val()); });
$('input[type=checkbox][name=formA[histo]]').click(function(){
if($(this).attr('checked')== true){ $('#txt').css('display','block');
}else{ $('#txt').css('display','none'); }
});
$('select[name=formA[source]]').change(function(){
formSource($(this).val());
});
$('input[type=checkbox][name=formA[histo]]').click(function() {
if($(this).attr('checked')== true){
$('#txt').css('display','block');
}else{
$('#txt').css('display','none');
}
$('#deselectBodacc').click(function(){
$('input[type=radio][name=formA[bodacc]]').each(function(){
$(this).attr('checked', false);
});
});
});
@ -72,8 +83,8 @@ fieldset {border:0; margin:0; padding:0;}
fieldset legend{ padding:0 0 0 10px;}
.fieldgrp{clear:both; width:100%; margin-bottom:.5em; overflow:hidden;}
.fieldgrp:after{content:"."; display:block; clear:both; visibility:hidden; line-height:0; height:0; }
.fieldgrp label{ width:150px; font-weight:bold; margin-left:30px; clear:both; padding:0 10px 0 0;line-height:22px;_padding-top:3px; float:left; display:block; font-size:108%;}
.fieldgrp label.inline{ clear:none; padding:0; margin:0; float:left; display:block;}
.fieldgrp label{ width:150px; font-weight:bold; margin-left:30px; clear:both; padding:0 10px 0 0; line-height:22px; _padding-top:3px; float:left; display:block; font-size:108%;}
.fieldgrp label.inline{ clear:none; margin:0; float:left; display:block; width:auto;}
.fieldgrp label span{font-weight:normal;}
.fieldgrp label abbr{color:#4B911C; font-size:120%; vertical-align:middle;}
.fieldgrp p { clear:both; margin:0 0 0 30px; font-size:12px; }
@ -82,8 +93,10 @@ fieldset legend{ padding:0 0 0 10px;}
.field .longfield-select{width:220px;}
.field .smallfield{width:95px;}
.field .medfield{width:110px;}
.field input, .field select{ font-size:110%; margin:2px 0; }
.field input[type="radio"] { margin:0 5px 0 5px; }
.field input, .field select{ font-size:110%; margin:2px 0; }
.field input.radio { margin:0 5px; vertical-align:middle; border:none; }
.field input.checkbox { border:none; }
.field span { margin-left:10px; }
div.submit{ width:100%; text-align:center; }
.noborder {border:none;}
</style>
@ -98,9 +111,9 @@ div.submit{ width:100%; text-align:center; }
<label for="source">Source</label>
<div class="field">
<select name="formA[source]">
<option value="bodacc" <?=(isset($_REQUEST['source']) && $_REQUEST['source']=='bodacc')? 'selected' : ''?>>BODACC / BORC</option>
<option value="asso" <?=(isset($_REQUEST['source']) && $_REQUEST['source']=='asso')? 'selected' : ''?>>JO Association</option>
<option value="balo" <?=(isset($_REQUEST['source']) && $_REQUEST['source']=='balo')? 'selected' : ''?>>BALO</option>
<option value="bodacc" <?=(isset($_SESSION['recherchehisto']['source']) && $_SESSION['recherchehisto']['source']=='bodacc')? 'selected' : ''?>>BODACC / BORC</option>
<option value="asso" <?=(isset($_SESSION['recherchehisto']['source']) && $_SESSION['recherchehisto']['source']=='asso')? 'selected' : ''?>>JO Association</option>
<option value="balo" <?=(isset($_SESSION['recherchehisto']['source']) && $_SESSION['recherchehisto']['source']=='balo')? 'selected' : ''?>>BALO</option>
</select>
</div>
</div>
@ -108,23 +121,24 @@ div.submit{ width:100%; text-align:center; }
<div id="bodacc" class="fieldgrp">
<label for="bodacc">Bodacc</label>
<div class="field">
<input type="radio" name="formA[bodacc]" value="a" <?=(isset($_REQUEST['bodacc']) && $_REQUEST['bodacc']=='a')? 'checked' : ''?> />A
<input type="radio" name="formA[bodacc]" value="b" <?=(isset($_REQUEST['bodacc']) && $_REQUEST['bodacc']=='b')? 'checked' : ''?>/>B
<input type="radio" name="formA[bodacc]" value="c" <?=(isset($_REQUEST['bodacc']) && $_REQUEST['bodacc']=='c')? 'checked' : ''?>/>C
<span><input class="radio" type="radio" name="formA[bodacc]" value="a" <?=(isset($_SESSION['recherchehisto']['bodacc']) && $_SESSION['recherchehisto']['bodacc']=='a')? 'checked' : ''?>/>A</span>
<span><input class="radio" type="radio" name="formA[bodacc]" value="b" <?=(isset($_SESSION['recherchehisto']['bodacc']) && $_SESSION['recherchehisto']['bodacc']=='b')? 'checked' : ''?>/>B</span>
<span><input class="radio" type="radio" name="formA[bodacc]" value="c" <?=(isset($_SESSION['recherchehisto']['bodacc']) && $_SESSION['recherchehisto']['bodacc']=='c')? 'checked' : ''?>/>C</span>
<span><a href="#" id="deselectBodacc">Désélection</a></span>
</div>
</div>
<div id="histo" class="fieldgrp">
<label for="histo">Historique jusqu'à 1953</label>
<div class="field">
<input type="checkbox" name="formA[histo]" <?=(isset($histo) && $histo=='on')? 'checked' : ''?>/>
<input class="checkbox" type="checkbox" name="formA[histo]" <?=(isset($_SESSION['recherchehisto']['histo']) && $_SESSION['recherchehisto']['histo']=='on')? 'checked' : ''?>/>
</div>
</div>
<div id="date" class="fieldgrp">
<label for="annee">Année</label>
<div class="field">
<input type="text" name="formA[annee]" size="4" maxlength="4" value="<?=$annee?>"/>
<input type="text" name="formA[annee]" size="4" maxlength="4" value="<?=$_SESSION['recherchehisto']['annee']?>"/>
</div>
<label class="inline" for="dateparution">ou Date de parution</label>
<div class="field">
@ -163,7 +177,7 @@ div.submit{ width:100%; text-align:center; }
<div id="txt" class="fieldgrp">
<label for="txt">Recherche</label>
<div class="field">
<input type="text" name="formA[txt]" size="55" maxlength="2048" value="<?=$_REQUEST['txt']?>"/>
<input type="text" name="formA[txt]" size="55" maxlength="2048" value="<?=htmlspecialchars($_SESSION['recherchehisto']['txt'])?>"/>
</div>
<p>
<b><u>Attention :</u></b>

View File

@ -1,21 +1,27 @@
<?php
$txt = $_REQUEST['txt'];
$annee = $_REQUEST['annee'];
$firephp->log($_SESSION, 'SESSION');
isset($_SESSION['recherchehisto']['source'])? $source = $_SESSION['recherchehisto']['source'] : $source='';
isset($_SESSION['recherchehisto']['bodacc'])? $bodacc = $_SESSION['recherchehisto']['bodacc'] : $bodacc='';
isset($_SESSION['recherchehisto']['histo'])? $histo = $_SESSION['recherchehisto']['histo'] : $histo='';
isset($_SESSION['recherchehisto']['annee'])? $annee = $_SESSION['recherchehisto']['annee'] : $annee='';
isset($_SESSION['recherchehisto']['dateparution'])? $dateparution = $_SESSION['recherchehisto']['dateparution'] : $dateparution='';
isset($_SESSION['recherchehisto']['nparution'])? $nparution = $_SESSION['recherchehisto']['nparution'] : $nparution='';
isset($_SESSION['recherchehisto']['bpage'])? $bpage = $_SESSION['recherchehisto']['bpage'] : $bpage = '';
isset($_SESSION['recherchehisto']['nannonce'])? $nannonce = $_SESSION['recherchehisto']['nannonce'] : $nannonce = '';
isset($_SESSION['recherchehisto']['naffaire'])? $naffaire = $_SESSION['recherchehisto']['naffaire'] : $naffaire = '' ;
isset($_SESSION['recherchehisto']['txt'])? $txt = $_SESSION['recherchehisto']['txt'] : $txt = '';
isset($bodacc)? $bodacc=$_REQUEST['bodacc'] : $bodacc='';
isset($_REQUEST['p']) ? $p=$_REQUEST['p'] : $p=0 ;
try {
$O = $client->rechercheHisto($txt, $annee, $bodacc, $p, $_SESSION['tabInfo']['nbReponses']);
$firephp->log($O,'result');
} catch (SoapFault $fault) {
require_once 'soaperror.php';
processSoapFault($client,$fault,$tabInfo, true);
}
$parametres = array('txt', 'annee', 'bodacc');
$params = array();
foreach( $parametres as $parametre){ $params[$parametre] = $parametre.'='.urlencode(${$parametre}); }
?>
<style type="text/css">
ol li { margin-bottom:10px; }
@ -23,10 +29,33 @@ ol li { margin-bottom:10px; }
<div id="center">
<?php
$parametres = array(
'source'=>'Source',
'bodacc'=>'Type',
'histo'=>'',
'annee'=>'Année',
'dateparution'=>'Date de parution',
'nparution'=>'Numéro de parution',
'bpage'=>'Page',
'nannonce'=>'Numéro d\'annonce',
'naffaire'=>'Numéro d\'affaire',
'txt'=>'Recherche');
$strCriteres = '';
foreach ($parametres as $key => $param)
{
if($_SESSION['recherchehisto'][$key]!='' && $param!='')
{
$strCriteres.= $param.' : '.$_SESSION['recherchehisto'][$key].'&nbsp;';
}
}
if ( $O['nbReponses']==0)
{
if( !isset($tvaIntra) )
echo '<p class="StyleInfoLib">Pas de r&eacute;sultat affich&eacute; avec le(s) crit&egrave;re(s) suivants : .</p>';
?>
<p class="StyleInfoLib">
Pas de r&eacute;sultat affich&eacute; avec le(s) crit&egrave;re(s) <a title="Retour au formulaire de recherche" href="./index.php?page=recherche&vue=annonce"><?=$strCriteres?></a>
</p>
<?php
}
else
{
@ -38,17 +67,17 @@ else
{
$totPage = ceil($O['nbReponsesTotal']/$O['nbReponses']);
$curPage = ceil($p/$O['nbReponses'])+1;
echo $O['nbReponsesTotal'].' r&eacute;ponses. '.$_SESSION['tabInfo']['nbReponses'].' r&eacute;sultats affich&eacute;s. Page '.$curPage.'/'.$totPage.'.';
echo '<br/><a href="./index.php?page=recherche&vue=annonce&'.implode('&', $params).'">Retour au formulaire de recherche</a>';
echo $O['nbReponsesTotal'].' r&eacute;ponses. avec les critères <a title="Retour au formulaire de recherche" href="./index.php?page=recherche&vue=annonce">'.$strCriteres.'</a>';
echo $_SESSION['tabInfo']['nbReponses'].' r&eacute;sultats affich&eacute;s.';
echo 'Page '.$curPage.'/'.$totPage.'.';
$prec = $p-$_SESSION['tabInfo']['nbReponses'];
$suiv = $p+$_SESSION['tabInfo']['nbReponses'];
} else {
$totPage = $curPage = 1;
echo $O['nbReponsesTotal'].' r&eacute;ponses';
echo $O['nbReponsesTotal'].' r&eacute;ponses. avec les critères <a title="Retour au formulaire de recherche" href="./index.php?page=recherche&vue=annonce">'.$strCriteres.'</a>';
}
echo '</p>';
$firephp->log($prec, 'prec');
?>
<ol>
<?php
@ -61,8 +90,17 @@ else
<?php
$texte = $reponse['Texte'];
foreach( $mots as $mot ){ $texte = preg_replace('/'.$mot.'/i', '<b>'.strtoupper($mot).'</b>', $texte);}
print '...&nbsp;'.$texte.'&nbsp;...<br/>Année : '.$reponse['Annee'];
print '<br/><a href="'.$reponse['Fichier'].'" target="_blank">Télécharger la page en PDF</a>';
if( substr($reponse['Code'],0,3)=='BOD' )
{
print '<u>BODACC :</u> '.substr($reponse['Code'],3,1);
}
print '&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;';
print '<u>Année :</u> '.$reponse['Annee'];
print '<br/>';
print '...&nbsp;'.$texte.'&nbsp;...';
print '<br/>';
print '<a href="'.$reponse['Fichier'].'" target="_blank">Télécharger la page en PDF</a>';
?>
</li>
<?php
@ -73,7 +111,7 @@ else
//Page précédentes
if($curPage>1)
{
print '<a href="./index.php?page=recherche&vue=annoncelist&'.implode('&', $params).'&p='.$prec.'">Page précédente</a>';
print '<a href="./index.php?page=recherche&vue=annoncelist&p='.$prec.'">Page précédente</a>';
}
?>
<< Page : <?=$curPage.'/'.$totPage?> >>
@ -81,7 +119,7 @@ else
//Page suivante
if ($curPage<$totPage)
{
print '<a href="./index.php?page=recherche&vue=annoncelist&'.implode('&', $params).'&p='.$suiv.'">Page suivante</a>';
print '<a href="./index.php?page=recherche&vue=annoncelist&p='.$suiv.'">Page suivante</a>';
}
?>