<?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     Admin.Datamanage.Cast.Update.Check
 * @author      netnee T.Otogawa <tomokazu.otogawa@netnee.jp>
 * @access      public
 */
class Admin_Datamanage_Cast_Update_Check
{
    var $session;
    var $c_pref;
    var $c_name;
    var $c_cast;
    var $actionChain;

    var $code;
    var $name;
    var $kana;
    var $castdiv;
    var $recommenddiv;
    var $comment;
    var $debutdate;
    var $birthplace;
    var $birthdate;
    var $img_count_s;
    var $img_count_m;
    var $img_count_l;
    var $updcnt;

    var $title;
    var $pagename;
    var $actionnm;
    var $from;    //ページID
    var $div;

    var $srcword;            //検索値
    var $srccastdiv;         //キャスト種別
    var $srcrecommenddiv;    //おすすめ区分

    var $srcdispnum;        // 表示件数

    function execute()
    {
        $div = (empty($this->div)) ? 2 : 1;
        $errorList =& $this->actionChain->getCurErrorList();
        if ($this->c_cast->uniqueCastnm($div, $this->name, $this->castdiv, $this->code)) {
            $errorList->add('uniquecastnm', 'キャスト名が重複しています');
            return 'input';
        }

        $postdata = array("code"=>$this->code, 
                          "name"=>$this->name, 
                          "kana"=>$this->kana, 
                          "castdiv"=>$this->castdiv,
                          "recommenddiv"=>$this->recommenddiv,
                          "comment"=>$this->comment, 
                          "debutdate"=>$this->debutdate, 
                          "birthplace"=>$this->birthplace, 
                          "birthdate"=>$this->birthdate, 
                          "updcnt"=>$this->updcnt);
        $this->session->removeParameter("cast");
        $this->session->setParameter("cast", $postdata);

        return 'success';
    }

    function getPrefoptions()
    {
        return $this->c_pref->selectAll();
    }

    function getPrefnm()
    {
        if (empty($this->birthplace)) return "";
        $pref = $this->c_pref->selectKey($this->birthplace);
        return $pref["prefnm"];
    }

    function getCastdivradio(){
        // キャスト種別取得（キャスト種別は"６"）
        return $this->c_name->selectDivAll(6);
    }
}
?>
