From 3659031ed2d0ca29f5bf60f5df949ee019991e96 Mon Sep 17 00:00:00 2001 From: Benjamin Renard Date: Thu, 8 Feb 2018 18:16:23 +0100 Subject: [PATCH 1/2] LSattr_html :: password : add get_mail_attr_function parameter --- .../LSattr_html/LSattr_html_password.docbook | 18 ++++- .../class/class.LSformElement_password.php | 33 +++++++- .../lang/fr_FR.UTF8/LC_MESSAGES/ldapsaisie.mo | Bin 42179 -> 42925 bytes .../lang/fr_FR.UTF8/LC_MESSAGES/ldapsaisie.po | 71 +++++++++++------- public_html/lang/ldapsaisie.pot | 61 +++++++++------ 5 files changed, 129 insertions(+), 54 deletions(-) diff --git a/doc/conf/LSattribute/LSattr_html/LSattr_html_password.docbook b/doc/conf/LSattribute/LSattr_html/LSattr_html_password.docbook index c4f54df4..ecbfa7ce 100644 --- a/doc/conf/LSattribute/LSattr_html/LSattr_html_password.docbook +++ b/doc/conf/LSattribute/LSattr_html/LSattr_html_password.docbook @@ -15,8 +15,8 @@ 'nb' => [nb caractères], 'chars' => '[liste de caractères possibles]' ), - '[autre liste de caractères possible]', // Liste caractère avec un nombre - // d'apparitions égal à 1 + '[autre liste de caractères possibles]', // Liste caractère avec un nombre + // d'apparitions égal à 1 ... ), 'use_pwgen' => [booléen], // Utiliser pwgen pour la génération du mot de passe @@ -28,6 +28,7 @@ 'subject' => "[LSformat du sujet du mail]", 'msg' => "[LSformat du message du mail]", 'mail_attr' => 'mail', // Attribut mail de l'objet + 'get_mail_attr_function' => '[function]', // Fonction retournant l'attribut mail de l'objet 'send' => 1, // Activation par défaut de l'envoi du mot de passe 'ask' => 1, // Laisser le choix à l'utilisateur 'canEdit' => 1 // Activation de l'édition du LSformat du message par l'utilisateur @@ -211,6 +212,19 @@ + + get_mail_attr_function + + Nom de la fonction (ou callable au sens PHP) + qui sera utilisé pour récupérer le nom de l'attribut listant les mails + possibles de l'utilisateur. Cette fonction prendra en paramètre, l'objet + LSformElement courant et devra retourner une valeur + équivalente au paramètre de configuration mail_attr. + Si ce paramètre est défini, il prévalera toujours sur le paramètre + mail_attr. + + + bcc diff --git a/public_html/includes/class/class.LSformElement_password.php b/public_html/includes/class/class.LSformElement_password.php index d810a61c..34ad3cb6 100644 --- a/public_html/includes/class/class.LSformElement_password.php +++ b/public_html/includes/class/class.LSformElement_password.php @@ -154,6 +154,7 @@ class LSformElement_password extends LSformElement { ); if (isset($this -> params['html_options']['mail'])) { $params['mail'] = $this -> params['html_options']['mail']; + $params['mail']['mail_attr'] = $this -> getMailAttrs(); } LSsession :: addJSconfigParam($this -> name,$params); @@ -208,13 +209,35 @@ class LSformElement_password extends LSformElement { return $find; } } - + + function getMailAttrs() { + if (!isset($this -> params['html_options']['mail']) || !is_array($this -> params['html_options']['mail'])) + return False; + if (isset($this -> params['html_options']['mail']['get_mail_attr_function'])) { + if (is_callable($this -> params['html_options']['mail']['get_mail_attr_function'])) { + try { + return call_user_func_array($this -> params['html_options']['mail']['get_mail_attr_function'], array(&$this)); + } + catch(Exception $e) { + LSerror :: addErrorCode('LSformElement_password_05', $e->getMessage()); + } + } + else { + LSerror :: addErrorCode('LSformElement_password_04'); + return False; + } + } + elseif (isset($this -> params['html_options']['mail']['mail_attr'])) { + return $this -> params['html_options']['mail']['mail_attr']; + } + } + function send($params) { if (is_array($this -> sendMail)) { $mail = (String)$this -> sendMail['mail']; Lsdebug($mail); if ($mail=="") { - $mail_attrs = $this -> params['html_options']['mail']['mail_attr']; + $mail_attrs = $this -> getMailAttrs(); if (!is_array($mail_attrs)) { $mail_attrs=array($mail_attrs); } @@ -346,3 +369,9 @@ _("LSformElement_password : Contact mail invalid (%{mail}). Can't send password. LSerror :: defineError('LSformElement_password_03', _("LSformElement_password : Fail to exec pwgen. Check it's correctly installed.") ); +LSerror :: defineError('LSformElement_password_04', +_("LSformElement_password : Fail to determine witch e-mail attribute to use to send new password : get_mail_attr_function parameter not refer to a valid function.") +); +LSerror :: defineError('LSformElement_password_05', +_("LSformElement_password : Fail to determine witch e-mail attribute to use to send new password : get_mail_attr_function throwed an exception : %{msg}") +); diff --git a/public_html/lang/fr_FR.UTF8/LC_MESSAGES/ldapsaisie.mo b/public_html/lang/fr_FR.UTF8/LC_MESSAGES/ldapsaisie.mo index 70fcdfc3a846eb8a84edf644ca0aa2a150b984fc..50ad200d410933d684ce97facabf712446cb98d5 100644 GIT binary patch delta 7416 zcmcK8d3aRS9meqkB!n%7B_tsbGDskhJ%JEN6aomc3Mh*pA?rY5mVwEHC@2@O$Rb!_ z#03OFunJ0DqJoG84YqZmXp3SOskD}&b*U&K2yMUboJ;k2eEMha!!Mt6&OLMXduO!y z^_F{%wscN(4%=wBhPN=L2PU;M<|)!?(JD3Obi6Tr@MBECsP4u@U^-rjx!4PD#Id*t zbMY{$i3?bWQ8YdUC*v%91cw{rm`fxEQ!tFy+u|)4hRd-vu0(ZsH^$(77>;|8kD4Z& zfNx_bOz3F`nu#6APegrwmYXj_=4gBvM*n6JiAV|@jKX!Oj<;ZE+=*>)FRGzKsD^)y z>hN7uy}x4`Ucfj^PPF$6u`BuOT`N%oUxL>;BsP;6g`c2imgTVn7=-P~Uya&=v93O( zs@aH4+B}aM@b54g|9}IqCHpcA2cgjX|AG`Io4UR;0 zSdChVyRakPi`tS$QCn~TwdZYk(nsEcp z!DToOKg2prWf>;oCalHNxC5s%`UQ9aZ^jyyL7zX4lW`jjO|)}=hdm%M zhv}+dkL!87hWw}$V+P_H)Tus*TGF#P9CK6c>25^EV)h}6U{0V`uq6kg8q<(Dm8U=g;= zwgWFgb$lOcVDF(O?wA~7DoISj5x5VzXTC$)FzK8m<>z1`-h)H&X{2xS1?FQS%S6)5 zLgnv9-G3dKgE@~ntjR3njW`OYtN*Ped=#8TFM0>r8NKNmmuF}0b!|copam}tKNjK? zY{JBiPvK!qnd#wsCxTCIy{>Nc8~nXAk7KX9(K9Pc94f-$?ryu{A<+G zPGkdb!Y6PxMldQJx(d|RHDe+6W!-7g%)`;R1MBe9UBr~&TAYwcO#QE$B_ra#L@|4FeAsX z|LSlh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>c&Zv5QQJZ)SHp1soGjtyH{I5~asbLey8b!Rx3!aT~Sf-cQ=| z?uQM@$D?Mh560ocZhk*%Np892PL*ADQ#8a_Zlt27G6&T_5vpUGF&g)x7wUS;Qu%iv zf3FcA5wnSrghu)t!JsQo$V;ewqD`)i%O-3KoK0c`@jbDI_=2E==53-2p^GIpb=;Ph z7ng=bIxkd~+dm87AaRAzFm#Z09k5jXP>&7ByItG54}OHQL&Y<~Lmh8QI*{|j68w~CK6BBDN7SO^Y2D@eia1HsBt9lObMIl)8EsAa&J{u0*UhI<7~tOc15=48 z_n!Xmc6DMQWm}09x16_Cq;CsP_4\n" "Language-Team: LdapSaisie \n" @@ -18,7 +18,7 @@ msgstr "" "Content-Transfer-Encoding: 8bit\n" "X-Poedit-SourceCharset: utf-8\n" "X-Poedit-Basepath: /var/www/ldapsaisie/trunk\n" -"X-Generator: Poedit 1.6.10\n" +"X-Generator: Poedit 1.8.11\n" #: view.php:44 modify.php:54 #: includes/class/class.LSformElement_supannCompositeAttribute.php:106 @@ -1218,30 +1218,49 @@ msgstr "" msgid "Modify the mail sent to notice the user" msgstr "Modifier mail de notification de l'utilisateur" -#: includes/class/class.LSformElement_password.php:261 +#: includes/class/class.LSformElement_password.php:284 msgid "Notice mail sent." msgstr "Le mail de notification a été envoyé." -#: includes/class/class.LSformElement_password.php:341 +#: includes/class/class.LSformElement_password.php:364 msgid "LSformElement_password : No contact mail available to send password." msgstr "" "LSformElement_password : Aucun mail de contact disponible pour envoyer le " "mot de passe." -#: includes/class/class.LSformElement_password.php:344 +#: includes/class/class.LSformElement_password.php:367 msgid "" "LSformElement_password : Contact mail invalid (%{mail}). Can't send password." msgstr "" "LSformElement_password : Mail de contact invalide (%{mail}). Impossible " "d'envoyer le mot de passe." -#: includes/class/class.LSformElement_password.php:347 +#: includes/class/class.LSformElement_password.php:370 msgid "" "LSformElement_password : Fail to exec pwgen. Check it's correctly installed." msgstr "" "LSformElement_password : Impossible d'exécuter pwgen. Vérifier qu'il est " "bien installé." +#: includes/class/class.LSformElement_password.php:373 +msgid "" +"LSformElement_password : Fail to determine witch e-mail attribute to use to " +"send new password : get_mail_attr_function parameter not refer to a valid " +"function." +msgstr "" +"LSformElement_password : Impossible de déterminer quel attribut e-mail doit " +"être utilisé pour l'envoi du mot de passe : le paramètre " +"get_mail_attr_function ne fait pas référence à une fonction valide." + +#: includes/class/class.LSformElement_password.php:376 +msgid "" +"LSformElement_password : Fail to determine witch e-mail attribute to use to " +"send new password : get_mail_attr_function throwed an exception : %{msg}" +msgstr "" +"LSformElement_password : Impossible de déterminer quel attribut e-mail doit " +"être utilisé pour l'envoi du mot de passe : le fonction " +"get_mail_attr_function a déclenchée une exception : %{msg}." + #: includes/class/class.LSformElement_url.php:51 msgid "Display this website." msgstr "Afficher le site internet." @@ -1484,38 +1503,38 @@ msgstr "Étape" msgid "Pedagogical element" msgstr "Élement pédagogique" -#: includes/class/class.LSsearch.php:1037 +#: includes/class/class.LSsearch.php:1043 msgid "Actions" msgstr "Actions" -#: includes/class/class.LSsearch.php:1040 +#: includes/class/class.LSsearch.php:1046 msgid "This search didn't get any result." msgstr "Cette recherche n'a retournée aucun résultat" -#: includes/class/class.LSsearch.php:1292 +#: includes/class/class.LSsearch.php:1298 msgid "LSsearch : Invalid filter : %{filter}." msgstr "LSsearch : Filtre invalide : %{filter}." -#: includes/class/class.LSsearch.php:1295 +#: includes/class/class.LSsearch.php:1301 msgid "LSsearch : Invalid basedn : %{basedn}." msgstr "LSsearch : Base DN invalide." -#: includes/class/class.LSsearch.php:1298 +#: includes/class/class.LSsearch.php:1304 msgid "LSsearch : Invalid value for %{param} parameter." msgstr "LSsearch : La valeur du paramètre %{param} est incorrecte." -#: includes/class/class.LSsearch.php:1301 +#: includes/class/class.LSsearch.php:1307 msgid "" "LSsearch : Invalid size limit. Must be an integer greater or equal to 0." msgstr "" "LSsearch : Limite de taille de recherche invalide. Elle doit être un entier " "supérieur ou égal à 0." -#: includes/class/class.LSsearch.php:1304 +#: includes/class/class.LSsearch.php:1310 msgid "LSsearch : Invalid parameter %{attr}. Must be an boolean." msgstr "LSsearch : Paramètre %{param} invalide. Il doit être un booléen." -#: includes/class/class.LSsearch.php:1307 +#: includes/class/class.LSsearch.php:1313 msgid "" "LSsearch : Invalid parameter attributes. Must be an string or an array of " "strings." @@ -1523,13 +1542,13 @@ msgstr "" "LSsearch : Paramètre 'attributes' invalide. Il doit être une chaîne de " "caractères ou un tableau de chaînes de caractères." -#: includes/class/class.LSsearch.php:1310 +#: includes/class/class.LSsearch.php:1316 msgid "LSsearch : Can't build attributes list for make filter." msgstr "" "LSsearch : Impossible de construire la liste des attributs pour faire le " "filtre." -#: includes/class/class.LSsearch.php:1313 +#: includes/class/class.LSsearch.php:1319 msgid "" "LSsearch : Error building filter with attribute '%{attr}' and pattern " "'%{pattern}'" @@ -1537,34 +1556,34 @@ msgstr "" "LSsearch : Problème en construisant le filtre avec l'attribut '%{attr}' et " "le mot clé '%{pattern}'" -#: includes/class/class.LSsearch.php:1316 +#: includes/class/class.LSsearch.php:1322 msgid "LSsearch : Error combining filters." msgstr "LSsearch : Problème en combinant les filtres." -#: includes/class/class.LSsearch.php:1319 +#: includes/class/class.LSsearch.php:1325 msgid "LSsearch : Invalid pattern." msgstr "LSsearch : Mot clé invalide." -#: includes/class/class.LSsearch.php:1322 +#: includes/class/class.LSsearch.php:1328 msgid "LSsearch : Invalid attribute %{attr} in parameters." msgstr "LSsearch : Attribut %{attr} incorrect dans les paramètres." -#: includes/class/class.LSsearch.php:1325 +#: includes/class/class.LSsearch.php:1331 msgid "LSsearch : Error during the search." msgstr "LSsearch : Erreur pendant la recherche." -#: includes/class/class.LSsearch.php:1328 +#: includes/class/class.LSsearch.php:1334 msgid "LSsearch : Error sorting the search." msgstr "LSsearch : Erreur pendant le trie de la recherche." -#: includes/class/class.LSsearch.php:1331 +#: includes/class/class.LSsearch.php:1337 msgid "" "LSsearch : The function of the custum information %{name} is not callable." msgstr "" "LSsearch : La fonction de l'information personnalisée %{name} n'est pas " "exécutable." -#: includes/class/class.LSsearch.php:1334 +#: includes/class/class.LSsearch.php:1340 msgid "" "LSsearch : Invalid predefinedFilter for LSobject type %{type} : %{label} " "(filter : %{filter})." @@ -1572,7 +1591,7 @@ msgstr "" "LSsearch : PredefinedFilter invalide pour le type d'LSobject %{type} : " "%{label} (filtre : %{filter})." -#: includes/class/class.LSsearch.php:1337 +#: includes/class/class.LSsearch.php:1343 msgid "LSsearch : Error during execution of the custom action %{customAction}." msgstr "" "LSldapObject : Erreur durant l'exécution de l'action personnalisée " @@ -1650,7 +1669,7 @@ msgstr "Erreur inconnu : %{error}" msgid "PHP error : %{error}" msgstr "Erreur PHP : %{error}" -#: includes/class/class.LSsearchEntry.php:250 +#: includes/class/class.LSsearchEntry.php:257 msgid "" "LSsearchEntry : Invalid formaterFunction %{func} for extraDisplayedColumns " "%{column}." diff --git a/public_html/lang/ldapsaisie.pot b/public_html/lang/ldapsaisie.pot index 31a2813e..87980c5d 100644 --- a/public_html/lang/ldapsaisie.pot +++ b/public_html/lang/ldapsaisie.pot @@ -8,7 +8,7 @@ msgid "" msgstr "" "Project-Id-Version: PACKAGE VERSION\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2017-10-12 14:50+0200\n" +"POT-Creation-Date: 2018-02-08 18:12+0100\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "Last-Translator: FULL NAME \n" "Language-Team: LANGUAGE \n" @@ -1040,24 +1040,37 @@ msgstr "" msgid "Modify the mail sent to notice the user" msgstr "" -#: includes/class/class.LSformElement_password.php:261 +#: includes/class/class.LSformElement_password.php:284 msgid "Notice mail sent." msgstr "" -#: includes/class/class.LSformElement_password.php:341 +#: includes/class/class.LSformElement_password.php:364 msgid "LSformElement_password : No contact mail available to send password." msgstr "" -#: includes/class/class.LSformElement_password.php:344 +#: includes/class/class.LSformElement_password.php:367 msgid "" "LSformElement_password : Contact mail invalid (%{mail}). Can't send password." msgstr "" -#: includes/class/class.LSformElement_password.php:347 +#: includes/class/class.LSformElement_password.php:370 msgid "" "LSformElement_password : Fail to exec pwgen. Check it's correctly installed." msgstr "" +#: includes/class/class.LSformElement_password.php:373 +msgid "" +"LSformElement_password : Fail to determine witch e-mail attribute to use to " +"send new password : get_mail_attr_function parameter not refer to a valid " +"function." +msgstr "" + +#: includes/class/class.LSformElement_password.php:376 +msgid "" +"LSformElement_password : Fail to determine witch e-mail attribute to use to " +"send new password : get_mail_attr_function throwed an exception : %{msg}" +msgstr "" + #: includes/class/class.LSformElement_url.php:51 msgid "Display this website." msgstr "" @@ -1280,83 +1293,83 @@ msgstr "" msgid "Pedagogical element" msgstr "" -#: includes/class/class.LSsearch.php:1037 +#: includes/class/class.LSsearch.php:1043 msgid "Actions" msgstr "" -#: includes/class/class.LSsearch.php:1040 +#: includes/class/class.LSsearch.php:1046 msgid "This search didn't get any result." msgstr "" -#: includes/class/class.LSsearch.php:1292 +#: includes/class/class.LSsearch.php:1298 msgid "LSsearch : Invalid filter : %{filter}." msgstr "" -#: includes/class/class.LSsearch.php:1295 +#: includes/class/class.LSsearch.php:1301 msgid "LSsearch : Invalid basedn : %{basedn}." msgstr "" -#: includes/class/class.LSsearch.php:1298 +#: includes/class/class.LSsearch.php:1304 msgid "LSsearch : Invalid value for %{param} parameter." msgstr "" -#: includes/class/class.LSsearch.php:1301 +#: includes/class/class.LSsearch.php:1307 msgid "" "LSsearch : Invalid size limit. Must be an integer greater or equal to 0." msgstr "" -#: includes/class/class.LSsearch.php:1304 +#: includes/class/class.LSsearch.php:1310 msgid "LSsearch : Invalid parameter %{attr}. Must be an boolean." msgstr "" -#: includes/class/class.LSsearch.php:1307 +#: includes/class/class.LSsearch.php:1313 msgid "" "LSsearch : Invalid parameter attributes. Must be an string or an array of " "strings." msgstr "" -#: includes/class/class.LSsearch.php:1310 +#: includes/class/class.LSsearch.php:1316 msgid "LSsearch : Can't build attributes list for make filter." msgstr "" -#: includes/class/class.LSsearch.php:1313 +#: includes/class/class.LSsearch.php:1319 msgid "" "LSsearch : Error building filter with attribute '%{attr}' and pattern " "'%{pattern}'" msgstr "" -#: includes/class/class.LSsearch.php:1316 +#: includes/class/class.LSsearch.php:1322 msgid "LSsearch : Error combining filters." msgstr "" -#: includes/class/class.LSsearch.php:1319 +#: includes/class/class.LSsearch.php:1325 msgid "LSsearch : Invalid pattern." msgstr "" -#: includes/class/class.LSsearch.php:1322 +#: includes/class/class.LSsearch.php:1328 msgid "LSsearch : Invalid attribute %{attr} in parameters." msgstr "" -#: includes/class/class.LSsearch.php:1325 +#: includes/class/class.LSsearch.php:1331 msgid "LSsearch : Error during the search." msgstr "" -#: includes/class/class.LSsearch.php:1328 +#: includes/class/class.LSsearch.php:1334 msgid "LSsearch : Error sorting the search." msgstr "" -#: includes/class/class.LSsearch.php:1331 +#: includes/class/class.LSsearch.php:1337 msgid "" "LSsearch : The function of the custum information %{name} is not callable." msgstr "" -#: includes/class/class.LSsearch.php:1334 +#: includes/class/class.LSsearch.php:1340 msgid "" "LSsearch : Invalid predefinedFilter for LSobject type %{type} : %{label} " "(filter : %{filter})." msgstr "" -#: includes/class/class.LSsearch.php:1337 +#: includes/class/class.LSsearch.php:1343 msgid "LSsearch : Error during execution of the custom action %{customAction}." msgstr "" @@ -1428,7 +1441,7 @@ msgstr "" msgid "PHP error : %{error}" msgstr "" -#: includes/class/class.LSsearchEntry.php:250 +#: includes/class/class.LSsearchEntry.php:257 msgid "" "LSsearchEntry : Invalid formaterFunction %{func} for extraDisplayedColumns " "%{column}." From 1fe65e0d6b1e3b6c2233a9c1d5dd7b28572cbbc5 Mon Sep 17 00:00:00 2001 From: Benjamin Renard Date: Mon, 19 Feb 2018 11:18:55 +0100 Subject: [PATCH 2/2] LSattr_html::valueWithUnit : add translate_labels, store_integer and round_down parameters --- .../LSattr_html_valueWithUnit.docbook | 28 ++++++++++++++++++- .../class.LSformElement_valueWithUnit.php | 16 +++++++++-- 2 files changed, 40 insertions(+), 4 deletions(-) diff --git a/doc/conf/LSattribute/LSattr_html/LSattr_html_valueWithUnit.docbook b/doc/conf/LSattribute/LSattr_html/LSattr_html_valueWithUnit.docbook index d3765129..7e0d1ef7 100644 --- a/doc/conf/LSattribute/LSattr_html/LSattr_html_valueWithUnit.docbook +++ b/doc/conf/LSattribute/LSattr_html/LSattr_html_valueWithUnit.docbook @@ -11,9 +11,12 @@ '[facteur2]' => '[label unit2]', [...] ), + 'translate_labels' => [booléen], 'nb_decimals' => [number of decimals], 'dec_point' => '[decimals point]', - 'thousands_sep' => '[thousands separator]' + 'thousands_sep' => '[thousands separator]', + 'store_integer' => [booléen], + 'round_down' => [booléen], ) ),]]> ... @@ -29,6 +32,13 @@ + + translate_labels + + Booléen permettant d'activer/désactiver la traduction des labels (Par defaut : Vrai). + + + nb_decimals @@ -50,6 +60,22 @@ + + store_integer + + Booléen permettant d'activer/désactiver le stockage de valeurs entières (Par defaut : + Vrai). + + + + + round_down + + Booléen permettant d'arrondir à l'entier inférieur (et non à l'entier supérieur + par défaut) en cas de stockage de valeurs entières. + + + diff --git a/public_html/includes/class/class.LSformElement_valueWithUnit.php b/public_html/includes/class/class.LSformElement_valueWithUnit.php index c793150e..1c369d97 100644 --- a/public_html/includes/class/class.LSformElement_valueWithUnit.php +++ b/public_html/includes/class/class.LSformElement_valueWithUnit.php @@ -44,7 +44,7 @@ class LSformElement_valueWithUnit extends LSformElement { if (isset($this -> params['html_options']['units']) && is_array($this -> params['html_options']['units'])) { $units=array(); foreach($this -> params['html_options']['units'] as $sill => $label) { - $units[$sill]=__($label); + $units[$sill]=((!isset($this -> params['html_options']['translate_labels']) || $this -> params['html_options']['translate_labels'])?__($label):$label); } krsort($units); return $units; @@ -162,8 +162,18 @@ class LSformElement_valueWithUnit extends LSformElement { $f = 1; if (isset($_POST[$this -> name.'_unitFact'][$key]) && ($_POST[$this -> name.'_unitFact'][$key]!=1)) { $f = $_POST[$this -> name.'_unitFact'][$key]; - } - $return[$this -> name][$key] = ($val*$f); + } + if (isset($this -> params['html_options']['store_integer']) && $this -> params['html_options']['store_integer']) { + if (isset($this -> params['html_options']['round_down']) && $this -> params['html_options']['round_down']) { + $return[$this -> name][$key] = floor($val*$f); + } + else { + $return[$this -> name][$key] = ceil($val*$f); + } + } + else { + $return[$this -> name][$key] = ($val*$f); + } } } }