* 変更点一覧
+** 2.5.0-dev
+
+*** features
+
+- ソースコード全体をUTF-8化
+-- 但し、日本語のソースコードコメントはそのまま
+- 国際化 (i18n) のための機能追加
+-- スケルトンの日本語コメントをすべてASCIIに変更(好みのエンコーディングで編集できるようにするため)
+
** 2.3.5
*** features
*/
/**
- * indexフォームの実装
+ * Index form implementation
*
* @author {$author}
* @access public
class {$project_id}_Form_Index extends {$project_id}_ActionForm
{
- /** @var bool バリデータにプラグインを使うフラグ */
+ /** @var bool specify if you use validator plugin */
var $use_validator_plugin = false;
/**
* @access private
- * @var array フォーム値定義
+ * @var array form definition.
*/
- var $form = array(
+ var $form = array(
/*
- * TODO: このアクションが使用するフォームを記述してください
+ * TODO: Write form definition which this action uses.
+ * @see http://ethna.jp/ethna-document-dev_guide-form.html
*
- * 記述例(typeを除く全ての要素は省略可能):
+ * Example(You can omit all elements except for "type" one) :
*
* 'sample' => array(
- * // フォームの定義
- * 'type' => VAR_TYPE_INT, // 入力値型
- * 'form_type' => FORM_TYPE_TEXT, // フォーム型
- * 'name' => 'サンプル', // 表示名
+ * // Form definition
+ * 'type' => VAR_TYPE_INT, // Input type
+ * 'form_type' => FORM_TYPE_TEXT, // Form type
+ * 'name' => 'Sample', // Display name
*
- * // バリデータ(記述順にバリデータが実行されます)
- * 'required' => true, // 必須オプション(true/false)
- * 'min' => null, // 最小値
- * 'max' => null, // 最大値
- * 'regexp' => null, // 文字種指定(正規表現)
+ * // Validator (executes Validator by written order.)
+ * 'required' => true, // Required Option(true/false)
+ * 'min' => null, // Minimum value
+ * 'max' => null, // Maximum value
+ * 'regexp' => null, // String by Regexp
+ * 'mbregexp' => null, // Multibype string by Regexp
+ * 'mbregexp_encoding' => 'UTF-8', // Matching encoding when using mbregexp
*
- * // フィルタ
- * 'filter' => null, // 入力値変換フィルタオプション
+ * // Filter
+ * 'filter' => 'sample', // Optional Input filter to convert input
+ * 'custom' => null, // Optional method name which
+ * // is defined in this(parent) class.
* ),
*/
- );
+ );
+
+ /**
+ * Form input value convert filter : sample
+ *
+ * @access protected
+ * @param mixed $value Form Input Value
+ * @return mixed Converted result.
+ */
+ /*
+ function _filter_sample($value)
+ {
+ // convert to upper case.
+ return strtoupper($value);
+ }
+ */
}
/**
- * indexアクションの実装
+ * Index action implementation.
*
* @author {$author}
* @access public
*/
class {$project_id}_Action_Index extends {$project_id}_ActionClass
{
+ /**
+ * preprocess Index action.
+ *
+ * @access public
+ * @return string Forward name (null if no errors.)
+ */
+ function prepare()
+ {
/**
- * indexアクションの前処理
- *
- * @access public
- * @return string Forward先(正常終了ならnull)
- */
- function prepare()
- {
- return null;
+ if ($this->af->validate() > 0) {
+ return 'error';
}
+ $sample = $this->af->get('sample');
+ */
+ return null;
+ }
- /**
- * indexアクションの実装
- *
- * @access public
- * @return string 遷移名
- */
- function perform()
- {
- return 'index';
- }
+ /**
+ * Index action implementation.
+ *
+ * @access public
+ * @return string Forward Name.
+ */
+ function perform()
+ {
+ return 'index';
+ }
}
+
?>
// {{{ {$project_id}_ActionClass
/**
- * action実行クラス
+ * action execution class
*
* @author {$author}
* @package {$project_id}
class {$project_id}_ActionClass extends Ethna_ActionClass
{
/**
- * アクション実行前の認証処理を行う
+ * authenticate before executing action.
*
* @access public
- * @return string 遷移名(nullなら正常終了, falseなら処理終了)
+ * @return string Forward name.
+ * (null if no errors. false if we have something wrong.)
*/
function authenticate()
{
}
/**
- * アクション実行前の処理(フォーム値チェック等)を行う
+ * Preparation for executing action. (Form input check, etc.)
*
* @access public
- * @return string 遷移名(nullなら正常終了, falseなら処理終了)
+ * @return string Forward name.
+ * (null if no errors. false if we have something wrong.)
*/
function prepare()
{
}
/**
- * アクション実行
+ * execute action.
*
* @access public
- * @return string 遷移名(nullなら遷移は行わない)
+ * @return string Forward name.
+ * (we does not forward if returns null.)
*/
function perform()
{
}
}
// }}}
+
?>
// {{{ {$project_id}_ActionForm
/**
- * アクションフォームクラス
+ * ActionForm class.
*
* @author {$author}
* @package {$project_id}
* @access private
*/
- /** @var array フォーム値定義(デフォルト) */
+ /** @var array form definition (default) */
var $form_template = array();
- /** @var bool バリデータにプラグインを使うフラグ */
+ /** @var bool specify if you use validator plugin */
var $use_validator_plugin = true;
/**#@-*/
/**
- * フォーム値検証のエラー処理を行う
+ * Error handling of form input validation.
*
* @access public
- * @param string $name フォーム項目名
- * @param int $code エラーコード
+ * @param string $name form item name.
+ * @param int $code error code.
*/
function handleError($name, $code)
{
}
/**
- * フォーム値定義テンプレートを設定する
+ * setter method for form template.
*
* @access protected
- * @param array $form_template フォーム値テンプレート
- * @return array フォーム値テンプレート
+ * @param array $form_template form template
+ * @return array form template after setting.
*/
function _setFormTemplate($form_template)
{
}
/**
- * フォーム値定義を設定する
+ * setter method for form definition.
*
* @access protected
*/
}
// }}}
+
?>
* @version $Id$
*/
-/** アプリケーションベースディレクトリ */
+/** Application base directory */
define('BASE', dirname(dirname(__FILE__)));
-/** include_pathの設定(アプリケーションディレクトリを追加) */
+/** include_path setting (adding "/app" and "/lib" directory to include_path) */
$app = BASE . "/app";
$lib = BASE . "/lib";
ini_set('include_path', ini_get('include_path') . PATH_SEPARATOR . implode(PATH_SEPARATOR, array($app, $lib)));
-/** アプリケーションライブラリのインクルード */
+/** including application library. */
require_once 'Ethna/Ethna.php';
require_once '{$project_id}_Error.php';
require_once '{$project_id}_ActionClass.php';
require_once '{$project_id}_ViewClass.php';
/**
- * {$project_id}アプリケーションのコントローラ定義
+ * {$project_id} application Controller definition.
*
* @author {$author}
* @access public
*/
/**
- * @var string アプリケーションID
+ * @var string Application ID(appid)
*/
var $appid = '{$application_id}';
/**
- * @var array forward定義
+ * @var array forward definition.
*/
var $forward = array(
/*
- * TODO: ここにforward先を記述してください
+ * TODO: write forward definition here.
*
- * 記述例:
+ * Example:
*
* 'index' => array(
* 'view_name' => '{$project_id}_View_Index',
);
/**
- * @var array action定義
+ * @var array action definition.
*/
var $action = array(
/*
- * TODO: ここにaction定義を記述してください
+ * TODO: write action definition here.
*
- * 記述例:
+ * Example:
*
* 'index' => array(),
*/
);
/**
- * @var array soap action定義
+ * @var array SOAP action definition.
*/
var $soap_action = array(
/*
- * TODO: ここにSOAPアプリケーション用のaction定義を
- * 記述してください
- * 記述例:
+ * TODO: write action definition for SOAP application here.
+ * Example:
*
* 'sample' => array(),
*/
);
/**
- * @var array アプリケーションディレクトリ
+ * @var array application directory.
*/
var $directory = array(
'action' => 'app/action',
);
/**
- * @var array DBアクセス定義
+ * @var array database access definition.
*/
var $db = array(
'' => DB_TYPE_RW,
);
/**
- * @var array 拡張子設定
+ * @var array extention(.php, etc) configuration.
*/
var $ext = array(
'php' => 'php',
);
/**
- * @var array クラス定義
+ * @var array class definition.
*/
var $class = array(
/*
- * TODO: 設定クラス、ログクラス、SQLクラスをオーバーライド
- * した場合は下記のクラス名を忘れずに変更してください
+ * TODO: When you override Configuration class, Logger class,
+ * SQL class, don't forget to change definition as follows!
*/
'class' => 'Ethna_ClassFactory',
'backend' => 'Ethna_Backend',
);
/**
- * @var array 検索対象となるプラグインのアプリケーションIDのリスト
+ * @var array list of application id where Ethna searches plugin.
*/
var $plugin_search_appids = array(
/*
- * プラグイン検索時に検索対象となるアプリケーションIDのリストを記述します。
+ * write list of application id where Ethna searches plugin.
*
- * 記述例:
- * Common_Plugin_Foo_Bar のような命名のプラグインがアプリケーションの
- * プラグインディレクトリに存在する場合、以下のように指定すると
- * Common_Plugin_Foo_Bar, {$project_id}_Plugin_Foo_Bar, Ethna_Plugin_Foo_Bar
- * の順にプラグインが検索されます。
+ * Example:
+ * When there are plugins whose name are like "Common_Plugin_Foo_Bar" in
+ * application plugin directory, Ethna searches them in the following order.
+ *
+ * 1. Common_Plugin_Foo_Bar,
+ * 2. {$project_id}_Plugin_Foo_Bar
+ * 3. Ethna_Plugin_Foo_Bar
*
* 'Common', '{$project_id}', 'Ethna',
*/
);
/**
- * @var array フィルタ設定
+ * @var array filter definition.
*/
var $filter = array(
/*
- * TODO: フィルタを利用する場合はここにそのプラグイン名を
- * 記述してください
- * (クラス名を指定するとfilterディレクトリからフィルタクラス
- * を読み込みます)
+ * TODO: when you use filter, write filter plugin name here.
+ * (If you specify class name, Ethna reads filter class in
+ * filter directory)
*
- * 記述例:
+ * Example:
*
* 'ExecutionTime',
*/
);
/**
- * @var array smarty modifier定義
+ * @var array smarty modifier definition.
*/
var $smarty_modifier_plugin = array(
/*
- * TODO: ここにユーザ定義のsmarty modifier一覧を記述してください
+ * TODO: write user defined smarty modifier here.
*
- * 記述例:
+ * Example:
*
* 'smarty_modifier_foo_bar',
*/
);
/**
- * @var array smarty function定義
+ * @var array smarty function definition.
*/
var $smarty_function_plugin = array(
/*
- * TODO: ここにユーザ定義のsmarty function一覧を記述してください
+ * TODO: write user defined smarty function here.
*
- * 記述例:
+ * Example:
*
* 'smarty_function_foo_bar',
*/
);
/**
- * @var array smarty block定義
+ * @var array smarty block definition.
*/
var $smarty_block_plugin = array(
/*
- * TODO: ここにユーザ定義のsmarty block一覧を記述してください
- *
- * 記述例:
+ * TODO: write user defined smarty block here.
*
+ * Example:
+ *
* 'smarty_block_foo_bar',
*/
);
/**
- * @var array smarty prefilter定義
+ * @var array smarty prefilter definition.
*/
var $smarty_prefilter_plugin = array(
/*
- * TODO: ここにユーザ定義のsmarty prefilter一覧を記述してください
+ * TODO: write user defined smarty prefilter here.
*
- * 記述例:
+ * Example:
*
* 'smarty_prefilter_foo_bar',
*/
);
/**
- * @var array smarty postfilter定義
+ * @var array smarty postfilter definition.
*/
var $smarty_postfilter_plugin = array(
/*
- * TODO: ここにユーザ定義のsmarty postfilter一覧を記述してください
+ * TODO: write user defined smarty postfilter here.
*
- * 記述例:
+ * Example:
*
* 'smarty_postfilter_foo_bar',
*/
);
/**
- * @var array smarty outputfilter定義
+ * @var array smarty outputfilter definition.
*/
var $smarty_outputfilter_plugin = array(
/*
- * TODO: ここにユーザ定義のsmarty outputfilter一覧を記述してください
+ * TODO: write user defined smarty outputfilter here.
*
- * 記述例:
+ * Example:
*
* 'smarty_outputfilter_foo_bar',
*/
/**#@-*/
}
+
?>
* $Id$
*/
-/*--- アプリケーションエラー定義 ---*/
+/*--- Application Error Definition ---*/
/*
- * TODO: ここにアプリケーションのエラー定義を記述してください。
- * なお、255までのエラーコードはフレームワークで予約されていますので
- * エラーコードには256以上の整数を使用してください。
+ * TODO: Write application error definition here.
+ * Error codes 255 and below are reserved
+ * by Ethna, so use over 256 value for error code.
*
- * 記述例:
+ * Example:
* define('E_LOGIN_INVALID', 256);
*/
?>
*/
/**
- * 実行時間計測フィルタプラグインの実装
+ * filter plugin implementation for measuring execution time.
*
* @author {$author}
* @access public
*/
/**
- * @var int 開始時間
+ * @var int Start time.
*/
var $stime;
/**
- * 実行前フィルタ
+ * filter before first processing.
*
* @access public
*/
}
/**
- * アクション実行前フィルタ
+ * filter BEFORE executing action.
*
* @access public
- * @param string $action_name 実行されるアクション名
- * @return string null:正常終了 (string):実行するアクション名を変更
+ * @param string $action_name Action name.
+ * @return string null: normal.
+ * string: if you return string, it will be interpreted
+ * as Action name which will be executed immediately.
*/
function preActionFilter($action_name)
{
}
/**
- * アクション実行後フィルタ
+ * filter AFTER executing action.
*
* @access public
- * @param string $action_name 実行されたアクション名
- * @param string $forward_name 実行されたアクションからの戻り値
- * @return string null:正常終了 (string):遷移名を変更
+ * @param string $action_name executed Action name.
+ * @param string $forward_name return value from executed Action.
+ * @return string null: normal.
+ * string: if you return string, it will be interpreted
+ * as Forward name.
*/
function postActionFilter($action_name, $forward_name)
{
}
/**
- * 実行後フィルタ
+ * filter which will be executed at the end.
*
* @access public
*/
*/
/**
- * {$project_id}ユニットテストマネージャクラス
+ * {$project_id} Unit Test Manager Class.
*
* @author {$author}
* @access public
class {$project_id}_UnitTestManager extends Ethna_UnitTestManager
{
/**
- * @var array 一般テストケース定義
+ * @var array General test case definition.
*/
var $testcase = array(
/*
- * TODO: ここに一般テストケース定義を記述してください
+ * TODO: Write general test case definition here.
*
- * 記述例:
+ * Example:
*
* 'util' => 'app/UtilTest.php',
*/
*/
/**
- * URLハンドラクラス
+ * URLHandler class.
*
* @author {$author}
* @access public
*/
class {$project_id}_UrlHandler extends Ethna_UrlHandler
{
- /** @var array アクションマッピング */
+ /** @var array Action Mapping */
var $action_map = array(
/*
'user' => array(
);
/**
- * {$project_id}_UrlHandlerクラスのインスタンスを取得する
+ * get {$project_id}_UrlHandler class instance.
*
* @access public
*/
return $instance;
}
- // {{{ ゲートウェイリクエスト正規化
+ // {{{ normalize gateway request method.
/**
- * リクエスト正規化(userゲートウェイ)
+ * normalize request(via user defined gateway)
*
* @access private
*/
*/
// }}}
- // {{{ ゲートウェイパス生成
+ // {{{ generate gateway path method.
/**
- * パス生成(userゲートウェイ)
+ * generate path(via user defined gateway)
*
* @access private
*/
*/
// }}}
- // {{{ フィルタ
+ // {{{ filter
// }}}
}
*/
/**
- * indexビューの実装
+ * Index view implementation.
*
* @author {$author}
* @access public
class {$project_id}_View_Index extends {$project_id}_ViewClass
{
/**
- * 遷移前処理
+ * preprocess before forwarding.
*
* @access public
*/
{
}
}
+
?>
// {{{ {$project_id}_ViewClass
/**
- * viewクラス
+ * View class.
*
* @author {$author}
* @package {$project_id}
class {$project_id}_ViewClass extends Ethna_ViewClass
{
/**
- * 共通値を設定する
+ * set common default value.
*
* @access protected
- * @param object {$project_id}_Renderer レンダラオブジェクト
+ * @param object {$project_id}_Renderer Renderer object.
*/
function _setDefault(&$renderer)
{
}
}
// }}}
+
?>
*/
/**
- * {$action_name}フォームの実装
+ * {$action_name} Form implementation.
*
* @author {$author}
* @access public
*/
class {$action_form} extends {$project_id}_ActionForm
{
- /** @var bool バリデータにプラグインを使うフラグ */
+ /** @var bool specify if you use validator plugin */
var $use_validator_plugin = true;
/**
* @access private
- * @var array フォーム値定義
+ * @var array form definition.
*/
var $form = array(
- /*
- 'sample' => array(
- // フォームの定義
- 'type' => VAR_TYPE_INT, // 入力値型
- 'form_type' => FORM_TYPE_TEXT, // フォーム型
- 'name' => 'サンプル', // 表示名
-
- // バリデータ(記述順にバリデータが実行されます)
- 'required' => true, // 必須オプション(true/false)
- 'min' => null, // 最小値
- 'max' => null, // 最大値
- 'regexp' => null, // 文字種指定(正規表現)
-
- // フィルタ
- 'filter' => null, // 入力値変換フィルタオプション
- ),
+ /*
+ * TODO: Write form definition which this action uses.
+ * @see http://ethna.jp/ethna-document-dev_guide-form.html
+ *
+ * Example(You can omit all elements except for "type" one) :
+ *
+ * 'sample' => array(
+ * // Form definition
+ * 'type' => VAR_TYPE_INT, // Input type
+ * 'form_type' => FORM_TYPE_TEXT, // Form type
+ * 'name' => 'Sample', // Display name
+ *
+ * // Validator (executes Validator by written order.)
+ * 'required' => true, // Required Option(true/false)
+ * 'min' => null, // Minimum value
+ * 'max' => null, // Maximum value
+ * 'regexp' => null, // String by Regexp
+ * 'mbregexp' => null, // Multibype string by Regexp
+ * 'mbregexp_encoding' => 'UTF-8', // Matching encoding when using mbregexp
+ *
+ * // Filter
+ * 'filter' => 'sample', // Optional Input filter to convert input
+ * 'custom' => null, // Optional method name which
+ * // is defined in this(parent) class.
+ * ),
*/
);
+
+ /**
+ * Form input value convert filter : sample
+ *
+ * @access protected
+ * @param mixed $value Form Input Value
+ * @return mixed Converted result.
+ */
+ /*
+ function _filter_sample($value)
+ {
+ // convert to upper case.
+ return strtoupper($value);
+ }
+ */
}
/**
- * {$action_name}アクションの実装
+ * {$action_name} action implementation.
*
* @author {$author}
* @access public
class {$action_class} extends {$project_id}_ActionClass
{
/**
- * {$action_name}アクションの前処理
+ * preprocess of {$action_name} Action.
*
* @access public
- * @return string 遷移名(正常終了ならnull, 処理終了ならfalse)
+ * @return string forward name(null: success.
+ * false: in case you want to exit.)
*/
function prepare()
{
}
/**
- * {$action_name}アクションの実装
+ * {$action_name} action implementation.
*
* @access public
- * @return string 遷移名
+ * @return string forward name.
*/
function perform()
{
return '{$action_name}';
}
}
+
?>
*/
/**
- * {$action_name}フォームの実装
+ * {$action_name} Form implementation.
*
* @author {$author}
* @access public
*/
class {$action_form} extends {$project_id}_ActionForm
{
- /** @var bool バリデータにプラグインを使うフラグ */
+ /** @var bool specify if you use validator plugin */
var $use_validator_plugin = true;
/**
* @access private
- * @var array フォーム値定義
+ * @var array form definition.
*/
var $form = array(
- /*
- 'sample' => array(
- // フォームの定義
- 'type' => VAR_TYPE_INT, // 入力値型
- 'form_type' => FORM_TYPE_TEXT, // フォーム型
- 'name' => 'サンプル', // 表示名
-
- // バリデータ(記述順にバリデータが実行されます)
- 'required' => true, // 必須オプション(true/false)
- 'min' => null, // 最小値
- 'max' => null, // 最大値
- 'regexp' => null, // 文字種指定(正規表現)
-
- // フィルタ
- 'filter' => null, // 入力値変換フィルタオプション
- ),
+ /*
+ * TODO: Write form definition which this action uses.
+ * @see http://ethna.jp/ethna-document-dev_guide-form.html
+ *
+ * Example(You can omit all elements except for "type" one) :
+ *
+ * 'sample' => array(
+ * // Form definition
+ * 'type' => VAR_TYPE_INT, // Input type
+ * 'form_type' => FORM_TYPE_TEXT, // Form type
+ * 'name' => 'Sample', // Display name
+ *
+ * // Validator (executes Validator by written order.)
+ * 'required' => true, // Required Option(true/false)
+ * 'min' => null, // Minimum value
+ * 'max' => null, // Maximum value
+ * 'regexp' => null, // String by Regexp
+ * 'mbregexp' => null, // Multibype string by Regexp
+ * 'mbregexp_encoding' => 'UTF-8', // Matching encoding when using mbregexp
+ *
+ * // Filter
+ * 'filter' => 'sample', // Optional Input filter to convert input
+ * 'custom' => null, // Optional method name which
+ * // is defined in this(parent) class.
+ * ),
*/
);
+
+ /**
+ * Form input value convert filter : sample
+ *
+ * @access protected
+ * @param mixed $value Form Input Value
+ * @return mixed Converted result.
+ */
+ /*
+ function _filter_sample($value)
+ {
+ // convert to upper case.
+ return strtoupper($value);
+ }
+ */
}
/**
- * {$action_name}アクションの実装
+ * {$action_name} action implementation.
*
* @author {$author}
* @access public
class {$action_class} extends {$project_id}_ActionClass
{
/**
- * {$action_name}アクションの前処理
+ * preprocess of {$action_name} Action.
*
* @access public
- * @return string 遷移名(正常終了ならnull, 処理終了ならfalse)
+ * @return string forward name(null: success.
+ * false: in case you want to exit.)
*/
function prepare()
{
}
/**
- * {$action_name}アクションの実装
+ * {$action_name} action implementation.
*
* @access public
- * @return string 遷移名
+ * @return string forward name.
*/
function perform()
{
return null;
}
}
+
?>
*/
/**
- * {$action_name}フォームのテストケース
+ * {$action_name} Form testcase.
*
* @author {$author}
* @access public
{
/**
* @access private
- * @var string アクション名
+ * @var string Action name.
*/
var $action_name = '{$action_name}';
/**
- * テストの初期化
+ * initialize test.
*
- * @access public
+ * @access public
*/
function setUp()
{
- $this->createActionForm(); // アクションフォームの作成
+ $this->createActionForm(); // create ActionForm.
}
/**
- * テストの後始末
+ * clean up testcase.
*
- * @access public
+ * @access public
*/
function tearDown()
{
}
/**
- * {$action_name}アクションフォームのサンプルテストケース
+ * {$action_name} ActionForm sample testcase.
*
* @access public
*/
function test_formSample()
{
/*
- // フォームの設定
+ // setting form input.
$this->af->set('id', 1);
- // {$action_name}アクションフォーム値検証
+ // {$action_name} ActionForm input validation.
$this->assertEqual($this->af->validate(), 0);
*/
/**
- * TODO: テストケースを記述して下さい。
+ * TODO: write test case! :)
* @see http://simpletest.org/en/first_test_tutorial.html
* @see http://simpletest.org/en/unit_test_documentation.html
*/
}
/**
- * {$action_name}アクションのテストケース
+ * {$action_name} Action testcase.
*
* @author {$author}
* @access public
{
/**
* @access private
- * @var string アクション名
+ * @var string Action name.
*/
var $action_name = '{$action_name}';
/**
- * テストの初期化
+ * initialize test.
*
- * @access public
+ * @access public
*/
function setUp()
{
- $this->createActionForm(); // アクションフォームの作成
- $this->createActionClass(); // アクションクラスの作成
+ $this->createActionForm(); // create ActionForm.
+ $this->createActionClass(); // create ActionClass.
- $this->session->start(); // セッションの開始
+ $this->session->start(); // start session.
}
/**
- * テストの後始末
+ * clean up testcase.
*
- * @access public
+ * @access public
*/
function tearDown()
{
- $this->session->destroy(); // セッションの破棄
+ $this->session->destroy(); // destroy session.
}
/**
- * {$action_name}アクションクラスのサンプルテストケース
+ * {$action_name} ActionClass sample testcase.
*
* @access public
*/
function test_actionSample()
{
/*
- // フォームの設定
+ // setting form input.
$this->af->set('id', 1);
- // {$action_name}アクション実行前の認証処理
+ // Authentication before processing {$action_name} Action.
$forward_name = $this->ac->authenticate();
$this->assertNull($forward_name);
- // {$action_name}アクションの前処理
+ // {$action_name} Action preprocess.
$forward_name = $this->ac->prepare();
$this->assertNull($forward_name);
- // {$action_name}アクションの実装
+ // {$action_name} Action implementation.
$forward_name = $this->ac->perform();
$this->assertEqual($forward_name, '{$action_name}');
*/
/**
- * TODO: テストケースを記述して下さい。
+ * TODO: write test case! :)
* @see http://simpletest.org/en/first_test_tutorial.html
* @see http://simpletest.org/en/unit_test_documentation.html
*/
$this->fail('No Test! write Test!');
}
}
+
?>
*/
/**
- * {$action_name}フォームの実装
+ * {$action_name} Form implementation.
*
* @author {$author}
* @access public
*/
class {$action_form} extends {$project_id}_ActionForm
{
- /** @var bool バリデータにプラグインを使うフラグ */
+ /** @var bool specify if you use validator plugin */
var $use_validator_plugin = true;
/**
* @access private
- * @var array フォーム値定義
+ * @var array form definition.
*/
var $form = array(
- /*
- 'sample' => array(
- // フォームの定義
- 'type' => VAR_TYPE_INT, // 入力値型
- 'form_type' => FORM_TYPE_TEXT, // フォーム型
- 'name' => 'サンプル', // 表示名
-
- // バリデータ(記述順にバリデータが実行されます)
- 'required' => true, // 必須オプション(true/false)
- 'min' => null, // 最小値
- 'max' => null, // 最大値
- 'regexp' => null, // 文字種指定(正規表現)
-
- // フィルタ
- 'filter' => null, // 入力値変換フィルタオプション
- ),
+ /*
+ * TODO: Write form definition which this action uses.
+ * @see http://ethna.jp/ethna-document-dev_guide-form.html
+ *
+ * Example(You can omit all elements except for "type" one) :
+ *
+ * 'sample' => array(
+ * // Form definition
+ * 'type' => VAR_TYPE_INT, // Input type
+ * 'form_type' => FORM_TYPE_TEXT, // Form type
+ * 'name' => 'Sample', // Display name
+ *
+ * // Validator (executes Validator by written order.)
+ * 'required' => true, // Required Option(true/false)
+ * 'min' => null, // Minimum value
+ * 'max' => null, // Maximum value
+ * 'regexp' => null, // String by Regexp
+ * 'mbregexp' => null, // Multibype string by Regexp
+ * 'mbregexp_encoding' => 'UTF-8', // Matching encoding when using mbregexp
+ *
+ * // Filter
+ * 'filter' => 'sample', // Optional Input filter to convert input
+ * 'custom' => null, // Optional method name which
+ * // is defined in this(parent) class.
+ * ),
*/
);
+
+ /**
+ * Form input value convert filter : sample
+ *
+ * @access protected
+ * @param mixed $value Form Input Value
+ * @return mixed Converted result.
+ */
+ /*
+ function _filter_sample($value)
+ {
+ // convert to upper case.
+ return strtoupper($value);
+ }
+ */
}
/**
- * {$action_name}アクションの実装
+ * {$action_name} action implementation.
*
* @author {$author}
* @access public
class {$action_class} extends {$project_id}_ActionClass
{
/**
- * {$action_name}アクションの前処理
+ * preprocess of {$action_name} Action.
*
* @access public
- * @return string 遷移名(正常終了ならnull, 処理終了ならfalse)
+ * @return string forward name(null: success.
+ * false: in case you want to exit.)
*/
function prepare()
{
}
/**
- * {$action_name}アクションの実装
+ * {$action_name} action implementation.
*
* @access public
- * @return string 遷移名
+ * @return string forward name.
*/
function perform()
{
class {$app_object} extends Ethna_AppObject
{
/**
- * プロパティの表示名を取得する
+ * property display name getter.
*
* @access public
*/
return $this->get($key);
}
}
+
?>
* \r
* @author {$author}\r
* @package {$project_id}.Test\r
- * @version 1.0\r
*/\r
class {$name}_TestCase extends Ethna_UnitTestCase\r
{\r
/**\r
- * テストの初期化\r
+ * initialize test.\r
* \r
* @access public\r
*/\r
function setUp()\r
{\r
- // TODO: テストに際しての初期化コードを記述してください\r
- // 例: テスト用のデータをDBから読み込む\r
+ // TODO: write test initialization code.\r
+ // Example: read test data from database.\r
}\r
\r
/**\r
- * テストの後始末\r
+ * clean up testcase.\r
* \r
- * @access public\r
+ * @access public\r
*/\r
function tearDown()\r
{\r
- // TODO: テスト終了に際してのコードを記述してください\r
- // 例: テスト用のデータから開発用のデータに戻す\r
+ // TODO: write testcase cleanup code.\r
+ // Example: restore database data for development.\r
}\r
\r
/**\r
- * サンプルのテストケース\r
+ * sample testcase.\r
* \r
* @access public\r
*/\r
function test_{$name}()\r
{\r
/**\r
- * TODO: テストケースを記述して下さい。\r
+ * TODO: write test case! :)\r
* @see http://simpletest.org/en/first_test_tutorial.html\r
* @see http://simpletest.org/en/unit_test_documentation.html\r
*/\r
*/
/**
- * {$forward_name}ビューの実装
+ * {$forward_name} view implementation.
*
* @author {$author}
* @access public
class {$view_class} extends {$project_id}_ViewClass
{
/**
- * 遷移前処理
+ * preprocess before forwarding.
*
* @access public
*/
{
}
}
+
?>
*/
/**
- * {$forward_name}ビューの実装
+ * {$forward_name} view implementation.
*
* @author {$author}
* @access public
{
/**
* @access private
- * @var string ビュー名
+ * @var string view name.
*/
var $forward_name = '{$forward_name}';
/**
- * テストの初期化
+ * initialize test.
*
- * @access public
+ * @access public
*/
function setUp()
{
- $this->createPlainActionForm(); // アクションフォームの作成
- $this->createViewClass(); // ビューの作成
+ $this->createPlainActionForm(); // create ActionForm
+ $this->createViewClass(); // create View.
}
/**
- * テストの後始末
+ * clean up testcase.
*
- * @access public
+ * @access public
*/
function tearDown()
{
}
/**
- * {$forward_name}遷移前処理のサンプルテストケース
+ * {$forward_name} preprocess sample testcase.
*
* @access public
*/
function test_viewSample()
{
/*
- // フォームの設定
+ // setting form input.
$this->af->set('id', 1);
- // {$forward_name}遷移前処理
+ // {$forward_name} preprocess.
$this->vc->preforward();
$this->assertNull($this->af->get('data'));
*/
/**
- * TODO: テストケースを記述して下さい。
+ * TODO: write test case! :)
* @see http://simpletest.org/en/first_test_tutorial.html
* @see http://simpletest.org/en/unit_test_documentation.html
*/