1: <?php
2: 3: 4: 5: 6: 7: 8: 9: 10: 11: 12:
13:
14: defined('CON_FRAMEWORK') || die('Illegal call: Missing framework initialization - request aborted.');
15:
16: function frontendusers_valid_to_getTitle ()
17: {
18: return i18n("Valid to");
19: }
20:
21: function frontendusers_valid_to_display ()
22: {
23: global $feuser,$db,$belang,$cfg;
24:
25: $langscripts = '';
26:
27:
28: $path_to_calender_pic = cRegistry::getBackendUrl() . $cfg['path']['images'] . 'calendar.gif';
29:
30: $template = '%s';
31:
32: $currentValue = $feuser->get("valid_to");
33:
34: if ($currentValue == '') {
35: $currentValue = '0000-00-00';
36: }
37: $currentValue = str_replace('00:00:00', '', $currentValue);
38:
39:
40: $sValidFrom = '<input type="text" id="valid_to" name="valid_to" value="'.$currentValue.'">';
41: $sValidFrom .= '<script type="text/javascript">
42: (function(Con, $) {
43: $(function() {
44: $("#valid_to").datetimepicker({
45: buttonImage: "'. $path_to_calender_pic .'",
46: buttonImageOnly: true,
47: showOn: "both",
48: dateFormat: "yy-mm-dd",
49: onClose: function(dateText, inst) {
50: var startDateTextBox = $("#valid_from");
51: if (startDateTextBox.val() != "") {
52: var testStartDate = new Date(startDateTextBox.val());
53: var testEndDate = new Date(dateText);
54: if (testStartDate > testEndDate) {
55: startDateTextBox.val(dateText);
56: }
57: } else {
58: startDateTextBox.val(dateText);
59: }
60: },
61: onSelect: function(selectedDateTime) {
62: var end = $(this).datetimepicker("getDate");
63: $("#valid_from").datetimepicker("option", "maxDate", new Date(end.getTime()));
64: }
65: });
66: });
67: })(Con, Con.$);
68: </script>';
69:
70: return sprintf($template,$sValidFrom);
71: }
72:
73: function frontendusers_valid_to_wantedVariables()
74: {
75: return (array("valid_to"));
76: }
77:
78: function frontendusers_valid_to_store($variables)
79: {
80: global $feuser;
81:
82: $feuser->set("valid_to", $variables["valid_to"], false);
83: }
84: ?>
85: