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.

37 lines
891 B

13 years ago
13 years ago
  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 $data = 1;
  19. protected $encode = true;
  20. function __construct()
  21. {
  22. parent::__construct();
  23. $this->template = 'ajax';
  24. }
  25. function fetch()
  26. {
  27. // header("Content-type: application/json; charset=utf-8");
  28. header("Content-type: text/html; charset=utf-8");
  29. header("Cache-Control: no-store, no-cache, must-revalidate");
  30. $this->view->assign('data', $this->encode ? json_encode($this->data) : $this->data);
  31. return $this->view->fetch($this->getTemplate());
  32. }
  33. }