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