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