lagman/yii-fullcalendar

Arshaw的FullCalendar jQuery插件的Yii扩展

安装: 20

依赖: 0

建议者: 0

安全性: 0

星标: 0

关注者: 1

分支: 3

开放性问题: 1

语言:JavaScript

类型:yii-extension

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

This package is auto-updated.

Last update: 2024-09-17 19:44:19 UTC


README

由Alexey Samoylov (alexey.samoylov@gmail.com) 编写。

要求

  • PHP 5.4
  • Yii 1.x

示例

全局组件配置示例

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

使用示例

视图

<?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',
        ]
    ],
]]);
?>

控制器

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);
}

链接