Using Scheduler inside CakePHP framework

I’m trying to use Scheduler inside of the CakePHP framework. Unfortunately, trying to load/display data from the server is causing problems.

The view file is very basic. I’ve been able to load data if I use an inline js variable, but trying to get json data from the server has been a problem. The response in Firebug appears to be accurate, the format of the dates returned by the server match the format specified in scheduler.config.xml_date and there is no issue with the response status.

Because we have so many of our own functions already coded, we aren’t using the dhtmlx connectors. (Although I’ve tried to integrate them using the tutorial found here: docs.dhtmlx.com/tutorials__conne … index.html)

Here is the data that is being returned in Firebug.

{“data”:[{“id”:1,“text”:“Meeting”,“start_date”:“04-11-2013 14:00”,“end_date”:“04-11-2013 17:00”},{“id”
:2,“text”:“Conference”,“start_date”:“04-15-2013 12:00”,“end_date”:“04-18-2013 19:00”}]}

Here is the js that I use to call the function
scheduler.config.xml_date="%m-%d-%Y %H:%i";
scheduler.init(‘scheduler_here’,new Date(2013,3,10),“month”);
scheduler.load("<?=Router::url(array('action' => 'data', 'ext' => 'json'))?>", “json”);

We really like what Scheduler does and we ant to use it, but if we can’t get it to integrate into CakePHP that’s a pretty severe roadblock. If there is any other information that would be helpful for me to include, let me know!

The data which you are using is valid, so I’m not sure why issue occurs. Same data works for me.

docs.dhtmlx.com/scheduler/snippet/84510ed4

Double check the response

  • do not have anything except JSON ( server side code may try to add some HTML output which breaks JSON data )
  • content-type of response is application/json

There are no any specific actions required from CakePHP, while data is a valid JSON it must be loaded and shown.

Sorry for the delayed reply - holidays and all. :confused:

I’m not getting any sort of errors in the console and I can use the same data in a page outside of the framework, so I don’t think that it’s a data issue. The content type is application/json; charset=UTF-8. I don’t see anything extra that the function could possibly be returning - I have another plugin that uses JSON data and that one works without any problems.

The data works outside of the framework, which makes me think that something in Cake is the issue. But I can make other JSON calls which work just fine, so I’m not sure what I’m doing wrong when making this JSON request. scheduler.getEvents() returns an empty array, but I’m not sure how to use that information in continuing to debug this…

Oh, and here is a link to the page that I’m debugging: experienceplus.com/atlas_sta … scheduler2

Hello.

It seems like you scheduler cannot load data like this. You should update it to newer version.

Not sure how I ended up with such an old version of Scheduler since I’ve only been working with this for about a month, but updating it did the trick. Thanks!

Here’s a quick list of features you’ll enjoy when usingCakePHP:

Active, friendly community
Flexible licensing
Compatible with versions 4 and 5 of PHP
Integrated CRUD for database interaction
Application scaffolding
Code generation
MVC (Model, View, Controller) architecture
Request dispatcher with clean, custom URLs and routes
Built-in validation
Fast and flexible templating (PHP syntax, with helpers)
View Helpers for AJAX, JavaScript, HTML Forms and more
Email, Cookie, Security, Session, and Request Handling Components
Flexible ACL (Access Control List)
Data Sanitization
Flexible Caching
Localization
Works from any web site directory, with little to no Apache configuration involved