Welcome Guest, Not a member yet? Register   Sign In
NOT WORKING: Showing three calendars with three different months
#1
Shocked 

Hi everyone.

I am trying to make an events booking web application using CodeIgniter with HMVC. To do that I am making use of codeigniters calendaring class. I am trying to show three calendars like this...

   

So for example here I would like to show september - october - november, then if they clicked the arrow right it would show the next three months.

Okay, so down to business. Here is my Bookings controller as it stands (with comments).

PHP Code:
public function index($year null$month null$day null)
    {
        if (empty($year)) {
            redirect('book/index/' date('Y/m/d'time()));
        }

        $this->load->model('book/Booking_Model');

        // september
        $data['cal_one']   $this->Booking_Model->generateCalendar($year$month$day);
        // october
        $data['cal_two']   $this->Booking_Model->generateCalendar($yeardate('m'strtotime('+1 months')), $day);
        // november
        $data['cal_three'] = $this->Booking_Model->generateCalendar($yeardate('m'strtotime('+2 months')), $day);

        // to load the view
        $data['module'] = 'book';
        $data['view_file'] = 'select_date';
        $this->load->module('templates');
        $this->templates->frontend($data);
    



Here is my model that generates the calendar

PHP Code:
public function generateCalendar($year$month$day$student_id null)
 
   {
 
      
        $params 
= [
 
           'show_next_prev' => true,
 
           'next_prev_url'  => base_url() . 'schedule/index',
 
           'template'       => '
                {table_open}<table id="tt-calendar">{/table_open}

                    {heading_row_start}<tr>{/heading_row_start}

                        {heading_previous_cell}
                            <th class="text-center">

                            </th>
                        {/heading_previous_cell}

                        {heading_title_cell}
                            <th class="text-center" colspan="{colspan}">
                                <h4>
                                    {heading}
                                </h4>
                            </th>
                        {/heading_title_cell}

                        {heading_next_cell}
                            <th class="text-center">

                            </th>
                        {/heading_next_cell}

                    {heading_row_end}</tr>{/heading_row_end}
                    {week_row_start}<tr>{/week_row_start}

                        {week_day_cell}
                            <td>
                                <strong>
                                    {week_day}
                                </strong>
                            </td>
                        {/week_day_cell}

                    {week_row_end}</tr>{/week_row_end}
                    {cal_row_start}<tr>{/cal_row_start}

                        {cal_cell_start}<td>{/cal_cell_start}

                        {cal_cell_start_today}<td id="tt-calendar-today">{/cal_cell_start_today}

                        {cal_cell_start_other}<td id="tt-calendar-test">{/cal_cell_start_other}

                        {cal_cell_content}
                            <div class="day" href="" onclick="return getDate(' 
$year ' + /' $month '/ + {day});">
                                {day} ' 
$month '
                            </div>
                        {/cal_cell_content}

                        {cal_cell_content_today}
                            <div class="day" href="" onclick="return getDate(' 
$year ' + /' $month '/ + {day});">
                                {day} ' 
$month '
                            </div>
                        {/cal_cell_content_today}

                        {cal_cell_no_content}
                            <div class="day" href="" onclick="return getDate(' 
$year ' + /' $month '/ + {day});">
                                {day} ' 
$month '
                            </div>
                        {/cal_cell_no_content}

                        {cal_cell_no_content_today}
                            <div class="day" href="" onclick="return getDate(' 
$year ' + /' $month '/ + {day});">
                                {day} ' 
$month '
                            </div>
                        {/cal_cell_no_content_today}

                        {cal_cell_blank}&nbsp;{/cal_cell_blank}

                        {cal_cell_other}{day}{/cal_cel_other}

                        {cal_cell_end}</td>{/cal_cell_end}

                        {cal_cell_end_today}</td>{/cal_cell_end_today}

                        {cal_cell_end_other}</td>{/cal_cell_end_other}

                    {cal_row_end}</tr>{/cal_row_end}

                {table_close}</table>{/table_close}'
 
       ];

 
       // loading the calendar and passing the params and data
 
       $this->load->library('calendar'$params);
 
       return $this->calendar->generate($year$month);
 
   




The problem here is that when I load calendar one (september) the library is loaded and ?cached? so that when I try and load calendar two (october), the dates are all for september.

How do I display multiple calendars side by side??
Reply


Messages In This Thread
NOT WORKING: Showing three calendars with three different months - by jethro - 09-16-2016, 07:02 AM



Theme © iAndrew 2016 - Forum software by © MyBB