This is basically the entire code. I'm trying to display in the calendar day if there are available time slots to book an appointment. There are 3 available per day. It checks the number of used time slots and uses the switch statement to echo how many are left.
$count = $this->cal->countByDate($this->uri->segment(2) . "-" . $this->uri->segment(3) . "-" . "22");
$testswitch = 0;
switch ($count) {
case '0':
$testswitch = 'Three Available Time Slots <br><br><a href="" class="btn btn-default btn-xs"><i class="fa fa-calendar"></i> Book Appointment</a>';
break;
case '1':
$testswitch = 'Two Available Time Slots <br><br><a href="" class="btn btn-default btn-xs"><i class="fa fa-calendar"></i> Book Appointment</a>';
break;
case '2':
$testswitch = 'One Available Time Slot <br><br><a href="" class="btn btn-default btn-xs"><i class="fa fa-calendar"></i> Book Appointment</a>';
break;
case '3':
$testswitch = 'No Available Time Slots';
break;
default:
$testswitch = 'Something Is Broken';
break;
}
echo "<pre>";
print_r ($count);
echo "</pre>";
$yolo = true;
//PREFS
$prefs = array(
'start_day' => 'monday',
'month_type' => 'long',
'day_type' => 'long',
'show_next_prev' => TRUE,
'next_prev_url' => base_url('schedule/'),
);
$prefs['template'] = '
{table_open}<table class="calendar">{/table_open}
{week_day_cell}<th class="day_header">{week_day}</th>{/week_day_cell}
{cal_cell_content}<span class="day_listing"><a href="{content}">{day}</a></span> ' .
"{$testswitch}"
. ' {/cal_cell_content}
{cal_cell_content_today}<div class="today"><span class="day_listing"><a href="{content}">{day}</a></span> {content}</div>{/cal_cell_content_today}
{cal_cell_no_content}<span class="day_listing">{day}</span> {/cal_cell_no_content}
{cal_cell_no_content_today}<div class="today"><span class="day_listing">{day}</span></div>{/cal_cell_no_content_today}
';
My issue is:
$count = $this->cal->countByDate($this->uri->segment(2) . "-" . $this->uri->segment(3) . "-" . "22");
I need to turn that day, "22", into {day} so the calendar will input the day for me.
Like it uses it in the template here:
{cal_cell_no_content}<span class="day_listing">{day}</span> {/cal_cell_no_content}