diff --git a/trunk/includes/class/class.LSformElement_boolean.php b/trunk/includes/class/class.LSformElement_boolean.php
index bd6b6d32..59f71c3c 100644
--- a/trunk/includes/class/class.LSformElement_boolean.php
+++ b/trunk/includes/class/class.LSformElement_boolean.php
@@ -32,6 +32,9 @@
class LSformElement_boolean extends LSformElement {
+ var $fieldTemplate = 'LSformElement_boolean_field.tpl';
+ var $template = 'LSformElement_boolean.tpl';
+
/**
* Retourne les infos d'affichage de l'élément
*
@@ -41,79 +44,19 @@ class LSformElement_boolean extends LSformElement {
*/
function getDisplay(){
$return = $this -> getLabelInfos();
- // value
if (!$this -> isFreeze()) {
- $return['html'] = "
\n";
$GLOBALS['LSsession'] -> addJSscript('LSformElement_boolean.js');
}
- else {
- $return['html'] = "\n";
- if (empty($this -> values)) {
- $return['html'] .= "- "._('Aucune valeur definie')."
\n";
- }
- else {
- $return['html'] .= "- ".(($this -> isTrue($this -> values))?_('Oui'):_('Non'))."
\n";
- }
- $return['html'] .= "
\n";
- }
+ $return['html'] = $this -> fetchTemplate(
+ NULL,
+ array(
+ 'yesTxt' => _('Oui'),
+ 'noTxt' => _('Non')
+ )
+ );
return $return;
}
- /**
- * Retourne le code HTML d'un champ vide
- *
- * @retval string Code HTML d'un champ vide.
- */
- function getEmptyField() {
- return " "._('Oui')." "._('Non');
- }
-
- /**
- * Determine si la valeur passé en paramètre correspond a True ou non
- *
- * - true = si $data[] contient un champ à 1
- * - false = sinon
- *
- * @param[in] $data La valeur de l'attribut
- *
- * @retval boolean True ou False
- */
- function isTrue($data) {
- if(!is_array($data)) {
- $data=array($data);
- }
- if($data[0]=='yes') {
- return true;
- }
- return;
- }
-
- /**
- * Determine si la valeur passé en paramètre correspond a False ou non
- *
- * @param[in] $data La valeur de l'attribut
- *
- * @retval boolean True ou False
- */
- function isFalse($data) {
- if(!is_array($data)) {
- $data=array($data);
- }
- if($data[0]=='no') {
- return true;
- }
- return;
- }
-
}
?>
diff --git a/trunk/templates/default/LSformElement_boolean.tpl b/trunk/templates/default/LSformElement_boolean.tpl
new file mode 100644
index 00000000..c48bd505
--- /dev/null
+++ b/trunk/templates/default/LSformElement_boolean.tpl
@@ -0,0 +1,7 @@
+
diff --git a/trunk/templates/default/LSformElement_boolean_field.tpl b/trunk/templates/default/LSformElement_boolean_field.tpl
new file mode 100644
index 00000000..61f9843d
--- /dev/null
+++ b/trunk/templates/default/LSformElement_boolean_field.tpl
@@ -0,0 +1,5 @@
+{if $freeze}
+{if $value=='yes'}{$yesTxt}{elseif $value=='no'}{$noTxt}{else}{$noValueTxt}{/if}
+{else}
+{$yesTxt} {$noTxt}
+{/if}