Unable To Show The Timeslot And Location In Fullcalendar Extension

Hi,i am using the efullcalendar extension, i try to retrieve the location room in that calendar but somehow it just allow to show the event that i add in.i wonder did i miss it anything.Hopefully got anyone can check my code.Beside this extension,is there other extension.

Bookingdetails model


<?php


class Bookingdetail extends CActiveRecord {


    public $Booked;


    /**

     * @return string the associated database table name

     */

    public function tableName() {

        return 'bookingdetail';

    }


    /**

     * @return array validation rules for model attributes.

     */

    public function rules() {

        // NOTE: you should only define rules for those attributes that

        // will receive user inputs.

        return array(

            array('Username, UserID, RoomTypeID, RefroomID, DayID, TimeID, NumberOfStudent, Booked, Event, StartDate, EndDate,	Time', 'required'),

            array('UserID, RoomTypeID, RefroomID, DayID, TimeID, NumberOfStudent, Booked', 'numerical', 'integerOnly' => true),

            array('Username, Event', 'length', 'max' => 256),

            // The following rule is used by search().

            // @todo Please remove those attributes that should not be searched.

            array('BookingID, Username, UserID, RoomTypeID, RefroomID, DayID, TimeID, NumberOfStudent, Booked, Event, StartDate, EndDate,Time', 'safe', 'on' => 'search'),

        );

    }


    /**

     * @return array relational rules.

     */

    public function relations() {

        // NOTE: you may need to adjust the relation name and the related

        // class name for the relations automatically generated below.

        return array(

            'user' => array(self::BELONGS_TO, 'User', 'UserID'),

            'roomType' => array(self::BELONGS_TO, 'Roomtype', 'RoomTypeID'),

            'day' => array(self::BELONGS_TO, 'Day', 'DayID'),

            'time' => array(self::BELONGS_TO, 'Timeslot', 'TimeID'),

        );

    }


    /**

     * @return array customized attribute labels (name=>label)

     */

    public function attributeLabels() {

        return array(

            'BookingID' => 'Booking',

            'Username' => 'Username',

            'UserID' => 'User',

            'RoomTypeID' => 'Room Type',

            'RefroomID' => 'Refroom',

            'DayID' => 'Day',

            'TimeID' => 'Time',

            'NumberOfStudent' => 'Number Of Student',

            'Booked' => 'Booked',

            'Event' => 'Event',

            'StartDate' => 'Start Date',

            'EndDate' => 'End Date',

            'Time' => 'Time',

        );

    }


  

    public function search() {

        // @todo Please modify the following code to remove attributes that should not be searched.


        $criteria = new CDbCriteria;


        $criteria->compare('BookingID', $this->BookingID);

        $criteria->compare('Username', $this->Username, true);

        $criteria->compare('UserID', $this->UserID);

        $criteria->compare('RoomTypeID', $this->RoomTypeID);

        $criteria->compare('RefroomID', $this->RefroomID);

        $criteria->compare('DayID', $this->DayID);

        $criteria->compare('TimeID', $this->TimeID);

        $criteria->compare('NumberOfStudent', $this->NumberOfStudent);

        $criteria->compare('Booked', $this->Booked);

        $criteria->compare('Event', $this->Event, true);

        $criteria->compare('StartDate', $this->StartDate, true);

        $criteria->compare('EndDate', $this->EndDate, true);

        $criteria->compare('Time', $this->Time, true);




        return new CActiveDataProvider($this, array(

            'criteria' => $criteria,

        ));

    }


   

    public static function model($className = __CLASS__) {

        return parent::model($className);

    }


    public function fetchEvents() {

        // $events = [];

        $bookingDetails = Yii::app()->db->createCommand()

                ->select('bookingdetail.BookingID,bookingdetail.Event,bookingdetail.StartDate,bookingdetail.EndDate,refroom.Room,roomtype.RoomType,day.Day,timeslot.TimeSlot')

                ->from('bookingdetail')

                ->leftJoin('refroom', 'bookingdetail.RefroomID =refroom.RefroomID')

                ->leftJoin('roomtype', 'bookingdetail.RoomTypeID=roomtype.RoomID')

                ->leftJoin('day', 'bookingdetail.DayID=day.DayID')

                ->leftJoin('timeslot', 'bookingdetail.TimeID=timeslot.TimeSlotID')

                //->where('BookingID=:bookingID', array(':bookingID' => $id))

                ->queryAll();


        foreach ($bookingDetails as $row) {

            $events[] = array(

                'id' => $row['BookingID'],

//                'data' => [

//                    'var1' => 'val1',

//                    'var2' => 'val2',

//                    'varn' => 'valn',

//                ],

                'title' => $row['Event'],

                'start' => $row['StartDate'],

                'end' => $row['EndDate'],

                // 'time' => $row['TimeSlot'],

                'location' => $row['Room'],

                'allDay' => false,

                'color' => '#CC0000',

                'editable' => true,

                    // 'url' => Yii::app()->createUrl('Site/Calendar'),

            );

        }


        return $events;

    }


}

sitecontroller


   public function actionCalendar() {


        $modelCalender = new Bookingdetail();


        echo json_encode($modelCalender->fetchEvents());

        Yii::app()->end();

    }



view


<div class="twelve ptop20">

    <br/>

    <br/>

    <div class='nine ptop12 row right'><h6><b><i>Welcome,<?php echo $user['0']['FirstName'], ' ', $user['0']['LastName'] ?>!</i></b></h6></div>

    <br/>

    <br/>

    <?php if ($user[0]['UserLevelID'] == '1') { ?>    

        <?php echo $this->renderPartial('menubaradmin'); ?>

    <?php } else if ($user[0]['UserLevelID'] == '2') { ?>

        <?php echo $this->renderPartial('menubar'); ?>

    <?php } ?>

    <div class="nine row ptop20 mright20 ">


        <?php

        $this->widget('ext.EFullCalendar.EFullCalendar', array(

            'themeCssFile' => 'cupertino/theme.css',

            // raw html tags

            'htmlOptions' => array(

                // you can scale it down as well, try 80%

                'style' => 'width:100%'

            ),

            // FullCalendar's options.

            // Documentation available at

            // http://arshaw.com/fullcalendar/docs/

            'options' => array(

                'header' => array(

                    'left' => 'prev,next today',

                    'center' => 'title',

                    'right' => ' month',

                ),

                'lazyFetching' => true,

                'events' => Yii::app()->createUrl('Site/Calendar'), // action URL for dynamic events, or

                'timeFormat'=> 'H(:mm)',

           

            )

        ));

        ?>


    </div>

</div>

Hi,

Where are you fetching the rooms… details i cannot see in your code :)

Did you put the action calendar in your controller rules?

This is the action i fetching…


public function actionRoomStatus() {

        $userModel = new User();


        $userID = Yii::app()->session['ID'];


        $user = Yii::app()->db->createCommand()

                ->select('UserID,FirstName,LastName,UserLevelID')

                ->from('user')

                ->where('userID=:userID', array(':userID' => $userID))

                ->queryRow();


       if (Yii::app()->request->isAjaxRequest) {

            $this->generateCalendarEvents();

            Yii::app()->end();

        }



Shouldn’t it be:


   ->queryAll();

that part is just grab the one user name so i use query row.

Where is $id set? The function declaration isn’t including it “fetchEvents($id)”, and it isn’t declared/set elsewhere in the function. Yes, I noticed that the ->where is commented out, but assume that you want to use it.