-
Notifications
You must be signed in to change notification settings - Fork 0
/
front.html
130 lines (111 loc) · 3.82 KB
/
front.html
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
<!doctype html>
<html lang="en">
<head>
<meta charset="utf-8" />
<title>jQuery UI Datepicker - Restrict date range</title>
<link rel="stylesheet" href="http://code.jquery.com/ui/1.10.3/themes/smoothness/jquery-ui.css" />
<script src="http://code.jquery.com/jquery-1.9.1.js"></script>
<script src="http://code.jquery.com/ui/1.10.3/jquery-ui.js"></script>
<script>
var curr = new Date; // get current date
var first = curr.getDate() - curr.getDay() + 1; // First day is the day of the month - the day of the week
var last = first + 6; // last day is the first day + 6
var today = new Date(curr);
var firstday = new Date(curr.setDate(first));
var lastday = new Date(curr.setDate(last));
var max = dhm(lastday-today);
var min = dhm(today-firstday);
function dhm(t){
var cd = 24 * 60 * 60 * 1000,
ch = 60 * 60 * 1000,
d = Math.floor(t / cd),
h = '0' + Math.floor( (t - d * cd) / ch),
m = '0' + Math.round( (t - d * cd - h * ch) / 60000);
return [d];
}
$(function() {
$( "#datepicker" ).datepicker({
minDate: "-"+min+"D",
maxDate: "+"+max+"D",
onSelect: function(date){
$.ajax({
type: 'GET',
url: '/index.php?id=5225',
data: "datum=" + date,
success: function(data) {
$('.tab1').html('');
$('.tab2').html('');
var rezultat = JSON.parse(data);
//alert(data);
var tr;
for (var i = 1; i <= rezultat['radio']['columns']; i++) {
tr = $('<tr/>');
tr.append("<td>" + rezultat['radio']['vrijeme_'+i] + "</td>");
tr.append("<td>" + rezultat['radio']['naslov_'+i] + "</td>");
$('.tab1').append(tr);
}
var tr2;
for (var i = 1; i <= rezultat['televizija']['columns']; i++) {
tr = $('<tr/>');
tr.append("<td>" + rezultat['televizija']['vrijeme_'+i] + "</td>");
tr.append("<td>" + rezultat['televizija']['naslov_'+i] + "</td>");
$('.tab2').append(tr);
}
}
});
},
showOn: "button",
buttonImage: "./img/calendar.gif",
buttonImageOnly: true
});
});
$(function() {
$( "#tabs" ).tabs();
});
jQuery(function($) {
$.datepicker.regional['bs'] = {
closeText: 'Zatvori',
prevText: '<',
nextText: '>',
currentText: 'Danas',
monthNames: ['Januar', 'Februar', 'Mart', 'April', 'Maj', 'Juni',
'Juli', 'August', 'Septembar', 'Oktobar', 'Novembar', 'Decembar'
],
monthNamesShort: ['Jan', 'Feb', 'Mar', 'Apr', 'Maj', 'Jun',
'Jul', 'Aug', 'Sep', 'Okt', 'Nov', 'Dec'
],
dayNames: ['Nedelja', 'Ponedeljak', 'Utorak', 'Srijeda', 'Četvrtak', 'Petak', 'Subota'],
dayNamesShort: ['Ned', 'Pon', 'Uto', 'Sri', 'Čet', 'Pet', 'Sub'],
dayNamesMin: ['Ne', 'Po', 'Ut', 'Sr', 'Če', 'Pe', 'Su'],
weekHeader: 'Wk',
dateFormat: 'dd.mm.yy',
firstDay: 1,
isRTL: false,
showMonthAfterYear: false,
yearSuffix: ''
};
$.datepicker.setDefaults($.datepicker.regional['bs']);
});
$("#datepicker").datepicker( $.datepicker.regional[ "bs" ] );
$( document ).ready(function() {
});
</script>
</head>
<body>
<p>Odaberi dan: <input type="text" id="datepicker" style="display:none"/>
</p>
<div id="tabs">
<ul>
<li><a href="#tabs-1">TV</a></li>
<li><a href="#tabs-2">RADIO</a></li>
</ul>
<div id="tabs-1">
<table class="tab1"></table>
</div>
<div id="tabs-2">
<table class="tab2">
</table>
</div>
</div>
</body>
</html>