FullCalendar

Have anyone ever had to do with FullCalendar extension? If so, anyone perhaps knows how to add second event.

The following code can’t add second event.


<?php 

$this->widget('application.extensions.fullcalendar.FullcalendarGraphWidget', 

    array(

        'data'=>array(

    		array(

    			'id'=>'11',

                'title'=> 'All Day Event',

                'start'=> date('2010-08-21'),

    			'end'=> date('2010-08-23'),

		    ),

		    array(

    			'id'=>'15',

                'title'=> 'Big Day',

                'start'=> date('2010-08-27'),

		    )

        ),

        'options'=>array(

            'editable'=>true,

        ),

        'htmlOptions'=>array(

               'style'=>'width:800px;margin: 0 auto;'

        ),

    )

);

?>



I realize that no one was occupied with it.

I am.

You need to fix one line in the FullCalendar Widget.

Open the FullCalendarGraphWidget.php and change line 25 to:

$encodeoptions=CJavaScript::encode($this->options+array(‘events’=>$this->data));

good luck :)

It works. Thanks :)

Yeah, it works fine.

According this fix.

/*

$encodeoptions=CJavaScript::encode($this->options+array(‘events’=>$this->data));

*/

You can get a full calendar with event adding/dragging by these code.

<?php

	&#036;this-&gt;widget('application.extensions.fullcalendar.FullcalendarGraphWidget', 


    	array(


	        'data'=&gt;array(


    	        array(


        	        'title'=&gt; 'All Day Event',


	                'start'=&gt; date('2010-09-01'),


                    'end'=&gt; date('2010-09-02'),


    	        ),


                array(


	                'title'=&gt; 'test',


	                'start'=&gt; date('2010-09-05'),


                    'end'=&gt; date('2010-09-06'),


                )


	        ),


	        'options'=&gt;array(


	            'editable'=&gt;true,


	            'header' =&gt; array(


        	        'left' =&gt; 'prev,next today',


        	        'right' =&gt; 'month,agendaWeek,agendaDay',


        	        'center' =&gt; 'title',


    	        ),


    	        'selectable' =&gt; true,


    	        'selectHelper' =&gt; true,


    	        'select' =&gt; &quot;js:function(start, end, allDay) {


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


			        if (title) {


				        calendar.fullCalendar('renderEvent',


						    {


								title: title,


								start: start,


								end: end,


								allDay: allDay


							},


							true // make the event 'stick'


						);


					}





					calendar.fullCalendar('unselect');


    	        }&quot;


	        ),


	        'htmlOptions'=&gt;array(


	               'style'=&gt;'width:720px;margin: 0 auto;'


	        ),


		)


	);

?>

Also, thanks. Certainly be helpful :)

However, when you select and add an event title will not be added :unsure:

And one more question. How to specify the exact time?

For question 1:

This is just a demo about front-end, if you want to save you event then you need Ajax call and some PHP code to save the event object.

For question 2:

Below is a piece of code that can specify the exact time.

array(

‘title’=> ‘test’,

‘start’=> date(‘2010-09-05 13:00:30’),

‘end’=> date(‘2010-09-05 14:30:30’),

‘allDay’ => false

)

The start and end attributes can be also a UNIX timestamp. But allDay attributes must be false if you want specify the exact time.

Although I have tested so many combinations something like that didn’t enter my mind :) Thanks

With regard to the first question I know that it is necessary to combain these two technologies to save.

However concerning displaying itself - it can’t show what you would like to add, i.e. ‘window’ to add title an event emerges but the event after addition doesn’t show itself even temporarily.

My code:


$this->widget('application.extensions.fullcalendar.FullcalendarGraphWidget', 

    array(

        'data'=>array(

			array(

				'title'=> 'test',

				'start'=> date('2010-09-02 06:30'),

				'end'=> date('2010-09-02 07:30'),

				'allDay'=> false

			)

        ),

        'options'=>array(

        	'theme'=> true,

            'editable'=>true,

        	'header' => array(

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

				'right' => 'month,agendaWeek,agendaDay',

				//'center' => 'title',

			),

			'selectable' => true,

			'selectHelper' => true,

			'select' => "js:function(start, end, allDay) {

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

				if (title) {

					calendar.fullCalendar('renderEvent',{

						title: title,

						start: start,

						end: end,

						allDay: allDay

					},

					true // make the event 'stick'

					);

				}

				calendar.fullCalendar('unselect');

			}"

		),

        'htmlOptions'=>array(

               'style'=>'width:800px;margin: 0 auto;'

        ),

    )

);

This:


$ ('# Calendar'). FullCalendar ((

is likely to be recorded like this:


'Options' => array (

I have a question how to transform this statement in php


var calendar = $ ('# calendar'). fullCalendar ((

because without this probably does not want to dynamically add events.

Sorry, late to comment

For my mistake I forgot the important code. According to the above code you should change the code “Yii::app()->getClientScript()->registerScript(CLASS.’#’.$id,”$(’#$id’).fullCalendar($encodeoptions);");" in FullcalendarGraphWidget.php to “Yii::app()->getClientScript()->registerScript(CLASS.’#’.$id,“var calendar=$(’#$id’).fullCalendar($encodeoptions);”);”

If done the code can work well.

Enjoy yourself and good luck.

It works. Thanks :)

Thank you so much Bulwaria for posting this example! It was the final piece of help I needed to get the calendar to work. Thanks!

How do you add hyperlinks to the events. Like the one on the Yii extension page demos an event click her for facebook?

‘url’=>‘http://google.com

for anyone who wants to know.

Figured it out.

How can I change color of different events ?

eventBackgroundColor

It’s really works. Thanks…

Hi! I am using the fullcalendar widget updated to version 1.5.3 & am using ajax call for "select" to save an event. The created event is getting saved in database but it is not sticking to the calendar when created. "renderEvent" is not working for me & so is its stick parameter. The events are displayed on reloading the page. But I want to stick the events to the calendar when they are created.

Also, in the week view when i click on any time slot, the slot gets selected with certain delay i.e. if I click on 6:00 am then 7:30 am slot gets selected.

Any help will be appreciated. Thanks in advance.