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