forked from kivitendo/kivitendo-crm
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathexample2.phtml
189 lines (161 loc) · 5.85 KB
/
example2.phtml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
<!DOCTYPE html>
<html>
<head>
<meta charset='utf-8' />
<?php
require_once("inc/stdLib.php");
$menu = $_SESSION['menu'];
echo $menu['stylesheets'];
echo $menu['javascripts'];
echo $head['JQUERY'];
echo $head['JQUERYUI'];
echo $head['JQTABLE'];
echo $head['THEME'];
echo $head['JUI-DROPDOWN'];
echo $head['TRANSLATION'];
/*****************************************************************************************************************************
Grundsätze: Content wird via Ajax im Json-Format geholt und an die entsprechenden Container verteilt
Daten werden ohne Reload einfach via Ajax gespeichert.
Fürs Holen und Schreiben von Daten befindet sich unter jqhelp eine gleichnamige Datei mit der Extension ".php"
Auf das Benutzen der Variable $_SESSION sollte weitestgehend verzichtet werden.
Statt JS einzusetzen sollte auf die jQuery-Methoden zurückgegriffen werden.
Url-Parameter können mit $.urlParam( 'ParameterName' ) gelesen werden.
******************************************************************************************************************************/
?>
<script type="text/javascript" src="lxcars/jQueryAddOns/date-time-picker.js"></script>
<script type="text/javascript" src="lxcars/jQueryAddOns/german-date-time-picker.js"></script>
<script language="javascript" type="text/javascript" src="translation/all.lng"></script>
<script>
$(document).ready(function() {
$("#senddialog").dialog({
width: 400,
height: 'auto',
buttons: [{
text: 'Save',
click: function() {
var object = {};
// Formular-inputs in ein array
var array = $('#fsend').serializeArray();
// Ein object aus dem array machen
$.each(array, function(index, item) {
object[item.name] = item.value;
});
//mit ajax als JSON verschicken
$.ajax({
data: { action: "newEntry", data: JSON.stringify(object)},
dataType: 'json',
type: 'POST',
url: "ajax/example.php",
success: function(){
alert(".:save success:.");
},
error: function(){
alert(".:save error:.");
}
})
}
}, //Ende Button "Save"
{ text: 'Get',//translate
click: function(){
$("#getdialog").dialog({
width:500,
height:"auto",
position: { my: "left top", at: "left bottom", of: "p" },
buttons: [{
text: '.:close:.',
id: 'closeBtn',
click: function() {
$('#getdialog').dialog('close');
}
}]
}).dialog("open").html( '<table id="showtable" class="tablesorter">' +
'<tr> <th>ID</th><th>Datum</th><th>Name</th><th>Alter</th><th>Bemerkungen</th></tr>' +
'<tbody id="tbody"></tbody> <tfoot></tfoot> </table>');
$.ajax({
dataType: 'json',
url: 'ajax/example.php?action=getData',
method: "GET",
success: function( json ) {
drawTable(json);
},
error: function(){
alert(".:get error:.");
}
})
}
}] //Ende buttons[]
}); //Ende dialog()
// $("#name").focus();
$("#datetime").datetimepicker({
//dateFormat: 'yy-mm-dd',
stepMinute: 5,
hour: 1,
hourMin: 6,
hourMax: 19,
//timeSuffix: ' Uhr',
timeText: 'Zeit',
hourText: 'Stunde',
closeText: 'Fertig',
currentText: 'Jetzt'
}).focus();
$("#showtable").tablesorter({widgets: ['zebra']});
}); //Ende $(document).ready()
function drawTable(data) {
$("#tbody").empty();
for (var i = 0; i < data.length; i++) {
drawRow(data[i]);
}
}
function drawRow( rowData ) {
var row = $("<tr>");
$("#tbody").append(row);
row.append($("<td>" + rowData.id + "</td>"));
row.append($("<td>" + rowData.date_time + "</td>"));
row.append($("<td>" + rowData.c_name + "</td>"));
row.append($("<td>" + rowData.c_age + "</td>"));
row.append($("<td>" + rowData.c_comments + "</td></tr>"));
}
</script>
<style>
.ui-menu, #searchfield { width: 180px; }
table.tablesorter { width: auto; cursor: pointer }
</style>
</head>
<body>
<?php
echo $menu['pre_content'];
echo $menu['start_content'];
?>
<?php echo $menu['end_content']; ?>
<p class="ui-state-highlight ui-corner-all tools" style="margin-top: 20px; padding: 0.6em;">Testfile </p>
<!-- <div id="example" style="position:absolute"></div>
-->
<div id="senddialog" title=".:send data:. / .:get data:.">
<p>
<form id="fsend">
<table>
<tr>
<td><label>Datum / Uhrzeit</label></td>
<td><input type="text" name="datetime" id="datetime"></td>
</tr>
<tr>
<td><label>Name</label></td>
<td><input type="text" name="name" id="name"></td>
</tr>
<tr>
<td><label>Alter</label></td>
<td><input type="text" name="age" id="age"></td>
</tr>
<tr>
<td><label>Bemerkungen</label></td>
<td><input type="text" name="comments" id="comments"></td>
</tr>
</table>
</form>
</p>
</div>
<div id="getdialog" class="getdialog" title=".:data:. .:from:. .:server:.">
<!-- <button id="closeBtn">Close</button>-->
</div>
</body>
</html>