PHP Classes

File: src/Controller/JaxonController.php

Recommend this page to a friend!
  Classes of Thierry Feuzeu   Jaxon for Zend Framework   src/Controller/JaxonController.php   Download  
File: src/Controller/JaxonController.php
Role: Class source
Content type: text/plain
Description: Class source
Class: Jaxon for Zend Framework
Zend plugin to call PHP classes from with AJAX
Author: By
Last change: Updated the plugin and the controller.
Updated the Jaxon controller
Adapted to the new class hierarchy is jaxon-core.
Apply fixes from StyleCI
Date: 3 years ago
Size: 1,808 bytes
 

Contents

Class file image Download
<?php

namespace Jaxon\Zend\Controller;

use
Zend\Mvc\Controller\AbstractActionController;
use
Zend\View\Model\ViewModel;
use
Jaxon\Zend\Controller\Plugin\JaxonPlugin;

class
JaxonController extends AbstractActionController
{
   
/**
     * @var \Jaxon\Zend\Controller\Plugin\JaxonPlugin
     */
   
protected $jaxon;

   
/**
     * The Jaxon Controller constructor
     *
     * The parameter is automatically populated by Zend.
     *
     * @param JaxonPlugin $jaxon
     */
   
public function __construct(JaxonPlugin $jaxon)
    {
       
$this->jaxon = $jaxon;
    }

   
/**
     * Process a Jaxon request.
     *
     * The HTTP response is automatically sent back to the browser
     *
     * @return void
     */
   
public function indexAction()
    {
       
$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 the Jaxon request
       
if($this->jaxon->canProcessRequest())
        {
            return
$this->jaxon->processRequest();
        }
    }
}