Files
majestic/app/AjaxAction.php

38 lines
890 B
PHP
Raw Normal View History

2011-04-27 18:33:57 +04:00
<?php
/**
* AjaxAction
*
* @copyright NetMonsters <team@netmonsters.ru>
* @link
2012-03-19 18:18:25 +04:00
* @package Majestic
2011-04-27 18:33:57 +04:00
* @subpackage face
* @since
* @version SVN: $Id$
* @filesource $URL$
*/
/**
2011-10-13 14:55:06 +04:00
* базовый класс для всей экшенов выполняющихся по аякс-запросу
*/
2011-04-27 18:33:57 +04:00
abstract class AjaxAction extends Action
{
public $data = 1;
2011-10-13 14:55:06 +04:00
2011-04-27 18:33:57 +04:00
protected $encode = true;
function __construct()
{
parent::__construct();
$this->template = 'ajax';
}
2011-04-27 19:16:40 +04:00
function fetch()
2011-04-27 18:33:57 +04:00
{
2011-04-27 19:16:40 +04:00
// header("Content-type: application/json; charset=utf-8");
2011-04-27 18:33:57 +04:00
header("Content-type: text/html; charset=utf-8");
header("Cache-Control: no-store, no-cache, must-revalidate");
2011-04-27 19:16:40 +04:00
$this->view->assign('data', $this->encode ? json_encode($this->data) : $this->data);
return $this->view->fetch($this->getTemplate());
2011-04-27 18:33:57 +04:00
}
}