Merge diverses petites corrections

This commit is contained in:
Michael RICOIS 2012-02-16 15:01:06 +00:00
commit 395f1ed792
7 changed files with 89 additions and 31 deletions

View File

@ -49,7 +49,12 @@ class UserController extends Libs_Controller
$url = $session->url;
}
}
if (!empty($url) && $url!='/user/login' && $url!='/localauth' && $url != '/user/logout' && $url!='/favicon.ico'){
if (!empty($url) &&
$url!='/user/login' &&
$url!='/localauth' &&
$url != '/user/logout'
&& $url!='/favicon.ico')
{
$this->_redirect($url);
}
$this->_redirect('/');

View File

@ -28,25 +28,24 @@ class Object_Codepostaux extends Libs_Row
if ($valeur[0] == 'D'){
$valeur = substr($valeur, 1, strlen($valeur));
$insee = $table->fetchAll($table->select('departements', array('codeRegionInsee'))
->where('numdep = ?', $valeur))->toArray();
->where('numdep = ?', substr($valeur, 0, 2)))->toArray();
foreach ($insee as $code)
$in[] = 'R'.$code['codeRegionInsee'];
} else{
$valeur = substr($valeur, 1, strlen($valeur));
$valeur = substr($valeur, 0, strlen($valeur));
$insee = $table->fetchAll($table->select('departements', array('codeRegionInsee'))
->where('numdep = ?', substr($valeur, 0, 2)))->toArray();
foreach ($insee as $code)
$in[] = $code;
$in[] = 'R'.$code['codeRegionInsee'];
}
} else if ($niveau == 1) {
$valeur = substr($valeur, 1, strlen($valeur));
$valeur = substr($valeur, 0, strlen($valeur));
$insee = $table->fetchAll($table->select('departements', array('codeRegionInsee'))
->where('numdep = ?', substr($valeur, 0, 2)))->toArray();
foreach ($insee as $code)
$in[] = $code;
$in[] = 'D'.$code['numdep'];
}
}
return ($in);
}

View File

