File: /var/www/selfanalyse/wp-content/plugins/psychometrics/api/psy_calendar_format.php
<?php
/*
* Get Full calendar in html
*/
function get_calender_full($year = '', $month = '', $counselor_id)
{
global $wpdb;
$PSY_SLOT_AVAILABLE = $wpdb->prefix . PSY_SLOT_AVAILABLE;
$date_Year = ($year != '') ? $year : date("Y");
$date_Month = ($month != '') ? $month : date("m");
$date = $date_Year . '-' . $date_Month . '-01';
$current_Month_First_Day = date("N", strtotime($date));
$total_Days_ofMonth = cal_days_in_month(CAL_GREGORIAN, $date_Month, $date_Year);
$total_Days_ofMonthDisplay = ($current_Month_First_Day == 7) ? ($total_Days_ofMonth) : ($total_Days_ofMonth + $current_Month_First_Day);
$boxDisplay = ($total_Days_ofMonthDisplay <= 35) ? 35 : 42;
?>
<h4><?php echo date('F', mktime(0, 0, 0, $date_Month, 10)) . ' ' . $date_Year ?></h4>
<ul class="day-ul">
<li>SUN</li>
<li>MON</li>
<li>TUE</li>
<li>WED</li>
<li>THU</li>
<li>FRI</li>
<li>SAT</li>
</ul>
<ul class="date-ul">
<?php
// this is for create calendra
$dayCount = 1;
for ($cb = 1; $cb <= $boxDisplay; $cb++) {
if (($cb >= $current_Month_First_Day + 1 || $current_Month_First_Day == 7) && $cb <= ($total_Days_ofMonthDisplay)) {
$currentDate = $date_Year . '-' . $date_Month . '-' . $dayCount;
$checkSlot = $wpdb->get_var("SELECT count(id) FROM $PSY_SLOT_AVAILABLE where scheduled_date='$currentDate' and counselor_id='$counselor_id' and created_by='counselor'");
$bookDate = "'".$currentDate."'";
$counselor = "'".$counselor_id."'";
//Define date cell color
if ($checkSlot >= 1 && strtotime($currentDate) > strtotime(date("Y-m-d"))) {
echo '<li date="' . $currentDate . '" class="slot-book" title="Available for booking" onclick="bookApp('.$bookDate.','.$counselor.')">';
}else if (strtotime($currentDate) == strtotime(date("Y-m-d"))) {
echo '<li date="' . $currentDate . '" title="Current Date" class="current-date">';
} else if (strtotime($currentDate) < strtotime(date("Y-m-d"))) {
echo '<li date="' . $currentDate . '" class="no-date">';
} else {
echo '<li date="' . $currentDate . '" class="user-slot" title="book slot" onclick="bookAppUser('.$bookDate.','.$counselor.')">';
}
echo '<span>';
echo $dayCount;
echo '</span>';
echo '</li>';
if($dayCount%7 == 0)
{
echo '<br>';
}
$dayCount++;
?>
<?php } else { ?>
<li><span> </span></li>
<?php }
} ?>
</ul>
<?php
}