You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

38 lines
850 B

  1. <?php
  2. /**
  3. * AjaxAction
  4. *
  5. * @copyright NetMonsters <team@netmonsters.ru>
  6. * @link
  7. * @package Kuperauto
  8. * @subpackage face
  9. * @since
  10. * @version SVN: $Id$
  11. * @filesource $URL$
  12. */
  13. /**
  14. * базовый класс для всей экшенов выполняющихся по аякс-запросу
  15. */
  16. abstract class AjaxAction extends Action
  17. {
  18. public $template_dir = 'ajax';
  19. public $data = 1;
  20. protected $encode = true;
  21. function __construct()
  22. {
  23. Env::setParam('hide_debug', true);
  24. parent::__construct();
  25. $this->template = 'ajax';
  26. }
  27. function prepare()
  28. {
  29. header("Content-type: text/html; charset=utf-8");
  30. header("Cache-Control: no-store, no-cache, must-revalidate");
  31. $this->templater->assign('data', $this->encode ? json_encode($this->data) : $this->data);
  32. }
  33. }