timepicker.js.php 2.8 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667
  1. <?php
  2. /* Copyright (C) 2012 Regis Houssin <regis.houssin@capnetworks.com>
  3. * Copyright (C) 2012 Laurent Destailleur <eldy@users.sourceforge.net>
  4. *
  5. * This program is free software; you can redistribute it and/or modify
  6. * it under the terms of the GNU General Public License as published by
  7. * the Free Software Foundation; either version 3 of the License, or
  8. * (at your option) any later version.
  9. *
  10. * This program is distributed in the hope that it will be useful,
  11. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  12. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  13. * GNU General Public License for more details.
  14. *
  15. * You should have received a copy of the GNU General Public License
  16. * along with this program. If not, see <http://www.gnu.org/licenses/>.
  17. */
  18. /**
  19. * \file htdocs/core/js/timepicker.js.php
  20. * \brief File that include javascript functions for timepicker
  21. */
  22. //if (! defined('NOREQUIREUSER')) define('NOREQUIREUSER','1'); // Not disabled cause need to load personalized language
  23. //if (! defined('NOREQUIREDB')) define('NOREQUIREDB','1');
  24. if (! defined('NOREQUIRESOC')) define('NOREQUIRESOC','1');
  25. //if (! defined('NOREQUIRETRAN')) define('NOREQUIRETRAN','1'); // Not disabled cause need to do translations
  26. if (! defined('NOCSRFCHECK')) define('NOCSRFCHECK',1);
  27. if (! defined('NOTOKENRENEWAL')) define('NOTOKENRENEWAL',1);
  28. if (! defined('NOLOGIN')) define('NOLOGIN',1);
  29. if (! defined('NOREQUIREMENU')) define('NOREQUIREMENU',1);
  30. if (! defined('NOREQUIREHTML')) define('NOREQUIREHTML',1);
  31. if (! defined('NOREQUIREAJAX')) define('NOREQUIREAJAX','1');
  32. session_cache_limiter(FALSE);
  33. require_once '../../main.inc.php';
  34. // Define javascript type
  35. top_httphead('text/javascript; charset=UTF-8');
  36. // Important: Following code is to avoid page request by browser and PHP CPU at each Dolibarr page access.
  37. if (empty($dolibarr_nocache)) header('Cache-Control: max-age=3600, public, must-revalidate');
  38. else header('Cache-Control: no-cache');
  39. ?>
  40. // For JQuery Timepicker
  41. jQuery(function($){
  42. $.timepicker.regional['<?php echo $langs->defaultlang ?>'] = {
  43. timeOnlyTitle: '<?php echo $langs->trans("TimeOnly") ?>',
  44. timeText: '<?php echo $langs->trans("Time") ?>',
  45. hourText: '<?php echo $langs->trans("Hour") ?>',
  46. minuteText: '<?php echo $langs->trans("Minute") ?>',
  47. secondText: '<?php echo $langs->trans("Second") ?>',
  48. millisecText: '<?php echo $langs->trans("Millisecond") ?>',
  49. timezoneText: '<?php echo $langs->trans("Timezone") ?>',
  50. currentText: '<?php echo $langs->trans("Now") ?>',
  51. closeText: '<?php echo $langs->trans("Close2") ?>',
  52. timeFormat: 'HH:mm',
  53. amNames: ['AM', 'A'],
  54. pmNames: ['PM', 'P'],
  55. isRTL: <?php echo ($langs->trans("DIRECTION")=='rtl'?'true':'false'); ?>
  56. };
  57. $.timepicker.setDefaults($.timepicker.regional['<?php echo $langs->defaultlang ?>']);
  58. });
  59. <?php
  60. if (is_object($db)) $db->close();