2009-08-27 09:01:45 +00:00
|
|
|
|
<?php
|
|
|
|
|
define('RECHERCHE_MAX', 10);
|
|
|
|
|
|
|
|
|
|
/*
|
|
|
|
|
<?php include_once 'recherche/recherche_feed.php';?>
|
|
|
|
|
<?php if ( count($_SESSION['recherche']['list'])>1 && $_SESSION['tabInfo']['idClient']==1){?><img src="./img/recherche_feed.png" id="recherche_feed"/><?php }?>
|
|
|
|
|
*/
|
|
|
|
|
|
2009-09-10 15:31:37 +00:00
|
|
|
|
/**
|
|
|
|
|
* Sauvegarde des informations de la recherche saisie dans le formulaire
|
|
|
|
|
* @param array $form
|
|
|
|
|
* @return void
|
|
|
|
|
*/
|
2009-08-27 09:01:45 +00:00
|
|
|
|
function recherche_save($form)
|
|
|
|
|
{
|
|
|
|
|
$recherche_list = array();
|
2009-09-10 15:31:37 +00:00
|
|
|
|
$recherche_info = array();
|
2009-08-27 09:01:45 +00:00
|
|
|
|
if( isset($_SESSION['recherche']['list']) ) $recherche_list = $_SESSION['recherche']['list'];
|
2009-09-10 15:31:37 +00:00
|
|
|
|
if( isset($_SESSION['recherche']['info']) ) $recherche_info = $_SESSION['recherche']['info'];
|
|
|
|
|
//Assignation donn<6E>es formulaire
|
2009-08-27 09:01:45 +00:00
|
|
|
|
$recherche_list[] = serialize($form);
|
2009-09-10 15:31:37 +00:00
|
|
|
|
$recherche_info[] = '';
|
|
|
|
|
//On supprime la premi<6D>re recherche soit la plus ancienne si le tableau <20> un taille sup<75>rieure au maximum
|
2009-08-31 08:21:47 +00:00
|
|
|
|
if(count($recherche_list)>RECHERCHE_MAX) $item_shift = array_shift($recherche_list);
|
2009-09-10 15:31:37 +00:00
|
|
|
|
if(count($recherche_info)>RECHERCHE_MAX) $item_shift = array_shift($recherche_info);
|
|
|
|
|
//Assignation des donn<6E>es dans la session
|
2009-08-27 09:01:45 +00:00
|
|
|
|
$_SESSION['recherche']['list'] = $recherche_list;
|
2009-09-10 15:31:37 +00:00
|
|
|
|
$_SESSION['recherche']['info'] = $recherche_info;
|
2009-08-27 09:01:45 +00:00
|
|
|
|
}
|
|
|
|
|
|
2009-09-10 15:31:37 +00:00
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Sauvegarde une information suppl<EFBFBD>mentaire concernant la recherche (raisonSociale)
|
|
|
|
|
* @param array $info
|
|
|
|
|
* @param int $index
|
|
|
|
|
* @return void
|
|
|
|
|
*/
|
|
|
|
|
function recherche_saveinfo($info, $index = 0)
|
|
|
|
|
{
|
|
|
|
|
global $firephp;
|
|
|
|
|
$recherche_info = array();
|
|
|
|
|
if( isset($_SESSION['recherche']['info']) ) $recherche_info = $_SESSION['recherche']['info'];
|
|
|
|
|
$rindex = count($recherche_info)-1-$index;
|
|
|
|
|
$recherche_info[$rindex][key($info)] = $info[key($info)];
|
|
|
|
|
$firephp->log($recherche_info, 'SAVE : recherche_info');
|
|
|
|
|
$_SESSION['recherche']['info'] = $recherche_info;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Affiche les <EFBFBD>l<EFBFBD>ments des recherches sauvegard<EFBFBD>es
|
|
|
|
|
* @param int $index
|
|
|
|
|
* @return array ou boolean
|
|
|
|
|
*/
|
2009-08-27 09:01:45 +00:00
|
|
|
|
function recherche_element($index)
|
|
|
|
|
{
|
|
|
|
|
global $firephp;
|
|
|
|
|
$recherche_list = array();
|
2009-09-10 15:31:37 +00:00
|
|
|
|
$recherche_info = array();
|
2009-08-27 09:01:45 +00:00
|
|
|
|
if( isset($_SESSION['recherche']['list']) ) $recherche_list = $_SESSION['recherche']['list'];
|
2009-09-10 15:31:37 +00:00
|
|
|
|
if( isset($_SESSION['recherche']['info']) ) $recherche_info = $_SESSION['recherche']['info'];
|
2009-08-27 09:01:45 +00:00
|
|
|
|
$rindex = count($recherche_list)-1-$index;
|
|
|
|
|
if( array_key_exists($rindex, $recherche_list) && isset($recherche_list[$rindex]) ){
|
|
|
|
|
$returntab = unserialize($recherche_list[$rindex]);
|
|
|
|
|
$link = '';
|
|
|
|
|
foreach($returntab as $key => $val)
|
|
|
|
|
{
|
|
|
|
|
$link.= '&formR['.$key.']='.$val;
|
|
|
|
|
}
|
|
|
|
|
$returntab['link'] = $link;
|
2009-09-10 15:31:37 +00:00
|
|
|
|
if(isset($recherche_info[$rindex])) $returntab['info'] = $recherche_info[$rindex];
|
|
|
|
|
$firephp->log($rindex, 'rindex');
|
|
|
|
|
$firephp->log($returntab, 'returntab');
|
2009-08-27 09:01:45 +00:00
|
|
|
|
return $returntab;
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
return FALSE;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|