From e99fdacad34009cc898581378435eb59d36b4b6c Mon Sep 17 00:00:00 2001 From: Benjamin Renard Date: Fri, 10 Aug 2012 12:32:54 +0200 Subject: [PATCH] SUPANN : Ajout du support generique de champs a etiquette ({SUPANN} ou {UAI}) --- ...lement_supannLabeledValue_label_SUPANN.png | 1 + ...rmElement_supannLabeledValue_label_UAI.png | Bin 0 -> 901 bytes ...class.LSformElement_supannLabeledValue.php | 84 ++++++++++++++++++ .../LSformElement_supannLabeledValue.tpl | 19 ++++ ...LSformElement_supannLabeledValue_field.tpl | 13 +++ 5 files changed, 117 insertions(+) create mode 120000 public_html/images/default/LSformElement_supannLabeledValue_label_SUPANN.png create mode 100644 public_html/images/default/LSformElement_supannLabeledValue_label_UAI.png create mode 100644 public_html/includes/class/class.LSformElement_supannLabeledValue.php create mode 100644 public_html/templates/default/LSformElement_supannLabeledValue.tpl create mode 100644 public_html/templates/default/LSformElement_supannLabeledValue_field.tpl diff --git a/public_html/images/default/LSformElement_supannLabeledValue_label_SUPANN.png b/public_html/images/default/LSformElement_supannLabeledValue_label_SUPANN.png new file mode 120000 index 00000000..b171c1da --- /dev/null +++ b/public_html/images/default/LSformElement_supannLabeledValue_label_SUPANN.png @@ -0,0 +1 @@ +LSformElement_supannRoleEntite_label_SUPANN.png \ No newline at end of file diff --git a/public_html/images/default/LSformElement_supannLabeledValue_label_UAI.png b/public_html/images/default/LSformElement_supannLabeledValue_label_UAI.png new file mode 100644 index 0000000000000000000000000000000000000000..355dfb4d5c7d018d377c5e8d1b329e4a6a031277 GIT binary patch literal 901 zcmWlXU1(Z&7{*UBx}+n|A^OQEpKZ7^`fkc4(p(q6P<7omee?+WeZ23f%F zXpA$d$&AxfQ$LP+w0@oAIr=~5fBZ<*`E`uiqdl^iCc#{Eb03kkOJVxJ?|FEhtM}rS zUzJV{h|Y=-1R0o~lFW2+uuK0N9sl^^JJ&kVb9ZL)65`Iie~2Kx=+!INCuH-FW%FKi z-iQ83$Ynmcj9mQ5ue?tv?o&z`wSf8+D5;ctm2y(0Bo!#NsGw8|piY_$n z++>KF3~}@NmdTJZKTMj8(GBC4*%&h$6E<_qV%~aWN?JFPR&&Z`$vABgGjCxVX~(0C z-I8)xGA>)%i9K=ISv!_;U|AeXyX=|A_-`&e>%a;wXTj~_JdUgfPkZpJ&s_+(3qDUS z;LQaCc`A?#(JTly5gw*J%9SXf$>kd;9wb&v%=9&kvi;gJ!dN*nIIvSFP5c|F&8$ zTCLV!t)ru(zdN*#j*pMq|DCi?UbkPpdU^8t z>3MT_E;rfND~1a@(&0gE|GC-kzxd<_(by=$jlw%;Z+S*;%UY{(sXO9m4 + */ + +class LSformElement_supannLabeledValue extends LSformElement { + + var $template = 'LSformElement_supannLabeledValue.tpl'; + var $fieldTemplate = 'LSformElement_supannLabeledValue_field.tpl'; + + /** + * Retourne les infos d'affichage de l'élément + * + * Cette méthode retourne les informations d'affichage de l'élement + * + * @retval array + */ + function getDisplay(){ + $return = $this -> getLabelInfos(); + + $parseValues=array(); + foreach($this -> values as $val) { + $parseValue=array( + 'value' => $val + ); + $tr=$this -> translate($val); + if ($tr) { + if($tr['translated']) + $parseValue['translated']=$tr['translated']; + if($tr['label']) + $parseValue['label']=$tr['label']; + } + $parseValues[]=$parseValue; + } + $return['html'] = $this -> fetchTemplate(NULL,array('parseValues' => $parseValues)); + return $return; + } + + /** + * Traduit une valeur + * + * @param[in] $value La valeur + * + * @retval array Un tableau cle->valeur contenant translated et label ou False + **/ + function translate($value) { + return array ( + 'translated' => 'NOT IMPLEMENTED', + 'label' => 'NOT IMPLEMENTED', + ); + } + +} + +?> diff --git a/public_html/templates/default/LSformElement_supannLabeledValue.tpl b/public_html/templates/default/LSformElement_supannLabeledValue.tpl new file mode 100644 index 00000000..076f6060 --- /dev/null +++ b/public_html/templates/default/LSformElement_supannLabeledValue.tpl @@ -0,0 +1,19 @@ +
    + {if $parseValues} + {foreach from=$parseValues item=parseValue} + {if $parseValue.translated}{assign var=value value=$parseValue.translated}{else}{assign var=value value=$parseValue.value}{/if} + {if $parseValue.label!="no"}{assign var=label value=$parseValue.label}{else}{assign var=label value=""}{/if} +
  • {include file=$fieldTemplate}
  • + {foreachelse} + {assign var=value value=""} +
  • {include file=$fieldTemplate}
  • + {/foreach} + {else} + {foreach from=$values item=value} +
  • {include file=$fieldTemplate}
  • + {foreachelse} + {assign var=value value=""} +
  • {include file=$fieldTemplate}
  • + {/foreach} + {/if} +
diff --git a/public_html/templates/default/LSformElement_supannLabeledValue_field.tpl b/public_html/templates/default/LSformElement_supannLabeledValue_field.tpl new file mode 100644 index 00000000..6f2d243f --- /dev/null +++ b/public_html/templates/default/LSformElement_supannLabeledValue_field.tpl @@ -0,0 +1,13 @@ +{if $freeze} + {if $value or $parseValue} + {if $parseValue} + {if $label}[{$label}] {/if}{$value} + {else} + {$value} + {/if} + {else} + {$noValueTxt} + {/if} +{else} + +{/if}