Modification du Helper adapté pour la structure de donnée.

This commit is contained in:
Damien LASSERRE 2012-01-11 10:45:45 +00:00
parent e1529c549e
commit 465269d60d

View File

@ -11,6 +11,8 @@ Class Zend_View_Helper_Field extends Zend_View_Helper_Abstract
switch($type){ switch($type){
case 'select': case 'select':
return ($this->structureHTML($field['label'], $this->selectHTML($name, $field))); return ($this->structureHTML($field['label'], $this->selectHTML($name, $field)));
case 'selectMultiple':
return ($this->structureHTML($field['label'], $this->selectMultipleHTML($name, $field)));
case 'interval': case 'interval':
return ($this->structureHTML($field['label'], $this->intervalHTML($name, $field))); return ($this->structureHTML($field['label'], $this->intervalHTML($name, $field)));
case 'date': case 'date':
@ -29,59 +31,84 @@ Class Zend_View_Helper_Field extends Zend_View_Helper_Abstract
private function structureHTML($label, $html) private function structureHTML($label, $html)
{ {
return ('<div class="fieldgrp"> $return ='<div class="fieldgrp">
<label>'.$label.'</label> <label>'.$label.'</label>
<div class="field"> <div class="field">
'.$html.' '.$html.'
<span></span> <span><a href="">Switch type</a></span>
</div> </div>
</div>'); </div>';
return ($return);
} }
/* Select */
private function selectHTML($name, $field) private function selectMultipleHTML($name, $field)
{ {
$i = 0;
$return = '<select class="criteres" name="'.$name.'">'; $return = '<select class="criteres" name="'.$name.'">';
$return .= '<option value="tous">Tous</option>'; $return .= '<option value="tous">Tous</option>';
foreach($field['fields'][$field['type']]['value'] as $option) { foreach($field['fields'][$field['type']]['value'] as $option) {
$return .= '<option '.(($field['fields']['selected'] == $option)?'selected':'').' value="'.$option.'">'.$option.'</option>'; $return .= '<option '.(($field['fields']['selected'] == $option)?'selected':'').' value="'.$i++.'">'.$option.'</option>';
} }
$return .= '</select>'; $return .= '</select>';
return ($return); return ($return);
} }
/* Select Multiple */
private function selectHTML($name, $field)
{
$i = 0;
$return = '<select class="criteres" name="'.$name.'">';
$return .= '<option value="tous">Tous</option>';
foreach($field['fields'][$field['type']]['value'] as $option) {
$return .= '<option '.(($field['fields']['selected'] == $option)?'selected':'').' value="'.$i++.'">'.$option.'</option>';
}
$return .= '</select>';
return ($return);
}
/* Interval */
private function intervalHTML($name, $field) private function intervalHTML($name, $field)
{ {
$return .= '<div style="text-align:right;height:17px;">'; $return = '<div class="mySlider" style="text-align:right;height:17px;">';
$return .= '<input value="'.$field['fields'][$field['type']]['value'][0].','.$field['fields'][$field['type']]['value'][1].'" name="'.$name.'" class="range slider_Text" type="text" id="'.$name.'" min="'.$field['fields'][$field['type']]['default'][0].'" max="'.$field['fields'][$field['type']]['default'][1].'" style="margin-left:10px;margin-top:3px;float:left;border:0; color:black; font-weight:bold;" />'; $return .= '<input style="display:none;" value="'.$field['fields'][$field['type']]['value'][0].','.$field['fields'][$field['type']]['value'][1].'" name="'.$name.'" class="range slider_Text" type="text" id="'.$name.'" min="0" max="1000" />';
$return .= '<div input="'.$name.'" class="slider-range"></div></div>'; $return .= '<div input="'.$name.'" class="slider-range"></div></div>';
return ($return); return ($return);
} }
/* Dates */
private function dateHTML($name, $field) private function dateHTML($name, $field)
{ {
$return .= '<input value="" type="text" class="from" name="'.$name.'1" /> a '; $return = '<input value="" type="text" class="datepicker" name="'.$name.'1" /> a ';
$return .= '<input type="text" class="to" name="'.$name.'2" />'; $return .= '<input type="text" class="datepicker" name="'.$name.'2" />';
return ($return); return ($return);
} }
/* Textes */
private function textHTML($name, $field) private function textHTML($name, $field)
{ {
$return .= '<input style="border:1px inset silver;width:60%" class="criteres" type="text" name="'.$name.'" value="'.$field['fields'][$field['type']]['value'].'" /></div>'; $return = '<input style="border:1px inset silver;width:60%" class="criteres" type="text" name="'.$name.'" value="'.$field['fields'][$field['type']]['value'].'" /></div>';
return ($return); return ($return);
} }
private function textareaHTML($name, $field, $item) /* Textarea */
private function textareaHTML($name, $field)
{ {
$return .= '<textarea style="border:1px inset silver;width:60%;height:40px;" name="'.$name.'">'.$field['fields'][$field['type']]['value'].'</textarea>'; $return = '<textarea style="border:1px inset silver;width:60%;height:40px;" name="'.$name.'">'.$field['fields'][$field['type']]['value'].'</textarea>';
return ($return); return ($return);
} }
/* Radios */
private function radioHTML($name, $field, $item) private function radioHTML($name, $field, $item)
{ {
// en cours. $return = '<input type="radio" name="'.$name.'" />';
return ($return);
} }
} }