PHP Classes

File: src/Controllers/JaxonController.php

Recommend this page to a friend!
  Classes of Thierry Feuzeu   Jaxon for Yii   src/Controllers/JaxonController.php   Download  
File: src/Controllers/JaxonController.php
Role: Class source
Content type: text/plain
Description: Class source
Class: Jaxon for Yii
Yi plugin to call PHP from with AJAX
Author: By
Last change: Updated the plugin and the controller.
Typo fix.
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,379 bytes
 

Contents

Class file image Download
<?php

namespace Jaxon\Yii\Controllers;

use
yii\web\Controller;
use
Yii;

class
JaxonController extends Controller
{
   
/**
     * Process a Jaxon request.
     *
     * The HTTP response is automatically sent back to the browser
     *
     * @return void
     */
   
public function actionIndex()
    {
       
// Process Jaxon request
       
$jaxon = Yii::$app->getModule('jaxon');

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

        if(
$jaxon->canProcessRequest())
        {
            return
$jaxon->processRequest();
        }
    }
}