issue #0001797: add Checkbox and Radio buttons

This commit is contained in:
Michael RICOIS 2013-12-05 14:08:28 +00:00
parent ba6dbbb0d7
commit 1c029fafe4
5 changed files with 68 additions and 84 deletions

View File

@ -115,7 +115,7 @@ class Zend_View_Helper_Field extends Zend_View_Helper_Abstract
}
$style = '';
$class = ' class="fieldgrp"';
$class = ' class="panel panel-info fieldgrp"';
if ( $display===false ) {
$style = ' style="display:none;"';
}
@ -139,7 +139,7 @@ class Zend_View_Helper_Field extends Zend_View_Helper_Abstract
*/
private function structureLabel($label)
{
$return = '<label>'.$label.'</label>';
$return = '<div class="panel-heading">'.$label.'</div>';
return $return;
}
@ -209,18 +209,19 @@ class Zend_View_Helper_Field extends Zend_View_Helper_Abstract
{
$session = new Scores_Fields();
$sessionValeur = $session->getCritere($name);
$return = '<select size="'.count($options['value']).'" class="criteres " name="'.$name.'" multiple>';
$return = '<div class="btn-group criteres" size="'.count($options['value']).'" name="'.$name.'" data-toggle="buttons">';
foreach($options['value'] as $value => $label) {
$selected = "";
if( !empty($sessionValeur) ) {
if ( is_array($sessionValeur) && in_array($value, $sessionValeur) ) {
$selected = " selected";
$selected = "active";
}
}
$return .= '<option'.$selected.' value="'.$value.'">'.$label.'</option>';
$return .= '<label class="btn btn-primary '.$selected.'">
<input type="checkbox" name="options" value="'.$value.'" id="option1">'.$label.'
</label>';
}
$return .= '</select>';
$return .= '</div>';
$return .= '<a href="#" class="selectMultiple">Sélectionner</a>';
$return .= '&nbsp;<a href="#" class="selectMultipleEx">Exclure</a>';
return $return;
@ -240,19 +241,18 @@ class Zend_View_Helper_Field extends Zend_View_Helper_Abstract
if( is_array($sessionValeur) ) {
$sessionValeur = implode(',', $sessionValeur);
}
$return = '<select class="criteres" name="'.$name.'">';
$return .= '<option '.(($sessionValeur == '-')?'selected':'').' value="-">-</option>';
$return = '<div style="float:right" class="btn-group criteres" data-toggle="buttons" name="'.$name.'">';
foreach($options['value'] as $value => $label) {
$selected = "";
if( $sessionValeur!==null && $sessionValeur != "-" && $sessionValeur==$value )
$selected = " selected";
$return .= '<option'.$selected.' value="'.$value.'">'.$this->view->translate($label).'</option>';
$selected = "active";
$return .= '<label class="btn btn-primary '.$selected.'">
<input type="radio" name="options" id="option1" value="'.$value.'">'.$this->view->translate($label).'</label>';
}
$return .= '</select>';
$return .= '</div>';
return $return;
}
protected function intervalDateHTML($name, $options)

View File

@ -9,27 +9,24 @@
</div>
<div id="collapse-1" class="panel-collapse collapse">
<div class="panel-body">
<div id="entreprise">
<ul id="fieldsblock">
<li><?=$this->Field('siege')?></li>
<li><?=$this->Field('groupe')?></li>
<li><?=$this->Field('tel')?></li>
<li><?=$this->Field('fax')?></li>
<li><?=$this->Field('web')?></li>
<li><?=$this->Field('mail')?></li>
<li><?=$this->Field('presentRcs')?></li>
<li><?=$this->Field('adrDom')?></li>
<li><?=$this->Field('dirNom')?></li>
<li><?=$this->Field('dateCrea_etab')?></li>
<li><?=$this->Field('participation')?></li>
<li class="advanced"><?=$this->Field('nbMPubli')?></li>
<li class="advanced"><?=$this->Field('dateCrea_ent')?></li>
<li class="advanced"><?=$this->Field('action')?></li>
<li class="advanced"><?=$this->Field('nbActio')?></li>
<li class="advanced"><?=$this->Field('nbPart')?></li>
<li class="mode"><img src="/themes/default/images/fleche-bas.gif" /></li>
</ul>
<?=$this->Field('siege')?>
<?=$this->Field('groupe')?>
<?=$this->Field('tel')?>
<?=$this->Field('fax')?>
<?=$this->Field('web')?>
<?=$this->Field('mail')?>
<?=$this->Field('presentRcs')?>
<?=$this->Field('adrDom')?>
<?=$this->Field('dirNom')?>
<?=$this->Field('dateCrea_etab')?>
<?=$this->Field('participation')?>
<?=$this->Field('nbMPubli')?>
<?=$this->Field('dateCrea_ent')?>
<?=$this->Field('action')?>
<?=$this->Field('nbActio')?>
<?=$this->Field('nbPart')?>
</div>
<div id="link">
<a class="resetFamille" id="entreprise">Réinitialiser les critères entreprises</a>
@ -62,7 +59,6 @@
<li><?=$this->Field('eff_entrep')?></li>
<li class="advanced"><?=$this->Field('eff_etab')?></li>
<li class="advanced"><?=$this->Field('nbEtab')?></li>
<li class="mode"><img src="/themes/default/images/fleche-bas.gif" /></li>
</ul>
</div>
<div style="text-align:right;margin-top:20px;">
@ -101,7 +97,6 @@
<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;">
@ -131,7 +126,6 @@
<li><?=$this->Field('procolHisto')?></li>
<li><?=$this->Field('dateImmat')?></li>
<li class="advanced"><?=$this->Field('tvaIntraValide')?></li>
<li class="mode"><img src="/themes/default/images/fleche-bas.gif" /></li>
</ul>
</div>
<div style="text-align:right;margin-top:20px;">
@ -174,7 +168,6 @@
<li class="advanced"><?=$this->Field('bilHM')?></li>
<li class="advanced"><?=$this->Field('bilHN')?></li>
<li class="advanced"><?=$this->Field('bilYP')?></li>
<li class="mode"><img src="/themes/default/images/fleche-bas.gif" /></li>
</ul>
</div>
<div style="text-align:right;margin-top:20px;">

View File

@ -1,32 +1,20 @@
<div class="panel panel-primary">
<div class="panel-heading"><h3 class="panel-title">Résumé de vos critères</h3></div>
<div class="panel-body">
<div class="alert alert-warning">Aucune sélection.</div>
</div>
<?php if ( count($this->infos)>0 ) {?>
<ul class="list-group">
<?php $color = 0;?>
<?php foreach($this->infos as $critere => $item) {?>
<li class="list-group-item">
<div style="float:left; margin:2px 0;">
<?=$item['label']?>
<div class="alert alert-info">
<a class="close" data-dismiss="alert" href="<?=$this->url(array('controller'=>'index', 'action'=>'remove', 'critere'=>$critere), null, true)?>" aria-hidden="true">&times;</a>
<div style='font-weight: 700;'><?=$item['label']?>:</div>
<?php if ( is_string($item['in']) && !empty($item['in']) ) {?>
<br/>&nbsp;&nbsp;<?=$item['in']?>
<p>&nbsp;&nbsp;<?=$item['in']?>
<?php } elseif ( is_array($item['in']) || is_array($item['ex']) ) {?>
<br/>&nbsp;&nbsp;<a class="criterelist" title="<?=$item['label']?>" href="<?=$this->url(array('controller'=>'index', 'action'=>'criterelist', 'key'=>$critere), null, true)?>">Liste</a>
<?php }?>
&nbsp;&nbsp;<a class="criterelist" title="<?=$item['label']?>" href="<?=$this->url(array('controller'=>'index', 'action'=>'criterelist', 'key'=>$critere), null, true)?>">Liste</a>
<?php }?></p>
</div>
<div style="height:16px; width:16px; float:right;">
<a class="remove" href="<?=$this->url(array('controller'=>'index', 'action'=>'remove', 'critere'=>$critere), null, true)?>">
<img src="/themes/default/images/cross.png" />
</a>
</div>
</li>
<?php }?>
</ul>
<?php }?>
<?php }else{?><div class="alert alert-warning">Aucune sélection.</div><?}?>
</div>
<a href="/comptage/reset" class="btn btn-primary btn-block">Initialiser les critères</a>
<a href="/comptage/previsualisation" class="btn btn-primary btn-block">Prévisualiser</a>
<a href="/comptage/savedialog" class="saveciblage btn btn-primary btn-block">Extraire</a>

File diff suppressed because one or more lines are too long

View File

