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: <link rel="stylesheet" type="text/css" href="styles/jquery/jquery-ui.css">
46: {_JS_HEAD_CONTENIDO_}
47: <script type="text/javascript" src="scripts/jquery/plugins/timepicker.js"></script>';
48: $sValidFrom .= $langscripts;
49:
50: $sValidFrom .= '<input type="text" id="valid_from" name="valid_from" value="' . $currentValue . '">';
51: $sValidFrom .= '<script type="text/javascript">
52: (function(Con, $) {
53: $(function() {
54: $("#valid_from").datetimepicker({
55: buttonImage:"' . $path_to_calender_pic . '",
56: buttonImageOnly: true,
57: showOn: "both",
58: dateFormat: "yy-mm-dd",
59: onClose: function(dateText, inst) {
60: var endDateTextBox = $("#valid_to");
61: if (endDateTextBox.val() != "") {
62: var testStartDate = new Date(dateText);
63: var testEndDate = new Date(endDateTextBox.val());
64: if (testStartDate > testEndDate) {
65: endDateTextBox.val(dateText);
66: }
67: } else {
68: endDateTextBox.val(dateText);
69: }
70: },
71: onSelect: function(selectedDateTime) {
72: var start = $(this).datetimepicker("getDate");
73: $("#valid_to").datetimepicker("option", "minDate", new Date(start.getTime()));
74: }
75: });
76: });
77: })(Con, Con.$);
78: </script>';
79:
80: $template = sprintf($template, $sValidFrom);
81: $oTemplate = new cTemplate();
82: return $oTemplate->generate($template, 1);
83: }
84:
85: function frontendusers_valid_from_wantedVariables() {
86: return (array("valid_from"));
87: }
88:
89: function frontendusers_valid_from_store($variables) {
90: global $feuser;
91:
92: $feuser->set("valid_from", $variables["valid_from"], false);
93: }
94:
95: ?>
96: