Platon Technologies
neprihlásený Prihlásiť Registrácia
SlovakEnglish
open source software development oslavujeme 10 rokov vývoja otvoreného softvéru! Pondelok, 30. november 2026
O nás
Magazín
Otvorený softvér
CVS
Služby
Index  »  Projekty  »  phpMyEdit  »  Fórum  »  International issues

phpMyEdit Configuration     International issues
Odoslať novú tému   Odpovedať na tému    
 
paolodp     Založený: 06.07.2006   Príspevky: 11  
Príspevok Zaslal: 2006-07-19 14:40
Návrat hore  Odpovedať s citátom     

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

 
michal     Založený: 17.06.2003   Príspevky: 537   Bydlisko: Slovakia
Príspevok Zaslal: 2006-07-24 10:02
Návrat hore  Odpovedať s citátom     

http://opensource.platon.sk/projects/doc.php/phpMyEdit/html/configuration.output-control.html

date masks and number format don't work ?

but this solves only the output/display part.

the query part can be done by triggers (as you have done) or by 'sqlw' option.

 
Odoslať novú tému   Odpovedať na tému    

Copyright © 2002-2006 Platon Group
Stránka používa redakčný systém Metafox
Na začiatok · Odkazový formulár · Prihláška
Upozorniť na chybu na PLATON.SK webstránke · Podmienky použitia · Ochrana osobných údajov