From 822e1e614aef9deb6d85a0e5b7c340b5677a17aa Mon Sep 17 00:00:00 2001 From: Anton Terekhov Date: Wed, 27 Apr 2011 18:33:57 +0400 Subject: [PATCH] Added default Ajax action --- app/AjaxAction.php | 38 ++++++++++++++++++++++++++++++++++++++ 1 file changed, 38 insertions(+) create mode 100644 app/AjaxAction.php diff --git a/app/AjaxAction.php b/app/AjaxAction.php new file mode 100644 index 0000000..c9e0b97 --- /dev/null +++ b/app/AjaxAction.php @@ -0,0 +1,38 @@ + + * @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); + } +}