<?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.Insert.Done
 * @author      netnee T.Otogawa <tomokazu.otogawa@netnee.jp>
 * @access      public
 */
class Admin_Datamanage_Cast_Insert_Done
{
    var $c_cast;
    var $session;
    var $actionChain;

    var $name;
    var $kana;
    var $castdiv;
    var $recommenddiv;
    var $comment;
    var $debutdate;
    var $birthplace;
    var $birthdate;
    var $upduser;

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

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

    var $srcdispnum;        // 表示件数

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

        if ($data["recommenddiv"] <> 1){
            $data["recommenddiv"] = 2;
        }

        $this->row = $this->c_cast->insert($div, 
                                            $data["name"], 
                                            $data["kana"], 
                                            $data["castdiv"], 
                                            $data["recommenddiv"], 
                                            $data["comment"], 
                                            $data["debutdate"], 
                                            $data["birthplace"], 
                                            $data["birthdate"],
                                            $this->upduser);
        if (!$this->row) return "input";
        return 'success';
    }
}
?>
