1: <?php
2: 3: 4: 5: 6: 7: 8: 9: 10: 11: 12: 13: 14:
15:
16: defined('CON_FRAMEWORK') || die('Illegal call: Missing framework initialization - request aborted.');
17:
18: function frontendusers_valid_from_getTitle() {
19: return i18n("Valid from");
20: }
21:
22: function frontendusers_valid_from_display() {
23: global $feuser, $db, $belang, $cfg;
24:
25: $langscripts = '';
26:
27: if (($lang_short = substr(strtolower($belang), 0, 2)) != "en") {
28: $langscripts = '<script type="text/javascript" src="scripts/jquery/plugins/timepicker-' . $lang_short . '.js"></script>
29: <script type="text/javascript" src="scripts/jquery/plugins/datepicker-' . $lang_short . '.js"></script>';
30: }
31:
32: $path_to_calender_pic = cRegistry::getBackendUrl() . $cfg['path']['images'] . 'calendar.gif';
33:
34: $template = '%s';
35:
36: $currentValue = $feuser->get("valid_from");
37:
38: if ($currentValue == '') {
39: $currentValue = '0000-00-00';
40: }
41: $currentValue = str_replace('00:00:00', '', $currentValue);
42:
43: $sValidFrom = '
44: <link rel="stylesheet" type="text/css" href="styles/jquery/plugins/timepicker.css">
45: {_JS_HEAD_CONTENIDO_}
46: <script type="text/javascript" src="scripts/jquery/plugins/timepicker.js"></script>';
47: $sValidFrom .= $langscripts;
48:
49: $sValidFrom .= '<input type="text" id="valid_from" name="valid_from" value="' . $currentValue . '">';
50: $sValidFrom .= '<script type="text/javascript">
51: (function(Con, $) {
52: $(function() {
53: $("#valid_from").datetimepicker({
54: buttonImage:"' . $path_to_calender_pic . '",
55: buttonImageOnly: true,
56: showOn: "both",
57: dateFormat: "yy-mm-dd",
58: onClose: function(dateText, inst) {
59: var endDateTextBox = $("#valid_to");
60: if (endDateTextBox.val() != "") {
61: var testStartDate = new Date(dateText);
62: var testEndDate = new Date(endDateTextBox.val());
63: if (testStartDate > testEndDate) {
64: endDateTextBox.val(dateText);
65: }
66: } else {
67: endDateTextBox.val(dateText);
68: }
69: },
70: onSelect: function(selectedDateTime) {
71: var start = $(this).datetimepicker("getDate");
72: $("#valid_to").datetimepicker("option", "minDate", new Date(start.getTime()));
73: }
74: });
75: });
76: })(Con, Con.$);
77: </script>';
78:
79: $template = sprintf($template, $sValidFrom);
80: $oTemplate = new cTemplate();
81: return $oTemplate->generate($template, 1);
82: }
83:
84: function frontendusers_valid_from_wantedVariables() {
85: return (array("valid_from"));
86: }
87:
88: function frontendusers_valid_from_store($variables) {
89: global $feuser;
90:
91: $feuser->set("valid_from", $variables["valid_from"], false);
92: }
93:
94: ?>
95: