efullcalendarheart Extension for Arshaw FullCalendar Versi 2

  1. Requirements
  2. Instalation
  3. Usage
  4. Result
  5. Advanced Usage

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

2 0
15 followers
2 264 downloads
Yii Version: 1.1
License: MIT
Category: Date and Time
Developed by: ThePr0f3550r
Created on: May 7, 2014
Last updated: 10 years ago

Downloads

show all

Related Extensions