<?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.Itemmanage.Change.Update.Done
 * @author      H.Watanabe <hiroshi.watanabe@netnee.jp>
 * @access      public
 */
class Admin_Itemmanage_Change_Update_Done
{
    var $itembasic;
    var $upduser;
    var $actionnm;
    
    var $actionChain;

    var $title;
    var $pagename;
    var $from;
    
    var $itemdiv;
    var $jancode;
    var $hinban;
    var $itemtitle;
    var $release_date_start;
    var $release_date_end;
    var $publish_date_start;
    var $publish_date_end;
    var $maker_capital;
    var $maker_name;
    var $media;
    var $cast;
    var $situation;
    var $photo_situation;
    var $publish_situation;
    var $sort;
    var $genre_select;
    
    var $code;

    var $itemnm;
    var $itemnmkana;
    var $subtitle;
    var $maker_capi;
    var $makercd;
    var $labelcd;
    var $seriescd;
    var $iteminfo;
    var $comment;
    var $itemexp;

    var $genre;
//    var $cast;

    var $itemdivcd;
    var $eirinrating;
    var $examgroupcd;
    var $examno;
    var $rankingrate;
    var $releasedate;

    var $originaltitle;
    var $productyear;
    var $productcountry;

    var $salestartdate;
    var $orderclosedate;
    var $medianm;
    var $makeritemcd;
    var $jancd;
    var $saleformnm;
    var $rectime;
    var $makerprice;

    var $updcnt;
    var $webupdcnt;
    
    var $makername;
    var $serisename;
    var $labelname;
    

    var $option01;
    var $option02;
    var $option03;
    var $option04;
    var $option05;
    var $option06;
    var $option07;
    var $option08;
    var $option09;
    var $option10;

    var $option;

    var $use_tags;

    /**
     * execute
     *
     * @access  public
     */
    function execute()
    {
        $errorList =& $this->actionChain->getCurErrorList();
        
        $log =& LogFactory::getLog();
        $log->debug("Admin_Itemmanage_Change_Update_Doneが実行されました", "Admin_Itemmanage_Change_Update_Done#execute");
        

        if (preg_match_all("@(?:</?([^>]*?)>)@im",$this->itemexp, $match)) {
            //$log->debug(print_r($match[0],true), "");
            $errorList =& $this->actionChain->getCurErrorList();

            $use_tags = str_replace(",", "|", $this->use_tags);
            foreach ($match[0] as $val) {
                if (!preg_match("@(?:</?[".$use_tags."]++(([\s]+[^>]*?)*)>)@im",$val)) {
                    $log->debug("@(?:</?[".$use_tags."]++(([\s]+[^>]*?)*)>)@im  : ". $val, "");
                    $errorList->add("error", "使用できないHTMLタグが入力されています。");
                    $errorList->add("error", "「".$this->use_tags."」が使用できます。");
                    return 'error';
                }
            }
        }


        if (!empty($this->releasedate)) {
            $this->releasedate = str_replace("/", "-", $this->releasedate);
        }
        
        $result = $this->itembasic->update($this->code, $this->itemnm, $this->itemnmkana, $this->makercd, $this->itemexp
                                            , $this->option01, $this->option02, $this->option03, $this->option04
                                            , $this->option05, $this->option06, $this->option07, $this->option08
                                            , $this->option09, $this->option10, $this->upduser, $this->updcnt
                                            , $this->releasedate
                                            , $this->rankingrate, $this->comment, $this->webupdcnt, $this->genre);
        
        if (is_array($result)) {
            $errorList -> add("Error", $result[1]);
            return 'error';
        }
        if (is_object($result)){
            return 'error';
        }
        return 'success';
    }
}
?>
