timepicker.js.php 2.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687
  1. <?php
  2. /* Copyright (C) 2012 Regis Houssin <regis.houssin@inodbox.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 <https://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('NOREQUIRESOC')) {
  23. define('NOREQUIRESOC', '1');
  24. }
  25. if (!defined('NOCSRFCHECK')) {
  26. define('NOCSRFCHECK', 1);
  27. }
  28. if (!defined('NOTOKENRENEWAL')) {
  29. define('NOTOKENRENEWAL', 1);
  30. }
  31. if (!defined('NOLOGIN')) {
  32. define('NOLOGIN', 1);
  33. }
  34. if (!defined('NOREQUIREMENU')) {
  35. define('NOREQUIREMENU', 1);
  36. }
  37. if (!defined('NOREQUIREHTML')) {
  38. define('NOREQUIREHTML', 1);
  39. }
  40. if (!defined('NOREQUIREAJAX')) {
  41. define('NOREQUIREAJAX', '1');
  42. }
  43. session_cache_limiter('public');
  44. require_once '../../main.inc.php';
  45. /*
  46. * View
  47. */
  48. // Define javascript type
  49. top_httphead('text/javascript; charset=UTF-8');
  50. // Important: Following code is to avoid page request by browser and PHP CPU at each Dolibarr page access.
  51. if (empty($dolibarr_nocache)) {
  52. header('Cache-Control: max-age=10800, public, must-revalidate');
  53. } else {
  54. header('Cache-Control: no-cache');
  55. }
  56. ?>
  57. // For JQuery Timepicker
  58. jQuery(function($){
  59. $.timepicker.regional['<?php echo $langs->defaultlang ?>'] = {
  60. timeOnlyTitle: '<?php echo $langs->trans("TimeOnly") ?>',
  61. timeText: '<?php echo $langs->trans("Time") ?>',
  62. hourText: '<?php echo $langs->trans("Hour") ?>',
  63. minuteText: '<?php echo $langs->trans("Minute") ?>',
  64. secondText: '<?php echo $langs->trans("Second") ?>',
  65. millisecText: '<?php echo $langs->trans("Millisecond") ?>',
  66. timezoneText: '<?php echo $langs->trans("Timezone") ?>',
  67. currentText: '<?php echo $langs->trans("Now") ?>',
  68. closeText: '<?php echo $langs->trans("Close2") ?>',
  69. timeFormat: 'HH:mm',
  70. amNames: ['AM', 'A'],
  71. pmNames: ['PM', 'P'],
  72. isRTL: <?php echo ($langs->trans("DIRECTION") == 'rtl' ? 'true' : 'false'); ?>
  73. };
  74. $.timepicker.setDefaults($.timepicker.regional['<?php echo $langs->defaultlang ?>']);
  75. });
  76. <?php
  77. if (is_object($db)) {
  78. $db->close();
  79. }