<?php
/**
 * @copyright ONE/DEPO Project
 * @license   PHP License 3.01 <http://www.php.net/license/3_01.txt>
 */


/* vim: set expandtab tabstop=4 shiftwidth=4 softtabstop=4: */

/**
 * [[機能説明]]
 *
 * @package     [[package名]]
 * @author      Tominaga hitosi <mail@example.com>
 * @access      public
 */
class Admin_Usermanage_Customer_Detail
{
    /**
     * [[機能説明]]
     *
     * @access  public
     */

    var $c_member;
    var $c_consumer;
    var $c_seller;
    var $c_pref;
    var $c_secquestion;
    var $l_crypt;

//GETで与えられる変数
    var $from;
    var $membercd;

    var $title;
    var $pagename;

    var $mcd;
    var $username;
    var $mailaddr;
    var $prefcd;
    var $sex;
    var $telno;
    var $month;
    var $birth_year1;
    var $birth_month1;
    var $birth_day1;
    var $birth_year2;
    var $birth_month2;
    var $birth_day2;
    var $add_year1;
    var $add_month1;
    var $add_day1;
    var $add_year2;
    var $add_month2;
    var $add_day2;
    var $maildiv;

    var $consumer;
    var $seller;
    var $sort;
    var $conditions;
    var $pageID;


	// ユーザー出品情報詳細 入力パラメータ
    var $itemcd;
    var $structcd;
    var $stockcd;
    var $sellercd;

    function execute()
    {
        $log =& LogFactory::getLog();
        $log->debug("Admin_Usermanage_Customer_Detailが実行されました", "Admin_Usermanage_Customer_Detail#execute");
        $res = $this->c_member->selectNoDel($this->membercd); 
        if($this->membercd && $res){
        	return 'success';
        } else {
            return 'input';
        }
    }

    function getMember()
    {
        $array = $this->c_member->selectNoDel($this->membercd);
        if($array){
        $this->setSecquestionnm($array['secquestioncd']);
        $array['secquestionans'] = $this->l_crypt->decrypt($array['secquestionans']);
        } 
        return $array;
    }

    function getConsumer()
    {
    	$array = $this->c_consumer->select_one($this->membercd);
        if($array) {
            $this -> setPrefname($array['prefcd']);
            $this -> setPrefname($array['sendprefcd']);
        }
        return $array;
    }

    function getSeller()
    {
        $array = $this->c_seller->getSellerInfo($this->membercd);
        if($array) $this -> setPrefname($array['depprefcd']);
        return $array;
    }

    function setPrefname(&$pref)
    {
        $data = $this->c_pref->selectKey(intval($pref));
        $pref = $data['prefnm'];
    }

    function setSecquestionnm(&$question)
    {
        $data     = $this->c_secquestion->selectKey(intval($question));
        $question = $data['secquestionnm'];
    }

    function getFrom()
    {
        $fromarray = explode('/', $this->from);
        if($fromarray[0] == "itemexhibit"){
        	return $this->from;
        }
        
        switch($this->from){
            case("customerlist"):
                return "customer_customerlist";
            case("requestlist"):
                return "itemrequest_requestlist";
            case("itemexhibit_detail"):
                return "itemexhibit_detail";
            case("valuation"):
                return "valuation_list";
            default:
                return "customer_customerlist";
        }
    }

	function getCondictionPOST()
	{
        return  "<input type='hidden' name='mcd' value='". htmlspecialchars($this->mcd, ENT_QUOTES) ."'>"
	            ."<input type='hidden' name='username' value='". htmlspecialchars($this->username, ENT_QUOTES) ."'>"
	            ."<input type='hidden' name='mailaddr' value='". htmlspecialchars($this->mailaddr, ENT_QUOTES) ."'>"
	            ."<input type='hidden' name='prefcd' value='". htmlspecialchars($this->prefcd, ENT_QUOTES) ."'>"
	            ."<input type='hidden' name='sex[]' value='". htmlspecialchars($this->sex[0], ENT_QUOTES) ."'>"
	            ."<input type='hidden' name='sex[]' value='". htmlspecialchars($this->sex[1], ENT_QUOTES) ."'>"
	            ."<input type='hidden' name='telno' value='". htmlspecialchars($this->telno, ENT_QUOTES) ."'>"
	            ."<input type='hidden' name='month' value='". htmlspecialchars($this->month, ENT_QUOTES) ."'>"
	            ."<input type='hidden' name='birth_year1' value='". htmlspecialchars($this->birth_year1, ENT_QUOTES) ."'>"
	            ."<input type='hidden' name='birth_month1' value='". htmlspecialchars($this->birth_month1, ENT_QUOTES) ."'>"
	            ."<input type='hidden' name='birth_day1' value='". htmlspecialchars($this->birth_day1, ENT_QUOTES) ."'>"
	            ."<input type='hidden' name='birth_year2' value='". htmlspecialchars($this->birth_year2, ENT_QUOTES) ."'>"
	            ."<input type='hidden' name='birth_month2' value='". htmlspecialchars($this->birth_month2, ENT_QUOTES) ."'>"
	            ."<input type='hidden' name='birth_day2' value='". htmlspecialchars($this->birth_day2, ENT_QUOTES) ."'>"
	            ."<input type='hidden' name='add_year1' value='". htmlspecialchars($this->add_year1, ENT_QUOTES) ."'>"
	            ."<input type='hidden' name='add_month1' value='". htmlspecialchars($this->add_month1, ENT_QUOTES) ."'>"
	            ."<input type='hidden' name='add_day1' value='". htmlspecialchars($this->add_day1, ENT_QUOTES) ."'>"
	            ."<input type='hidden' name='add_year2' value='". htmlspecialchars($this->add_year2, ENT_QUOTES) ."'>"
	            ."<input type='hidden' name='add_month2' value='". htmlspecialchars($this->add_month2, ENT_QUOTES) ."'>"
	            ."<input type='hidden' name='add_day2' value='". htmlspecialchars($this->add_day2, ENT_QUOTES) ."'>"
	            ."<input type='hidden' name='maildiv' value='". htmlspecialchars($this->maildiv, ENT_QUOTES) ."'>"
	            ."<input type='hidden' name='consumer' value='". htmlspecialchars($this->consumer, ENT_QUOTES) ."'>"
	            ."<input type='hidden' name='seller' value='". htmlspecialchars($this->seller, ENT_QUOTES) ."'>"
                ."<input type='hidden' name='pageID' value='". htmlspecialchars($this->pageID, ENT_QUOTES) ."'>"
                ."<input type='hidden' name='sort' value='". htmlspecialchars($this->sort, ENT_QUOTES) ."'>";
	}
}
?>