Corrections

This commit is contained in:
Michael RICOIS 2012-05-10 12:23:24 +00:00
commit fae32b348d
3 changed files with 40 additions and 38 deletions

View File

@ -25,6 +25,7 @@ class JuridiqueController extends Zend_Controller_Action
public function completedAction()
{
require_once APPLICATION_PATH . '/models/FormeJuridique.php';
$table = new Application_Model_FormJuridique();
$this->_helper->layout()->disableLayout();
$this->_helper->viewRenderer->setNoRender();

View File

@ -1,67 +1,67 @@
<?php
Class Zend_View_Helper_Field extends Zend_View_Helper_Abstract
{
{
public function Field($name, $field, $type = null)
{
$html = '';
if($field != null) {
$html.= '<div class="fieldgrp">';
$html.= '<div class="fieldgrp">';
if($type == null)
$type = $field['type'];
switch($type)
{
case 'select':
$html.= $this->structureHTML(
$field['label'],
$field['label'],
$this->selectHTML($name, $field));
break;
case 'selectMultiple':
$html.= $this->structureHTML(
$field['label'],
$field['label'],
$this->selectMultipleHTML($name, $field));
break;
case 'intervalSelect':
$html.= $this->structureHTML(
$field['label'],
$field['label'],
$this->intervalSelectHTML($name, $field));
break;
case 'interval':
$html.= $this->structureHTML(
$field['label'],
$field['label'],
$this->intervalHTML($name, $field));
break;
case 'date':
$html.= $this->structureHTML(
$field['label'],
$field['label'],
$this->dateHTML($name, $field));
break;
case 'text':
switch($name) {
case 'reg':
$label = 'Localisation Régions';
$label = 'Régions';
break;
case 'vil':
case 'adr_com':
$label = 'Localisation Villes';
$label = 'Villes';
break;
case 'dep':
$label = 'Localisation Départements';
$label = 'Départements';
break;
default:
$label = $field['label'];
}
$html.= $this->structureHTML(
$label,
$label,
$this->textHTML($name, $field, $name), $field['help'][ucfirst($name)]);
break;
case 'textarea':
$html.= $this->structureHTML(
$field['label'],
$field['label'],
$this->textareaHTML($name, $field));
break;
case 'radio':
$html.= $this->structureHTML(
$field['label'],
$field['label'],
$this->radioHTML($name, $field));
break;
case 'file':
@ -74,7 +74,7 @@ Class Zend_View_Helper_Field extends Zend_View_Helper_Abstract
}
return $html;
}
private function structureHTML($label, $html, $help = null)
{
$out = '';
@ -82,7 +82,7 @@ Class Zend_View_Helper_Field extends Zend_View_Helper_Abstract
$out.= '<div class="field">'.$html.'</div>';
return $out;
}
/**
* Définition du label
* @param unknown_type $label
@ -93,7 +93,7 @@ Class Zend_View_Helper_Field extends Zend_View_Helper_Abstract
if($help)
$return .= '<p style="font-size:9px;">'.$help.'</p>';
return ($return);
}
@ -106,7 +106,7 @@ Class Zend_View_Helper_Field extends Zend_View_Helper_Abstract
}
return ($valeur);
}
private function intervalSelectHTML($name, $field)
{
$session = new SessionCiblage();
@ -119,7 +119,7 @@ Class Zend_View_Helper_Field extends Zend_View_Helper_Abstract
else
$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) {
@ -128,22 +128,22 @@ Class Zend_View_Helper_Field extends Zend_View_Helper_Abstract
else
$return .= '<option '.(($sessionValeur[1] == $elements[1])?'selected':'').' value="'. $elements[1].'">'.number_format($elements[1], 0,'', ' ').'</option>';
}
$return .= '</select>';
$return .= ' <span id="'.$name.'"><a href="" class="intervalSelect" id="'.$name.'">Valider</a></span>';
return ($return);
}
/* Select */
private function selectMultipleHTML($name, $field)
{
$session = new SessionCiblage();
$sessionValeur = $session->getCritere($name);
/*if(is_array($sessionValeur))
$sessionValeur = implode(',', $sessionValeur);*/
$return = '<select size="'.count($field['fields'][$field['type']]['value']).'" class="criteres '.$field['type']['class'].'" name="'.$name.'" multiple>';
$return .= '<option '.(($sessionValeur == 'tous')?'selected':'').' value="tous">Tous</option>';
$return .= '<option '.(($sessionValeur == '-')?'selected':'').' value="-">-</option>';
foreach($field['fields'][$field['type']]['value'] as $value => $label) {
$selected = "";
if(($sessionValeur != null) and in_array($value, $sessionValeur) and $sessionValeur != "tous")
@ -153,56 +153,56 @@ Class Zend_View_Helper_Field extends Zend_View_Helper_Abstract
$return .= '</select>';
return ($return);
}
/* Select Multiple */
private function selectHTML($name, $field)
{
$session = new SessionCiblage();
$sessionValeur = $session->getCritere($name);
if(is_array($sessionValeur))
$sessionValeur = implode(',', $sessionValeur);
$return = '<select class="criteres '.$field['type']['class'].'" name="'.$name.'">';
$return .= '<option '.(($sessionValeur == 'tous')?'selected':'').' value="tous">Tous</option>';
$return .= '<option '.(($sessionValeur == '-')?'selected':'').' value="-">-</option>';
foreach($field['fields'][$field['type']]['value'] as $value => $label) {
$selected = "";
if(($sessionValeur != null) and $sessionValeur == $value and $sessionValeur != "tous")
if(($sessionValeur != null) and $sessionValeur == $value and $sessionValeur != "-")
$selected = " selected";
$return .= '<option'.$selected.' value="'.$value.'">'.$label.'</option>';
}
$return .= '</select>';
return ($return);
}
/* Interval */
private function intervalHTML($name, $field)
{
$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].'" /> à ';
$return .= '<input class="'.$field['class'].'" type="text" name="'.$name.'2" value="'.$valeur[1].'" />';
$return .= ' <a href="" class="interval" id="'.$name.'">Valider</a>';
$return .= '</div>';
return ($return);
}
/* Dates */
private function dateHTML($name, $field)
{
$session = new SessionCiblage();
$return = '<div class="date" >';
$return .= '<input value="'.$session->getCritere($name).'" type="text" class="datepicker" name="'.$name.'1" /> a ';
$return .= '<input type="text" class="datepicker" name="'.$name.'2" />';
$return .= '</div>';
return ($return);
}
/* Textes */
private function textHTML($name, $field, $name)
{
@ -235,7 +235,7 @@ Class Zend_View_Helper_Field extends Zend_View_Helper_Abstract
$return .= '<a href="" class="autocomplet" textarea="'.$name.'">Valider</a> <a href="">Aide</a>';
return ($return);
}
/* Textarea */
private function textareaHTML($name, $field)
{
@ -246,17 +246,17 @@ Class Zend_View_Helper_Field extends Zend_View_Helper_Abstract
$return .= ' <img src="/themes/default/images/img_carte_fr.gif" title="Carte de france"/>';
return ($return);
}
private function fileuploadHtml($name, $field)
{
$return = '<input class="upload" type="file" name="fichier" id="'.$name.'" /> ';
return ($return);
}
/* Radios */
private function radioHTML($name, $field, $item)
{
$return = '<input type="radio" name="'.$name.'" />';
$return = '<input type="radio" name="'.$name.'" />';
return ($return);
}
}

View File

@ -24,7 +24,7 @@ Class Fields
'siege' => array(
'label' => 'Type d\'établissement',
'fields' => array(
'select' => array('value' => array('1' => 'Sièges uniquement', '0' => 'Secondaires')),
'select' => array('value' => array('1' => 'Sièges', '0' => 'Secondaires')),
),
'famille' => 'entreprise',
'activated' => true,
@ -1015,6 +1015,7 @@ Class Fields
protected function fj($name, $valeur)
{
require_once APPLICATION_PATH . '/models/FormeJuridique.php';
$table = new Application_Model_FormJuridique();
if(strlen($valeur) < 5) {