lagman/yii-fullcalendar

Yii extension for the Arshaw's FullCalendar jQuery plugin

Installs: 20

Dependents: 0

Suggesters: 0

Security: 0

Stars: 0

Watchers: 1

Forks: 3

Open Issues: 1

Language:JavaScript

Type:yii-extension

dev-master 2014-02-12 03:35 UTC

This package is auto-updated.

Last update: 2024-10-17 19:54:01 UTC


README

By Alexey Samoylov (alexey.samoylov@gmail.com).

Requirements

  • PHP 5.4
  • Yii 1.x

Examples

Global component configuration example:

'components' => [
    'fullcalendar' => [
        'class' => 'ext.yii-fullcalendar.FullCalendar',
            'options' => [
                'buttonText' => [
                    'today' => 'Сегодня',
                    'week' => 'Неделя',
                    'day' => 'День',
                ],
                'allDayDefault' => false,
            ],
        ],
    ],

Usage example:

View:

<?php $this->widget('ext.yii-fullcalendar.FullCalendarWidget', [ 'options' => [
    'defaultView' => 'agendaWeek',
    'header' => [
        'left' => 'prev,next today',
        'center' => 'title',
        'right' => 'agendaWeek, agendaDay',
    ],
    'allDaySlot' => false,
    'editable' => false,
    'buttonText' => [
        'today' => 'Сегодня',
        'week' => 'Неделя',
        'day' => 'День',
    ],
    'slotMinutes' => 15,
    'height' =>  5000,
    'minTime' => '08:00',
    'maxTime' => '20:00',
    'events' => [],
    'eventSources' => [
        [
            'url' => Yii::app()->request->url,
            'type' => 'POST',
            'data' => [
                'ajax' => true,
            ],
            'error' => "js:function() {
                alert('Ошибка загрузки данных!');
            }",
            'color' => 'green',
            'textColor' => 'black',
        ]
    ],
]]);
?>

Controller:

public function actionCalendar()
{
    if (Yii::app()->request->isAjaxRequest) {
        $this->generateCalendarEvents();
        Yii::app()->end();
    }

    $this->render('calendar');
}

public function generateCalendarEvents()
{
    $events = [
        [ 'title' => 'sample event 1', 'start' => time() ],
    ];

    echo CJSON::encode($events);
}

Links