@ -1,6 +1,7 @@
$(document).ready(function()
{
$('#tabs').tabs({
/*$('.panel-group').tabs({
cookie: { expires: 1 }
});
@ -18,8 +19,8 @@ $(document).ready(function()
}
});
}
});
});*/
$('div#panel').delegate('div#criteres a.criterelist', 'click', function(e){
e.preventDefault();
var title = $(this).attr('title');
@ -43,16 +44,16 @@ $(document).ready(function()
return false;
});
$('#tabs').delegate('select.criteres', 'change', function(e){
$('.panel-group').delegate('div.criteres label', 'change', function(e){
e.stopPropagation();
if ( !$(this).attr('size') ){
var valeur = $(this, ':selected').val();
set($(this).attr('name'), valeur);
if ( !$(this).parent('div').attr('size') ){
var valeur = $(this).find('input').val();
set($(this).parent('div').attr('name'), valeur);
}
});
$('#tabs').delegate('input[type=checkbox].criteres', 'click', function(e){
$('.panel-group').delegate('input[type=checkbox].criteres', 'click', function(e){
e.stopPropagation();
if($(this).is(':checked')) {
set($(this).attr('name'), 1);
@ -61,7 +62,7 @@ $(document).ready(function()
}
});
$('#tabs').delegate('input[type=radio].criteres', 'click', function(e){
$('.panel-group').delegate('input[type=radio].criteres', 'click', function(e){
e.stopPropagation();
set($(this).attr('name'), $(this).val());
});
@ -97,7 +98,7 @@ $(document).ready(function()
close: function ( event, ui) { this.value = ''; },
});
$('#tabs').delegate('a.autocomplete', 'click', function(e){
$('.panel-group').delegate('a.autocomplete', 'click', function(e){
e.stopPropagation();
var name = $(this).parent().find('input.criteres').attr('name');
var ul = $(this).parent().find('ul.selectqueries');
@ -111,7 +112,7 @@ $(document).ready(function()
ul.empty();
});
$('#tabs').delegate('a.autocompleteEx', 'click', function(e){
$('.panel-group').delegate('a.autocompleteEx', 'click', function(e){
e.stopPropagation();
var name = $(this).parent().find('input.criteres').attr('name');
var ul = $(this).parent().find('ul.selectqueries');
@ -125,19 +126,21 @@ $(document).ready(function()
ul.empty();
});
$('#tabs').delegate('a.selectMultiple', 'click', function(e){
$('.panel-group').delegate('a.selectMultiple', 'click', function(e){
e.stopPropagation();
var obj = $(this).parent().find('select.criteres');
set(obj.attr('name'), obj.val());
var obj = $(this).parent().find('div.criteres label input');
//alert('aaa');
set(obj.parent().attr('name'), obj.val());
});
$('#tabs').delegate('a.selectMultipleEx', 'click', function(e){
$('.panel-group').delegate('a.selectMultipleEx', 'click', function(e){
e.stopPropagation();
var obj = $(this).parent().find('select.criteres');
set(obj.attr('name'), obj.val(), 1);
});
$('#tabs').delegate('a.intervalDate', 'click', function(e){
$('.panel-group').delegate('a.intervalDate', 'click', function(e){
e.preventDefault();
var key = $(this).attr('id');
var val1 = $('select[name='+key+'1_a]').val() + $('select[name='+key+'1_m]').val() + $('select[name='+key+'1_j]').val();
@ -149,7 +152,7 @@ $(document).ready(function()
return false;
});
$('#tabs').delegate('a.interval', 'click', function(e){
$('.panel-group').delegate('a.interval', 'click', function(e){
e.preventDefault();
var key = $(this).attr('id');
var val1 = $('input[name='+key+'1]').val();
@ -161,7 +164,7 @@ $(document).ready(function()
return false;
});
$('#tabs').delegate('a.intervalSelect', 'click', function(e){
$('.panel-group').delegate('a.intervalSelect', 'click', function(e){
e.preventDefault();
var key = $(this).attr('id');
var values = $('select[name='+key+'1] option:selected').val()+','+$('select[name='+key+'2] option:selected').val();
@ -169,7 +172,7 @@ $(document).ready(function()
return false;
});
$('#tabs').delegate('a.arborescence', 'click', function(e) {
$('.panel-group').delegate('a.arborescence', 'click', function(e) {
e.preventDefault();
var title = $(this).attr('title');
var href = $(this).attr('href');
@ -201,7 +204,7 @@ $(document).ready(function()
return false;
});
$('#tabs').delegate('a.text', 'click', function(e) {
$('.panel-group').delegate('a.text', 'click', function(e) {
e.preventDefault();
var id = $(this).attr('id');
if ($('div#field_text_'+id).css('display') == 'none') {
@ -211,7 +214,7 @@ $(document).ready(function()
}
});
$('#tabs').delegate('a.dlist', 'click', function(e) {
$('.panel-group').delegate('a.dlist', 'click', function(e) {
e.preventDefault();
var id = $(this).attr('id');
if ($('div#field_list_'+id).css('display') == 'none') {
@ -221,7 +224,7 @@ $(document).ready(function()
}
});
$('#tabs').delegate('a.list', 'click', function(e){
$('.panel-group').delegate('a.list', 'click', function(e){
e.stopPropagation();
var obj = $(this).parent().find('textarea.criteres');
//regexp
@ -229,7 +232,7 @@ $(document).ready(function()
set(obj.attr('name'), obj.val());
});
$('#tabs').delegate('a.listEx', 'click', function(e){
$('.panel-group').delegate('a.listEx', 'click', function(e){
e.stopPropagation();
var obj = $(this).parent().find('textarea.criteres');
//regexp