<?php
/*!
* Copyright Anucha Puangpaka
* Contacts anucha.ppk@icloud.com 062-479-9836
*/
error_reporting(E_ALL);
ini_set("display_errors", 0);
include('../../head.php');
$xsites = "$ap_site$ap_folder"."ap/calendar/";
?>
<link href="<?php echo $xsites; ?>css/addons/fullcalendar.min.css" rel="stylesheet">
<div class="body-main-row-body container theme-showcase" role="main">
<div class="breadcrumbx">
<div class="row">
<div class="col-lg-12 col-md-12 col-sm-12">
<ul class="breadcrumb" itemscope="" itemtype="http://schema.org/BreadcrumbList">
<li itemprop="itemListElement" itemscope="" itemtype="http://schema.org/ListItem">
<a href="<?php echo $_SERVER['SERVER_SCRIPT'] ?>?lang=<?php echo $_GET['lang'] ?>" itemprop="item">
<span itemprop="name"><?php echo $ap_home; ?></span>
</a>
<meta itemprop="position" content="1">
</li>
<li itemprop="itemListElement" itemscope="" itemtype="http://schema.org/ListItem">
<a href="<?php echo $xsites; ?>" itemprop="item">
<span itemprop="name">ปฏิทิน <?php echo $title; ?></span>
</a>
<meta itemprop="position" content="2">
</li>
</ul>
</div>
</div>
<div class="row">
<div class="col-lg-12 col-md-12 col-sm-12">
<h4 align="center"><?php $_GET['text'] = "ปฏิทิน $title"; echo $_GET['text']; ?></h4>
<hr>
<div class="">
<table class="">
<thead>
</thead>
<tbody>
<?php
$sql = "select * from ap_days_type order by code asc";
$query = mysqli_query($conn,$sql);
$i = 0;
while($rows = mysqli_fetch_array($query)){
$i++;
?>
<td><table><tr><td bgcolor="<?php echo $rows['color'];?>" width="10"></td><td> <?php echo $rows['name'];?> </td></tr></table></td>
<?php
}
?>
</tbody>
</table>
</div>
<p></p>
<div class="" id="calendar"></div>
<p></p>
<script>
$(document).ready(function () {
$('#calendar').fullCalendar({
header: {
left: 'prev,next,today',
center: 'title',
right: 'month,agendaWeek,agendaDay,listWeek'
},
defaultDate: '<?php echo date('Y-m-d'); ?>',
timezone: 'Asia/Bangkok',
locale: 'th',
// height: 'auto',
navLinks: true,
eventLimit: true,
eventRender: function (eventObj, $el) {
$el.popover({
title: eventObj.title,
content: eventObj.description,
trigger: 'hover',
html: true,
placement: 'top',
container: 'body'
});
},
events: <?php
echo "[\n";
$sql = "SELECT * FROM ap_days ORDER BY id ASC";
$query = mysqli_query($conn, $sql);
$num_rows = mysqli_num_rows($query);
$i = 0;
while($rows = mysqli_fetch_array($query)){
$i++;
$sql2 = "select * from ap_days_type where code='$rows[apType]'";
$query2 = mysqli_query($conn,$sql2);
$rows2 = mysqli_fetch_array($query2);
if(empty($rows['apImages'])){
$images = "";
}else{
$images = "<center><p><img src=\"$rows[apImages]\" width=\"100%\" alt=\"$rows[apTitle]\"></p></center>";
}
if(empty($rows['apYear'])){
$rows['apYear'] = date('Y');
}
$days = explode(",", $rows['apDay']);
for($ix=0;$ix<count($days);$ix++){
echo "\n";
?>
{
title: '<?php echo $rows['apTitle']; ?>',
description: '<?php echo $images.$rows['apInfo']."<p>* $rows2[name]</p>"; ?>',
start: '<?php echo $rows['apYear'].'-'.$rows['apMount'].'-'.$days[$ix]; ?>',
color: '<?php echo $rows2[color]; ?>',
url: '<?php echo $rows['apURL']; ?>'
}
<?php
if($ix<(count($days)-1)){
echo ",";
}
}
if($i<$num_rows){ echo ","; }
}
echo "\n]";
?>,
eventClick: function(event) {
if (event.url) {
window.open(event.url);
return false;
}
}
});
});
</script>
<?php echo social(); ?>
</div>
</div>
</div>
<p></p>
</div>
<?php
include ('../../footText.php');
include ('../../foot.php');
?>