Prise en compte des champs "list"
This commit is contained in:
parent
206c19e3e2
commit
e2608152a2
@ -24,155 +24,114 @@ class Zend_View_Helper_Field extends Zend_View_Helper_Abstract
|
||||
//How many type of fields is defined
|
||||
$nbFields = count($params['fields']);
|
||||
|
||||
$this->display = true;
|
||||
$display = true;
|
||||
|
||||
//If more than one field exist we need to make a special display
|
||||
if ( $nbFields > 1) {
|
||||
$html.= '<div class="fieldgrp clearfix">';
|
||||
$html.= $this->structureLabel($label);
|
||||
$html.= '<div class="field">';
|
||||
$out.= '<div class="fieldgrp clearfix">';
|
||||
$out.= $this->structureLabel($label);
|
||||
$out.= '<div class="field">';
|
||||
foreach ( $params['fields'] as $type => $options )
|
||||
{
|
||||
switch ($type) {
|
||||
switch ($type) {
|
||||
case 'tree':
|
||||
$href = $this->view->url(array('controller' => 'arborescence', 'action' => $options['action'], 'key' => $name));
|
||||
$html.= '<a class="arborescence" title="'.$options['title'].'" href="'.$href.'">';
|
||||
$html.= 'Arborescence';
|
||||
$html.= '</a>';
|
||||
$out.= '<a class="arborescence" title="'.$options['title'].'" href="'.$href.'">';
|
||||
$out.= 'Arborescence';
|
||||
$out.= '</a>';
|
||||
break;
|
||||
case 'text':
|
||||
$html.= '<a class="text" title="'.$options['title'].'" href="#" id="'.$name.'" >';
|
||||
$html.= 'Recherche';
|
||||
$html.= '</a>';
|
||||
$out.= '<a class="text" title="'.$options['title'].'" href="#" id="'.$name.'" >';
|
||||
$out.= 'Recherche';
|
||||
$out.= '</a>';
|
||||
break;
|
||||
case 'list':
|
||||
$out.= '<a class="list" title="'.$options['title'].'" href="#" id="'.$name.'" >';
|
||||
$out.= 'Liste';
|
||||
$out.= '</a>';
|
||||
break;
|
||||
}
|
||||
$html.= ' ';
|
||||
$out.= ' ';
|
||||
}
|
||||
$html.= '</div>';
|
||||
$html.= '</div>';
|
||||
$out.= '</div>';
|
||||
$out.= '</div>';
|
||||
//Masquer les champs
|
||||
$this->display = false;
|
||||
$display = false;
|
||||
}
|
||||
|
||||
//Draw fields
|
||||
foreach ( $params['fields'] as $type => $options )
|
||||
{
|
||||
$label = $labelG;
|
||||
if ( array_key_exists('label', $options) ) {
|
||||
$label = $options['label'];
|
||||
}
|
||||
|
||||
switch($type)
|
||||
{
|
||||
case 'select':
|
||||
$html.= $this->structureHTML(
|
||||
$label,
|
||||
$this->selectHTML($name, $options),
|
||||
$title
|
||||
);
|
||||
$html = $this->selectHTML($name, $options);
|
||||
break;
|
||||
case 'selectMultiple':
|
||||
$html.= $this->structureHTML(
|
||||
$label,
|
||||
$this->selectMultipleHTML($name, $options),
|
||||
$title
|
||||
);
|
||||
$html = $this->selectMultipleHTML($name, $options);
|
||||
break;
|
||||
case 'intervalSelect':
|
||||
$html.= $this->structureHTML(
|
||||
$label,
|
||||
$this->intervalSelectHTML($name, $options),
|
||||
$title
|
||||
);
|
||||
$html = $this->intervalSelectHTML($name, $options);
|
||||
break;
|
||||
case 'checkbox':
|
||||
$html.= $this->structureHTML(
|
||||
$label,
|
||||
$this->checkboxHTML($name, $options),
|
||||
$title
|
||||
);
|
||||
$html = $this->checkboxHTML($name, $options);
|
||||
break;
|
||||
case 'intervalDate':
|
||||
$html.= $this->structureHTML(
|
||||
$label,
|
||||
$this->intervalDateHTML($name, $options),
|
||||
$title
|
||||
);
|
||||
$html = $this->intervalDateHTML($name, $options);
|
||||
break;
|
||||
case 'interval':
|
||||
$html.= $this->structureHTML(
|
||||
$label,
|
||||
$this->intervalHTML($name, $field),
|
||||
$title
|
||||
);
|
||||
$html = $this->intervalHTML($name, $field);
|
||||
break;
|
||||
case 'date':
|
||||
$html.= $this->structureHTML(
|
||||
$field['label'],
|
||||
$this->dateHTML($name, $field));
|
||||
$html = $this->dateHTML($name, $field);
|
||||
break;
|
||||
case 'text':
|
||||
$html.= $this->structureHTML(
|
||||
$label,
|
||||
$this->textHTML($name, $options),
|
||||
$title
|
||||
);
|
||||
$html = $this->textHTML($name, $options);
|
||||
break;
|
||||
case 'textarea':
|
||||
$html.= $this->structureHTML(
|
||||
$field['label'],
|
||||
$this->textareaHTML($name, $field)
|
||||
);
|
||||
$html = $this->textareaHTML($name, $field);
|
||||
break;
|
||||
case 'radio':
|
||||
$html.= $this->structureHTML(
|
||||
$field['label'],
|
||||
$this->radioHTML($name, $field));
|
||||
$html = $this->radioHTML($name, $field);
|
||||
break;
|
||||
case 'file':
|
||||
$html.= $this->structureHTML(
|
||||
$field['label'],
|
||||
$this->fileuploadHtml($name, $field));
|
||||
$html = $this->fileuploadHtml($name, $field);
|
||||
break;
|
||||
case 'tree':
|
||||
//Do nothing
|
||||
break;
|
||||
case 'list':
|
||||
$html.= $this->structureHTML(
|
||||
$label,
|
||||
$this->textareaHTML($name, $options),
|
||||
$title
|
||||
);
|
||||
$html = $this->textareaHTML($name, $options);
|
||||
break;
|
||||
default:
|
||||
$html.= $this->structureHTML($name, '');
|
||||
break;
|
||||
|
||||
$html = $this->structureHTML($name, '');
|
||||
break;
|
||||
}
|
||||
|
||||
$label = $labelG;
|
||||
if ( array_key_exists('label', $options) ) {
|
||||
$label = $options['label'];
|
||||
}
|
||||
|
||||
$style = '';
|
||||
$class = ' class="fieldgrp"';
|
||||
if ( $display===false ) {
|
||||
$style = ' style="display:none;"';
|
||||
}
|
||||
if ( !empty($title) ) {
|
||||
$title = ' title="'.$title.'"';
|
||||
}
|
||||
|
||||
$out.= '<div id="field_'.$type.'_'.$this->name.'" '.$class.''.$style.''.$title.'>';
|
||||
$out.= $this->structureLabel($label);
|
||||
$out.= '<div class="field">'.$html.'</div>';
|
||||
$out.= '</div>';
|
||||
|
||||
}
|
||||
return $html;
|
||||
}
|
||||
|
||||
private function structureHTML($label, $html, $title='')
|
||||
{
|
||||
$out = '';
|
||||
|
||||
$style = '';
|
||||
$class = ' class="fieldgrp"';
|
||||
if ( $this->display===false ) {
|
||||
$style = ' style="display:none;"';
|
||||
}
|
||||
if ( !empty($title) ) {
|
||||
$title = ' title="'.$title.'"';
|
||||
}
|
||||
|
||||
$out.= '<div id="field_'.$this->name.'" '.$class.''.$style.''.$title.'>';
|
||||
$out.= $this->structureLabel($label);
|
||||
$out.= '<div class="field">'.$html.'</div>';
|
||||
$out.= '</div>';
|
||||
|
||||
return $out;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Définition du label
|
||||
* @param unknown_type $label
|
||||
|
@ -178,6 +178,7 @@ class Scores_Fields
|
||||
'fields' => array(
|
||||
'tree' => array('value' => null, 'action' => 'naf', 'title' => "Arborescence de code NAF établissement"),
|
||||
'text' => array('value' => null, 'label' => "Recherche de code NAF", 'title'=>"Sélection de code NAF établissement"),
|
||||
'list' => array('value' => null, 'label' => "Liste de code NAF", 'title'=>"Liste de code NAF établissement"),
|
||||
),
|
||||
'famille' => 'economique',
|
||||
'activated' => true,
|
||||
@ -187,6 +188,7 @@ class Scores_Fields
|
||||
'fields' => array(
|
||||
'tree' => array('value' => null, 'action' => 'naf', 'title' => "Arborescence de code NAF entreprise"),
|
||||
'text' => array('value' => null, 'label' => "Recherche de code NAF", 'title'=>"Sélection de code NAF entreprise"),
|
||||
'list' => array('value' => null, 'label' => "Liste de code NAF", 'title'=>"Liste de code NAF entreprise"),
|
||||
),
|
||||
'famille' => 'economique',
|
||||
'activated' => true,
|
||||
@ -795,8 +797,6 @@ Les zones urbaines sensibles constituent un sous-ensemble de l'ensemble plus lar
|
||||
* min,max
|
||||
*
|
||||
*/
|
||||
|
||||
|
||||
|
||||
//Do some operation on value
|
||||
$types = array_keys($this->fields[$key]['fields']);
|
||||
|
@ -212,21 +212,37 @@ $(document).ready(function()
|
||||
$('#tabs').delegate('a.text', 'click', function(e) {
|
||||
e.preventDefault();
|
||||
var id = $(this).attr('id');
|
||||
if ($('div#field_'+id).css('display') == 'none') {
|
||||
$('div#field_'+id).show('blind');
|
||||
if ($('div#field_text_'+id).css('display') == 'none') {
|
||||
$('div#field_text_'+id).show('blind');
|
||||
} else {
|
||||
$('div#field_'+id).hide('blind');
|
||||
$('div#field_text_'+id).hide('blind');
|
||||
}
|
||||
});
|
||||
|
||||
$('#tabs').delegate('a.list', 'click', function(e) {
|
||||
e.preventDefault();
|
||||
var id = $(this).attr('id');
|
||||
if ($('div#field_list_'+id).css('display') == 'none') {
|
||||
$('div#field_list_'+id).show('blind');
|
||||
} else {
|
||||
$('div#field_list_'+id).hide('blind');
|
||||
}
|
||||
});
|
||||
|
||||
$('#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);
|
||||
}
|
||||
//regexp
|
||||
|
||||
set(obj.attr('name'), obj.val());
|
||||
});
|
||||
|
||||
$('#tabs').delegate('a.listEx', 'click', function(e){
|
||||
e.stopPropagation();
|
||||
var obj = $(this).parent().find('textarea.criteres');
|
||||
//regexp
|
||||
|
||||
set(obj.attr('name'), obj.val(), 1);
|
||||
});
|
||||
|
||||
});
|
||||
|
Loading…
Reference in New Issue
Block a user