This extension only wrapper of fantastic calendar library, it is FullCalendar Version 2.xx..
This extension inspired by efullcalendar that still use FullCalendar version 1.XX
Requirements ¶
Yii 1.1
Instalation ¶
Only extract to Your extension directory :)
Usage ¶
in view You can use this code
<?php $this->widget('ext.fullcalendar.EFullCalendarHeart', array(
//'themeCssFile'=>'cupertino/jquery-ui.min.css',
'options'=>array(
'header'=>array(
'left'=>'prev,next,today',
'center'=>'title',
'right'=>'month,agendaWeek,agendaDay',
),
'events'=>$this->createUrl('latihan/training/calendarEvents'), // URL to get event
)));
?>
In Controller You can use this..
public function actionCalendarEvents()
{
$items = array();
$model=Training::model()->findAll();
foreach ($model as $value) {
$items[]=array(
'title'=>$value->name,
'start'=>$value->start,
'end'=>date('Y-m-d', strtotime('+1 day', strtotime($value->finish))),
//'color'=>'#CC0000',
//'allDay'=>true,
//'url'=>'http://anyurl.com'
);
}
echo CJSON::encode($items);
Yii::app()->end();
}
But.. You can use All feature of Arshaw fullCalendar versi 2.XX. And You can update next version of fullCalendar with easy.. please see extract result..
Result ¶
No pict is hoax
Advanced Usage ¶
In myproject, I use extension yiibooster.. below example usage for advanced.. MyScenario is when a event is clicked.. It will show detail information from the event as modal popup.. this is use jquery ajax..
In view
<?php $this->widget('ext.heart.fullcalendar.EFullCalendarHeart', array(
//'themeCssFile'=>'cupertino/jquery-ui.min.css',
'options'=>array(
'header'=>array(
'left'=>'prev,next,today',
'center'=>'title',
'right'=>'month,agendaWeek,agendaDay',
),
'events'=>$this->createUrl('latihan/training/calendarEvents'),
'eventClick'=> 'js:function(calEvent, jsEvent, view) {
$("#myModalHeader").html(calEvent.title);
$("#myModalBody").load("'.Yii::app()->createUrl("latihan/training/view/id/").'"+calEvent.id+"?asModal=true");
$("#myModal").modal();
}',
)));
?>
<?php $this->beginWidget(
'bootstrap.widgets.TbModal',
array('id' => 'myModal')
); ?>
<div class="modal-header">
<a class="close" data-dismiss="modal">×</a>
<h4 id="myModalHeader">Modal header</h4>
</div>
<div class="modal-body" id="myModalBody">
<p>One fine body...</p>
</div>
<div class="modal-footer">
<?php $this->widget(
'bootstrap.widgets.TbButton',
array(
'label' => 'Close',
'url' => '#',
'htmlOptions' => array('data-dismiss' => 'modal'),
)
); ?>
</div>
<?php $this->endWidget(); ?>
In Controller
public function actionView($id)
{
if (@$_GET['asModal']==true)
{
$this->renderPartial('view',
array('model'=>$this->loadModel($id)),false,true
);
}
else{
$this->layout = 'column2';
$this->render('view',array(
'model'=>$this->loadModel($id),
));
}
}
public function actionCalendar()
{
$model=new Training('search');
$model->unsetAttributes(); // clear any default values
if(isset($_GET['Training']))
$model->attributes=$_GET['Training'];
$this->render('calendar',array(
'model'=>$model,
));
}
public function actionCalendarEvents()
{
$items = array();
$model=Training::model()->findAll();
foreach ($model as $value) {
$items[]=array(
'id'=>$value->id,
'title'=>$value->name,
'start'=>$value->start,
'end'=>date('Y-m-d', strtotime('+1 day', strtotime($value->finish))),
//'color'=>'#CC0000',
//'allDay'=>true,
'url'=>'#',
);
}
echo CJSON::encode($items);
Yii::app()->end();
}
Result..
This extension created with love :)
You have any ideas??? contact us milisstudio@gmail.com
Great
Thanks very much!
Not tested yet, but this solves problems with latter Yii 1.1.x versions which uses updated jQuery and breaks the FullCalendar 1.x
Regards!
:)
Can I use any language?
like http://arshaw.com/fullcalendar/docs2/text/lang/
@Евгений Yes You can
Yes you can use it.
special characters
thanks for extension :)
I have a problem with special characters, it don't show in calendar
example:
in database: Análise
show in calendar: An&Atild;¡lise
can someone help me solve this? in tables and in rest of script it show right
@ Error
I have a problem on this line. I cant load this page.. plz help me out
$("#myModalBody").load("'.Yii::app()->createUrl("/calendar/view/id/").'"+calEvent.id+"?asModal=true");
How To send dynamic custom data to server-side (form input)
Example:
<?php $this->widget('ext.fullcalendar.EFullCalendarHeart', array( //'themeCssFile'=>'cupertino/jquery-ui.min.css', 'id'=>'calendar1', 'options'=>array( 'header'=>array( 'left'=>'prev,next,today', 'center'=>'title', 'right'=>'month,agendaWeek,agendaDay', ), 'events'=>array( 'url'=>$this->createUrl('/evento/calendarEvents'), 'type'=>'POST', 'data'=>new CJavaScriptExpression( "function() { return { custom_parameter: $('#input_id').val() }; }" ) ),...
The startParam and endParam values will still automatically be included.
Problem to limit events
I can't limit the events displayed in the month view, ie make the show more instead of showing all the events assigned button to appear one day, I hope someone can help me with that, thanks
Model Sugestion
Do some one have a suggestion for the parameters that should be present at a model for events? I know the basic infos I need for my project, but as I'm just starting playing with the full calendar, I don't know what are the possibilities.
Tks,
Keren
Keren gan, kepake banget nih buat saya.
Note:
If we in month view, and want to click at a day which show all event at that day, use dayClick. The example as below at view:
<?php $this->widget('ext.fullcalendar.EFullCalendarHeart', array( //'themeCssFile'=>'cupertino/jquery-ui.min.css', 'id'=>'calendar', 'options'=>array( 'header'=>array( 'left'=>'prev,today,next', 'center'=>'title', 'right'=>'month,agendaWeek,agendaDay', ), 'firstDay'=>0, // from Sunday 'businessHours'=>array( // work time 'start'=>'08:00', 'end'=>'17:00', 'dow'=>'1,2,3,4,5', // monday to friday ), 'events'=>$this->createUrl('kegiatan/kalenderEvents/'), // URL to get event 'dayClick'=> "js:function(date, jsEvent, view) { if(view.name == 'month' || view.name == 'basicWeek') { $('#calendar').fullCalendar('changeView', 'basicDay'); $('#calendar').fullCalendar('gotoDate', date); } }" ))); ?> [/php]
Source: http://stackoverflow.com/questions/27961647/fullcalenday-clicking-day-change-to-agenda-view-of-that-particular-date
If you have any questions, please ask in the forum instead.
Signup or Login in order to comment.