fullcalendar - Events and Full Calendar in CakePHP -


I set the full calendar plugin in CakePHP, I can see it, it is displayed, In my complete calendar plugin my PHP Controller (Visual admin feed) I do not know what is wrong, no events have been displayed in my calendar. I am grateful if anyone knows why my calender is empty, look at the screen, it's in my console:

 Enter image details here

The answer is null.

js file:

  // javascript document $ (document) .ready (function () {$ ('agenda wake', previously: 8, week mode: (# Header: {left: 'Previous, Next Today', Center: 'Title', Right: 'Month, Agenda Wiic, Agenda Day'}, 'Variables', aspect Retro: 2, Editable: True, Event: {url: FcRoot Text color: 'black', // an option!}, Layout: function (event, element) {}}}}; ; Get the list of events (JSON) public function admin_feed ($ id = null) The feed action is called from js {/ code>  

EventController

  $ This-> Layout = "AJAX"; $ wars = $ this- & Parameters ['url']; $ Conditions = array ('condition' = & gt; array ('UNIX_TIMESTAMP (start)> =' => $ vars ['start'], 'UNIX_TIMESTAMP (start) ($ '=' = & Gt; $ vars ['end'])); $ events = $ this- & gt; Event- & gt; Search ('all', $ terms); foreign currency ($ events $ event ) {If ($ event ['event'] ['all_day'] == 1) {$ allday = true; $ End = $ event ['event'] ['start']; } And {$ allday = false; $ End = $ event ['event'] ['end']; } $ Data [] = array ('id' = & gt; $ event ['event'] ['id'], 'title' = & gt; $ event ['event'] ['title'], 'start '= & Gt; $ event [' event '] [' start '],' end '=> end =); } $ This- & gt; Set ("json", json_encode ($ data)); }   

In the scene / event / admin_feed

  & lt ;? Php echo $ json; ? & Gt;   

Reactions now:

Enter the image details here

You really should take advantage of routing and view for it. This allows you to organize your code systematically and keep things dry.

  public function admin_feed ($ id = null) {$ vars = $ this-> params ['url']; $ Conditions = array ('condition' = & gt; array ('UNIX_TIMESTAMP') = '=> $ vars [' Start '],' UNIX_TIMESTAMP (start) & lt; = '= & gt; $ Vars ['end'])); $ Events = $ this- & gt; Events- & gt; Search ('All', $ terms); Foreign exchange ($ events as $ event) {if ($ event ['event'] ['all_day'] == 1) {$ allday = true; $ End = $ event ['event'] ['start']; } And {$ allday = false; $ End = $ event ['event'] ['end']; } $ Data [] = array ('id' = & gt; $ event ['event'] ['id'], 'title' = & gt; $ event ['event'] ['title'], 'start '= & Gt; $ event [' event '] [' start '],' end '=> end =); } $ This- & gt; Set ("Event", $ data); }   

Now, your admin_feed operation is only useful for more than a Jason Feed (even if you want it to be). This makes testing even easier.

Add the following to your paths, to tell the cake that you want to allow the json extension:

  router :: parseExtensions ( 'Json');   

Then, add request handler to your controller components. This component will automatically switch to your Jason View and Layout when a Jason Extension will find.

Next, add a layout for all json views in /View/Layout/json/default.ctp :

    

Then, add your view to /View/Events/json/admin_feed.ctp :

  & lt ;? Php echo json_encode ($ events);   

That's it. Now, if you want to use admin_feed to view HTML events, you can do this by adding a view to it.

Your full calendar URL should now be: FcRoot + '/admin/events/feed.json' . Try to see it in the browser, whether you are watching Jason.

Comments

Popular posts from this blog

c# - Textbox not clickable but editable -

Matlab transpose a table vector -

ios - Adding an SKSpriteNode to SKScene from a child SKSpriteNode -