<?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.Check
 * @author      H.Watanabe <hiroshi.watanabe@netnee.jp>
 * @access      public
 */
class Admin_Itemmanage_Change_Check
{
    var $view;
    var $itemupdate;

    var $result;
    var $castnm;
    var $genrenm;
    
    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 $itemcd;
    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 $updcnt;
    var $webupdcnt;
    var $actionnm;

    var $cd;

    var $cas;
    var $return;
    

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


    var $actionChain;
    var $use_tags;

    function execute()
    {
        $log =& LogFactory::getLog();
        $log->debug("Admin_Itemmanage_Change_Checkが実行されました", "Admin_Itemmanage_Change_Check#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 'input';
                }
            }
        }

        return 'success';
    }
    function getOption() {
        return $this->itemupdate->getOptionList(100,200);
    }

    function getGenrename($params)
    {
        return $this->genrenm[$params["itemcd"]];
    }

    function getGenreCheckbox() {
        $genre["l"] = $this->view->getGenreTreeAll();
        $genre["s"] = $this->view->getGenrecdForItemcd($this->result["itemcd"]);
        return $genre;
    }

    function getGenrenmList()
    {
        if (!empty($this->genre)) {
            if (is_array($this->genre)) {
                return $this->view->getGenreTree($this->genre);
            }
        }
        return "";
    }
}
?>
