Inheritance: extends Zend_Controller_Action
Esempio n. 1
0
 public static function getInstance()
 {
     if (!is_object(self::$instance)) {
         self::$instance = new AjaxController();
     }
     return self::$instance;
 }
Esempio n. 2
0
 /**
  * Initialises Widget stuff.
  */
 function __construct($light = false, $view = null)
 {
     if ($view != null) {
         $this->_view = $view;
     }
     $this->user = new User();
     $this->load();
     $this->name = get_class($this);
     // If light loading enabled, we stop here
     if ($light) {
         return;
     }
     // Put default widget init here.
     $this->ajax = AjaxController::getInstance();
     // Generating Ajax calls.
     $refl = new ReflectionClass($this->name);
     $meths = $refl->getMethods();
     foreach ($meths as $method) {
         if (preg_match('#^ajax#', $method->name)) {
             $pars = $method->getParameters();
             $params = array();
             foreach ($pars as $param) {
                 $params[] = $param->name;
             }
             $this->ajax->defun($this->name, $method->name, $params);
         }
     }
     $config = array('tpl_dir' => $this->respath('', true), 'cache_dir' => CACHE_PATH, 'tpl_ext' => 'tpl', 'auto_escape' => false);
     // We load the template engine
     $this->view = new Tpl();
     $this->view->objectConfigure($config);
     $this->view->assign('c', $this);
     $this->pure = false;
 }
Esempio n. 3
0
 function init($ctx)
 {
     parent::init($ctx);
     header('P3P:CP=" OTI DSP COR IVA OUR IND COM "');
     $ref = $_SERVER['HTTP_REFERER'];
     $allow_domains = array('axelahome.com');
     $allow = false;
     foreach ($allow_domains as $domain) {
         if (preg_match("/^http(s)?:\\/\\/[^\\/]*{$domain}\\//", $ref)) {
             $allow = true;
             break;
         }
     }
     if (ENV != 'dev' && !$allow) {
         _throw("非法的 Referer: " . htmlspecialchars($ref));
     }
     $ctx->user = UC::auth();
 }
<?php

namespace Glossary;

require_once '../global.inc.php';
AjaxController::instance()->run();
Esempio n. 5
0
<?php

error_reporting(E_ERROR);
ini_set('display_errors', 0);
include_once 'classAjaxController.php';
$ajax = new AjaxController();
echo $ajax->getResult();
unset($ajax);
Esempio n. 6
0
<?php

require_once $_SERVER['DOCUMENT_ROOT'] . '/config/bootstrap.php';
include __DIR__ . '/AjaxController.php';
require_once __DIR__ . '/CrudController.php';
$ajax = new AjaxController();
$ajax->parseRequest();
$controllerClass = $ajax->run();
if ($controllerClass) {
    $controllerClass->sendHeaders();
}
<?php

/**
 * Execute the ajax controller if we are performing an ajax action.
 */
if (isset($_POST['ajax_action'])) {
    $ax = new AjaxController();
    $ax->handle_request($_POST['ajax_action']);
}
/**
 * Handler for AJAX requests.
 */
class AjaxController
{
    /**
     * Default constructor.
     */
    function AjaxController()
    {
        session_start();
        // continue current session
    }
    /**
     * Handles the specified action.
     * $action : action constant to be handled
     */
    function handle_request($action)
    {
        switch ($action) {
            case 'SAVE_BOOKING':
                $this->save_booking();
 /**
  * Create new instance.
  */
 public function __construct()
 {
     parent::__construct('ajaxCountry');
     $this->set('ajaxCountryMap', array('id', 'name'));
     $this->set('ajaxZoneMap', array('id', 'name'));
 }
Esempio n. 9
0
 function printScripts()
 {
     $out = '';
     $widgets = WidgetWrapper::getInstance();
     $scripts = array_merge($this->scripts, $widgets->loadjs());
     foreach ($scripts as $script) {
         $out .= '<script type="text/javascript" src="' . $script . '"></script>' . "\n";
     }
     $ajaxer = AjaxController::getInstance();
     $out .= $ajaxer->genJs();
     return $out;
 }
    {
        include __DIR__ . '/../models/inmueble.php';
        $obj = inmueble::obtInmueble();
        foreach ($obj as $var) {
            $var->Imagenes = "<button type='button' id='image-viewer' class='btn btn-primary' href='views/es/sistema/galeria2.php?id={$var->id}'> Ver {$var->id} </button>";
        }
        $info = AjaxController::$begin . json_encode($obj) . AjaxController::$end;
        return $info;
    }
}
// __DIR__ guarda la ubicacion actual del archivo
include __DIR__ . '/../connection.php';
$info = '{"data": []}';
switch ($_SESSION['action']) {
    case 'usuarios':
        $info = AjaxController::usuarios();
        break;
    case 'auditorias':
        $info = AjaxController::auditorias();
        break;
    case 'inmuebles':
        $info = AjaxController::inmuebles();
        break;
    case 'estados':
        $info = AjaxController::estados();
        break;
    case 'municipios':
        $info = AjaxController::municipios();
        break;
}
echo $info;
Esempio n. 11
0
 public function init()
 {
     $this->modelInstance = new $this->model();
     return parent::init();
 }
Esempio n. 12
0
<?php

/**
 * xuad.net tutorial: ajax_tutorial
 *
 * Copyright (c) Patrick Mosch
 *
 * @link http://xuad.net
 * @license http://www.gnu.org/licenses/lgpl-3.0.html LGPL
 */
// Benoetigter AjaxController wird eingebunden
require_once 'classes/AjaxController.php';
// Neue Instanz des Controllers anlegen
$ajaxController = new AjaxController();
// Controller ausfuehren
echo $ajaxController->execute();
Esempio n. 13
0
<?php

include '../php_boot/boot_main.php';
tfw::IMPORT("php_classes/helpers", "MainHelper.inc", 1);
tfw::IMPORT("php_classes/helpers", "HelperSelect.inc", 1);
class AjaxController
{
    public function __construct()
    {
    }
    public function get_select()
    {
        $ar[""] = "";
        $ar["v1111"] = "txt1111";
        $ar["v2222"] = "txt2222";
        $ar["v3333"] = "txt3333";
        $ar["v4444"] = "txt4444";
        $ar["v5555"] = "txt5555";
        $ar["v6666"] = "txt6666";
        $ar["v7777"] = "txt7777";
        $ar["v8888"] = "txt8888";
        $oSelect = new HelperSelect($ar, "selTestSingle");
        $oSelect->show();
    }
}
$oAjax = new AjaxController();
$oAjax->get_select();
<?php

namespace de\schulte360\web\requirejs\php;

include "./classes/AjaxController.class.php";
$testClass = new AjaxController(filter_input(INPUT_POST, 'test1', FILTER_SANITIZE_SPECIAL_CHARS), filter_input(INPUT_POST, 'test1', FILTER_SANITIZE_SPECIAL_CHARS));
$testClass->execute();