ancarebeca / fullcalendarbundle Goto Github PK
View Code? Open in Web Editor NEWSymfony3 integration with the library FullCalendar.js
Symfony3 integration with the library FullCalendar.js
Hello ancarebeca, I just downloaded and tested out your example of full calendar, but I cannot find out how to show url and use other features of the full calendar itself, the main reason Im writing this is because of the url, I only want to display a url from the entity extending your bundle, the whole calendar works as in the example but the stored url in my bd dont, how can I do this ?
Constructor in EventInterface is too strict.
Users should be able, while extending Event, to implement their own logic in entity constructor.
Hello everybody,
When i try to access the calendar layout i dont get events on the page, i only got them when i access /full-calendar/load, this is the error i get :
Uncaught TypeError: Cannot read property 'stripTime' of undefined
at v (fullcalendar.min.js:6)
at u (fullcalendar.min.js:6)
at t (fullcalendar.min.js:6)
at s (fullcalendar.min.js:6)
at fullcalendar.min.js:6
at Object.success (fullcalendar.min.js:6)
at j (jquery.min.js:2)
at Object.fireWith [as resolveWith] (jquery.min.js:2)
at x (jquery.min.js:4)
at XMLHttpRequest.<anonymous> (jquery.min.js:4)
This is my head layout :
{% block stylesheets %}
<link rel="stylesheet" href="//maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css">
<link rel="stylesheet" href="{{ asset('bundles/fullcalendar/css/fullcalendar/fullcalendar.min.css') }}" />
{% endblock %}
{% block javascripts %}
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.2.1/jquery.min.js"></script>
<script type="text/javascript" src="{{ asset('bundles/fullcalendar/js/fullcalendar/lib/jquery.min.js') }}"></script>
<script src="//maxcdn.bootstrapcdn.com/bootstrap/3.3.7/js/bootstrap.min.js"></script>
<script src="//cdnjs.cloudflare.com/ajax/libs/bootstrap-confirmation/1.0.7/bootstrap-confirmation.js"></script>
<script src="{{ asset('bundles/fosjsrouting/js/router.js') }}"></script>
<script src="{{ path('fos_js_routing_js', { callback: 'fos.Router.setData' }) }}"></script>
<script type="text/javascript" src="{{ asset('bundles/fullcalendar/js/fullcalendar/lib/moment.min.js') }}"></script>
<script type="text/javascript" src="{{ asset('bundles/fullcalendar/js/fullcalendar/fullcalendar.min.js') }}"></script>
<script type="text/javascript" src="{{ asset('bundles/fullcalendar/js/fullcalendar/fullcalendar.default-settings.js') }}"></script>
{% endblock %}
Hello, sorry I got couples of questions.
I'm working on a project and I have to display a calendar (start, end and detail). Trying to use this bundle, i face some misunderstandings.
What is the purpose of the CalendarEvent (created in the README.md)? When I look at the exemple, I don't see its implementation but it's just used (https://github.com/ancarebeca/full-calendar-example/blob/master/src/AppBundle/EventListener/LoadDataListener.php)
Line 43 (of the previous page linked), should I define the "addEvent()" method? (Since the CalendarEvent doesn't exist)
Depending on the example branch, what is the difference btwn CalendarEvent and Schedule class ?
To add styles and Js, I don't have the bundle in the asset (web) dir. Did I do wrong when installing ? I can't find any style and script anywhere.
Thank you
Hi,
I tried to set the end date on the Demo. I changed the end date in the database and also used setEndDate() with the database value inside the loadData() function but it had no effect on the displayed subjects. Am I missing sth.?
Kind regards,
Sebastian
Hi !
I tried to override default jfull calendar settings by adding my own in Resources/public/js/ like it is said in the documentations, but it doesn't seems to work. I also tried things like adding a AncaRebecaFullCalendarBundle/fullcalendar/public/js/fullcalendar.default-settings.js file, but nothing worked.
Can you help me with that ?
Thanks a lot !
Hello,
I try to use the fullcalendarbundle, but I'm facing a problem:
In src/AppBundle/Listener/LoadDataListener.php, method's names are getStart and getEnd, not
getStartDatetime and getEndDatetime.
The use AncaRebeca\FullCalendarBundle\Model\Event; generate an
Error: Cannot instantiate abstract class AncaRebeca\FullCalendarBundle\Model\Event
I replaced it with the custom event entity.
Now I don't have error, but events are not displayed in the calendar.
Can you please help me?
I use SF2.8.2.
Regards
Good night the bundle is working ok with Symfony 4 too.
Thanks.
Hello, I'm currently in development study and for my final project I'm working on the development of a CRM, I wanted to use your calendar, I chose to develop under symfony 4, the problem being the version of symfony, and the 30 days remaining before the exam, I come to ask you a little help regarding the adaptation of the calendar on symfony 4.
In my twig I have my fullcalendar script which generates me the calendar it takes into account all the necessary options, I just can't make the link with my events entity thanks to the events option ! I have a php file with a pdo connection and a sql request ect... everything is supposed to be good but the script doesn't get to the said file .
Thank you for taking the time to look at my problem .
``
Hello,
When i add this to my services.xml my site dont run anymore, PHP error : does not contain valid YAML
cmr.service.listener: class: CMRBundle\Listener\LoadDataListener tags: - { name: 'kernel.event_listener', event: 'fullcalendar.set_data', method: loadData }
Thanks
You shouldn't include your frontend dependencies inside bundle repository, it's a bad practice.
Instead, you should specify in documentation the versions of your frontend dependencies you support, and suggest a possible installation method (e.g. using bower, or npm, or a CDN)
Hey does this bundle worked on symfony 3.0.4 ?
Latest version is 3.5.1. It would be great to update the library bundled with this bundle.
Hi,
I might be asking this in the wrong place, but I'm a bit confused at how I use this.
I setup everything as instructed, but can't seem to see any data on the calendar.
Do I need to create my own controller?
How do I access the calendar?
I created my own controller to load the view, but I don't see any data. Not sure what I'm missing.
Hi
I tried the plugin, it works perfectly. However, I have a question. I wish to have two calendars on my website, they are on different pages. Both calendars should not retrieve the same data so they should not call the same route full-calendar/load
. I don't know how to add a new route, and a new listener for loadData.
Thank you
Hey,
Sorry to disturb you but can you please explain more about how your bundle works ? I did everything just like in the instructions but i still get a 404 error and the calendar is always empty.
It seems like the CalendarJS is trying to fetch data from here : http://localhost/full-calendar/load which is incorrect of course.
Great bundle by the way and thank you
Hello,
Ive followed the entire guide to install the calendar.
This is myclass EventCustom.php in /RDVBundle/Entity/EventCustom.php
`<?php
namespace RDVBundle\Entity;
use AncaRebeca\FullCalendarBundle\Model\FullCalendarEvent;
use Doctrine\ORM\Mapping as ORM;
/**
class CalendarEvent extends FullCalendarEvent
{
/**
* @var int
*
* @Orm\Column(name="id", type="integer")
* @Orm\Id
* @Orm\GeneratedValue(strategy="AUTO")
*/
protected $id;
/**
* @var string
*/
protected $title;
/**
* @var boolean
*/
protected $allDay = true;
/**
* @var \DateTime
*/
protected $startDate;
/**
* @var \DateTime
*/
protected $endDate;
/**
* @var string
*/
protected $url;
/**
* @var string
*/
protected $className;
/**
* @var boolean
*/
protected $editable = false;
/**
* @var boolean
*/
protected $startEditable = false;
/**
* @var boolean
*/
protected $durationEditable = false;
/**
* @var string
*/
protected $rendering;
/**
* @var boolean
*/
protected $overlap = true;
/**
* @var integer
*/
protected $constraint;
/**
* @var string
*/
protected $source;
/**
* @var string
*/
protected $color;
/**
* @var string
*/
protected $backgroundColor;
/**
* @var string
*/
protected $textColor;
/**
* @var array
*/
protected $customFields = [];
/**
* @param string $title
* @param \DateTime $start
*/
public function __construct($title, \DateTime $start)
{
$this->title = $title;
$this->startDate = $start;
}
/**
* @return int
*/
public function getId()
{
return $this->id;
}
/**
* @param int $id
*/
public function setId($id)
{
$this->id = $id;
}
/**
* @return string
*/
public function getTitle()
{
return $this->title;
}
/**
* @param string $title
*/
public function setTitle($title)
{
$this->title = $title;
}
/**
* @return boolean
*/
public function isAllDay()
{
return $this->allDay;
}
/**
* @param boolean $allDay
*/
public function setAllDay($allDay)
{
$this->allDay = $allDay;
}
/**
* @return \DateTime
*/
public function getStartDate()
{
return $this->startDate;
}
/**
* @param \DateTime $startDate
*/
public function setStartDate(\DateTime $startDate)
{
$this->startDate = $startDate;
}
/**
* @return \DateTime
*/
public function getEndDate()
{
return $this->endDate;
}
/**
* @param \DateTime $endDate
*/
public function setEndDate(\DateTime $endDate)
{
$this->endDate = $endDate;
}
/**
* @return string
*/
public function getUrl()
{
return $this->url;
}
/**
* @param string $url
*/
public function setUrl($url)
{
$this->url = $url;
}
/**
* @return string
*/
public function getClassName()
{
return $this->className;
}
/**
* @param string $className
*/
public function setClassName($className)
{
$this->className = $className;
}
/**
* @return boolean
*/
public function isEditable()
{
return $this->editable;
}
/**
* @param boolean $editable
*/
public function setEditable($editable)
{
$this->editable = $editable;
}
/**
* @return boolean
*/
public function isStartEditable()
{
return $this->startEditable;
}
/**
* @param boolean $startEditable
*/
public function setStartEditable($startEditable)
{
$this->startEditable = $startEditable;
}
/**
* @return boolean
*/
public function isDurationEditable()
{
return $this->durationEditable;
}
/**
* @param boolean $durationEditable
*/
public function setDurationEditable($durationEditable)
{
$this->durationEditable = $durationEditable;
}
/**
* @return string
*/
public function getRendering()
{
return $this->rendering;
}
/**
* @param string $rendering
*/
public function setRendering($rendering)
{
$this->rendering = $rendering;
}
/**
* @return boolean
*/
public function isOverlap()
{
return $this->overlap;
}
/**
* @param boolean $overlap
*/
public function setOverlap($overlap)
{
$this->overlap = $overlap;
}
/**
* @return int
*/
public function getConstraint()
{
return $this->constraint;
}
/**
* @param int $constraint
*/
public function setConstraint($constraint)
{
$this->constraint = $constraint;
}
/**
* @return string
*/
public function getSource()
{
return $this->source;
}
/**
* @param string $source
*/
public function setSource($source)
{
$this->source = $source;
}
/**
* @return string
*/
public function getColor()
{
return $this->color;
}
/**
* @param string $color
*/
public function setColor($color)
{
$this->color = $color;
}
/**
* @return string
*/
public function getBackgroundColor()
{
return $this->backgroundColor;
}
/**
* @param string $backgroundColor
*/
public function setBackgroundColor($backgroundColor)
{
$this->backgroundColor = $backgroundColor;
}
/**
* @return string
*/
public function getTextColor()
{
return $this->textColor;
}
/**
* @param string $textColor
*/
public function setTextColor($textColor)
{
$this->textColor = $textColor;
}
/**
* @param $name
* @param $value
*
* @return mixed
*/
public function setCustomField($name, $value)
{
$this->customFields[$name] = $value;
}
/**
* @param $name
*
* @return mixed
*/
public function getCustomFieldValue($name)
{
return $this->customFields[$name];
}
/**
* @return array
*/
public function getCustomFields()
{
return $this->customFields;
}
/**
* @param $name
*
* @return mixed
*/
public function removeCustomField($name)
{
if (!isset($this->customFields[$name]) && !array_key_exists($name, $this->customFields)) {
return null;
}
$removed = $this->customFields[$name];
unset($this->customFields[$name]);
return $removed;
}
/**
* @return array
*/
public function toArray()
{
$event = [];
$event['title'] = $this->getTitle();
$event['start'] = $this->getStartDate()->format("Y-m-d\TH:i:sP");
$event['allDay'] = $this->isAllDay();
$event['editable'] = $this->isEditable();
$event['startEditable'] = $this->isStartEditable();
$event['durationEditable'] = $this->isDurationEditable();
$event['overlap'] = $this->isOverlap();
if (null !== $this->getId()) {
$event['id'] = $this->getId();
}
if (null !== $this->getUrl()) {
$event['url'] = $this->getUrl();
}
if (null !== $this->getBackgroundColor()) {
$event['backgroundColor'] = $this->getBackgroundColor();
}
if (null !== $this->getTextColor()) {
$event['textColor'] = $this->getTextColor();
}
if (null !== $this->getClassName()) {
$event['className'] = $this->getClassName();
}
if (null !== $this->getEndDate()) {
$event['end'] = $this->getEndDate()->format("Y-m-d\TH:i:sP");
}
if (null !== $this->getRendering()) {
$event['rendering'] = $this->getRendering();
}
if (null !== $this->getConstraint()) {
$event['constraint'] = $this->getConstraint();
}
if (null !== $this->getSource()) {
$event['source'] = $this->getSource();
}
if (null !== $this->getColor()) {
$event['color'] = $this->getColor();
}
foreach ($this->getCustomFields() as $field => $value) {
$event[$field] = $value;
}
return $event;
}
}`
But when i do a dump-sql, only the id field is added to the dababase.
Thanks a lot
I am implementing FullCalendarBundle into Symfony 3.4 but I am struggling to load data into calendar. The calendar works fine but I cannot see my own event.
I did read the documentation and now I am trying to get an inspiration from example.
The data I am loading is the Event entity with title and date.
I made this listener based on documentation and example:
LoadDataListener.php
namespace AppBundle\Listener;
use AncaRebeca\FullCalendarBundle\Event\CalendarEvent as BundleCalendarEvent;
use AncaRebeca\FullCalendarBundle\Model\Event as BundleEvent;
use AppBundle\Entity\Event as MyEvent;
class LoadDataListener
{
public function loadData(MyEvent $event, BundleCalendarEvent $calendarEvent)
{
$calendarEvent->addEvent(new BundleEvent($event->getName(), $event->getDateTime()));
}
}
and than I load the data to calendar with:
$loading = new LoadDataListener();
$loading->loadData($event, new CalendarEvent($event->getDateTime(), $event->getDateTime(), array()));
If I understand it correctly, here is the part where I can set up the method how to load the events (fullcalendar.default-settings.js).
eventSources: [
{
url: /full-calendar/load,
type: 'POST',
data: {
filters: { param: foo }
}
error: function() {
//alert()
}
}
Thanks a lot for any idea.
Hello I create my Calendar Event class
<?php
namespace AppBundle\Entity;
use AncaRebeca\FullCalendarBundle\Model\Event as BaseEvent;
use Doctrine\ORM\Mapping as ORM;
/**
* @ORM\Entity
* @ORM\Table(name="f_calendar")
*/
class CalendarEvent extends BaseEvent
{
/**
* @ORM\Id
* @ORM\Column(name="id", type="integer")
* @ORM\GeneratedValue(strategy="AUTO")
*/
protected $id;
}
after php bin/console doctrine:schema:update --force
my database don't herit Event and i only have the ID field!!!
Can you help me to solve this problem?
Hi, i need ti use full-calendar for my app.
Thanks for your work, but i am using MongoDB ODM and not ORM databases.
So i have no error, but i have no data in the calendar.
I rewrite the CalendarEvent like in the schedule.php example and i populate my mongodb collection with two documents (title , start: and allDay).
Do you have an idea ?
Thx
Hi,
While installing the bundle in my Symfony 3.1 app I get the following error.
[Symfony\Component\Yaml\Exception\ParseException]
The reserved indicator "@" cannot start a plain scalar; you need to quote the scalar at line 9 (near "- @anca_rebeca_full_calendar.service.serializer").
The fix is very simple, I'll make a PR with the fix.
Hello,
Thanks to you that I was able to correctly config this bundle with my symfony project <3
When i access full-calendar/load i can see the events loads from db in array :
[{"title":"Yoga class","startDate":"2018-01-15T16:46:33+00:00","allDay":true,"editable":false,"startEditable":false,"durationEditable":false,"overlap":true,"id":2,"url":"jujujuju","end":"2018-01-24T16:46:33+00:00"}, {"title":"Mami","startDate":"2018-01-15T16:46:33+00:00","allDay":true,"editable":false,"startEditable":false,"durationEditable":false,"overlap":true,"id":3,"url":"jujujuju","end":"2018-01-25T16:46:33+00:00"}]
But in the calendar layout events dont load, the profiler say that a have 404 ajax request :
Method | Type | Status | URL | Time | Profile |
---|---|---|---|---|---|
POST | xhr | 404 | /full-calendar/load | 104ms | n/a |
In Chrome Debug it seems that the problem is related to path, the POST METHOD failed 404 :
POST http://localhost/full-calendar/load 404 (Not Found)
The correct url should be : http://localhost/No/Web/app_dev.php/full-calendar/load
Please how can i fix that.
My routing file :
fos_js_routing:
resource: "@FOSJsRoutingBundle/Resources/config/routing/routing.xml"
ancarebeca_fullcalendar:
resource: "@FullCalendarBundle/Resources/config/routing.yml"
This is my head layout :
<script type="text/javascript" src="{{ asset('bundles/fullcalendar/js/fullcalendar/lib/jquery.min.js') }}"></script>
<script src="//maxcdn.bootstrapcdn.com/bootstrap/3.3.7/js/bootstrap.min.js"></script>
<script src="//cdnjs.cloudflare.com/ajax/libs/bootstrap-confirmation/1.0.7/bootstrap-confirmation.js"></script>
<script src="{{ asset('bundles/fosjsrouting/js/router.js') }}"></script>
<script src="{{ path('fos_js_routing_js', { callback: 'fos.Router.setData' }) }}"></script>
<script type="text/javascript" src="{{ asset('bundles/fullcalendar/js/fullcalendar/lib/moment.min.js') }}"></script>
<script type="text/javascript" src="{{ asset('bundles/fullcalendar/js/fullcalendar/fullcalendar.min.js') }}"></script>
<script type="text/javascript" src="{{ asset('bundles/fullcalendar/js/fullcalendar/fullcalendar.default-settings.js') }}"></script>
Ive installed fosjsrouting.
Thanks for your help
a conflict by installing FullCalendarBundle
composer require ancarebeca/full-calendar-bundle gives:
I have added extra fields to the CalendarEvent entity, how do I display these, for example, on hover or click?
I added the description field, but the fullCalendar
eventClick: function (calEvent, jsEvent, view)
doesn't return my custom fields in it's calEvent parameter.
Thanks in advance!
Can you help me I have symfony3.3.13 and I installed this bundle, it appears but I have a problem with ajax: / full-calendar / load error 404 ???
What should I put in the file EventCustom.php instead of "Your fields":
namespace AppBundle \ Entity;
use AncaRebeca \ FullCalendarBundle \ Model \ FullCalendarEvent;
class CalendarEvent extends FullCalendarEvent
{
// Your fields
}
Do I have to create a particular table?
Thank you for your help and your work for this Bundle
Catchable Fatal Error: Argument 1 passed to PMAS\SearchBundle\EventListener\LoadDataListener::loadData() must be an instance of PMAS\SearchBundle\EventListener\CalendarEvent, instance of AncaRebeca\FullCalendarBundle\Event\CalendarEvent given
The LoadDataListener from my apllcation is call with instance of AncaRebeca\FullCalendarBundle\Event\CalendarEvent
My services:
services:
app_bundle.service.listener:
class: PMAS\SearchBundle\EventListener\LoadDataListener
tags:
- { name: 'kernel.event_listener', event: 'fullcalendar.set_data', method: loadData }
Hello, I dont know why i cant run the calendar in good way this is my files please help me its been 2 weeks that i try to solve that :
LoadData :
`<?php
namespace CMRBundle\EventListener;
use AncaRebeca\FullCalendarBundle\Event\CalendarEvent;
use AncaRebeca\FullCalendarBundle\Model\Event;
use AncaRebeca\FullCalendarBundle\Model\FullCalendarEvent;
use CMRBundle\Entity\Schedule;
use Doctrine\ORM\EntityManager;
class LoadDataListener
{
/**
* @var EntityManager
*/
private $em;
public function __construct(EntityManager $em)
{
$this->em = $em;
}
/**
* @param CalendarEvent $calendarEvent
*
* @return FullCalendarEvent[]
*/
public function loadData(CalendarEvent $calendarEvent)
{
// You can retrieve information from the event dispatcher (eg, You may want which day was selected in the calendar):
// $startDate = $calendarEvent->getStart();
// $endDate = $calendarEvent->getEnd();
// $filters = $calendarEvent->getFilters();
// You may want do a custom query to populate the events
// $currentEvents = $repository->findByStartDate($startDate);
$repository = $this->em->getRepository('CMRBundle:Schedule');
$schedules = $repository->findAll();
// You may want to add an Event into the Calendar view.
/** @var Schedule $schedule */
foreach ($schedules as $schedule) {
$calendarEvent->addEvent(new Event($schedule->getTitle(), $schedule->getStart()));
}
}
} `
Schedule :
`<?php
namespace CMRBundle\EventListener;
use Doctrine\ORM\Mapping as ORM;
/**
Schedule
@Orm\Table(name="schedule")
@Orm\Entity(repositoryClass="CMRBundle\Repository\ScheduleRepository")
/
class Schedule
{
/*
/**
/**
/**
/**
/**
Set title
@param string $title
@return Schedule
*/
public function setTitle($title)
{
$this->title = $title;
return $this;
}
/**
/**
/**
/**
/**
And this is the error i dont understand what im missing :
{"error":"Catchable Fatal Error: Argument 1 passed to CMRBundle\\EventListener\\LoadDataListener::__construct() must be an instance of Doctrine\\ORM\\EntityManager, none given, called in C:\\wamp64\\www\\No\\var\\cache\\dev\\appDevDebugProjectContainer.php on line 492 and defined"}
Ive used the example available
Hello,
Thank you for this bundle.
I don't understand why I have this error on production but not on version dev.
My prod configuration is in amazon elastic beanstalk server. The error is:
TypeError: N is null
I have screenshot my javascript console:
In my development version I haven't this problem.
Any idea ?
Thank you.
I did everything as in instruction, but i get:
"Catchable Fatal Error: Argument 1 passed to Ent\AppBundle\Listener\LoadDataListener::loadData() must be an instance of Ent\AppBundle\Listener\CalendarEvent, instance of AncaRebeca\FullCalendarBundle\Event\CalendarEvent given"
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.