<?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     [[package名]]
 * @author      H.Watanabe <hiroshi.watanabe@netnee.jp>
 * @access      public
 */
class Admin_Itemmanage_Import_Delete_Complete
{
    var $title;
    var $pagename;
    
    var $prev_action;

    /**
     * [[機能説明]]
     *
     * @access  public
     */
     
    var $dataimport;
    
    var $deldate;
    var $deletecount;
    
    function execute()
    {
        $delflg = true;
        $res = $this->dataimport->getDeleteItemcd($this->deldate);
        foreach ( $res as $value ) {
            $ret = $this->dataimport->delImport($value['itemcd']);
            if(!$ret)  $delflg = false;
        }
        $this->deletecount = count($res);

        if($delflg){
            return 'success';
        } else {
            return 'input';
        }
    }
    
    /**
     * 過去のインポートユーザから日時に変換
     *
     * @access  public
     */
    function getImportDate($params)
    {
        $Y = substr($params["updusrnm"],  5, 4);
        $M = substr($params["updusrnm"],  9, 2);
        $D = substr($params["updusrnm"], 11, 2);
        $h = substr($params["updusrnm"], 14, 2);
        $m = substr($params["updusrnm"], 16, 2);
        $s = substr($params["updusrnm"], 18, 2);
        
        //YYYY年MM月DD日 hh時mm分ss秒 の形式で返却
        return sprintf("%04d年%02d月%02d日 %02d時%02d分%02d秒", $Y, $M, $D, $h, $m, $s);
    }
}
?>
