Source for file ActionClass.php

Documentation is available at ActionClass.php

  1. <?php
  2. // vim: foldmethod=marker
  3. /**
  4.  *  ActionClass.php
  5.  *
  6.  *  @author     Masaki Fujimoto <fujimoto@php.net>
  7.  *  @license    http://www.opensource.org/licenses/bsd-license.php The BSD License
  8.  *  @package    Ethna
  9.  *  @version    $Id: fe3fef6769eb39580c681736db08e0f2cbbbed01 $
  10.  */
  11.  
  12. // {{{ Ethna_ActionClass
  13. /**
  14.  *  action実行クラス
  15.  *
  16.  *  @author     Masaki Fujimoto <fujimoto@php.net>
  17.  *  @access     public
  18.  *  @package    Ethna
  19.  */
  20. {
  21.     /**#@+
  22.      *  @access private
  23.      */
  24.  
  25.     /** @protected    object  Ethna_Backend       backendオブジェクト */
  26.     protected $backend;
  27.  
  28.     /** @protected    object  Ethna_Config        設定オブジェクト    */
  29.     protected $config;
  30.  
  31.     /** @protected    object  Ethna_I18N          i18nオブジェクト */
  32.     protected $i18n;
  33.  
  34.     /** @protected    object  Ethna_ActionError   アクションエラーオブジェクト */
  35.     protected $action_error;
  36.  
  37.     /** @protected    object  Ethna_ActionError   アクションエラーオブジェクト(省略形) */
  38.     protected $ae;
  39.  
  40.     /** @protected    object  Ethna_ActionForm    アクションフォームオブジェクト */
  41.     protected $action_form;
  42.  
  43.     /** @protected    object  Ethna_ActionForm    アクションフォームオブジェクト(省略形) */
  44.     protected $af;
  45.  
  46.     /** @protected    object  Ethna_Session       セッションオブジェクト */
  47.     protected $session;
  48.  
  49.     /** @public    object  Ethna_Plugin        プラグインオブジェクト */
  50.     public $plugin;
  51.  
  52.     /** @protected    object  Ethna_Logger    ログオブジェクト */
  53.     protected $logger;
  54.  
  55.     /** @protected    array   Preload plugins definition  */
  56.     protected $plugins = array();
  57.  
  58.     /**#@-*/
  59.  
  60.     /**
  61.      *  Ethna_ActionClassのコンストラクタ
  62.      *
  63.      *  @access public
  64.      *  @param  object  Ethna_Backend   $backend    backendオブジェクト
  65.      */
  66.     public function __construct($backend)
  67.     {
  68.         $c $backend->getController();
  69.         $this->backend = $backend;
  70.         $this->config = $this->backend->getConfig();
  71.         $this->i18n = $this->backend->getI18N();
  72.  
  73.         $this->action_error = $this->backend->getActionError();
  74.         $this->ae = $this->action_error;
  75.  
  76.         $this->action_form = $this->backend->getActionForm();
  77.         $this->af = $this->action_form;
  78.  
  79.         $this->session = $this->backend->getSession();
  80.         $this->plugin = $this->backend->getPlugin();
  81.         $this->logger = $this->backend->getLogger();
  82.  
  83.         $this->preloadPlugin();
  84.     }
  85.  
  86.     /**
  87.      *  アクション実行前の認証処理を行う
  88.      *
  89.      *  @access public
  90.      *  @return string  遷移名(nullなら正常終了, falseなら処理終了)
  91.      */
  92.     public function authenticate()
  93.     {
  94.         return null;
  95.     }
  96.  
  97.     /**
  98.      *  アクション実行前の処理(フォーム値チェック等)を行う
  99.      *
  100.      *  @access public
  101.      *  @return string  遷移名(nullなら正常終了, falseなら処理終了)
  102.      */
  103.     public function prepare()
  104.     {
  105.         return null;
  106.     }
  107.  
  108.     /**
  109.      *  アクション実行
  110.      *
  111.      *  @access public
  112.      *  @return string  遷移名(nullなら遷移は行わない)
  113.      */
  114.     public function perform()
  115.     {
  116.         return null;
  117.     }
  118.  
  119.     /**
  120.      *  get plugin object
  121.      *
  122.      *  @access protected
  123.      */
  124.     protected function preloadPlugin()
  125.     {
  126.         foreach ($this->plugins as $alias => $plugin{
  127.             $plugin_alias $alias;
  128.             if (is_int($alias)) {
  129.                 $plugin_alias $plugin;
  130.             }
  131.  
  132.             $plugin_name explode('_'$plugin);
  133.             if (count($plugin_name=== 1{
  134.                 $plugin_alias[null;
  135.             }
  136.  
  137.             $this->plugin->setPlugin($plugin_alias$plugin_name);
  138.         }
  139.     }
  140. }
  141. // }}}

Documentation generated on Fri, 11 Nov 2011 03:57:16 +0900 by phpDocumentor 1.4.3