Source for file jResponseRedirect.class.php

Documentation is available at jResponseRedirect.class.php

  1. <?php
  2. /**
  3. @package     jelix
  4. @subpackage  core_response
  5. @author      Laurent Jouanneau
  6. @contributor Aubanel Monnier (patch for anchor)
  7. @contributor Loic Mathaud (fix bug)
  8. @contributor Afroxav (bug fix)
  9. @copyright   2005-2006 Laurent Jouanneau,  2007 Loic Mathaud
  10. @link        http://www.jelix.org
  11. @licence     GNU Lesser General Public Licence see LICENCE file or http://www.gnu.org/licenses/lgpl.html
  12. */
  13.  
  14. /**
  15. * Response To redirect to an action
  16. @package  jelix
  17. @subpackage core_response
  18. @see jResponse
  19. */
  20.  
  21. final class jResponseRedirect extends jResponse {
  22.     /**
  23.     * @var string 
  24.     */
  25.     protected $_type = 'redirect';
  26.  
  27.     /**
  28.      * selector of the action where you want to redirect.
  29.      * jUrl will be used to get the real url
  30.      * @var string 
  31.      */
  32.     public $action = '';
  33.  
  34.     /**
  35.      * the anchor you want to add to the final url. leave blank if you don't one.
  36.      * @since 1.0b2
  37.      */
  38.     public $anchor ='';
  39.  
  40.     /**
  41.      * parameters for the action/url
  42.      */
  43.     public $params = array();
  44.  
  45.     public function output(){
  46.         if($this->hasErrors()) return false;
  47.         $this->sendHttpHeaders();
  48.         header ('Location: '.jUrl::get($this->action$this->params).($this->anchor!='' '#'.$this->anchor:''));
  49.         return true;
  50.     }
  51.  
  52.     public function outputErrors(){
  53.          include_once(JELIX_LIB_RESPONSE_PATH.'jResponseHtml.class.php');
  54.          $resp new jResponseHtml();
  55.          $resp->outputErrors();
  56.     }
  57.  
  58. }
  59.  
  60. ?>

Documentation generated on Wed, 07 Sep 2011 13:47:47 +0200 by phpDocumentor 1.4.3