|
|
|
ปฏิทินกิจกรรม fullcalender 2.4.0 ต้องการให้คลิกแล้วลิ้งไปหน้าอื่น ช่วยดูโค้ดให้หน่อยค่ะ |
|
|
|
|
|
|
|
ไฟล์ index.php
Code (PHP)
<!DOCTYPE html>
<!DOCTYPE html>
<html>
<head>
<meta charset='utf-8' />
<link href='fullcalendar-2.4.0/fullcalendar.css' rel='stylesheet' />
<link href='fullcalendar-2.4.0/fullcalendar.print.css' rel='stylesheet' media='print' />
<script src='fullcalendar-2.4.0/lib/moment.min.js'></script>
<script src='fullcalendar-2.4.0/lib/jquery.min.js'></script>
<script src='fullcalendar-2.4.0/fullcalendar.min.js'></script>
<script src="fullcalendar-2.4.0/lang/th.js"></script>
<style>
body {
margin: 40px 10px;
padding: 0;
font-family: "Lucida Grande",Helvetica,Arial,Verdana,sans-serif;
font-size: 14px;
}
#calendar {
max-width: 900px;
margin: 0 auto;
}
<style type="text/css">
body,td,th {
color: #000;
}
body {
background-color: #FFF;
}
</style>
</style>
</head>
<body>
<p>
<?php
//Database
$link = mysqli_connect("localhost", "root", "1234", "wat");
mysqli_set_charset($link, 'utf8');
if (!$link) {
echo "Error: Unable to connect to MySQL." . PHP_EOL;
echo "Debugging errno: " . mysqli_connect_errno() . PHP_EOL;
echo "Debugging error: " . mysqli_connect_error() . PHP_EOL;
exit;
}
$query = "SELECT * FROM invited_works";
if ($result = $link->query($query)) {
/* fetch object array */
while ($obj = $result->fetch_object()) {
$data[] = array(
'id' => $obj->ID_iw,
'title'=>$obj->Name_iw,
'start'=> $obj->Data_iw,
'end'=> $obj->end_iw
);
}
/* free result set */
$result->close();
}
mysqli_close($link);
/*
$array = array(
array('title'=> 'Long Event',
'start'=> '2015-02-07',
'end'=> '2015-02-10'),
array('id'=> 999,
'title'=> 'Repeating Event',
'start'=> '2015-02-16T16:00:00')
);
*/
?>
<script>
$(document).ready(function() {
$('#calendar').fullCalendar({
header: {
left: 'prev,next today',
center: 'title',
right: 'month,basicWeek,basicDay'
},
defaultDate: '<?php echo date('Y-m-d');?>',
editable: true,
eventLimit: true, // allow "more" link when too many events
events : <?php echo json_encode($data);?>
});
});
</script>
<h3>
<p>ปฏิทินกิจนิมนต์</p>
<h3><a href="fullcalendar-2.4.0/list_iw_p.php"></a></h3>
<p><a href="list_iw_p.php">รายละเอียดกิจนิมนต์</a></p>
<p> </p>
<div id='calendar'></div>
</body>
</html>
ต้องการให้คลิกแล้วสามารถลิ้งไปหน้าอื่นได้ ต้องแทรกโค้ดไว้ตรงบรรทัดไหนค่ะ ขอตัวอย่างโค้ดด้วยนะค่ะ
Tag : PHP, JavaScript
|
|
|
|
|
|
Date :
2016-12-19 14:24:54 |
By :
dew |
View :
1239 |
Reply :
1 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Code (JavaScript)
$('#calendar').fullCalendar({
eventClick: function(calEvent, jsEvent, view) {
alert('Event: ' + calEvent.title);
alert('Coordinates: ' + jsEvent.pageX + ',' + jsEvent.pageY);
alert('View: ' + view.name);
// change the border color just for fun
$(this).css('border-color', 'red');
}
});
จะ redirect ด้วย window.location หรือ window.open แบบ popup ก็ได้ครับ
|
|
|
|
|
Date :
2016-12-19 16:38:02 |
By :
mr.win |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Load balance : Server 00
|