Added default Ajax action
This commit is contained in:
38
app/AjaxAction.php
Normal file
38
app/AjaxAction.php
Normal file
@ -0,0 +1,38 @@
|
||||
<?php
|
||||
/**
|
||||
* AjaxAction
|
||||
*
|
||||
* @copyright NetMonsters <team@netmonsters.ru>
|
||||
* @link
|
||||
* @package Kuperauto
|
||||
* @subpackage face
|
||||
* @since
|
||||
* @version SVN: $Id$
|
||||
* @filesource $URL$
|
||||
*/
|
||||
|
||||
/**
|
||||
* базовый класс для всей экшенов выполняющихся по аякс-запросу
|
||||
*/
|
||||
abstract class AjaxAction extends Action
|
||||
{
|
||||
public $template_dir = 'ajax';
|
||||
public $data = 1;
|
||||
protected $encode = true;
|
||||
|
||||
function __construct()
|
||||
{
|
||||
Env::setParam('hide_debug', true);
|
||||
|
||||
parent::__construct();
|
||||
|
||||
$this->template = 'ajax';
|
||||
}
|
||||
|
||||
function prepare()
|
||||
{
|
||||
header("Content-type: text/html; charset=utf-8");
|
||||
header("Cache-Control: no-store, no-cache, must-revalidate");
|
||||
$this->templater->assign('data', $this->encode ? json_encode($this->data) : $this->data);
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user