How to use yii cal extension?

Hi all,

I am new and still learning to use Yii framework. So I need some help with installing and using the cal extension.

I tried to follow instructions from the Yii website: downloaded and put the cal folder into the extension folder, updated the main config file, but after that I have no idea how to call/display the calendar in view class.

I tried to call it as an application component, a Widget as well as a generic component following the examples of using extension on Yii website, but all of them return errors.

Any help is much appreciated here. Thank you.

it is a module

put it under application.modules and the access it using the url /cal, if you are using urlFormat=path

also as explained in the extension, in your configuration file you must add the module to the modules index


return array(






Firstly, thank you Gustavo for the timely response.

I followed your instruction, put the cal under the modules and run the path:


However, I got this error:

Alias "cal.CalModule" is invalid. Make sure it points to an existing PHP file.

How can I fix this?

please post the complete error along with your url rules

It’s working now, I made a mistake about the allias. Thank you for the help. :)

Glad i could help :)

Can you provide some more info how to install and kick-start this module.

I followed all the above steps but without any success.

  1. I created a webapp (ex testdrive) and installed the module in testdrive/modules/cal/

  2. Add in config/main.php

  3. Check & set user privileges in modules/cal/components/ChangeUser.php

What’s next? How do I surf to my the calendar pages?

it depends of your url rules, if you use path then http://localhost/cal, if you use index.php in the name http://localhost/index.php/cal

if you dont use path http://localhost/?r=cal

Hi Gustavo,

I had no URL rewrite turned on so ?r=cal did the trick.

Can you point me to a URL where I can read up on how to specify a path in YII?

sure thing

here is the link

glad i could help

Hi I’m a Yii newbie and haven’t yet grasped it but I managed to get Cal working after some real headache.

  • The first was self inflicted since i intend to use SQLite. It was quite easy to solve though. I removed the Character Set properties and adjusted the Auto Increment. But why does the EVENTS table need an AUTO_INCREMENT=4?? SQLite doesn’t support this but it seems to work nonetheless.

  • Secondly I had some serious trouble with the User Authentication. If I drop the Cal module in a default webapp it seems I need to implement the ‘password’ and ‘id’ properties of the UserIdentity component (and the getId method) as provided in the Cal Demo, right? This wasn’t mentioned anywhere and took some serious code digging to find. Or am I just lost in the blue on this one? :)

After all it looks and runs great. I will continue testing it now and get back with more questions soon… ;)

Kind regards


Why does the EVENTS table need an AUTO_INCREMENT=4?

I also do not know. But most jQuery-based multi-users calendars are something that way.

Yes. This calendar requires user authentication

First of all, thanks for this nice module.

I need to customize the module to allow user to block multiple days/select day range.

Would you advise where should I change in your code?

Many thanks

You do not need rewrite the controller’s action.

To select day range you can use sample code from Full Calendar official demo:

selectable: true,

selectHelper: true,

select: function(start, end, allDay) {

	var title = prompt('Event Title:');

	if (title) {



			title: title,

			start: start,

			end: end,

			allDay: allDay


			true // make the event "stick"





You need paste this code into components\fullCal\eventCal.js and purge assets dir, of course.

Hi, this is a great module. Would you show some examples which integrate Zii calendar and cal? Thank you.

I solved it.

 'options' => array(

                                        'dateFormat' => 'yy-mm-dd',

                                        'changeMonth' => 'true',

                                        'changeYear' => 'true',

                                        'showButtonPanel' => 'true',

                                        'constrainInput' => 'false',

                                        'onSelect' => "js:function(selectedDate) { selectDateFromCalendar(selectedDate);}",


In eventCal.js

selectDateFromCalendar = function($selectDate)


            var selectdstr = $selectDate;

            var selectdate = $.fullCalendar.parseDate(selectdstr, "yyyy-mm-dd");

            $('#EventCal').fullCalendar( 'gotoDate', selectdate.getFullYear(), selectdate.getMonth(), selectdate.getDate());


What is the best way to set this up to serve as a list of events (from a 3rd party events table) and allow users to sign up for specific events (click and go to form)? I want to use this as a single calendar with available appointments and allow people to take the appointments. Once reserved, the appointment would not show on calendar.

i have the module up and running now and am looking at all the configs, etc.

I get the following error when I first fun http://mysite/cmms/cal

CDbCommand failed to execute the SQL statement: SQLSTATE[42S22]: Column not found: 1054 Unknown column 'kmgoddard' in 'where clause'. The SQL statement executed was: SELECT * FROM `events_helper` `t` WHERE user_id=kmgoddard 

added my username to:

protected function renderContent()


        $isAdmin = true;    // check admin privileges

        if (true == $isAdmin)

            $users = array(// create you own users list


I have the following problem(bug) and I can’t find the solution of it…

When I create a “New event” and select some time frame (exp. 7:30-8:30) I do NOT check “All day” and press “Ok” - the event go up at the top of the calendar where is the section “All day”. I mean the event don’t “stick” to the defined hours (7:40-8:30) but go for whole day. I checked the DB - all day is set to “0”, also when you open the event to edit it, it is with correct value (7:40-8:30). If I drag&drop it, it stay on correct place, if I resize to other time frame - it’s stay ok.

Only problem is when I create for first time some event, the new event don’t “stick” to his defined hours but go at top as “all day” event.

I guess I can fix this from eventCal.js but I can’t find where is problem. Do you have some ideas?

Any luck with this? I’m having the exact same problem, I’ve noticed that when the event div is created, it is placed inside the top div(allday container) but outside of the allday events.