Merge from 1.2
This commit is contained in:
commit
9affb31118
@ -1,11 +1,6 @@
|
||||
<?php
|
||||
class ComptageController extends Zend_Controller_Action
|
||||
{
|
||||
public function init()
|
||||
{
|
||||
/* Initialize action controller here */
|
||||
}
|
||||
|
||||
public function indexAction()
|
||||
{
|
||||
$this->_helper->layout()->disableLayout();
|
||||
|
@ -67,7 +67,7 @@ class FieldsController extends Zend_Controller_Action
|
||||
$q = preg_replace("/['-]/", ' ', $q);
|
||||
|
||||
//Remove characters
|
||||
$q = preg_replace("/^[a-z0-9]\s/i", '', $q);
|
||||
$q = preg_replace("/^[a-z]\s/i", '', $q);
|
||||
|
||||
//Detect if we have string
|
||||
if ( preg_match("/[a-zA-Z]+/", $q) )
|
||||
@ -92,14 +92,12 @@ class FieldsController extends Zend_Controller_Action
|
||||
$sql->where("LOWER(NC) ".$where);
|
||||
}
|
||||
$result = $table->fetchAll($sql);
|
||||
if (count($result)>0) {
|
||||
foreach ($result as $item) {
|
||||
$output[] = array(
|
||||
'label' => $item->NCCENR . ' (Région)',
|
||||
'value' => 'R'.$item->REGION
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
//Département
|
||||
$table = new Application_Model_Departements();
|
||||
@ -119,14 +117,12 @@ class FieldsController extends Zend_Controller_Action
|
||||
$sql->where("LOWER(libdep) ".$where);
|
||||
}
|
||||
$result = $table->fetchAll($sql);
|
||||
if (count($result)>0) {
|
||||
foreach ($result as $item) {
|
||||
$output[] = array(
|
||||
'label' => $item->libdep . ' (Département)',
|
||||
'label' => $item->libdep . ' (Dépatement)',
|
||||
'value' => 'D'.$item->numdep
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
//Ville
|
||||
$table = new Application_Model_CodePostaux();
|
||||
@ -146,31 +142,28 @@ class FieldsController extends Zend_Controller_Action
|
||||
$sql->where("LOWER(Commune) ".$where);
|
||||
}
|
||||
$result = $table->fetchAll($sql);
|
||||
if (count($result)>0) {
|
||||
foreach ($result as $item) {
|
||||
$output[] = array(
|
||||
'label' => $item->Commune . ', '. $item->Codepos .' (Ville)',
|
||||
'value' => 'C'.$item->INSEE
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
} elseif ( preg_match('/[0-9]{1,5}/', $q) ) {
|
||||
|
||||
//Code Postal
|
||||
$table = new Application_Model_CodePostaux();
|
||||
$sql = $table->select()->where('Codepos LIKE "'.$q.'%"')->limit(1);
|
||||
$sql = $table->select()->where('Codepos LIKE "'.$q.'%"');
|
||||
$result = $table->fetchAll($sql);
|
||||
if (count($result)>0) {
|
||||
foreach ($result as $item) {
|
||||
$output[] = array(
|
||||
'label' => $item->Codepos . ' ( Code postal )',
|
||||
'value' => $item->Codepos
|
||||
'label' => $item->Commune . ', '. $item->Codepos .' (Ville)',
|
||||
'value' => 'C'.$item->INSEE
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
break;
|
||||
case 'cj':
|
||||
$table = new Application_Model_FormeJuridique();
|
||||
|
@ -92,9 +92,58 @@ class Zend_View_Helper_Field extends Zend_View_Helper_Abstract
|
||||
$title
|
||||
);
|
||||
break;
|
||||
case 'intervalDate':
|
||||
$html.= $this->structureHTML(
|
||||
$label,
|
||||
$this->intervalDateHTML($name, $options),
|
||||
$title
|
||||
);
|
||||
break;
|
||||
case 'interval':
|
||||
$html.= $this->structureHTML(
|
||||
$label,
|
||||
$this->intervalHTML($name, $field),
|
||||
$title
|
||||
);
|
||||
break;
|
||||
case 'date':
|
||||
$html.= $this->structureHTML(
|
||||
$field['label'],
|
||||
$this->dateHTML($name, $field));
|
||||
break;
|
||||
case 'text':
|
||||
$html.= $this->structureHTML(
|
||||
$label,
|
||||
$this->textHTML($name, $options),
|
||||
$title
|
||||
);
|
||||
break;
|
||||
case 'textarea':
|
||||
$html.= $this->structureHTML(
|
||||
$field['label'],
|
||||
$this->textareaHTML($name, $field)
|
||||
);
|
||||
break;
|
||||
case 'radio':
|
||||
$html.= $this->structureHTML(
|
||||
$field['label'],
|
||||
$this->radioHTML($name, $field));
|
||||
break;
|
||||
case 'file':
|
||||
$html.= $this->structureHTML(
|
||||
$field['label'],
|
||||
$this->fileuploadHtml($name, $field));
|
||||
break;
|
||||
case 'tree':
|
||||
//Do nothing
|
||||
break;
|
||||
case 'list':
|
||||
$html.= $this->structureHTML(
|
||||
$label,
|
||||
$this->textareaHTML($name, $options),
|
||||
$title
|
||||
);
|
||||
break;
|
||||
default:
|
||||
$html.= $this->structureHTML($name, '');
|
||||
break;
|
||||
@ -334,32 +383,8 @@ class Zend_View_Helper_Field extends Zend_View_Helper_Abstract
|
||||
}
|
||||
|
||||
/* Textes */
|
||||
private function textHTML($name, $options)
|
||||
protected function textHTML($name, $options)
|
||||
{
|
||||
$session = new Scores_Fields();
|
||||
switch($name) {
|
||||
case 'ape_entrep':
|
||||
case 'ape_etab':
|
||||
$type = 'Naf';
|
||||
break;
|
||||
case 'vil':
|
||||
$type= 'Vil';
|
||||
break;
|
||||
case 'adr_com':
|
||||
case 'adr_com_ex':
|
||||
$type= $name;
|
||||
break;
|
||||
case 'cj':
|
||||
$type = 'Cj';
|
||||
break;
|
||||
case 'cj_ex':
|
||||
$type = 'Cj_ex';
|
||||
break;
|
||||
case 'adr_dept':
|
||||
case 'adr_dept_ex':
|
||||
$type= $name;
|
||||
break;
|
||||
}
|
||||
$return = '<input type="text" class="criteres autocomplete" name="'.$name.'" />';
|
||||
$return.= '<ul id="selectqueries"></ul>';
|
||||
$return.= '<a href="#" class="autocomplete">Sélectionner</a>';
|
||||
@ -368,14 +393,12 @@ class Zend_View_Helper_Field extends Zend_View_Helper_Abstract
|
||||
}
|
||||
|
||||
/* Textarea */
|
||||
private function textareaHTML($name, $field)
|
||||
protected function textareaHTML($name, $field)
|
||||
{
|
||||
$return = '<a class="arborescence" title="'.$field['title'].'" href="'.$this->view->url(array('controller' => 'arborescence', 'action' => $field['action'], 'key' => $name)).'">
|
||||
<img src="/themes/default/images/arborescence.gif" />
|
||||
</a> <img style="cursor:pointer" class="manuel" ref="'.$name.'" src="/themes/default/images/Textarea.gif" title="Champs texte"/>';
|
||||
if($name == 'adr_com')
|
||||
$return .= ' <img src="/themes/default/images/img_carte_fr.gif" title="Carte de france"/>';
|
||||
return ($return);
|
||||
$return = '<textarea class="criteres" name="'.$name.'" ></textarea>';
|
||||
$return.= '<a href="#" class="list">Sélectionner</a>';
|
||||
$return.= ' <a href="#" class="listEx">Exclure</a>';
|
||||
return $return;
|
||||
}
|
||||
|
||||
private function fileuploadHtml($name, $field)
|
||||
|
@ -60,12 +60,15 @@
|
||||
<?=$this->Field('geo_etranger')?>
|
||||
<?=$this->Field('geo_corse')?>
|
||||
</li>
|
||||
<li class="advanced"><?=$this->Field('codespostaux')?></li>
|
||||
<li class="advanced"><?=$this->Field('codesinsee')?></li>
|
||||
<li><?=$this->Field('zus')?></li>
|
||||
<li><?=$this->Field('zru')?></li>
|
||||
<li><?=$this->Field('zfu')?></li>
|
||||
<li><?=$this->Field('cucs')?></li>
|
||||
<li><?=$this->Field('zrr')?></li>
|
||||
<li><?=$this->Field('zafr')?></li>
|
||||
<li class="mode"><img src="/themes/default/images/fleche-bas.gif" /></li>
|
||||
</ul>
|
||||
</div>
|
||||
<div style="text-align:right;margin-top:20px;">
|
||||
|
@ -107,4 +107,4 @@ foreach($keys as $key) {
|
||||
$db->insert('fields_minmax', $data);
|
||||
if ($opts->manuel) echo $key.' -> min:'.$result->min.' max:'.$result->max."\n";
|
||||
}
|
||||
if ($opts->manuel) print('Terminé');
|
||||
if ($opts->manuel) print("Terminé\n");
|
||||
|
@ -1059,6 +1059,28 @@ class Ciblage
|
||||
}
|
||||
}
|
||||
|
||||
protected function codesinsee($value)
|
||||
{
|
||||
if ( array_key_exists('in', $value) && is_array($value['in']) && count($value['in'])>0 ) {
|
||||
$this->setFilter('codeCommune', $value['in']);
|
||||
}
|
||||
|
||||
if ( array_key_exists('ex', $value) && is_array($value['ex']) && count($value['ex'])>0 ) {
|
||||
$this->setFilter('codeCommune', $value['ex'], true);
|
||||
}
|
||||
}
|
||||
|
||||
protected function codespostaux($value)
|
||||
{
|
||||
if ( array_key_exists('in', $value) && is_array($value['in']) && count($value['in'])>0 ) {
|
||||
$this->setFilter('adr_cp', $value['in']);
|
||||
}
|
||||
|
||||
if ( array_key_exists('ex', $value) && is_array($value['ex']) && count($value['ex'])>0 ) {
|
||||
$this->setFilter('adr_cp', $value['ex']);
|
||||
}
|
||||
}
|
||||
|
||||
protected function getChildCJ($list)
|
||||
{
|
||||
$lastLevel = array();
|
||||
|
@ -333,7 +333,6 @@ class Scores_Fields
|
||||
'famille' => 'geographique',
|
||||
'activated' => true,
|
||||
),
|
||||
|
||||
'geo_domtom' => array(
|
||||
'label' => 'Exlcure les DOM-TOM',
|
||||
'fields' => array(
|
||||
@ -361,6 +360,24 @@ class Scores_Fields
|
||||
'activated' => true,
|
||||
'title' => 'Exclure les établissements situés en région Corse',
|
||||
),
|
||||
'codesinsee' => array(
|
||||
'label' => 'Liste de codes Insee',
|
||||
'fields' => array(
|
||||
'list' => array(),
|
||||
),
|
||||
'famille' => 'geographique',
|
||||
'activated' => true,
|
||||
'title' => 'Liste de code Insee séparés par des virgules ou des points-virgules',
|
||||
),
|
||||
'codespostaux' => array(
|
||||
'label' => 'Liste de codes postaux',
|
||||
'fields' => array(
|
||||
'list' => array(),
|
||||
),
|
||||
'famille' => 'geographique',
|
||||
'activated' => true,
|
||||
'title' => 'Liste de code postaux séparés des virgules ou des points-virgules',
|
||||
),
|
||||
'adr_reg' => array(
|
||||
'label' => 'Liste code région',
|
||||
'fields' => array(
|
||||
@ -770,6 +787,7 @@ Les zones urbaines sensibles constituent un sous-ensemble de l'ensemble plus lar
|
||||
|
||||
/**
|
||||
* single
|
||||
* interval
|
||||
* multiple
|
||||
*
|
||||
*
|
||||
@ -826,6 +844,9 @@ Les zones urbaines sensibles constituent un sous-ensemble de l'ensemble plus lar
|
||||
case 'tree':
|
||||
//@todo : Check if values exist
|
||||
break;
|
||||
case 'list':
|
||||
|
||||
break;
|
||||
}
|
||||
|
||||
//Save the value
|
||||
@ -842,10 +863,6 @@ Les zones urbaines sensibles constituent un sous-ensemble de l'ensemble plus lar
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* Définir les critères en une fois
|
||||
* @param array $criteres Criteres as array with key => val
|
||||
|
@ -105,6 +105,7 @@ $(document).ready(function()
|
||||
});
|
||||
set(name, values.join(','));
|
||||
}
|
||||
ul.empty();
|
||||
});
|
||||
|
||||
$('#tabs').delegate('a.autocompleteEx', 'click', function(e){
|
||||
@ -118,6 +119,7 @@ $(document).ready(function()
|
||||
});
|
||||
set(name, values.join(','), 1);
|
||||
}
|
||||
ul.empty();
|
||||
});
|
||||
|
||||
$('#tabs').delegate('a.selectMultiple', 'click', function(e){
|
||||
@ -217,6 +219,16 @@ $(document).ready(function()
|
||||
}
|
||||
});
|
||||
|
||||
$('#tabs').delegate('a.list', 'click', function(e) {
|
||||
e.stopPropagation();
|
||||
var obj = $(this).parent().find('textarea.criteres');
|
||||
var name = obj.attr('name');
|
||||
var value = obj.val();
|
||||
if (value!='') {
|
||||
set(name, value);
|
||||
}
|
||||
});
|
||||
|
||||
});
|
||||
|
||||
function set(key, value, ex)
|
||||
|
Loading…
Reference in New Issue
Block a user