Yii 1.1: efullcalendarheart

Extension for Arshaw FullCalendar Versi 2
10 followers

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 IMAGE

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">&times;</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

Total 5 comments

#17705 report it
vijay p s at 2014/07/16 07:34am
@ 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");
#17447 report it
nferreirax at 2014/06/13 12:02pm
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

#17241 report it
JbalTero at 2014/05/15 05:20am
@Евгений Yes You can

Yes you can use it.

#17234 report it
Евгений at 2014/05/14 02:49pm
Can I use any language?

like http://arshaw.com/fullcalendar/docs2/text/lang/

#17147 report it
Junior - df9 at 2014/05/07 08:43am
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!

:)

Leave a comment

Please to leave your comment.

Create extension