<?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     Seller_Itemexhibit_Register_Image_Check
 * @author      S.Oguma <shinichiro.oguma@netnee.jp>
 * @access      public
 */
class Seller_Itemexhibit_Register_Image_Check
{
    var $tname;
  
    var $fileUpload;
    var $actionChain;
    
    var $imgtypedivlist;
    var $nmtypedivlist;
    var $title;
    var $pagename;

    var $select;
    var $keyword;
    var $itemnumber;
    var $jancode;

    
    var $imgtypediv;
    var $generalcd;
    var $generalsub;
    var $imgintotitle;
    var $fromaction;
    
    var $filelist;
    
    var $mode;

    var $itemcd;
    var $structcd;
    var $sellercd;
    var $stockcd;
    var $mediacd;
    var $itemnm;
    var $salestartdate;
    var $rectime;
    var $makeritemcd;
    
    var $makernm;
    var $makerprice;
    var $saleformnm;
    var $medianm;
    var $jancd;
    var $condition;
    var $itemexp;
    var $sellingprice;
    var $souryouprc;
    var $exhibitcount;
    var $castnm;
    
    var $dest;
    
    // マスタメンテ部関連
    var $srcword;
    var $srcrecommenddiv;
    var $srcdispnum;
    var $srccastdiv;
    var $from;
    
    //seller_itemexhibit_now_info 用
    var $curnum;
    var $lowprice;

	var $sort;
	var $pageID;
	var $listsize;
    
    function execute()
    {
        $log =& LogFactory::getLog();
        $log->debug("Seller_Itemexhibit_Register_Image_Checkが実行されました", "Seller_Itemexhibit_Register_Image_Check#execute");

 /*
        // タイトル設定
        if (!empty($this->imgtypediv)){
            $this->pagename = $this->nmtypedivlist[$this->imgtypediv - 1];
        }
        if (!empty($this->imgtypediv) && $this->imgtypediv <> 5){  // レーベル画像のタイプ区分以外
            $tmpcd = $this->generalcd;
        } else {
            $tmpcd = $this->generalcd . "-" . $this->generalsub;
        }
*/
 
  
 
       $tmpcd = $this->itemcd . "-" . $this->structcd . "-" . $this->sellercd. "-" . $this->stockcd;
       

        $this->filelist = array();
        $i = 0;

        //***
        $this->fileUpload->setName("image");
        $count        = $this->fileUpload->count();
        $originalName = $this->fileUpload->getOriginalName();
        $mimeType     = $this->fileUpload->getMimeType();
        $filesize     = $this->fileUpload->getFilesize();
 

        if (isset($originalName[0]) && $originalName[0]) {
            $pathinfo = pathInfo($originalName[0]);
            $extension = $pathinfo['extension'];

            $imgnm = $tmpcd .".jpg";
            
            
            $dest = IMAGE_WORKDIR ."/". $imgnm;
            $this->fileUpload->move(0, $dest);

            $this->dest = $imgnm;

            
            $this->filelist[$i] = array(
                'originalName' => $originalName[0],
                'mimeType'     => $mimeType[0],
                'filesize'     => $filesize[0],
            );
            
            $log->debug(print_r($this->filelist[$i], true), "Seller_Itemexhibit_Register_Image_Check#execute");
            
            $i++;
        } else {
            $this->mode = "";
        }


        return "success";
    }
    
 function getConditionName()
    {
        $condition = $this->tname->selectKey(9, $this->condition);
        return $condition["name"];
    }
    

}
?>
  