Source for file ActionBase.php

Documentation is available at ActionBase.php

  1. <?php
  2. /**
  3.  * Teeple2 - PHP5 Web Application Framework inspired by Seasar2
  4.  *
  5.  * PHP versions 5
  6.  *
  7.  * LICENSE: This source file is subject to version 3.0 of the PHP license
  8.  * that is available through the world-wide-web at the following URI:
  9.  * http://www.php.net/license/3_0.txt.  If you did not receive a copy of
  10.  * the PHP License and are unable to obtain it through the web, please
  11.  * send a note to license@php.net so we can mail you a copy immediately.
  12.  *
  13.  * @package     teeple
  14.  * @author      Mitsutaka Sato <miztaka@gmail.com>
  15.  * @license     http://www.php.net/license/3_0.txt  PHP License 3.0
  16.  */
  17.  
  18. /**
  19.  * Actionクラスの基底クラスです。
  20.  *
  21.  * @package teeple
  22.  */
  23. abstract class Teeple_ActionBase {
  24.  
  25.     /**
  26.      * @var Logger 
  27.      */
  28.     protected $log;
  29.     
  30.     /**
  31.      * @var Teeple_Request 
  32.      */
  33.     protected $request;
  34.     public function setComponent_Teeple_Request($c{
  35.         $this->request = $c;
  36.     }
  37.  
  38.     /**
  39.      * @var Teeple_Session 
  40.      */
  41.     protected $session;
  42.     public function setComponent_Teeple_Session($c{
  43.         $this->session = $c;
  44.     }
  45.     
  46.     /**
  47.      * @var Teeple_DataSource 
  48.      */
  49.     protected $dataSource;
  50.     public function setComponent_Teeple_DataSource($c{
  51.         $this->dataSource = $c;
  52.     }
  53.     
  54.     /**
  55.      * @var Teeple_TransactionManager 
  56.      */
  57.     protected $txManager;
  58.     public function setComponent_Teeple_TransactionManager($c{
  59.         $this->txManager = $c;
  60.     }
  61.     
  62.     /**
  63.      * @var Teeple_Transaction 
  64.      */
  65.     protected $defaultTx;
  66.     public function setComponent_DefaultTx($c{
  67.         $this->defaultTx = $c;
  68.     }
  69.     
  70.     /**
  71.      * コンストラクタです。
  72.      */
  73.     public function __construct({
  74.         $this->log = LoggerManager::getLogger(get_class($this));
  75.     }
  76.  
  77.     public function __get($name{
  78.         if (preg_match('/^Entity_/'$name&& isset($this->defaultTx)) {
  79.             return $this->defaultTx->$name;
  80.         }
  81.         return NULL;
  82.     }
  83.     
  84.     /**
  85.      * 404 not found を返したいときに使用します。
  86.      * @return string 
  87.      */
  88.     public function exit404($message 'Page Not Found.'{
  89.         
  90.         header("HTTP/1.1 404 Not Found");
  91.         print($message);
  92.         $this->request->completeResponse();
  93.         return NULL;
  94.     }   
  95.  
  96.     /**
  97.      * TeepleActionにリダイレクトします。(リクエストを引継ぎます)
  98.      * @param string $actionName 
  99.      * @return string 
  100.      */
  101.     protected function redirect($actionName{
  102.         return "redirect:{$actionName}";
  103.     }    
  104.     
  105. }
  106.  
  107. ?>

Documentation generated on Mon, 26 Apr 2010 08:59:26 +0900 by phpDocumentor 1.4.3