Hi,
I'm trying using PME and I find it very very nice;
anyway, as I'm a french user, I need that numbers and (possibly) dates have correct mask in display AND in add/edit mode.
numbers in French has ',' as decimal separator: is there a way to do this ?
dates in MySql are in Y-m-d format; following a topic of Michal I tried to obtain d/m/Y format with update/insert before trigger, so I defined the date field as
| Kód: |
$opts['fdd']['DateResiliation'] = array(
'name' => 'Date Résiliation',
'select' => 'N',
'options' => 'AVCPDL',
'maxlen' => 10,
'datemask' => 'd/m/Y',
'calendar' => array(
'firstDay' => 1,
'ifFormat' => '%d/%m/%Y', // defaults to the ['strftimemask']
'singleClick' => true,
'weekNumbers' => false,
'showsTime' => false,
'timeFormat' => '24',
'button' => true,
'label' => '...',
'date' => date('%d/%m/%Y')) ,
'sort' => true,
'nowrap' => false,
'required' => false,
'help' => ''
);
$opts['triggers']['update']['pre'] = './TUP_Sante.inc';
$opts['triggers']['insert']['pre'] = './TUP_Sante.inc';
$opts['triggers']['update']['before'] = './TUB_Sante.inc';
$opts['triggers']['insert']['before'] = './TUB_Sante.inc';
|
(as you see,I'm using mce_cal extension)
and I created the two triggers files
| Kód: |
//TUP_Sante.inc
<?php
function dateen2fr($mydate){
list($date, $time) = explode(" ", $mydate);
list($year, $month, $day) = explode("-", $date);
return "$day/$month/$year";
}
$oldvals['DateResiliation']=dateen2fr($oldvals['DateResiliation'])
$newvals['DateResiliation']=dateen2fr($newvals['DateResiliation'])
?>
//TUB_Sante.inc
<?php
function datefr2en($mydate){
@list($jour,$mois,$annee)=explode('/',$mydate);
return @date('Y-m-d',mktime(0,0,0,$mois,$jour,$annee));
}
$newvals['DateResiliation']=datefr2en($newvals['DateResiliation'])
?>
|
The pre trigger don't work - I don't know why.
Anyway, even if this maybe can work, it is very heavy to implement for each date field (and similarly for each number field with decimals) and I'd like to know if there is another simpler way to do this.
Nepto and others fantastic pme developers would perhaps consider to fix it in main pme class ?
best regards
|