yii2fullcalendar ¶
JQuery Fullcalendar Yii2 Extension JQuery from: http://arshaw.com/fullcalendar/ License MIT
JQuery Documentation: http://arshaw.com/fullcalendar/docs/ Yii2 Extension by philipp@frenzel.net
A tiny sample can be found here: http://yii2fullcalendar.beeye.org
Installation ¶
Package is although registered at packagist.org - so you can just add one line of code, to let it run!
add the following line to your composer.json require section:
"philippfrenzel/yii2fullcalendar":"*",
Usage ¶
Quickstart Looks like this:
$events = array();
//Testing
$Event = new \yii2fullcalendar\models\Event();
$Event->id = 1;
$Event->title = 'Testing';
$Event->start = date('Y-m-d\Th:m:s\Z');
$events[] = $Event;
$Event = new \yii2fullcalendar\models\Event();
$Event->id = 2;
$Event->title = 'Testing';
$Event->start = date('Y-m-d\Th:m:s\Z',strtotime('tomorrow 6am'));
$events[] = $Event;
?>
<?= \yii2fullcalendar\yii2fullcalendar::widget(array(
'events'=> $events,
));
Note, that this will only view the events without any detailed view or option to add a new event.. etc.
AJAX Usage ¶
If you wanna use ajax loader, this could look like this:
<?= yii2fullcalendar\yii2fullcalendar::widget(array(
'ajaxEvents' => Url::to(['/timetrack/default/jsoncalendar'])
));
?>
and inside your referenced controller, the action should look like this:
public function actionJsoncalendar($start=NULL,$end=NULL,$_=NULL){
$times = \app\modules\timetrack\models\Timetable::find()->where(array('category'=>\app\modules\timetrack\models\Timetable::CAT_TIMETRACK))->all();
$events = array();
foreach ($times AS $time){
//Testing
$Event = new \yii2fullcalendar\models\Event();
$Event->id = $time->id;
$Event->title = $time->categoryAsString;
$Event->start = date('Y-m-d\Th:m:s\Z',strtotime($time->date_start.' '.$time->time_start));
$Event->end = date('Y-m-d\Th:m:s\Z',strtotime($time->date_start.' '.$time->time_end));
$events[] = $Event;
}
header('Content-type: application/json');
echo Json::encode($events);
Yii::$app->end();
}
attach event drop
How can attach event drop?
<?= \yii2fullcalendar\yii2fullcalendar::widget(array( 'ajaxEvents' => Url::to(['/site/jsoncalendar']), 'clientOptions' => [ 'editable' => true, 'droppable' => true, 'drop' => ???????? ], )); ?>
attach event drop
Hi IRCSASW,
pls. check out the latest docs at github and the full sample repository:
https://github.com/philippfrenzel/yii2fullcalendar-demo
If you still don't get it to run, pls. open an github issue:
https://github.com/philippfrenzel/yii2fullcalendar/issues
Thanks
404 error on files
Would you happen to know if the following is due to an error in the extension, or an error in my implementation?
http://www.yiiframework.com/forum/index.php/topic/63383-fullcalendar-404-error-on-dependant-files/
update event back to DB
I have made my events editable, so I can drag them around to try and update them.
But I am trying to figure what fullcalender function I should use when I have dragged one of those events from one day to another, to call the controller and update the database.
I tried to use the eventDragStop event, but the date on the event being dragged is still the old one at that point (unless I have done something wrong).
Do you know how I go about passing the event from the calender widget back to my controller after I have dragged the event to a new day, or even resized the event in day view?
EDIT:
To answer this for anyone else with this question:
eventResize
http://fullcalendar....ui/eventResize/
eventDrop
http://fullcalendar....t_ui/eventDrop/
The former is used when you resize an event to make it longer or shorter
The later is for when you drag an entire event from one date\time to another
error in date() function
the correct way is to use "i" instead of "m" for minutes.
... $Event->start = date('Y-m-d\Th:i:s\Z',strtotime($time->date_start.' '.$time->time_start)); ...
Thx!
I'll check and updated my readme at github! Pls. if possible, always post issues like this on github too, as it's much easier to keep track of this!
model Timetable
I do not find models Timetable.
Add google calendar
Hi can you tell me how to user google calendar in this widgets.Also how to combine google calendar events and json events.Can you please tell me...
Language not changing
Hi,
Congratulations! Good work!
I am trying change default language of my fullcalendar.
I am using this code:
<?= yii2fullcalendar\yii2fullcalendar::widget([ 'options' => [ 'language' => 'pt-br', //... more options to be defined here! ], 'events' => $events ]); ?>
But it does not change it. Continue with English language.
What is wrong? Can you help me pls?
Tks advanced.
@ric_ardo
`
php<?= yii2fullcalendar\yii2fullcalendar::widget([
'options' => [ 'lang' => 'pt-br', //... more options to be defined here! ], 'events' => $events ]); ?>
I checked the extension source.. This way is the correct use to change the language ;)
Hi, I´m trying to do something like this: https://fullcalendar.io/docs/event-tooltip-demo
Looking at the example in: https://codepen.io/pen/?editors=0010
I tried to do something like this:
$eventfull->rendering = ' function(eventObj, $el) { $el.popover({ title: eventObj.title, content: eventObj.description, trigger: \'hover\', placement: \'top\', container: \'body\' }); };';
But it just dosen´t work, any ideas?
Not Working
The file or directory to be published does not exist: D:\xampp\htdocs\yii/vendor/bower-asset/fullcalendar/dist
I have the same problem
The file or directory to be published does not exist: D:\xampp\htdocs\yii/vendor/bower-asset/fullcalendar/dist
Hello
I have used fullcalendar to display event. But i need to display image in fullcalendar and display html button in calendar.
For html
$times = BookingEvent::find()->all();
$events = array(); foreach ($times AS $time){ $html = '<span style="color:red">Full</span>'; $Event = new \yii2fullcalendar\models\Event(); $Event->id = $time->id; $Event->title = $html; $Event->start = date('Y-m-d',strtotime($time->start_date)); $Event->end = date('Y-m-d',strtotime($time->start_date)); $events[] = $Event; }
above display html tag as plain text.
If you have any questions, please ask in the forum instead.
Signup or Login in order to comment.