bulwaria
(Damian Lalewicz)
August 27, 2010, 7:22am
1
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;'
),
)
);
?>
bulwaria
(Damian Lalewicz)
August 31, 2010, 10:09am
2
I realize that no one was occupied with it.
thyseus
(Thyseus)
September 1, 2010, 1:48pm
3
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
vincent.dong
(Vincent Qiang Dong)
September 2, 2010, 8:48am
6
thyseus:
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
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
$this->widget('application.extensions.fullcalendar.FullcalendarGraphWidget',
array(
'data'=>array(
array(
'title'=> 'All Day Event',
'start'=> date('2010-09-01'),
'end'=> date('2010-09-02'),
),
array(
'title'=> 'test',
'start'=> date('2010-09-05'),
'end'=> date('2010-09-06'),
)
),
'options'=>array(
'editable'=>true,
'header' => array(
'left' => 'prev,next today',
'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:720px;margin: 0 auto;'
),
)
);
?>
bulwaria
(Damian Lalewicz)
September 2, 2010, 11:54am
7
Also, thanks. Certainly be helpful
bulwaria
(Damian Lalewicz)
September 2, 2010, 12:30pm
8
However, when you select and add an event title will not be added
And one more question. How to specify the exact time?
vincent.dong
(Vincent Qiang Dong)
September 3, 2010, 2:15am
9
Bulwaria:
However, when you select and add an event title will not be added
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.
bulwaria
(Damian Lalewicz)
September 3, 2010, 7:00am
10
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;'
),
)
);
bulwaria
(Damian Lalewicz)
September 7, 2010, 1:54pm
11
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.
vincent.dong
(Vincent Qiang Dong)
September 26, 2010, 8:21am
12
Bulwaria:
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.
Bulwaria:
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:
…
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!
closerwalk
(Closerwalk)
October 28, 2011, 5:53pm
15
How do you add hyperlinks to the events. Like the one on the Yii extension page demos an event click her for facebook?
closerwalk
(Closerwalk)
October 28, 2011, 6:05pm
16
‘url’=>‘http://google.com ’
for anyone who wants to know.
Figured it out.
umert
(Utalha)
March 21, 2012, 8:34am
17
How can I change color of different events ?
thyseus:
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’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.