<?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.Import.Log
 * @author      netnee T.Otogawa <tomokazu.otogawa@netnee.jp>
 * @access      public
 */
class Admin_Itemmanage_Import_Log
{
    var $title;
    var $pagename;
    
    var $datediv;

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

        $filepathname = IMPORTDIR_LOGS ."/dataimport_log.csv";

        if(!file_exists($filepathname)) {
            return 'error';
        }
        $len = filesize($filepathname);
        header("Cache-Control: public");
        header("Pragma: public");
        header ("Content-Disposition: inline ; filename=dataimport_log.csv");
        header ("Content-type: text/octet-stream");
        header ("Content-Length: ". $len);
        $handle = fopen ($filepathname, "r");
        while (!feof ($handle)) {
            $buffer = fgets($handle, 4096);
            $buffer = mb_convert_encoding($buffer, "SJIS","SJIS");
            echo $buffer;
        }
        fclose ($handle);
            
        
        return 'success';
    }
}
?>
