change date process maker to persian date ( jalali ) or add date picker jalali

5.4k Views Asked by At

I want to change dates shown everywhere in processmaker to another format(Persian calendar). I have my custom class to format dates. What is the best way to override the default function which returns the formatted date? I just found the CurDate method in the G class. Changed it's returned value but dates are still shown in gregorian format. Is there any other method for formatting dates?

I prefer an OOP solution to override the default function instead of hacking the core, if possible.

Thanks.

1

There are 1 best solutions below

4
On BEST ANSWER

http://processmakerplus.com/

For daynaform in PM2.x

1.Add jalali.js(Download) file to path \opt\processmaker\gulliver\js\widgets\pcal

2.Change the maborak file in path \processmaker\gulliver\js\maborak\core\maborak.js changed setup calendar like this

 Calendar.setup({
        inputField: id,
        ifFormat: mask,
        dateType: 'jalali',
        button: id + "[btn]",
        bottomBar: true,
        showsTime: showTIme,
        opacity: 1,
    });

maborak.js

3.In path\processmaker\gulliver\system\class.headPublisher.php and in function printHeader () you must add jalali.js file to header dynaform like this $this->addScriptFile("/js/widgets/pcal/jalali.js");class.publisher.php

For other place like current date top of the home page must in path processmaker\workflow\engine\skinEngine\skinEngine.php and in function _default() replace

$smarty->assign('udate', G::getformatedDate(date('Y-m-d'), 'M d, yyyy', SYS_LANG)) with

include_once("includes/inc.jdf.php");
$smarty->assign('udate', jdate('d F Y'));   

For dynaform in PM 3.x

1.Add bootstrap date picker file(Download) to path processmaker\workflow\public_html\lib\pmdynaform\libs\datepicker\jalali

2.Add address this file to external lib

/lib/pmdynaform/libs/datepicker/jalali/bootstrap-datepicker.js,/lib/pmdynaform/libs/datepicker/jalali/bootstrap-datepicker.css,/lib/pmdynaform/libs/datepicker/jalali/bootstrap-datepicker.fa.js

3.Add input(id=txt_dateSabt) to dynaform and create data picker with this java script code $("#txt_dateSabt").find("input").datepicker();

Sample dynaform with jalali date picker enter image description here enter image description here