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: $("#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: </script>';
67:
68: return sprintf($template,$sValidFrom);
69: }
70:
71: function frontendusers_valid_to_wantedVariables ()
72: {
73: return (array("valid_to"));
74: }
75:
76: function frontendusers_valid_to_store ($variables)
77: {
78: global $feuser;
79:
80: $feuser->set("valid_to", $variables["valid_to"], false);
81: }
82: ?>
83: