PHP Classes

File: src/Controller/JaxonController.php

Recommend this page to a friend!
  Classes of Thierry Feuzeu   Jaxon for CakePHP   src/Controller/JaxonController.php   Download  
File: src/Controller/JaxonController.php
Role: Class source
Content type: text/plain
Description: Class source
Class: Jaxon for CakePHP
This package integrates the Jaxon library into the
Author: By
Last change: Updated to support CakePHP 4.
Updated with latest changes on CakePHP 3.
Updated the plugin and the controller.
Updated the Jaxon controller
Adapted to the new class hierarchy is jaxon-core.
Fixed code style.
Fixed code style.
Date: 3 years ago
Size: 1,670 bytes
 

Contents

Class file image Download
<?php

namespace Jaxon\Cake\Controller;

use
Cake\Core\Configure;
use
App\Controller\AppController;

class
JaxonController extends AppController
{
   
/**
     * Load the Jaxon component.
     *
     * @return void
     */
   
public function initialize(): void
   
{
       
parent::initialize();
       
// Load the Jaxon plugin
       
$this->loadComponent('Jaxon/Cake.Jaxon');
    }

   
/**
     * Process a Jaxon request.
     *
     * The HTTP response is automatically sent back to the browser
     *
     * @return void
     */
   
public function index()
    {
       
$this->viewBuilder()->setLayout('ajax');

       
// $this->Jaxon->callback()->before(function ($target, &$bEndRequest) {
        // if($target->isFunction())
        // {
        // $function = $target->getFunctionName();
        // }
        // elseif($target->isClass())
        // {
        // $class = $target->getClassName();
        // $method = $target->getMethodName();
        // // $instance = $this->Jaxon->instance($class);
        // }
        // });
        // $this->Jaxon->callback()->after(function ($target, $bEndRequest) {
        // if($target->isFunction())
        // {
        // $function = $target->getFunctionName();
        // }
        // elseif($target->isClass())
        // {
        // $class = $target->getClassName();
        // $method = $target->getMethodName();
        // }
        // });

        // Process Jaxon request
       
if($this->Jaxon->canProcessRequest())
        {
            return
$this->Jaxon->processRequest();
        }
    }
}