[ Index ]

PHP Cross Reference of Moodle 1.9.3 [Build 15-Oct-2008]

title

Body

[close]

/lib/pear/HTML/AJAX/ -> Response.php (source)

   1  <?php
   2  /**
   3   * OO AJAX Implementation for PHP, contains HTML_AJAX_Response
   4   *
   5   * SVN Rev: $Id: Response.php,v 1.1.2.1 2008/10/03 07:09:50 nicolasconnault Exp $ 
   6   *
   7   * @category   HTML
   8   * @package    AJAX
   9   * @author     Elizabeth Smith <auroraeosrose@gmail.com>
  10   * @copyright  2005-2006 Elizabeth Smith
  11   * @license    http://www.opensource.org/licenses/lgpl-license.php  LGPL
  12   * @version    Release: 0.5.6
  13   */
  14  
  15  /**
  16   * Require the main AJAX library
  17   */
  18  require_once 'HTML/AJAX.php';
  19  
  20  /**
  21   * Simple base class for a response object to use as an ajax callback
  22   *
  23   * This is the base response class, more interesting response classes can be
  24   * built off of this, simply give it a unique content type and override the
  25   * getPayload method or fill the payload property with your extended classes's
  26   * serialized content
  27   *
  28   * @version   $Id: Response.php,v 1.1.2.1 2008/10/03 07:09:50 nicolasconnault Exp $
  29   */
  30  class HTML_AJAX_Response
  31  {
  32  
  33      /**
  34       * The base response class uses plain text so use that content type
  35       *
  36       * @var string
  37       * @access public
  38       */
  39      var $contentType = 'text/plain';
  40  
  41      /**
  42       * Assign a string to this variable to use the bare response class
  43       *
  44       * @var string
  45       * @access public
  46       */
  47      var $payload = '';
  48  
  49      /**
  50       * Returns the appropriate content type
  51       *
  52       * This normally simply returns the contentType property but can be overridden
  53       * by an extending class if the content-type is variable
  54       *
  55       * @return  string   appropriate content type
  56       * @access public
  57       */
  58      function getContentType()
  59      {
  60          return $this->contentType;
  61      }
  62  
  63      /**
  64       * Returns the serialized content of the response class
  65       *
  66       * You can either fill the payload elsewhere in an extending class and leave
  67       * this method alone, or you can override it if you have a different type
  68       * of payload that needs special treatment
  69       *
  70       * @return  string   serialized response content
  71       * @access public
  72       */
  73      function getPayload()
  74      {
  75          return $this->payload;
  76      }
  77  }
  78  ?>


Generated: Wed Jan 14 11:33:29 2009 Cross-referenced by PHPXref 0.7