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

class Admin_Portalmanage_Recommend_Complete
{
	// ページ情報 
	var $pagename;
	var $title;

	// 入力パラメータ
    var $itemcd;
    var $startdate;
    var $closedate;
    var $priority;
    var $updcnt;
    var $kubun;

    // 保持パラメータ
    var $fromaction;    // 転送元アクション
    var $sort;          // ソートキー
    var $pageID;        // ページ番号
    var $srcword;       // 検索
    var $srcdispnum;    // 表示件数
    var $prockbn;       // 処理区分

 // 商品検索用パラメータ
    var $div;
    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 $genre_select;


    // DB 
    var $recommend;
    var $data;
    
    //追加
    var $fromdetail;
    var $from;
    
    
    function execute()
    {
        if($this->kubun==1) { //　追加 
            $this->recommend->insert($this->itemcd, $this->startdate, $this->closedate, $this->priority, "fuco");
        } elseif($this->kubun==2) { // 変更 
            $this->recommend->update($this->itemcd, $this->startdate, $this->closedate, $this->priority, "fuco", $this->updcnt);
            if($this->prockbn==1) $this->kubun = 1;
        } elseif($this->kubun==3) { // 消去 
            $this->recommend->delete($this->itemcd, "fuco", $this->updcnt);
        }
        $log =& LogFactory::getLog();
        $log->debug("Admin_Portalmanage_Recommend_Completeが実行されました", "Admin_Portalmanage_recommend_Compelete#execute");
        return 'success';
    }
    /**
     * リスト復帰用URLパラメータ出力
     *
     * @return object
     */
    function getReturnParam()
    {
        if ( $this->fromaction == 'admin_portalmanage_recommend_list' ) {
			return  'div='.$this->div.
			        '&action='.$this->fromaction.
					'&sort='.$this->sort.
					'&pageID='.$this->pageID.
					'&srcword='.$this->srcword.
					'&srcdispnum='.$this->srcdispnum;
        } else {
                $return='div='.$this->div.
                        '&action='.$this->fromaction.
                        '&cd='.$this->itemcd.
                        '&jancode='.urlencode($this->jancode).
                        '&hinban='.urlencode($this->hinban).
                        '&itemtitle='.urlencode($this->itemtitle).
                        '&release_date_start='.$this->release_date_start.
                        '&release_date_end='.$this->release_date_end.
                        '&publish_date_start='.$this->publish_date_start.
                        '&publish_date_end='.$this->publish_date_end.
                        '&maker_capital='.$this->maker_capital.
                        '&maker_name='.$this->maker_name.
                        '&media='.$this->media.
                        '&cast='.urlencode($this->cast).
                        '&situation='.$this->situation.
                        '&photo_situation='.$this->photo_situation.
                        '&publish_situation='.$this->publish_situation.
                        '&sort='.$this->sort.
                        '&from='.$this->from;
                foreach ($this->genre_select as $val) {
                    $return .= '&genre_select[]='.$val;
                }
                return $return;
	}
    }
    
    function getReturnMsg()
    {
        if($this->fromdetail == "詳細画面へ" or $this->fromdetail ==1){
            return "詳細画面へ";
        } else {
            return "一覧へ戻る";
        }
    }
    
}
?>