├── .gitignore ├── src ├── ThemeAsset.php ├── MomentAsset.php ├── PrintAsset.php ├── models │ ├── CalendarModel.php │ ├── Resource.php │ └── Event.php ├── CoreAsset.php └── FullcalendarScheduler.php ├── demos ├── json.php ├── gcal.php ├── vertical-resource-view.php ├── rendering-hooks.php ├── simple.php ├── theme.php ├── scale.php ├── no-overlap.php ├── misc-callbacks.php ├── json │ └── SchedulerController.php ├── ordering.php ├── background-events.php ├── selectable.php ├── grouping.php ├── columns.php ├── dynamic-add-remove.php ├── column-grouping.php └── external-dragging.php ├── composer.json ├── LICENSE.md ├── CHANGE.MD ├── README.md └── composer.lock /.gitignore: -------------------------------------------------------------------------------- 1 | vendor/ 2 | -------------------------------------------------------------------------------- /src/ThemeAsset.php: -------------------------------------------------------------------------------- 1 | 'print', 18 | ]; 19 | /** @var string Npm path for the print settings */ 20 | public $sourcePath = '@npm/fullcalendar/dist'; 21 | } 22 | 23 | -------------------------------------------------------------------------------- /src/models/CalendarModel.php: -------------------------------------------------------------------------------- 1 | $field)) { 20 | unset($fields[$field]); 21 | } 22 | } 23 | return $fields; 24 | } 25 | } -------------------------------------------------------------------------------- /demos/json.php: -------------------------------------------------------------------------------- 1 | = \edofre\fullcalendarscheduler\FullcalendarScheduler::widget([ 2 | 'header' => [ 3 | 'left' => 'today prev,next', 4 | 'center' => 'title', 5 | 'right' => 'timelineDay,timelineThreeDays,agendaWeek,month', 6 | ], 7 | 'clientOptions' => [ 8 | 'now' => '2016-05-07', 9 | 'editable' => true, // enable draggable events 10 | 'aspectRatio' => 1.8, 11 | 'scrollTime' => '00:00', // undo default 6am scrollTime 12 | 'defaultView' => 'timelineDay', 13 | 'views' => [ 14 | 'timelineThreeDays' => [ 15 | 'type' => 'timeline', 16 | 'duration' => ['days' => 3], 17 | ], 18 | ], 19 | 'resourceLabelText' => 'Rooms', 20 | 'resources' => \yii\helpers\Url::to(['scheduler/resources', 'id' => 1]), 21 | 'events' => \yii\helpers\Url::to(['scheduler/events', 'id' => 2]), 22 | ], 23 | ]); 24 | ?> -------------------------------------------------------------------------------- /composer.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "edofre/yii2-fullcalendar-scheduler", 3 | "description": "Yii2 widget for fullcalendar scheduler module", 4 | "require": { 5 | "php": ">=5.5.0", 6 | "yiisoft/yii2": ">=2.0.9", 7 | "yiisoft/yii2-jui": ">=2.0.6", 8 | "npm-asset/fullcalendar": "v3.8.0", 9 | "npm-asset/fullcalendar-scheduler": "1.9.1" 10 | }, 11 | "keywords": [ 12 | "fullcalendar-scheduler", 13 | "scheduler", 14 | "javascript", 15 | "event", 16 | "calendar" 17 | ], 18 | "homepage": "https://github.com/edofre/yii2-fullcalendar-scheduler", 19 | "type": "yii2-extension", 20 | "license": "MIT", 21 | "authors": [ 22 | { 23 | "name": "Edo Freriks", 24 | "email": "edofre@gmail.com" 25 | } 26 | ], 27 | "autoload": { 28 | "psr-4": { 29 | "edofre\\fullcalendarscheduler\\": "src" 30 | } 31 | }, 32 | "extra": { 33 | "branch-alias": { 34 | "dev-master": "1.1.x-dev" 35 | } 36 | } 37 | } -------------------------------------------------------------------------------- /LICENSE.md: -------------------------------------------------------------------------------- 1 | The MIT License (MIT) 2 | 3 | Copyright (c) 2018 Edo Freriks 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | -------------------------------------------------------------------------------- /demos/gcal.php: -------------------------------------------------------------------------------- 1 | = \edofre\fullcalendarscheduler\FullcalendarScheduler::widget([ 2 | 'header' => [ 3 | 'left' => 'today prev,next', 4 | 'center' => 'title', 5 | 'right' => 'timelineMonth,timelineYear', 6 | ], 7 | 'clientOptions' => [ 8 | 'now' => '2016-05-07', 9 | 'editable' => true, // enable draggable events 10 | 'aspectRatio' => 1.8, 11 | 'scrollTime' => '00:00', // undo default 6am scrollTime 12 | 'defaultView' => 'timelineMonth', 13 | 14 | /* 15 | NOTE: unfortunately, Scheduler doesn't know how to associated events from 16 | Google Calendar with resources, so if you specify a resource list, 17 | nothing will show up :( Working on some solutions. 18 | */ 19 | 20 | // THIS KEY WON'T WORK IN PRODUCTION!!! 21 | // To make your own Google API key, follow the directions here: 22 | // http://fullcalendar.io/docs/google_calendar/ 23 | 'googleCalendarApiKey' => 'AIzaSyDcnW6WejpTOCffshGDDb4neIrXVUA1EAE', 24 | 25 | // US Holidays 26 | 'events' => 'usa__en@holiday.calendar.google.com', 27 | 28 | 'dayClick' => new \yii\web\JsExpression(" 29 | function (event) { 30 | // opens events in a popup window 31 | window.open(event.url, 'gcalevent', 'width=700,height=600'); 32 | return false; 33 | } 34 | "), 35 | ], 36 | ]); 37 | ?> -------------------------------------------------------------------------------- /src/models/Resource.php: -------------------------------------------------------------------------------- 1 | [ 3 | 'left' => 'prev,next today', 4 | 'center' => 'title', 5 | 'right' => 'agendaDay,agendaTwoDay,agendaWeek,month', 6 | ], 7 | 'clientOptions' => [ 8 | 'defaultView' => 'agendaDay', 9 | 'defaultDate' => '2016-05-07', 10 | 'editable' => true, 11 | 'selectable' => true, 12 | 'eventLimit' => true, // allow "more" link when too many events 13 | 'views' => [ 14 | 'agendaTwoDay' => [ 15 | 'type' => 'agenda', 16 | 'duration' => ['days' => 2], 17 | // views that are more than a day will NOT do this behavior by default 18 | // so, we need to explicitly enable it 19 | 'groupByResource' => true, 20 | //// uncomment this line to group by day FIRST with resources underneath 21 | //'groupByDateAndResource'=>true, 22 | ], 23 | ], 24 | //// uncomment this line to hide the all-day slot 25 | //allDaySlot'=>false, 26 | 'resources' => [ 27 | ['id' => 'a', 'title' => 'Room A'], 28 | ['id' => 'b', 'title' => 'Room B', 'eventColor' => 'green'], 29 | ['id' => 'c', 'title' => 'Room C', 'eventColor' => 'orange'], 30 | ['id' => 'd', 'title' => 'Room D', 'eventColor' => 'red'], 31 | ], 32 | 'events' => [ 33 | ['id' => '1', 'resourceId' => 'a', 'start' => '2016-05-06', 'end' => '2016-05-08', 'title' => 'event 1'], 34 | ['id' => '2', 'resourceId' => 'a', 'start' => '2016-05-07T09:00:00', 'end' => '2016-05-07T14:00:00', 'title' => 'event 2'], 35 | ['id' => '3', 'resourceId' => 'b', 'start' => '2016-05-07T12:00:00', 'end' => '2016-05-08T06:00:00', 'title' => 'event 3'], 36 | ['id' => '4', 'resourceId' => 'c', 'start' => '2016-05-07T07:30:00', 'end' => '2016-05-07T09:30:00', 'title' => 'event 4'], 37 | ['id' => '5', 'resourceId' => 'd', 'start' => '2016-05-07T10:00:00', 'end' => '2016-05-07T15:00:00', 'title' => 'event 5'], 38 | ], 39 | 'select' => new \yii\web\JsExpression(" 40 | function(start, end, jsEvent, view, resource) { 41 | console.log( 42 | 'select', 43 | start.format(), 44 | end.format(), 45 | resource ? resource.id : '(no resource)' 46 | ); 47 | } 48 | "), 49 | 'dayClick' => new \yii\web\JsExpression(" 50 | function(date, jsEvent, view, resource) { 51 | console.log( 52 | 'dayClick', 53 | date.format(), 54 | resource ? resource.id : '(no resource)' 55 | ); 56 | } 57 | "), 58 | ], 59 | ]); 60 | ?> -------------------------------------------------------------------------------- /demos/rendering-hooks.php: -------------------------------------------------------------------------------- 1 | = \edofre\fullcalendarscheduler\FullcalendarScheduler::widget([ 2 | 'header' => [ 3 | 'left' => 'today prev,next', 4 | 'center' => 'title', 5 | 'right' => 'timelineDay,timelineThreeDays,agendaWeek,month', 6 | ], 7 | 'clientOptions' => [ 8 | 'now' => '2016-05-07', 9 | 'editable' => true, // enable draggable events 10 | 'aspectRatio' => 1.8, 11 | 'scrollTime' => '00:00', // undo default 6am scrollTime 12 | 'defaultView' => 'timelineDay', 13 | 'views' => [ 14 | 'timelineThreeDays' => [ 15 | 'type' => 'timeline', 16 | 'duration' => ['days' => 3], 17 | ], 18 | ], 19 | 'resourceLabelText' => 'Rooms', 20 | 'resourceText' => new \yii\web\JsExpression(" 21 | function(resource) { 22 | return 'Auditorium ' + ('' + resource.id).toUpperCase(); 23 | } 24 | "), 25 | 'resourceRender' => new \yii\web\JsExpression(" 26 | function(resource, leftCells, rightCells) { 27 | if (resource.id == 'h') { 28 | leftCells.css('background-color', 'rgb(255, 243, 206)'); 29 | rightCells.css('background-color', 'rgba(255, 243, 206, .5)'); 30 | } 31 | } 32 | "), 33 | 'resources' => [ 34 | ['id' => 'a'], 35 | ['id' => 'b', 'eventColor' => 'green'], 36 | ['id' => 'c', 'eventColor' => 'orange'], 37 | ['id' => 'd'], 38 | ['id' => 'e'], 39 | ['id' => 'f', 'eventColor' => 'red'], 40 | ['id' => 'g'], 41 | ['id' => 'h'], 42 | ['id' => 'i'], 43 | ['id' => 'j'], 44 | ['id' => 'k'], 45 | ['id' => 'l'], 46 | ['id' => 'm'], 47 | ['id' => 'n'], 48 | ['id' => 'o'], 49 | ['id' => 'p'], 50 | ['id' => 'q'], 51 | ['id' => 'r'], 52 | ['id' => 's'], 53 | ['id' => 't'], 54 | ['id' => 'u'], 55 | ['id' => 'v'], 56 | ['id' => 'w'], 57 | ['id' => 'x'], 58 | ['id' => 'y'], 59 | ['id' => 'z'], 60 | ], 61 | 'events' => [ 62 | ['id' => '1', 'resourceId' => 'b', 'start' => '2016-05-07T02:00:00', 'end' => '2016-05-07T07:00:00', 'title' => 'event 1'], 63 | ['id' => '2', 'resourceId' => 'c', 'start' => '2016-05-07T05:00:00', 'end' => '2016-05-07T22:00:00', 'title' => 'event 2'], 64 | ['id' => '3', 'resourceId' => 'd', 'start' => '2016-05-06', 'end' => '2016-05-08', 'title' => 'event 3'], 65 | ['id' => '4', 'resourceId' => 'e', 'start' => '2016-05-07T03:00:00', 'end' => '2016-05-07T08:00:00', 'title' => 'event 4'], 66 | ['id' => '5', 'resourceId' => 'f', 'start' => '2016-05-07T00:30:00', 'end' => '2016-05-07T02:30:00', 'title' => 'event 5'], 67 | ], 68 | ], 69 | ]); 70 | ?> -------------------------------------------------------------------------------- /src/CoreAsset.php: -------------------------------------------------------------------------------- 1 | language) ? \Yii::$app->language : $this->language; 52 | if (file_exists($this->sourcePath . "/fullcalendar/dist/locale/$language.js")) { 53 | $this->js[] = "fullcalendar/dist/locale/$language.js"; 54 | } 55 | 56 | if ($this->googleCalendar) { 57 | $this->js[] = 'fullcalendar/dist/gcal.js'; 58 | } 59 | 60 | // We need to return the parent implementation otherwise the scripts are not loaded 61 | return parent::registerAssetFiles($view); 62 | } 63 | } 64 | -------------------------------------------------------------------------------- /demos/simple.php: -------------------------------------------------------------------------------- 1 | = \edofre\fullcalendarscheduler\FullcalendarScheduler::widget([ 2 | 'header' => [ 3 | 'left' => 'today prev,next', 4 | 'center' => 'title', 5 | 'right' => 'timelineDay,timelineThreeDays,agendaWeek,month', 6 | ], 7 | 'clientOptions' => [ 8 | 'now' => '2016-05-07', 9 | 'editable' => true, // enable draggable events 10 | 'aspectRatio' => 1.8, 11 | 'scrollTime' => '00:00', // undo default 6am scrollTime 12 | 'defaultView' => 'timelineDay', 13 | 'views' => [ 14 | 'timelineThreeDays' => [ 15 | 'type' => 'timeline', 16 | 'duration' => [ 17 | 'days' => 3, 18 | ], 19 | ], 20 | ], 21 | 'resourceLabelText' => 'Rooms', 22 | 'resources' => [ 23 | ['id' => 'a', 'title' => 'Auditorium A'], 24 | ['id' => 'b', 'title' => 'Auditorium B', 'eventColor' => 'green'], 25 | ['id' => 'c', 'title' => 'Auditorium C', 'eventColor' => 'orange'], 26 | [ 27 | 'id' => 'd', 'title' => 'Auditorium D', 28 | 'children' => [ 29 | ['id' => 'd1', 'title' => 'Room D1'], 30 | ['id' => 'd2', 'title' => 'Room D2'], 31 | ], 32 | ], 33 | ['id' => 'e', 'title' => 'Auditorium E'], 34 | ['id' => 'f', 'title' => 'Auditorium F', 'eventColor' => 'red'], 35 | ['id' => 'g', 'title' => 'Auditorium G'], 36 | ['id' => 'h', 'title' => 'Auditorium H'], 37 | ['id' => 'i', 'title' => 'Auditorium I'], 38 | ['id' => 'j', 'title' => 'Auditorium J'], 39 | ['id' => 'k', 'title' => 'Auditorium K'], 40 | ['id' => 'l', 'title' => 'Auditorium L'], 41 | ['id' => 'm', 'title' => 'Auditorium M'], 42 | ['id' => 'n', 'title' => 'Auditorium N'], 43 | ['id' => 'o', 'title' => 'Auditorium O'], 44 | ['id' => 'p', 'title' => 'Auditorium P'], 45 | ['id' => 'q', 'title' => 'Auditorium Q'], 46 | ['id' => 'r', 'title' => 'Auditorium R'], 47 | ['id' => 's', 'title' => 'Auditorium S'], 48 | ['id' => 't', 'title' => 'Auditorium T'], 49 | ['id' => 'u', 'title' => 'Auditorium U'], 50 | ['id' => 'v', 'title' => 'Auditorium V'], 51 | ['id' => 'w', 'title' => 'Auditorium W'], 52 | ['id' => 'x', 'title' => 'Auditorium X'], 53 | ['id' => 'y', 'title' => 'Auditorium Y'], 54 | ['id' => 'z', 'title' => 'Auditorium Z'], 55 | ], 56 | 'events' => [ 57 | ['id' => '1', 'resourceId' => 'b', 'start' => '2016-05-07T02:00:00', 'end' => '2016-05-07T07:00:00', 'title' => 'event 1'], 58 | ['id' => '2', 'resourceId' => 'c', 'start' => '2016-05-07T05:00:00', 'end' => '2016-05-07T22:00:00', 'title' => 'event 2'], 59 | ['id' => '3', 'resourceId' => 'd', 'start' => '2016-05-06', 'end' => '2016-05-08', 'title' => 'event 3'], 60 | ['id' => '4', 'resourceId' => 'e', 'start' => '2016-05-07T03:00:00', 'end' => '2016-05-07T08:00:00', 'title' => 'event 4'], 61 | ['id' => '5', 'resourceId' => 'f', 'start' => '2016-05-07T00:30:00', 'end' => '2016-05-07T02:30:00', 'title' => 'event 5'], 62 | ], 63 | ], 64 | ]); 65 | 66 | ?> -------------------------------------------------------------------------------- /demos/theme.php: -------------------------------------------------------------------------------- 1 | = \edofre\fullcalendarscheduler\FullcalendarScheduler::widget([ 2 | 'header' => [ 3 | 'left' => 'today prev,next', 4 | 'center' => 'title', 5 | 'right' => 'timelineDay,timelineThreeDays,agendaWeek,month', 6 | ], 7 | 'clientOptions' => [ 8 | 'theme' => true, 9 | 'now' => '2016-05-07', 10 | 'editable' => true, // enable draggable events 11 | 'aspectRatio' => 1.8, 12 | 'scrollTime' => '00:00', // undo default 6am scrollTime 13 | 'defaultView' => 'timelineDay', 14 | 'views' => [ 15 | 'timelineThreeDays' => [ 16 | 'type' => 'timeline', 17 | 'duration' => ['days' => 3], 18 | ], 19 | ], 20 | 'resourceLabelText' => 'Rooms', 21 | 'resources' => [ 22 | ['id' => 'a', 'title' => 'Auditorium A'], 23 | ['id' => 'b', 'title' => 'Auditorium B', 'eventColor' => 'green'], 24 | ['id' => 'c', 'title' => 'Auditorium C', 'eventColor' => 'orange'], 25 | [ 26 | 'id' => 'd', 'title' => 'Auditorium D', 27 | 'children' => [ 28 | ['id' => 'd1', 'title' => 'Room D1'], 29 | ['id' => 'd2', 'title' => 'Room D2'], 30 | ], 31 | ], 32 | ['id' => 'e', 'title' => 'Auditorium E'], 33 | ['id' => 'f', 'title' => 'Auditorium F', 'eventColor' => 'red'], 34 | ['id' => 'g', 'title' => 'Auditorium G'], 35 | ['id' => 'h', 'title' => 'Auditorium H'], 36 | ['id' => 'i', 'title' => 'Auditorium I'], 37 | ['id' => 'j', 'title' => 'Auditorium J'], 38 | ['id' => 'k', 'title' => 'Auditorium K'], 39 | ['id' => 'l', 'title' => 'Auditorium L'], 40 | ['id' => 'm', 'title' => 'Auditorium M'], 41 | ['id' => 'n', 'title' => 'Auditorium N'], 42 | ['id' => 'o', 'title' => 'Auditorium O'], 43 | ['id' => 'p', 'title' => 'Auditorium P'], 44 | ['id' => 'q', 'title' => 'Auditorium Q'], 45 | ['id' => 'r', 'title' => 'Auditorium R'], 46 | ['id' => 's', 'title' => 'Auditorium S'], 47 | ['id' => 't', 'title' => 'Auditorium T'], 48 | ['id' => 'u', 'title' => 'Auditorium U'], 49 | ['id' => 'v', 'title' => 'Auditorium V'], 50 | ['id' => 'w', 'title' => 'Auditorium W'], 51 | ['id' => 'x', 'title' => 'Auditorium X'], 52 | ['id' => 'y', 'title' => 'Auditorium Y'], 53 | ['id' => 'z', 'title' => 'Auditorium Z'], 54 | ], 55 | 'events' => [ 56 | ['id' => '1', 'resourceId' => 'b', 'start' => '2016-05-07T02:00:00', 'end' => '2016-05-07T07:00:00', 'title' => 'event 1'], 57 | ['id' => '2', 'resourceId' => 'c', 'start' => '2016-05-07T05:00:00', 'end' => '2016-05-07T22:00:00', 'title' => 'event 2'], 58 | ['id' => '3', 'resourceId' => 'd', 'start' => '2016-05-06', 'end' => '2016-05-08', 'title' => 'event 3'], 59 | ['id' => '4', 'resourceId' => 'e', 'start' => '2016-05-07T03:00:00', 'end' => '2016-05-07T08:00:00', 'title' => 'event 4'], 60 | ['id' => '5', 'resourceId' => 'f', 'start' => '2016-05-07T00:30:00', 'end' => '2016-05-07T02:30:00', 'title' => 'event 5'], 61 | ], 62 | ], 63 | ]); 64 | ?> -------------------------------------------------------------------------------- /demos/scale.php: -------------------------------------------------------------------------------- 1 | = \edofre\fullcalendarscheduler\FullcalendarScheduler::widget([ 2 | 'header' => [ 3 | 'left' => 'today prev,next', 4 | 'center' => 'title', 5 | 'right' => 'timelineDay,timelineTenDay,timelineMonth,timelineYear', 6 | ], 7 | 'clientOptions' => [ 8 | 'now' => '2016-05-07', 9 | 'editable' => true, 10 | 'aspectRatio' => 1.8, 11 | 'scrollTime' => '00:00', 12 | 'defaultView' => 'timelineDay', 13 | 'views' => [ 14 | 'timelineDay' => [ 15 | 'buttonText' => ':15 slots', 16 | 'slotDuration' => '00:15', 17 | ], 18 | 'timelineTenDay' => [ 19 | 'type' => 'timeline', 20 | 'duration' => ['days' => 10], 21 | ], 22 | ], 23 | 'resourceAreaWidth' => '25%', 24 | 'resourceLabelText' => 'Rooms', 25 | 'resources' => [ 26 | ['id' => 'a', 'title' => 'Auditorium A'], 27 | ['id' => 'b', 'title' => 'Auditorium B', 'eventColor' => 'green'], 28 | ['id' => 'c', 'title' => 'Auditorium C', 'eventColor' => 'orange'], 29 | [ 30 | 'id' => 'd', 'title' => 'Auditorium D', 31 | 'children' => [ 32 | ['id' => 'd1', 'title' => 'Room D1'], 33 | ['id' => 'd2', 'title' => 'Room D2'], 34 | ], 35 | ], 36 | ['id' => 'e', 'title' => 'Auditorium E'], 37 | ['id' => 'f', 'title' => 'Auditorium F', 'eventColor' => 'red'], 38 | ['id' => 'g', 'title' => 'Auditorium G'], 39 | ['id' => 'h', 'title' => 'Auditorium H'], 40 | ['id' => 'i', 'title' => 'Auditorium I'], 41 | ['id' => 'j', 'title' => 'Auditorium J'], 42 | ['id' => 'k', 'title' => 'Auditorium K'], 43 | ['id' => 'l', 'title' => 'Auditorium L'], 44 | ['id' => 'm', 'title' => 'Auditorium M'], 45 | ['id' => 'n', 'title' => 'Auditorium N'], 46 | ['id' => 'o', 'title' => 'Auditorium O'], 47 | ['id' => 'p', 'title' => 'Auditorium P'], 48 | ['id' => 'q', 'title' => 'Auditorium Q'], 49 | ['id' => 'r', 'title' => 'Auditorium R'], 50 | ['id' => 's', 'title' => 'Auditorium S'], 51 | ['id' => 't', 'title' => 'Auditorium T'], 52 | ['id' => 'u', 'title' => 'Auditorium U'], 53 | ['id' => 'v', 'title' => 'Auditorium V'], 54 | ['id' => 'w', 'title' => 'Auditorium W'], 55 | ['id' => 'x', 'title' => 'Auditorium X'], 56 | ['id' => 'y', 'title' => 'Auditorium Y'], 57 | ['id' => 'z', 'title' => 'Auditorium Z'], 58 | ], 59 | 'events' => [ 60 | ['id' => '1', 'resourceId' => 'b', 'start' => '2016-05-07T02:00:00', 'end' => '2016-05-07T07:00:00', 'title' => 'event 1'], 61 | ['id' => '2', 'resourceId' => 'c', 'start' => '2016-05-07T05:00:00', 'end' => '2016-05-07T22:00:00', 'title' => 'event 2'], 62 | ['id' => '3', 'resourceId' => 'd', 'start' => '2016-05-06', 'end' => '2016-05-08', 'title' => 'event 3'], 63 | ['id' => '4', 'resourceId' => 'e', 'start' => '2016-05-07T03:00:00', 'end' => '2016-05-07T08:00:00', 'title' => 'event 4'], 64 | ['id' => '5', 'resourceId' => 'f', 'start' => '2016-05-07T00:30:00', 'end' => '2016-05-07T02:30:00', 'title' => 'event 5'], 65 | ], 66 | ], 67 | ]); 68 | ?> -------------------------------------------------------------------------------- /demos/no-overlap.php: -------------------------------------------------------------------------------- 1 | = \edofre\fullcalendarscheduler\FullcalendarScheduler::widget([ 2 | 'header' => [ 3 | 'left' => 'today prev,next', 4 | 'center' => 'title', 5 | 'right' => 'timelineDay,timelineThreeDays,agendaWeek,month', 6 | ], 7 | 'clientOptions' => [ 8 | 'now' => '2016-05-07', 9 | 'editable' => true, // enable draggable events 10 | 'aspectRatio' => 1.8, 11 | 'scrollTime' => '00:00', // undo default 6am scrollTime 12 | 'defaultView' => 'timelineDay', 13 | 'views' => [ 14 | 'timelineThreeDays' => [ 15 | 'type' => 'timeline', 16 | 'duration' => ['days' => 3], 17 | ], 18 | ], 19 | 'eventOverlap' => false, // will cause the event to take up entire resource height 20 | 'resourceAreaWidth' => '25%', 21 | 'resourceLabelText' => 'Rooms', 22 | 'resources' => [ 23 | ['id' => 'a', 'title' => 'Auditorium A'], 24 | ['id' => 'b', 'title' => 'Auditorium B', 'eventColor' => 'green'], 25 | ['id' => 'c', 'title' => 'Auditorium C', 'eventColor' => 'orange'], 26 | [ 27 | 'id' => 'd', 'title' => 'Auditorium D', 28 | 'children' => [ 29 | ['id' => 'd1', 'title' => 'Room D1'], 30 | ['id' => 'd2', 'title' => 'Room D2'], 31 | ], 32 | ], 33 | ['id' => 'e', 'title' => 'Auditorium E'], 34 | ['id' => 'f', 'title' => 'Auditorium F', 'eventColor' => 'red'], 35 | ['id' => 'g', 'title' => 'Auditorium G'], 36 | ['id' => 'h', 'title' => 'Auditorium H'], 37 | ['id' => 'i', 'title' => 'Auditorium I'], 38 | ['id' => 'j', 'title' => 'Auditorium J'], 39 | ['id' => 'k', 'title' => 'Auditorium K'], 40 | ['id' => 'l', 'title' => 'Auditorium L'], 41 | ['id' => 'm', 'title' => 'Auditorium M'], 42 | ['id' => 'n', 'title' => 'Auditorium N'], 43 | ['id' => 'o', 'title' => 'Auditorium O'], 44 | ['id' => 'p', 'title' => 'Auditorium P'], 45 | ['id' => 'q', 'title' => 'Auditorium Q'], 46 | ['id' => 'r', 'title' => 'Auditorium R'], 47 | ['id' => 's', 'title' => 'Auditorium S'], 48 | ['id' => 't', 'title' => 'Auditorium T'], 49 | ['id' => 'u', 'title' => 'Auditorium U'], 50 | ['id' => 'v', 'title' => 'Auditorium V'], 51 | ['id' => 'w', 'title' => 'Auditorium W'], 52 | ['id' => 'x', 'title' => 'Auditorium X'], 53 | ['id' => 'y', 'title' => 'Auditorium Y'], 54 | ['id' => 'z', 'title' => 'Auditorium Z'], 55 | ], 56 | 'events' => [ 57 | ['id' => '1', 'resourceId' => 'b', 'start' => '2016-05-07T02:00:00', 'end' => '2016-05-07T07:00:00', 'title' => 'event 1'], 58 | ['id' => '2', 'resourceId' => 'c', 'start' => '2016-05-07T05:00:00', 'end' => '2016-05-07T22:00:00', 'title' => 'event 2'], 59 | ['id' => '3', 'resourceId' => 'd', 'start' => '2016-05-06', 'end' => '2016-05-08', 'title' => 'event 3'], 60 | ['id' => '4', 'resourceId' => 'e', 'start' => '2016-05-07T03:00:00', 'end' => '2016-05-07T08:00:00', 'title' => 'event 4'], 61 | ['id' => '5', 'resourceId' => 'f', 'start' => '2016-05-07T00:30:00', 'end' => '2016-05-07T02:30:00', 'title' => 'event 5'], 62 | ], 63 | ], 64 | ]); 65 | ?> -------------------------------------------------------------------------------- /demos/misc-callbacks.php: -------------------------------------------------------------------------------- 1 | = \edofre\fullcalendarscheduler\FullcalendarScheduler::widget([ 2 | 'header' => [ 3 | 'left' => 'today prev,next', 4 | 'center' => 'title', 5 | 'right' => 'timelineDay,timelineThreeDays,agendaWeek,month', 6 | ], 7 | 'clientOptions' => [ 8 | 'now' => '2016-05-07', 9 | 'editable' => true, // enable draggable events 10 | 'aspectRatio' => 1.8, 11 | 'scrollTime' => '00:00', // undo default 6am scrollTime 12 | 'defaultView' => 'timelineDay', 13 | 'views' => [ 14 | 'timelineThreeDays' => [ 15 | 'type' => 'timeline', 16 | 'duration' => ['days' => 3], 17 | ], 18 | ], 19 | // the point if this demo is to demonstrate dayClick... 20 | 'dayClick' => new \yii\web\JsExpression(" 21 | function(date, jsEvent, view, resourceObj) { 22 | console.log('dayClick', date.format(), resourceObj); 23 | } 24 | "), 25 | 'resourceLabelText' => 'Rooms', 26 | 'resources' => [ 27 | ['id' => 'a', 'title' => 'Auditorium A'], 28 | ['id' => 'b', 'title' => 'Auditorium B', 'eventColor' => 'green'], 29 | ['id' => 'c', 'title' => 'Auditorium C', 'eventColor' => 'orange'], 30 | [ 31 | 'id' => 'd', 'title' => 'Auditorium D', 32 | 'children' => [ 33 | ['id' => 'd1', 'title' => 'Room D1'], 34 | ['id' => 'd2', 'title' => 'Room D2'], 35 | ], 36 | ], 37 | ['id' => 'e', 'title' => 'Auditorium E'], 38 | ['id' => 'f', 'title' => 'Auditorium F', 'eventColor' => 'red'], 39 | ['id' => 'g', 'title' => 'Auditorium G'], 40 | ['id' => 'h', 'title' => 'Auditorium H'], 41 | ['id' => 'i', 'title' => 'Auditorium I'], 42 | ['id' => 'j', 'title' => 'Auditorium J'], 43 | ['id' => 'k', 'title' => 'Auditorium K'], 44 | ['id' => 'l', 'title' => 'Auditorium L'], 45 | ['id' => 'm', 'title' => 'Auditorium M'], 46 | ['id' => 'n', 'title' => 'Auditorium N'], 47 | ['id' => 'o', 'title' => 'Auditorium O'], 48 | ['id' => 'p', 'title' => 'Auditorium P'], 49 | ['id' => 'q', 'title' => 'Auditorium Q'], 50 | ['id' => 'r', 'title' => 'Auditorium R'], 51 | ['id' => 's', 'title' => 'Auditorium S'], 52 | ['id' => 't', 'title' => 'Auditorium T'], 53 | ['id' => 'u', 'title' => 'Auditorium U'], 54 | ['id' => 'v', 'title' => 'Auditorium V'], 55 | ['id' => 'w', 'title' => 'Auditorium W'], 56 | ['id' => 'x', 'title' => 'Auditorium X'], 57 | ['id' => 'y', 'title' => 'Auditorium Y'], 58 | ['id' => 'z', 'title' => 'Auditorium Z'], 59 | ], 60 | 'events' => [ 61 | ['id' => '1', 'resourceId' => 'b', 'start' => '2016-05-07T02:00:00', 'end' => '2016-05-07T07:00:00', 'title' => 'event 1'], 62 | ['id' => '2', 'resourceId' => 'c', 'start' => '2016-05-07T05:00:00', 'end' => '2016-05-07T22:00:00', 'title' => 'event 2'], 63 | ['id' => '3', 'resourceId' => 'd', 'start' => '2016-05-06', 'end' => '2016-05-08', 'title' => 'event 3'], 64 | ['id' => '4', 'resourceId' => 'e', 'start' => '2016-05-07T03:00:00', 'end' => '2016-05-07T08:00:00', 'title' => 'event 4'], 65 | ['id' => '5', 'resourceId' => 'f', 'start' => '2016-05-07T00:30:00', 'end' => '2016-05-07T02:30:00', 'title' => 'event 5'], 66 | ], 67 | ], 68 | ]); 69 | ?> -------------------------------------------------------------------------------- /demos/json/SchedulerController.php: -------------------------------------------------------------------------------- 1 | response->format = \yii\web\Response::FORMAT_JSON; 26 | 27 | return [ 28 | new Resource(["id" => "a", "title" => "Auditorium A"]), 29 | new Resource(["id" => "b", "title" => "Auditorium B", "eventColor" => "green"]), 30 | new Resource(["id" => "c", "title" => "Auditorium C", "eventColor" => "orange"]), 31 | new Resource([ 32 | "id" => "d", "title" => "Auditorium D", "children" => [ 33 | new Resource(["id" => "d1", "title" => "Room D1"]), 34 | new Resource(["id" => "d2", "title" => "Room D2"]), 35 | ], 36 | ]), 37 | new Resource(["id" => "e", "title" => "Auditorium E"]), 38 | new Resource(["id" => "f", "title" => "Auditorium F", "eventColor" => "red"]), 39 | new Resource(["id" => "g", "title" => "Auditorium G"]), 40 | new Resource(["id" => "h", "title" => "Auditorium H"]), 41 | new Resource(["id" => "i", "title" => "Auditorium I"]), 42 | new Resource(["id" => "j", "title" => "Auditorium J"]), 43 | new Resource(["id" => "k", "title" => "Auditorium K"]), 44 | new Resource(["id" => "l", "title" => "Auditorium L"]), 45 | new Resource(["id" => "m", "title" => "Auditorium M"]), 46 | new Resource(["id" => "n", "title" => "Auditorium N"]), 47 | new Resource(["id" => "o", "title" => "Auditorium O"]), 48 | new Resource(["id" => "p", "title" => "Auditorium P"]), 49 | new Resource(["id" => "q", "title" => "Auditorium Q"]), 50 | new Resource(["id" => "r", "title" => "Auditorium R"]), 51 | new Resource(["id" => "s", "title" => "Auditorium S"]), 52 | new Resource(["id" => "t", "title" => "Auditorium T"]), 53 | new Resource(["id" => "u", "title" => "Auditorium U"]), 54 | new Resource(["id" => "v", "title" => "Auditorium V"]), 55 | new Resource(["id" => "w", "title" => "Auditorium W"]), 56 | new Resource(["id" => "x", "title" => "Auditorium X"]), 57 | new Resource(["id" => "y", "title" => "Auditorium Y"]), 58 | new Resource(["id" => "z", "title" => "Auditorium Z"]), 59 | ]; 60 | } 61 | 62 | /** 63 | * @param $id 64 | * @param $start 65 | * @param $end 66 | * @return array 67 | */ 68 | public function actionEvents($id, $start, $end) 69 | { 70 | \Yii::$app->response->format = \yii\web\Response::FORMAT_JSON; 71 | return [ 72 | new Event(["id" => "1", "resourceId" => "b", "start" => "2016-05-07T02:00:00", "end" => "2016-05-07T07:00:00", "title" => "event 1"]), 73 | new Event(["id" => "2", "resourceId" => "c", "start" => "2016-05-07T05:00:00", "end" => "2016-05-07T22:00:00", "title" => "event 2"]), 74 | new Event(["id" => "3", "resourceId" => "d", "start" => "2016-05-06", "end" => "2016-05-08", "title" => "event 3"]), 75 | new Event(["id" => "4", "resourceId" => "e", "start" => "2016-05-07T03:00:00", "end" => "2016-05-07T08:00:00", "title" => "event 4"]), 76 | new Event(["id" => "5", "resourceId" => "f", "start" => "2016-05-07T00:30:00", "end" => "2016-05-07T02:30:00", "title" => "event 5"]), 77 | ]; 78 | } 79 | } 80 | -------------------------------------------------------------------------------- /demos/ordering.php: -------------------------------------------------------------------------------- 1 | = \edofre\fullcalendarscheduler\FullcalendarScheduler::widget([ 2 | 'header' => [ 3 | 'left' => 'today prev,next', 4 | 'center' => 'title', 5 | 'right' => 'timelineDay,timelineThreeDays,agendaWeek,month', 6 | ], 7 | 'clientOptions' => [ 8 | 'now' => '2016-05-07', 9 | 'editable' => true, // enable draggable events 10 | 'aspectRatio' => 1.8, 11 | 'scrollTime' => '00:00', // undo default 6am scrollTime 12 | 'defaultView' => 'timelineDay', 13 | 'views' => [ 14 | 'timelineThreeDays' => [ 15 | 'type' => 'timeline', 16 | 'duration' => ['days' => 3], 17 | ], 18 | ], 19 | 'resourceAreaWidth' => '30%', 20 | 'resourceColumns' => [ 21 | [ 22 | 'labelText' => 'Room', 23 | 'field' => 'title', 24 | ], 25 | [ 26 | 'labelText' => 'Occupancy', 27 | 'field' => 'occupancy', 28 | ], 29 | ], 30 | 'resourceOrder' => '-occupancy,title', // when occupancy tied, order by title 31 | 'resources' => [ 32 | ['id' => 'a', 'title' => 'Auditorium A', 'occupancy' => 40], 33 | ['id' => 'b', 'title' => 'Auditorium B', 'occupancy' => 40, 'eventColor' => 'green'], 34 | ['id' => 'c', 'title' => 'Auditorium C', 'occupancy' => 40, 'eventColor' => 'orange'], 35 | ['id' => 'd', 'title' => 'Auditorium D', 'occupancy' => 40,], 36 | ['id' => 'e', 'title' => 'Auditorium E', 'occupancy' => 40], 37 | ['id' => 'f', 'title' => 'Auditorium F', 'occupancy' => 40, 'eventColor' => 'red'], 38 | ['id' => 'g', 'title' => 'Auditorium G', 'occupancy' => 40], 39 | ['id' => 'h', 'title' => 'Auditorium H', 'occupancy' => 40], 40 | ['id' => 'i', 'title' => 'Auditorium I', 'occupancy' => 50], 41 | ['id' => 'j', 'title' => 'Auditorium J', 'occupancy' => 50], 42 | ['id' => 'k', 'title' => 'Auditorium K', 'occupancy' => 40], 43 | ['id' => 'l', 'title' => 'Auditorium L', 'occupancy' => 40], 44 | ['id' => 'm', 'title' => 'Auditorium M', 'occupancy' => 40], 45 | ['id' => 'n', 'title' => 'Auditorium N', 'occupancy' => 80], 46 | ['id' => 'o', 'title' => 'Auditorium O', 'occupancy' => 80], 47 | ['id' => 'p', 'title' => 'Auditorium P', 'occupancy' => 40], 48 | ['id' => 'q', 'title' => 'Auditorium Q', 'occupancy' => 40], 49 | ['id' => 'r', 'title' => 'Auditorium R', 'occupancy' => 40], 50 | ['id' => 's', 'title' => 'Auditorium S', 'occupancy' => 40], 51 | ['id' => 't', 'title' => 'Auditorium T', 'occupancy' => 40], 52 | ['id' => 'u', 'title' => 'Auditorium U', 'occupancy' => 40], 53 | ['id' => 'v', 'title' => 'Auditorium V', 'occupancy' => 40], 54 | ['id' => 'w', 'title' => 'Auditorium W', 'occupancy' => 40], 55 | ['id' => 'x', 'title' => 'Auditorium X', 'occupancy' => 40], 56 | ['id' => 'y', 'title' => 'Auditorium Y', 'occupancy' => 40], 57 | ['id' => 'z', 'title' => 'Auditorium Z', 'occupancy' => 40], 58 | ], 59 | 'events' => [ 60 | ['id' => '1', 'resourceId' => 'b', 'start' => '2016-05-07T02:00:00', 'end' => '2016-05-07T07:00:00', 'title' => 'event 1'], 61 | ['id' => '2', 'resourceId' => 'c', 'start' => '2016-05-07T05:00:00', 'end' => '2016-05-07T22:00:00', 'title' => 'event 2'], 62 | ['id' => '3', 'resourceId' => 'd', 'start' => '2016-05-06', 'end' => '2016-05-08', 'title' => 'event 3'], 63 | ['id' => '4', 'resourceId' => 'e', 'start' => '2016-05-07T03:00:00', 'end' => '2016-05-07T08:00:00', 'title' => 'event 4'], 64 | ['id' => '5', 'resourceId' => 'f', 'start' => '2016-05-07T00:30:00', 'end' => '2016-05-07T02:30:00', 'title' => 'event 5'], 65 | ], 66 | ], 67 | ]); 68 | ?> -------------------------------------------------------------------------------- /src/models/Event.php: -------------------------------------------------------------------------------- 1 | [ 3 | 'left' => 'today prev,next', 4 | 'center' => 'title', 5 | 'right' => 'timelineDay,timelineThreeDays,agendaWeek,month', 6 | ], 7 | 'clientOptions' => [ 8 | 'now' => '2016-05-07', 9 | 'editable' => true, // enable draggable events 10 | 'aspectRatio' => 1.8, 11 | 'scrollTime' => '00:00', // undo default 6am scrollTime 12 | 'defaultView' => 'timelineDay', 13 | 'views' => [ 14 | 'timelineThreeDays' => [ 15 | 'type' => 'timeline', 16 | 'duration' => ['days' => 3], 17 | ], 18 | ], 19 | 'resourceLabelText' => 'Rooms', 20 | 'resources' => [ 21 | ['id' => 'a', 'title' => 'Auditorium A'], 22 | ['id' => 'b', 'title' => 'Auditorium B', 'eventColor' => 'green'], 23 | ['id' => 'c', 'title' => 'Auditorium C', 'eventColor' => 'orange'], 24 | [ 25 | 'id' => 'd', 26 | 'title' => 'Auditorium D', 27 | 'children' => [ 28 | ['id' => 'd1', 'title' => 'Room D1'], 29 | ['id' => 'd2', 'title' => 'Room D2'], 30 | ], 31 | ], 32 | ['id' => 'e', 'title' => 'Auditorium E'], 33 | ['id' => 'f', 'title' => 'Auditorium F', 'eventColor' => 'red'], 34 | ['id' => 'g', 'title' => 'Auditorium G'], 35 | ['id' => 'h', 'title' => 'Auditorium H'], 36 | ['id' => 'i', 'title' => 'Auditorium I'], 37 | ['id' => 'j', 'title' => 'Auditorium J'], 38 | ['id' => 'k', 'title' => 'Auditorium K'], 39 | ['id' => 'l', 'title' => 'Auditorium L'], 40 | ['id' => 'm', 'title' => 'Auditorium M'], 41 | ['id' => 'n', 'title' => 'Auditorium N'], 42 | ['id' => 'o', 'title' => 'Auditorium O'], 43 | ['id' => 'p', 'title' => 'Auditorium P'], 44 | ['id' => 'q', 'title' => 'Auditorium Q'], 45 | ['id' => 'r', 'title' => 'Auditorium R'], 46 | ['id' => 's', 'title' => 'Auditorium S'], 47 | ['id' => 't', 'title' => 'Auditorium T'], 48 | ['id' => 'u', 'title' => 'Auditorium U'], 49 | ['id' => 'v', 'title' => 'Auditorium V'], 50 | ['id' => 'w', 'title' => 'Auditorium W'], 51 | ['id' => 'x', 'title' => 'Auditorium X'], 52 | ['id' => 'y', 'title' => 'Auditorium Y'], 53 | ['id' => 'z', 'title' => 'Auditorium Z'], 54 | ], 55 | 'events' => [ 56 | // background event, associated with a resource 57 | ['id' => 'bg1', 'resourceId' => 'b', 'rendering' => 'background', 'start' => '2016-05-07T01:00:00', 'end' => '2016-05-07T04:00:00'], 58 | // background event, NOT associated with a resource 59 | ['id' => 'bg2', 'rendering' => 'background', 'start' => '2016-05-07T05:00:00', 'end' => '2016-05-07T08:00:00'], 60 | // normal events... 61 | ['id' => '1', 'resourceId' => 'b', 'start' => '2016-05-07T02:00:00', 'end' => '2016-05-07T07:00:00', 'title' => 'event 1'], 62 | ['id' => '2', 'resourceId' => 'c', 'start' => '2016-05-07T05:00:00', 'end' => '2016-05-07T22:00:00', 'title' => 'event 2'], 63 | ['id' => '3', 'resourceId' => 'd', 'start' => '2016-05-06', 'end' => '2016-05-08', 'title' => 'event 3'], 64 | ['id' => '4', 'resourceId' => 'e', 'start' => '2016-05-07T03:00:00', 'end' => '2016-05-07T08:00:00', 'title' => 'event 4'], 65 | ['id' => '5', 'resourceId' => 'f', 'start' => '2016-05-07T00:30:00', 'end' => '2016-05-07T02:30:00', 'title' => 'event 5'], 66 | ], 67 | ], 68 | ]); 69 | ?> -------------------------------------------------------------------------------- /demos/selectable.php: -------------------------------------------------------------------------------- 1 | = \edofre\fullcalendarscheduler\FullcalendarScheduler::widget([ 2 | 'header' => [ 3 | 'left' => 'today prev,next', 4 | 'center' => 'title', 5 | 'right' => 'timelineDay,timelineThreeDays,agendaWeek,month', 6 | ], 7 | 'clientOptions' => [ 8 | 'selectable' => true, 9 | 'selectHelper' => true, 10 | 'now' => '2016-05-07', 11 | 'editable' => true, // enable draggable events 12 | 'aspectRatio' => 1.8, 13 | 'scrollTime' => '00:00', // undo default 6am scrollTime 14 | 'defaultView' => 'timelineDay', 15 | 'views' => [ 16 | 'timelineThreeDays' => [ 17 | 'type' => 'timeline', 18 | 'duration' => ['days' => 3], 19 | ], 20 | ], 21 | 'resourceLabelText' => 'Rooms', 22 | 'resources' => [ 23 | ['id' => 'a', 'title' => 'Auditorium A'], 24 | ['id' => 'b', 'title' => 'Auditorium B', 'eventColor' => 'green'], 25 | ['id' => 'c', 'title' => 'Auditorium C', 'eventColor' => 'orange'], 26 | [ 27 | 'id' => 'd', 'title' => 'Auditorium D', 28 | 'children' => [ 29 | ['id' => 'd1', 'title' => 'Room D1'], 30 | ['id' => 'd2', 'title' => 'Room D2'], 31 | ], 32 | ], 33 | ['id' => 'e', 'title' => 'Auditorium E'], 34 | ['id' => 'f', 'title' => 'Auditorium F', 'eventColor' => 'red'], 35 | ['id' => 'g', 'title' => 'Auditorium G'], 36 | ['id' => 'h', 'title' => 'Auditorium H'], 37 | ['id' => 'i', 'title' => 'Auditorium I'], 38 | ['id' => 'j', 'title' => 'Auditorium J'], 39 | ['id' => 'k', 'title' => 'Auditorium K'], 40 | ['id' => 'l', 'title' => 'Auditorium L'], 41 | ['id' => 'm', 'title' => 'Auditorium M'], 42 | ['id' => 'n', 'title' => 'Auditorium N'], 43 | ['id' => 'o', 'title' => 'Auditorium O'], 44 | ['id' => 'p', 'title' => 'Auditorium P'], 45 | ['id' => 'q', 'title' => 'Auditorium Q'], 46 | ['id' => 'r', 'title' => 'Auditorium R'], 47 | ['id' => 's', 'title' => 'Auditorium S'], 48 | ['id' => 't', 'title' => 'Auditorium T'], 49 | ['id' => 'u', 'title' => 'Auditorium U'], 50 | ['id' => 'v', 'title' => 'Auditorium V'], 51 | ['id' => 'w', 'title' => 'Auditorium W'], 52 | ['id' => 'x', 'title' => 'Auditorium X'], 53 | ['id' => 'y', 'title' => 'Auditorium Y'], 54 | ['id' => 'z', 'title' => 'Auditorium Z'], 55 | ], 56 | 'events' => [ 57 | ['id' => '1', 'resourceId' => 'b', 'start' => '2016-05-07T02:00:00', 'end' => '2016-05-07T07:00:00', 'title' => 'event 1'], 58 | ['id' => '2', 'resourceId' => 'c', 'start' => '2016-05-07T05:00:00', 'end' => '2016-05-07T22:00:00', 'title' => 'event 2'], 59 | ['id' => '3', 'resourceId' => 'd', 'start' => '2016-05-06', 'end' => '2016-05-08', 'title' => 'event 3'], 60 | ['id' => '4', 'resourceId' => 'e', 'start' => '2016-05-07T03:00:00', 'end' => '2016-05-07T08:00:00', 'title' => 'event 4'], 61 | ['id' => '5', 'resourceId' => 'f', 'start' => '2016-05-07T00:30:00', 'end' => '2016-05-07T02:30:00', 'title' => 'event 5'], 62 | ], 63 | 'select' => new \yii\web\JsExpression(" 64 | function(start, end, jsEvent, view, resource) { 65 | console.log( 66 | 'select callback', 67 | start.format(), 68 | end.format(), 69 | resource ? resource.id : '(no resource)' 70 | ); 71 | } 72 | "), 73 | 'dayClick' => new \yii\web\JsExpression(" 74 | function(date, jsEvent, view, resource) { 75 | console.log( 76 | 'dayClick', 77 | date.format(), 78 | resource ? resource.id : '(no resource)' 79 | ); 80 | } 81 | "), 82 | ], 83 | ]); 84 | ?> 85 | 86 | registerJs(" 88 | $('#select-G').on('click', function() { 89 | $('#calendar').fullCalendar('select', '2016-05-07T02:00:00', '2016-05-07T07:00:00', 'g'); 90 | }); 91 | 92 | $('#select-unspecified').on('click', function() { 93 | $('#calendar').fullCalendar('select', '2016-05-07T02:00:00', '2016-05-07T07:00:00'); 94 | }); 95 | "); 96 | ?> 97 | 98 |
99 | 100 | 101 |
-------------------------------------------------------------------------------- /src/FullcalendarScheduler.php: -------------------------------------------------------------------------------- 1 | true, 16 | 'default' => 'timelineDay', 17 | 'editable' => false, 18 | ]; 19 | /** 20 | * @var array Array containing the events, can be JSON array, PHP array or URL that returns an array containing JSON events 21 | */ 22 | public $events = []; 23 | /** 24 | * @var array Array containing the resources, can be JSON array, PHP array or URL that returns an array containing JSON resources 25 | */ 26 | public $resources = []; 27 | /** @var boolean Determines whether or not to include the gcal.js */ 28 | public $googleCalendar = false; 29 | /** 30 | * @var array 31 | * Possible header keys 32 | * - center 33 | * - left 34 | * - right 35 | * Possible options: 36 | * - title 37 | * - prevYear 38 | * - nextYear 39 | * - prev 40 | * - next 41 | * - today 42 | * - basicDay 43 | * - agendaDay 44 | * - basicWeek 45 | * - agendaWeek 46 | * - month 47 | */ 48 | public $header = [ 49 | 'center' => 'title', 50 | 'left' => 'prev,next, today', 51 | 'right' => 'timelineDay,timelineWeek,timelineMonth,timelineYear', 52 | ]; 53 | /** @var string Text to display while the calendar is loading */ 54 | public $loading = 'Please wait, calendar is loading'; 55 | /** 56 | * @var array Default options for the id and class HTML attributes 57 | */ 58 | public $options = [ 59 | 'id' => 'calendar', 60 | 'class' => 'fullcalendar', 61 | ]; 62 | /** 63 | * @var boolean Whether or not we need to include the ThemeAsset bundle 64 | */ 65 | public $theme = false; 66 | 67 | /** 68 | * Always make sure we have a valid id and class for the Fullcalendar widget 69 | */ 70 | public function init() 71 | { 72 | if (!isset($this->options['id'])) { 73 | $this->options['id'] = $this->getId(); 74 | } 75 | if (!isset($this->options['class'])) { 76 | $this->options['class'] = 'fullcalendar'; 77 | } 78 | 79 | parent::init(); 80 | } 81 | 82 | /** 83 | * Load the options and start the widget 84 | */ 85 | public function run() 86 | { 87 | $this->echoLoadingTags(); 88 | 89 | $assets = CoreAsset::register($this->view); 90 | 91 | if ($this->theme === true) { // Register the theme 92 | ThemeAsset::register($this->view); 93 | } 94 | 95 | if (isset($this->options['language'])) { 96 | $assets->language = $this->options['language']; 97 | } 98 | 99 | $assets->googleCalendar = $this->googleCalendar; 100 | $this->clientOptions['header'] = $this->header; 101 | 102 | $this->view->registerJs(implode("\n", [ 103 | "jQuery('#{$this->options['id']}').fullCalendar({$this->getClientOptions()});", 104 | ]), \yii\web\View::POS_READY); 105 | } 106 | 107 | /** 108 | * Echo the tags to show the loading state for the calendar 109 | */ 110 | private function echoLoadingTags() 111 | { 112 | echo \yii\helpers\Html::beginTag('div', $this->options) . "\n"; 113 | echo \yii\helpers\Html::beginTag('div', ['class' => 'fc-loading', 'style' => 'display:none;']); 114 | echo \yii\helpers\Html::encode($this->loading); 115 | echo \yii\helpers\Html::endTag('div') . "\n"; 116 | echo \yii\helpers\Html::endTag('div') . "\n"; 117 | } 118 | 119 | /** 120 | * @return string 121 | * Returns an JSON array containing the fullcalendar options, 122 | * all available callbacks will be wrapped in JsExpressions objects if they're set 123 | */ 124 | private function getClientOptions() 125 | { 126 | $options['loading'] = new \yii\web\JsExpression("function(isLoading, view ) { 127 | jQuery('#{$this->options['id']}').find('.fc-loading').toggle(isLoading); 128 | }"); 129 | 130 | $options['events'] = $this->events; 131 | $options['resources'] = $this->resources; 132 | $options = array_merge($options, $this->clientOptions); 133 | 134 | return \yii\helpers\Json::encode($options); 135 | } 136 | 137 | } 138 | -------------------------------------------------------------------------------- /demos/grouping.php: -------------------------------------------------------------------------------- 1 | = \edofre\fullcalendarscheduler\FullcalendarScheduler::widget([ 2 | 'header' => [ 3 | 'left' => 'today prev,next', 4 | 'center' => 'title', 5 | 'right' => 'timelineDay,timelineThreeDays,agendaWeek,month', 6 | ], 7 | 'clientOptions' => [ 8 | 'now' => '2016-05-07', 9 | 'editable' => true, // enable draggable events 10 | 'aspectRatio' => 1.8, 11 | 'scrollTime' => '00:00', // undo default 6am scrollTime 12 | 'defaultView' => 'timelineDay', 13 | 'views' => [ 14 | 'timelineThreeDays' => [ 15 | 'type' => 'timeline', 16 | 'duration' => ['days' => 3], 17 | ], 18 | ], 19 | 'resourceGroupField' => 'building', 20 | 'resources' => [ 21 | ['id' => 'a', 'building' => '460 Bryant', 'title' => 'Auditorium A'], 22 | ['id' => 'b', 'building' => '460 Bryant', 'title' => 'Auditorium B', 'eventColor' => 'green'], 23 | ['id' => 'c', 'building' => '460 Bryant', 'title' => 'Auditorium C', 'eventColor' => 'orange'], 24 | [ 25 | 'id' => 'd', 26 | 'building' => '460 Bryant', 27 | 'title' => 'Auditorium D', 28 | 'children' => [ 29 | ['id' => 'd1', 'title' => 'Room D1', 'occupancy' => 10], 30 | ['id' => 'd2', 'title' => 'Room D2', 'occupancy' => 10], 31 | ], 32 | ], 33 | ['id' => 'e', 'building' => '460 Bryant', 'title' => 'Auditorium E'], 34 | ['id' => 'f', 'building' => '460 Bryant', 'title' => 'Auditorium F', 'eventColor' => 'red'], 35 | ['id' => 'g', 'building' => '564 Pacific', 'title' => 'Auditorium G'], 36 | ['id' => 'h', 'building' => '564 Pacific', 'title' => 'Auditorium H'], 37 | ['id' => 'i', 'building' => '564 Pacific', 'title' => 'Auditorium I'], 38 | ['id' => 'j', 'building' => '564 Pacific', 'title' => 'Auditorium J'], 39 | ['id' => 'k', 'building' => '564 Pacific', 'title' => 'Auditorium K'], 40 | ['id' => 'l', 'building' => '564 Pacific', 'title' => 'Auditorium L'], 41 | ['id' => 'm', 'building' => '564 Pacific', 'title' => 'Auditorium M'], 42 | ['id' => 'n', 'building' => '564 Pacific', 'title' => 'Auditorium N'], 43 | ['id' => 'o', 'building' => '564 Pacific', 'title' => 'Auditorium O'], 44 | ['id' => 'p', 'building' => '564 Pacific', 'title' => 'Auditorium P'], 45 | ['id' => 'q', 'building' => '564 Pacific', 'title' => 'Auditorium Q'], 46 | ['id' => 'r', 'building' => '564 Pacific', 'title' => 'Auditorium R'], 47 | ['id' => 's', 'building' => '564 Pacific', 'title' => 'Auditorium S'], 48 | ['id' => 't', 'building' => '564 Pacific', 'title' => 'Auditorium T'], 49 | ['id' => 'u', 'building' => '564 Pacific', 'title' => 'Auditorium U'], 50 | ['id' => 'v', 'building' => '564 Pacific', 'title' => 'Auditorium V'], 51 | ['id' => 'w', 'building' => '564 Pacific', 'title' => 'Auditorium W'], 52 | ['id' => 'x', 'building' => '564 Pacific', 'title' => 'Auditorium X'], 53 | ['id' => 'y', 'building' => '564 Pacific', 'title' => 'Auditorium Y'], 54 | ['id' => 'z', 'building' => '564 Pacific', 'title' => 'Auditorium Z'], 55 | ], 56 | 'events' => [ 57 | ['id' => '1', 'resourceId' => 'b', 'start' => '2016-05-07T02:00:00', 'end' => '2016-05-07T07:00:00', 'title' => 'event 1'], 58 | ['id' => '2', 'resourceId' => 'c', 'start' => '2016-05-07T05:00:00', 'end' => '2016-05-07T22:00:00', 'title' => 'event 2'], 59 | ['id' => '3', 'resourceId' => 'd', 'start' => '2016-05-06', 'end' => '2016-05-08', 'title' => 'event 3'], 60 | ['id' => '4', 'resourceId' => 'e', 'start' => '2016-05-07T03:00:00', 'end' => '2016-05-07T08:00:00', 'title' => 'event 4'], 61 | ['id' => '5', 'resourceId' => 'f', 'start' => '2016-05-07T00:30:00', 'end' => '2016-05-07T02:30:00', 'title' => 'event 5'], 62 | ], 63 | ], 64 | ]); 65 | ?> -------------------------------------------------------------------------------- /demos/columns.php: -------------------------------------------------------------------------------- 1 | = \edofre\fullcalendarscheduler\FullcalendarScheduler::widget([ 2 | 'header' => [ 3 | 'left' => 'today prev,next', 4 | 'center' => 'title', 5 | 'right' => 'timelineDay,timelineThreeDays,agendaWeek,month', 6 | ], 7 | 'clientOptions' => [ 8 | 'now' => '2016-05-07', 9 | 'editable' => true, 10 | 'aspectRatio' => 1.8, 11 | 'scrollTime' => '00:00', 12 | 'defaultView' => 'timelineDay', 13 | 'views' => [ 14 | 'timelineThreeDays' => [ 15 | 'type' => 'timeline', 16 | 'duration' => ['days' => 3], 17 | ], 18 | ], 19 | 'resourceAreaWidth' => '30%', 20 | 'resourceColumns' => [ 21 | [ 22 | 'labelText' => 'Room', 23 | 'field' => 'title', 24 | ], 25 | [ 26 | 'labelText' => 'Occupancy', 27 | 'field' => 'occupancy', 28 | ], 29 | ], 30 | 'resources' => [ 31 | ['id' => 'a', 'title' => 'Auditorium A', 'occupancy' => 40], 32 | ['id' => 'b', 'title' => 'Auditorium B', 'occupancy' => 40, 'eventColor' => 'green'], 33 | ['id' => 'c', 'title' => 'Auditorium C', 'occupancy' => 40, 'eventColor' => 'orange'], 34 | [ 35 | 'id' => 'd', 36 | 'title' => 'Auditorium D', 37 | 'occupancy' => 40, 38 | 'children' => [ 39 | ['id' => 'd1', 'title' => 'Room D1', 'occupancy' => 10], 40 | ['id' => 'd2', 'title' => 'Room D2', 'occupancy' => 10], 41 | ], 42 | ], 43 | ['id' => 'e', 'title' => 'Auditorium E', 'occupancy' => 40], 44 | ['id' => 'f', 'title' => 'Auditorium F', 'occupancy' => 40, 'eventColor' => 'red'], 45 | ['id' => 'g', 'title' => 'Auditorium G', 'occupancy' => 40], 46 | ['id' => 'h', 'title' => 'Auditorium H', 'occupancy' => 40], 47 | ['id' => 'i', 'title' => 'Auditorium I', 'occupancy' => 40], 48 | ['id' => 'j', 'title' => 'Auditorium J', 'occupancy' => 40], 49 | ['id' => 'k', 'title' => 'Auditorium K', 'occupancy' => 40], 50 | ['id' => 'l', 'title' => 'Auditorium L', 'occupancy' => 40], 51 | ['id' => 'm', 'title' => 'Auditorium M', 'occupancy' => 40], 52 | ['id' => 'n', 'title' => 'Auditorium N', 'occupancy' => 40], 53 | ['id' => 'o', 'title' => 'Auditorium O', 'occupancy' => 40], 54 | ['id' => 'p', 'title' => 'Auditorium P', 'occupancy' => 40], 55 | ['id' => 'q', 'title' => 'Auditorium Q', 'occupancy' => 40], 56 | ['id' => 'r', 'title' => 'Auditorium R', 'occupancy' => 40], 57 | ['id' => 's', 'title' => 'Auditorium S', 'occupancy' => 40], 58 | ['id' => 't', 'title' => 'Auditorium T', 'occupancy' => 40], 59 | ['id' => 'u', 'title' => 'Auditorium U', 'occupancy' => 40], 60 | ['id' => 'v', 'title' => 'Auditorium V', 'occupancy' => 40], 61 | ['id' => 'w', 'title' => 'Auditorium W', 'occupancy' => 40], 62 | ['id' => 'x', 'title' => 'Auditorium X', 'occupancy' => 40], 63 | ['id' => 'y', 'title' => 'Auditorium Y', 'occupancy' => 40], 64 | ['id' => 'z', 'title' => 'Auditorium Z', 'occupancy' => 40], 65 | ], 66 | 'events' => [ 67 | ['id' => '1', 'resourceId' => 'b', 'start' => '2016-05-07T02:00:00', 'end' => '2016-05-07T07:00:00', 'title' => 'event 1'], 68 | ['id' => '2', 'resourceId' => 'c', 'start' => '2016-05-07T05:00:00', 'end' => '2016-05-07T22:00:00', 'title' => 'event 2'], 69 | ['id' => '3', 'resourceId' => 'd', 'start' => '2016-05-06', 'end' => '2016-05-08', 'title' => 'event 3'], 70 | ['id' => '4', 'resourceId' => 'e', 'start' => '2016-05-07T03:00:00', 'end' => '2016-05-07T08:00:00', 'title' => 'event 4'], 71 | ['id' => '5', 'resourceId' => 'f', 'start' => '2016-05-07T00:30:00', 'end' => '2016-05-07T02:30:00', 'title' => 'event 5'], 72 | ], 73 | ], 74 | ]); 75 | ?> -------------------------------------------------------------------------------- /demos/dynamic-add-remove.php: -------------------------------------------------------------------------------- 1 | = \edofre\fullcalendarscheduler\FullcalendarScheduler::widget([ 2 | 'header' => [ 3 | 'left' => 'promptResource today prev,next', 4 | 'center' => 'title', 5 | 'right' => 'timelineDay,timelineThreeDays,agendaWeek,month', 6 | ], 7 | 'clientOptions' => [ 8 | 'selectable' => true, 9 | 'selectHelper' => true, 10 | 'now' => '2016-05-07', 11 | 'editable' => true, // enable draggable events 12 | 'aspectRatio' => 1.8, 13 | 'scrollTime' => '00:00', // undo default 6am scrollTime 14 | 'defaultView' => 'timelineDay', 15 | 'views' => [ 16 | 'timelineThreeDays' => [ 17 | 'type' => 'timeline', 18 | 'duration' => ['days' => 3], 19 | ], 20 | ], 21 | 'customButtons' => [ 22 | 'promptResource' => [ 23 | 'text' => '+ room', 24 | 'click' => new \yii\web\JsExpression(" 25 | function() { 26 | var title = prompt('Room name'); 27 | if (title) { 28 | $('#calendar').fullCalendar( 29 | 'addResource', 30 | { title: title }, 31 | true // scroll to the new resource? 32 | ); 33 | } 34 | } 35 | "), 36 | ], 37 | ], 38 | 'resourceLabelText' => 'Rooms', 39 | 'resourceRender' => new \yii\web\JsExpression(" 40 | function(resource, cellEls) { 41 | cellEls.on('click', function() { 42 | if (confirm('Are you sure you want to delete ' + resource.title + '?')) { 43 | $('#calendar').fullCalendar('removeResource', resource); 44 | } 45 | }); 46 | } 47 | "), 48 | 'resources' => [ 49 | ['id' => 'a', 'title' => 'Auditorium A'], 50 | ['id' => 'b', 'title' => 'Auditorium B', 'eventColor' => 'green'], 51 | ['id' => 'c', 'title' => 'Auditorium C', 'eventColor' => 'orange'], 52 | [ 53 | 'id' => 'd', 54 | 'title' => 'Auditorium D', 55 | 'children' => [ 56 | ['id' => 'd1', 'title' => 'Room D1'], 57 | ['id' => 'd2', 'title' => 'Room D2'], 58 | ], 59 | ], 60 | ['id' => 'e', 'title' => 'Auditorium E'], 61 | ['id' => 'f', 'title' => 'Auditorium F', 'eventColor' => 'red'], 62 | ['id' => 'g', 'title' => 'Auditorium G'], 63 | ['id' => 'h', 'title' => 'Auditorium H'], 64 | ['id' => 'i', 'title' => 'Auditorium I'], 65 | ['id' => 'j', 'title' => 'Auditorium J'], 66 | ['id' => 'k', 'title' => 'Auditorium K'], 67 | ['id' => 'l', 'title' => 'Auditorium L'], 68 | ['id' => 'm', 'title' => 'Auditorium M'], 69 | ['id' => 'n', 'title' => 'Auditorium N'], 70 | ['id' => 'o', 'title' => 'Auditorium O'], 71 | ['id' => 'p', 'title' => 'Auditorium P'], 72 | ['id' => 'q', 'title' => 'Auditorium Q'], 73 | ['id' => 'r', 'title' => 'Auditorium R'], 74 | ['id' => 's', 'title' => 'Auditorium S'], 75 | ['id' => 't', 'title' => 'Auditorium T'], 76 | ['id' => 'u', 'title' => 'Auditorium U'], 77 | ['id' => 'v', 'title' => 'Auditorium V'], 78 | ['id' => 'w', 'title' => 'Auditorium W'], 79 | ['id' => 'x', 'title' => 'Auditorium X'], 80 | ['id' => 'y', 'title' => 'Auditorium Y'], 81 | ['id' => 'z', 'title' => 'Auditorium Z'], 82 | ], 83 | 'events' => [ 84 | ['id' => '1', 'resourceId' => 'b', 'start' => '2016-05-07T02:00:00', 'end' => '2016-05-07T07:00:00', 'title' => 'event 1'], 85 | ['id' => '2', 'resourceId' => 'c', 'start' => '2016-05-07T05:00:00', 'end' => '2016-05-07T22:00:00', 'title' => 'event 2'], 86 | ['id' => '3', 'resourceId' => 'd', 'start' => '2016-05-06', 'end' => '2016-05-08', 'title' => 'event 3'], 87 | ['id' => '4', 'resourceId' => 'e', 'start' => '2016-05-07T03:00:00', 'end' => '2016-05-07T08:00:00', 'title' => 'event 4'], 88 | ['id' => '5', 'resourceId' => 'f', 'start' => '2016-05-07T00:30:00', 'end' => '2016-05-07T02:30:00', 'title' => 'event 5'], 89 | ], 90 | ], 91 | ]); 92 | ?> 93 | registerCss(' 95 | body { 96 | margin: 0; 97 | padding: 0; 98 | font-family: "Lucida Grande",Helvetica,Arial,Verdana,sans-serif; 99 | font-size: 14px; 100 | } 101 | 102 | p { 103 | text-align: center; 104 | } 105 | 106 | #calendar { 107 | max-width: 900px; 108 | margin: 50px auto; 109 | } 110 | 111 | .fc-resource-area td { 112 | cursor: pointer; 113 | } 114 | '); 115 | ?> 116 |117 | HINT: click on a resource to delete it. 118 |
-------------------------------------------------------------------------------- /demos/column-grouping.php: -------------------------------------------------------------------------------- 1 | = \edofre\fullcalendarscheduler\FullcalendarScheduler::widget([ 2 | 'header' => [ 3 | 'left' => 'today prev,next', 4 | 'center' => 'title', 5 | 'right' => 'timelineDay,timelineThreeDays,agendaWeek,month', 6 | ], 7 | 'clientOptions' => [ 8 | 'now' => '2016-05-07', 9 | 'editable' => true, // enable draggable events 10 | 'aspectRatio' => 1.8, 11 | 'scrollTime' => '00:00', // undo default 6am scrollTime 12 | 'defaultView' => 'timelineDay', 13 | 'views' => [ 14 | 'timelineThreeDays' => [ 15 | 'type' => 'timeline', 16 | 'duration' => ['days' => 3], 17 | ], 18 | ], 19 | 'resourceLabelText' => 'Rooms', 20 | 'resourceAreaWidth' => '40%', 21 | 'resourceColumns' => [ 22 | [ 23 | 'group' => true, 24 | 'labelText' => 'Building', 25 | 'field' => 'building', 26 | ], 27 | [ 28 | 'labelText' => 'Room', 29 | 'field' => 'title', 30 | ], 31 | [ 32 | 'labelText' => 'Occupancy', 33 | 'field' => 'occupancy', 34 | ], 35 | ], 36 | 'resources' => [ 37 | ['id' => 'a', 'building' => '460 Bryant', 'title' => 'Auditorium A', 'occupancy' => 40], 38 | ['id' => 'b', 'building' => '460 Bryant', 'title' => 'Auditorium B', 'occupancy' => 40, 'eventColor' => 'green'], 39 | ['id' => 'c', 'building' => '460 Bryant', 'title' => 'Auditorium C', 'occupancy' => 40, 'eventColor' => 'orange'], 40 | [ 41 | 'id' => 'd', 42 | 'building' => '460 Bryant', 43 | 'title' => 'Auditorium D', 44 | 'occupancy' => 40, 45 | 'children' => [ 46 | ['id' => 'd1', 'title' => 'Room D1', 'occupancy' => 10], 47 | ['id' => 'd2', 'title' => 'Room D2', 'occupancy' => 10], 48 | ], 49 | ], 50 | ['id' => 'e', 'building' => '460 Bryant', 'title' => 'Auditorium E', 'occupancy' => 40], 51 | ['id' => 'f', 'building' => '460 Bryant', 'title' => 'Auditorium F', 'occupancy' => 40, 'eventColor' => 'red'], 52 | ['id' => 'g', 'building' => '564 Pacific', 'title' => 'Auditorium G', 'occupancy' => 40], 53 | ['id' => 'h', 'building' => '564 Pacific', 'title' => 'Auditorium H', 'occupancy' => 40], 54 | ['id' => 'i', 'building' => '564 Pacific', 'title' => 'Auditorium I', 'occupancy' => 40], 55 | ['id' => 'j', 'building' => '564 Pacific', 'title' => 'Auditorium J', 'occupancy' => 40], 56 | ['id' => 'k', 'building' => '564 Pacific', 'title' => 'Auditorium K', 'occupancy' => 40], 57 | ['id' => 'l', 'building' => '564 Pacific', 'title' => 'Auditorium L', 'occupancy' => 40], 58 | ['id' => 'm', 'building' => '564 Pacific', 'title' => 'Auditorium M', 'occupancy' => 40], 59 | ['id' => 'n', 'building' => '564 Pacific', 'title' => 'Auditorium N', 'occupancy' => 40], 60 | ['id' => 'o', 'building' => '564 Pacific', 'title' => 'Auditorium O', 'occupancy' => 40], 61 | ['id' => 'p', 'building' => '564 Pacific', 'title' => 'Auditorium P', 'occupancy' => 40], 62 | ['id' => 'q', 'building' => '564 Pacific', 'title' => 'Auditorium Q', 'occupancy' => 40], 63 | ['id' => 'r', 'building' => '564 Pacific', 'title' => 'Auditorium R', 'occupancy' => 40], 64 | ['id' => 's', 'building' => '564 Pacific', 'title' => 'Auditorium S', 'occupancy' => 40], 65 | ['id' => 't', 'building' => '564 Pacific', 'title' => 'Auditorium T', 'occupancy' => 40], 66 | ['id' => 'u', 'building' => '564 Pacific', 'title' => 'Auditorium U', 'occupancy' => 40], 67 | ['id' => 'v', 'building' => '564 Pacific', 'title' => 'Auditorium V', 'occupancy' => 40], 68 | ['id' => 'w', 'building' => '564 Pacific', 'title' => 'Auditorium W', 'occupancy' => 40], 69 | ['id' => 'x', 'building' => '564 Pacific', 'title' => 'Auditorium X', 'occupancy' => 40], 70 | ['id' => 'y', 'building' => '564 Pacific', 'title' => 'Auditorium Y', 'occupancy' => 40], 71 | ['id' => 'z', 'building' => '564 Pacific', 'title' => 'Auditorium Z', 'occupancy' => 40], 72 | ], 73 | 'events' => [ 74 | ['id' => '1', 'resourceId' => 'b', 'start' => '2016-05-07T02:00:00', 'end' => '2016-05-07T07:00:00', 'title' => 'event 1'], 75 | ['id' => '2', 'resourceId' => 'c', 'start' => '2016-05-07T05:00:00', 'end' => '2016-05-07T22:00:00', 'title' => 'event 2'], 76 | ['id' => '3', 'resourceId' => 'd', 'start' => '2016-05-06', 'end' => '2016-05-08', 'title' => 'event 3'], 77 | ['id' => '4', 'resourceId' => 'e', 'start' => '2016-05-07T03:00:00', 'end' => '2016-05-07T08:00:00', 'title' => 'event 4'], 78 | ['id' => '5', 'resourceId' => 'f', 'start' => '2016-05-07T00:30:00', 'end' => '2016-05-07T02:30:00', 'title' => 'event 5'], 79 | ], 80 | ], 81 | ]); 82 | ?> -------------------------------------------------------------------------------- /demos/external-dragging.php: -------------------------------------------------------------------------------- 1 | registerJs(" 12 | /* initialize the external events 13 | -----------------------------------------------------------------*/ 14 | $('#external-events .fc-event').each(function() { 15 | 16 | // store data so the calendar knows to render an event upon drop 17 | $(this).data('event', { 18 | title: $.trim($(this).text()), // use the element's text as the event title 19 | stick: true // maintain when user navigates (see docs on the renderEvent method) 20 | }); 21 | 22 | // make the event draggable using jQuery UI 23 | $(this).draggable({ 24 | zIndex: 999, 25 | revert: true, // will cause the event to go back to its 26 | revertDuration: 0 // original position after the drag 27 | }); 28 | }); 29 | ", \yii\web\View::POS_END); 30 | ?> 31 | 32 | = \edofre\fullcalendarscheduler\FullcalendarScheduler::widget([ 33 | 'header' => [ 34 | 'left' => 'today prev,next', 35 | 'center' => 'title', 36 | 'right' => 'timelineDay,timelineThreeDays,agendaWeek,month', 37 | ], 38 | 'clientOptions' => [ 39 | 'now' => '2016-05-07', 40 | 'editable' => true, // enable draggable events 41 | 'droppable' => true, // enable draggable events 42 | 'aspectRatio' => 1.8, 43 | 'scrollTime' => '00:00', // undo default 6am scrollTime 44 | 'defaultView' => 'timelineDay', 45 | 'views' => [ 46 | 'timelineThreeDays' => [ 47 | 'type' => 'timeline', 48 | 'duration' => ['days' => 3], 49 | ], 50 | ], 51 | 'resourceLabelText' => 'Rooms', 52 | 'resources' => [ 53 | ['id' => 'a', 'title' => 'Auditorium A'], 54 | ['id' => 'b', 'title' => 'Auditorium B', 'eventColor' => 'green'], 55 | ['id' => 'c', 'title' => 'Auditorium C', 'eventColor' => 'orange'], 56 | [ 57 | 'id' => 'd', 58 | 'title' => 'Auditorium D', 59 | 'children' => [ 60 | ['id' => 'd1', 'title' => 'Room D1'], 61 | ['id' => 'd2', 'title' => 'Room D2'], 62 | ], 63 | ], 64 | ['id' => 'e', 'title' => 'Auditorium E'], 65 | ['id' => 'f', 'title' => 'Auditorium F', 'eventColor' => 'red'], 66 | ['id' => 'g', 'title' => 'Auditorium G'], 67 | ['id' => 'h', 'title' => 'Auditorium H'], 68 | ['id' => 'i', 'title' => 'Auditorium I'], 69 | ['id' => 'j', 'title' => 'Auditorium J'], 70 | ['id' => 'k', 'title' => 'Auditorium K'], 71 | ['id' => 'l', 'title' => 'Auditorium L'], 72 | ['id' => 'm', 'title' => 'Auditorium M'], 73 | ['id' => 'n', 'title' => 'Auditorium N'], 74 | ['id' => 'o', 'title' => 'Auditorium O'], 75 | ['id' => 'p', 'title' => 'Auditorium P'], 76 | ['id' => 'q', 'title' => 'Auditorium Q'], 77 | ['id' => 'r', 'title' => 'Auditorium R'], 78 | ['id' => 's', 'title' => 'Auditorium S'], 79 | ['id' => 't', 'title' => 'Auditorium T'], 80 | ['id' => 'u', 'title' => 'Auditorium U'], 81 | ['id' => 'v', 'title' => 'Auditorium V'], 82 | ['id' => 'w', 'title' => 'Auditorium W'], 83 | ['id' => 'x', 'title' => 'Auditorium X'], 84 | ['id' => 'y', 'title' => 'Auditorium Y'], 85 | ['id' => 'z', 'title' => 'Auditorium Z'], 86 | ], 87 | 'events' => [ 88 | ['id' => '1', 'resourceId' => 'b', 'start' => '2016-05-07T02:00:00', 'end' => '2016-05-07T07:00:00', 'title' => 'event 1'], 89 | ['id' => '2', 'resourceId' => 'c', 'start' => '2016-05-07T05:00:00', 'end' => '2016-05-07T22:00:00', 'title' => 'event 2'], 90 | ['id' => '3', 'resourceId' => 'd', 'start' => '2016-05-06', 'end' => '2016-05-08', 'title' => 'event 3'], 91 | ['id' => '4', 'resourceId' => 'e', 'start' => '2016-05-07T03:00:00', 'end' => '2016-05-07T08:00:00', 'title' => 'event 4'], 92 | ['id' => '5', 'resourceId' => 'f', 'start' => '2016-05-07T00:30:00', 'end' => '2016-05-07T02:30:00', 'title' => 'event 5'], 93 | ], 94 | 'drop' => new \yii\web\JsExpression(" 95 | function(date, jsEvent, ui, resourceId) { 96 | console.log('drop', date.format(), resourceId); 97 | 98 | // is the \"remove after drop\" checkbox checked? 99 | if ($('#drop-remove').is(':checked')) { 100 | // if so, remove the element from the \"Draggable Events\" list 101 | $(this).remove(); 102 | } 103 | } 104 | "), 105 | 'eventReceive' => new \yii\web\JsExpression(" 106 | function(event) { // called when a proper external event is dropped 107 | console.log('eventReceive', event); 108 | } 109 | "), 110 | 'eventDrop' => new \yii\web\JsExpression(" 111 | function(event) { // called when an event (already on the calendar) is moved 112 | console.log('eventDrop', event); 113 | } 114 | "), 115 | ], 116 | ]); 117 | ?> 118 | registerCss(' 119 | body { 120 | margin-top: 40px; 121 | text-align: center; 122 | font-size: 14px; 123 | font-family: "Lucida Grande",Helvetica,Arial,Verdana,sans-serif; 124 | } 125 | 126 | #wrap { 127 | width: 1100px; 128 | margin: 0 auto; 129 | } 130 | 131 | #external-events { 132 | float: left; 133 | width: 150px; 134 | padding: 0 10px; 135 | border: 1px solid #ccc; 136 | background: #eee; 137 | text-align: left; 138 | } 139 | 140 | #external-events h4 { 141 | font-size: 16px; 142 | margin-top: 0; 143 | padding-top: 1em; 144 | } 145 | 146 | #external-events .fc-event { 147 | margin: 10px 0; 148 | cursor: pointer; 149 | } 150 | 151 | #external-events p { 152 | margin: 1.5em 0; 153 | font-size: 11px; 154 | color: #666; 155 | } 156 | 157 | #external-events p input { 158 | margin: 0; 159 | vertical-align: middle; 160 | } 161 | 162 | #calendar { 163 | float: right; 164 | width: 900px; 165 | } 166 | '); 167 | ?> 168 | 169 |179 | 180 | 181 |
182 |