001.
<?php
002.
header(
"Content-type:application/json; charset=UTF-8"
);
003.
header(
"Cache-Control: no-store, no-cache, must-revalidate"
);
004.
header(
"Cache-Control: post-check=0, pre-check=0"
, false);
005.
include
(
"connect.php"
);
006.
$mysqli
= connect();
007.
008.
$q
=
"SELECT * FROM tb_room WHERE date(start_time)>='"
.
$_GET
['start
']."'
";
009.
$q
.=
" AND date(end_time)<='"
.
$_GET
['
end
']."'
ORDER by locate";
010.
011.
$result
=
$mysqli
->query(
$q
);
012.
013.
while
(
$rs
=
$result
->fetch_object()){
014.
015.
if
(
$rs
->locate ==
"KARA1"
){
016.
$color
=
"#EC971F"
;
017.
}
018.
019.
if
(
$rs
->locate ==
"KARA2"
){
020.
$color
=
"#EC971F"
;
021.
}
022.
023.
if
(
$rs
->locate ==
"KARA3"
){
024.
$color
=
"#EC971F"
;
025.
}
026.
027.
if
(
$rs
->locate ==
"KARA4"
){
028.
$color
=
"#EC971F"
;
029.
}
030.
031.
if
(
$rs
->locate ==
"KARA5"
){
032.
$color
=
"#EC971F"
;
033.
}
034.
035.
if
(
$rs
->locate ==
"KARA6"
){
036.
$color
=
"#EC971F"
;
037.
}
038.
039.
if
(
$rs
->locate ==
"KARA7"
){
040.
$color
=
"#EC971F"
;
041.
}
042.
043.
if
(
$rs
->locate ==
"KARA8"
){
044.
$color
=
"#EC971F"
;
045.
}
046.
047.
if
(
$rs
->locate ==
"KARA9"
){
048.
$color
=
"#EC971F"
;
049.
}
050.
051.
if
(
$rs
->locate ==
"KARA10"
){
052.
$color
=
"#EC971F"
;
053.
}
054.
055.
if
(
$rs
->locate ==
"KARA11"
){
056.
$color
=
"#EC971F"
;
057.
}
058.
059.
if
(
$rs
->locate ==
"KARA12"
){
060.
$color
=
"#EC971F"
;
061.
}
062.
063.
if
(
$rs
->locate ==
"KARA13"
){
064.
$color
=
"#EC971F"
;
065.
}
066.
067.
if
(
$rs
->locate ==
"KARA14"
){
068.
$color
=
"#EC971F"
;
069.
}
070.
071.
if
(
$rs
->locate ==
"KARA15"
){
072.
$color
=
"#EC971F"
;
073.
}
074.
075.
if
(
$rs
->locate ==
"KARA16"
){
076.
$color
=
"#EC971F"
;
077.
}
078.
079.
if
(
$rs
->locate ==
"KARA17"
){
080.
$color
=
"#EC971F"
;
081.
}
082.
083.
if
(
$rs
->locate ==
"KARA18"
){
084.
$color
=
"#EC971F"
;
085.
}
086.
087.
if
(
$rs
->locate ==
"KARA19"
){
088.
$color
=
"#EC971F"
;
089.
}
090.
091.
if
(
$rs
->locate ==
"KARA20"
){
092.
$color
=
"#EC971F"
;
093.
}
094.
095.
$json_db
[]=
array
(
096.
"id"
=>
$rs
->id,
097.
"title"
=>
$rs
->locate.
","
.
$rs
->name.
","
.
$rs
->detail.
",'"
.
$rs
->save,
098.
"start"
=>
$rs
->start_time,
099.
"end"
=>
$rs
->end_time,
100.
"url"
=>
"show_data.php?id="
.
$rs
->id,
101.
"color"
=>
$color
,
102.
);
103.
}
104.
105.
$json
= json_encode(
$json_db
);
106.
107.
if
(isset(
$_GET
[
'callback'
]) &&
$_GET
[
'callback'
]!=
""
){
108.
echo
$_GET
[
'callback'
].
"("
.
$json
.
");"
;
109.
}
else
{
110.
echo
$json
;
111.
}
112.
?>