<?php
//error_reporting(E_ALL);
require_once './class/MySmarty.class.php';  // MySmarty class

/**
 *  入力フォーム表示クラス
 *
 *  @see MySmarty
 */
class Form1{
    /** Smartyのオブジェクト */
    var $_smarty;
    /** プルダウン等の表示データ */
    var $_params = array(
			 'gender'      => array(1=>'男性', 2=>'女性'),

			 'conjugality' => array(
						"選択してください",
						'独身',
						'既婚',
						),
			 
			 'blood'       => array(
						'A'  => 'A型',
						'B'  => 'B型',
						'AB' => 'AB型',
						'O'  => 'O型',
						),
			 
			 'carrier'     => array(
						'DoCoMo',
						'au',
						'SoftBank',
						'その他',
						),
			 );
    
    /**
     * 入力フォーム表示クラス コンストラクタ
     *
     * @param void
     * @return void
     */
    function Form1(){
	$this->_smarty = new MySmarty();
    }

    /**
     * 入力フォームの表示
     *
     * @param void
     * @return void
     */
    function viewForm(){
	$this->_smarty->assign('title',"入力フォーム サンプル");
	$this->_smarty->assign('params',$this->_params);
	$this->_smarty->display('form1.tpl');
    }

    /**
     * 入力データの表示
     *
     * @param void
     * @return void
     */
    function doneForm(){
	$this->_smarty->assign('title',"入力フォーム サンプル 結果表示");
	$this->_smarty->assign('params',$this->_params);
	$this->_smarty->display('form1_done.tpl');
    }
}

/**
 *  入力フォーム処理メイン関数
 *
 *  @see Form1
 *
 * @param void
 * @return void
 */
function main(){
    $form1 = new Form1();
    switch($_POST['PHASE']){
	case "DONE":
	    $form1->doneForm();
	    break;
	default:
	    $form1->viewForm();
	    break;
	    
    }
}

main();
?>