@ -1,6 +1,34 @@
<?php
class Object_Formejuridique extends Libs_Row
{
protected function _jstree_checked()
{
require_once('Scores/SessionCiblage.php');
$session = new SessionCiblage();
$valeurs = explode(',', $session->getCritere('cj'));
foreach($valeurs as $valeur) {
if($valeur != '')
$return[] = $valeur;
}
if(is_array($return))
return ($return);
return (array($valeurs));
}
protected function _jstree_undetermined()
{
return (array());
}
public function _getClass($valeur)
{
if(in_array($valeur, $this->_jstree_checked()))
return ('jstree-checked');
else if (in_array($valeur, $this->_jstree_undetermined()))
return ('jstree-undetermined');
}
public function _getParents()
{
$formes = new Table_Formejuridiques();
@ -10,10 +38,11 @@ class Object_Formejuridique extends Libs_Row
foreach($formes as $forme) {
$structure[] = array(
'data' => $forme['fjCode'].' : '.$forme['fjLibelle'],
'attr' => array('id' => $forme['fjCode']),
'attr' => array('id' => $forme['fjCode'],
'class' => $this->_getClass($forme['fjCode'])),
'state' => 'closed',
'children' => array($this->_getFils($forme['fjCode']))
);
'children' => array($this->_getFils($forme['fjCode'])),
);
}
return (json_encode($structure));
}
@ -33,7 +62,8 @@ class Object_Formejuridique extends Libs_Row
foreach($formes as $forme) {
$structure = array(
'data' => $forme['fjCode'].' : '.$forme['fjLibelle'],
'attr' => array('id' => $forme['fjCode']),
'attr' => array('id' => $forme['fjCode'],
'class' => $this->_getClass($forme['fjCode'])),
'state' => 'close',
'children' => (($lenth < 6)?$this->_getFils($forme['fjCode']):array())
);

View File

@ -92,16 +92,17 @@ Class Zend_View_Helper_Field extends Zend_View_Helper_Abstract
private function intervalSelectHTML($name, $field)
{
$session = new SessionCiblage();
$sessionValeur = explode(',', $session->getCritere($name));
$return = '<select class="intervalSelect" name="'.$name.'1" id="'.$name.'" number="1">';
foreach($field['fields'][$field['type']]['value'] as $elements) {
$return .= '<option value="'. $elements[0].'">'.number_format($elements[0], 0,'', ' ').'</option>';
$return .= '<option '.(($sessionValeur[0] == $elements[0])?'selected':'').' value="'. $elements[0].'">'.number_format($elements[0], 0,'', ' ').'</option>';
}
$return .= '</select> à ';
$return .= '<select class="intervalSelect" name="'.$name.'2" id="'.$name.'" number="2">';
foreach($field['fields'][$field['type']]['value'] as $elements) {
$return .= '<option value="'. $elements[1].'">'.number_format($elements[1], 0,'', ' ').'</option>';
$return .= '<option '.(($sessionValeur[1] == $elements[1])?'selected':'').' value="'. $elements[1].'">'.number_format($elements[1], 0,'', ' ').'</option>';
}
$return .= '</select>';
@ -135,12 +136,12 @@ Class Zend_View_Helper_Field extends Zend_View_Helper_Abstract
if(is_array($sessionValeur))
$sessionValeur = implode(',', $sessionValeur);
$return = '<select class="criteres '.$field['type']['class'].'" name="'.$name.'">';
$return .= '<option value="tous">Tous</option>';
$return .= '<option '.(($sessionValeur == 'tous')?'selected':'').' value="tous">Tous</option>';
foreach($field['fields'][$field['type']]['value'] as $value => $label) {
$selected = "";
if(($sessionValeur != null) and $sessionValeur == $value)
if(($sessionValeur != null) and $sessionValeur == $value and $sessionValeur != "tous")
$selected = " selected";
$return .= '<option'.((!empty($selected))?$selected:null).' value="'.$value.'">'.$label.'</option>';
$return .= '<option'.$selected.' value="'.$value.'">'.$label.'</option>';
}
$return .= '</select>';
return ($return);
@ -151,6 +152,7 @@ Class Zend_View_Helper_Field extends Zend_View_Helper_Abstract
{
$session = new SessionCiblage();
$valeur = $session->getCritere($name);
$valeur = explode(',', $valeur);
$return = '<div class="interval" >';
$return .= '<input class="'.$field['class'].'" type="text" name="'.$name.'1" value="'.$valeur[0].'" /> à ';

View File

@ -1,10 +1,19 @@
<h1>Rapelle de vos critères de selections</h1>
<h1>Vos critères de selections</h1>
<table style="margin-top:15px">
<?php foreach($this->criteres as $critere => $valeur):?>
<?php if($valeur != 'tous' and $valeur != null):?>
<?php if($valeur != 'tous' and $valeur != null and $valeur != 'null' and $valeur != ','):?>
<?php $valeur = explode(',', $valeur); ?>
<tr>
<td style="width:150px"><b style="text-decoration: underline"><?php echo $critere;?></b></td>
<td><?php echo $valeur;?></td>
<td valign="top" style="width:150px"><b style="text-decoration: underline"><?php echo $critere;?></b></td>
<td>
<?php if(is_array($valeur)):?>
<?php $i=0; foreach ($valeur as $val):?>
<b><?php echo $val?></b> <?php (($i%3 == 0)?'<br />':''); $i++;?>
<?php endforeach;?>
<?php else: ?>
<b><?php echo $val;?></b>
<?php endif; ?>
</td>
</tr>
<?php endif; ?>
<?php endforeach; ?>

View File

@ -12,20 +12,16 @@ Class Ciblage
public $nb_results = 5000;
public $max_results = 500000;
public $mysql_host = '192.168.78.230';
public $mysql_user = 'sphinx';
public $mysql_password = 'indexer';
public $mysql_database = 'jo';
public $sphinx_host = '192.168.78.252';
public $sphinx_port = 3312;
public $sphinx_match = SPH_MATCH_EXTENDED2;
public $sphinx_sort = SPH_SORT_EXTENDED;
public function __construct($structure, $need = false)
{
$configuration = Zend_Registry::get('configuration');
//Instantiation Sphinx
$this->sphinx = new SphinxClient();
$this->sphinx->SetServer($this->sphinx_host, $this->sphinx_port);
$this->sphinx->SetServer($configuration->sphinx->host, intval($configuration->sphinx->port));
$this->sphinx->SetMatchMode(SPH_MATCH_EXTENDED2);
$this->sphinx->ResetFilters();
foreach($structure as $key => $valeur) {
@ -211,7 +207,7 @@ Class Ciblage
protected function tvaIntraValide($valeur) {
$this->setFilter('tvaIntraValide', $valeur);
}
protected function NaceEtab($valeur) {
$this->setAlpha('NaceEtab', $valeur);
}
@ -288,13 +284,17 @@ Class Ciblage
}
protected function nbMPubli($valeur) {
$this->setFilterRange('nbMPubli', $valeur);
$this->setFilter('nbMPubli', $valeur);
}
protected function nbPart($valeur) {
$this->setFilterRange('nbPart', $valeur);
}
protected function bilDuree($valeur) {
$this->setFilterRange('bilDuree', $valeur);
}
protected function bilType($valeur) {
$this->setAlpha('bilType', $valeur);
}
@ -304,7 +304,7 @@ Class Ciblage
}
protected function bilTca($valeur) {
$this->setFilterRange('bilTca', $valeur);
$this->setFilter('bilTca', $valeur);
}
protected function bilEE($valeur) {

View File

@ -98,6 +98,19 @@ class SessionCiblage
return $this->{$element};
}
public function resetFamille($famille)
{
require_once('Field.php');
$fields = new Fields(null);
$reference = $fields->getByFamille($famille);
echo '<pre>';print_r($this->valeur);
foreach($this->valeur as $name => $valeur) {
if(array_key_exists($name, $reference)) {
unset($this->valeur[$name]);
}
}
$this->setSession();
}
public function clearCiblage()
{