Changeset 19491


Ignore:
Timestamp:
2010/11/07 03:33:36 (13 years ago)
Author:
Yammy
Message:

CSVダウンロードの暫定実装

Location:
branches/camp/camp-2_5-E
Files:
5 edited

Legend:

Unmodified
Added
Removed
  • branches/camp/camp-2_5-E/data/class/SC_Display.php

    r19400 r19491  
    4646    */ 
    4747    function hoge(LC_Page $page, $is_admin = false){ 
    48         
    4948        if(!$this->deviceSeted || !is_null($this->view)){ 
    5049            $device = ($is_admin) ? 8 : $this->detectDevice(); 
    51             if (!$this->deviceSeted) { 
    52                 $this->setDevice($device); 
    53             } 
     50            $this->setDevice($device); 
    5451        } 
    5552        $this->assignobj($page); 
    56          
    5753        $this->response->setResposeBody($this->view->fetch($page->getTemplate())); 
    5854    } 
     
    9086                $this->setView(new SC_AdminView()); 
    9187        } 
    92          
    9388        $this->deviceSeted = true; 
    9489    } 
  • branches/camp/camp-2_5-E/data/class/pages/LC_Page.php

    r19371 r19491  
    122122        $this->objDisplay->hoge($this); 
    123123        $this->objDisplay->response->response(); 
     124    } 
     125 
     126    /** 
     127     * Page のレスポンス送信(ダウンロード). 
     128     * 
     129     * @return void 
     130     */ 
     131    function sendResponseCSV($file_name, $data) { 
     132        $this->objDisplay->hoge($this); 
     133        $this->objDisplay->addHeader("Content-disposition", "attachment; filename=${file_name}"); 
     134        $this->objDisplay->addHeader("Content-type", "application/octet-stream; name=${file_name}"); 
     135        $this->objDisplay->addHeader("Cache-Control", ""); 
     136        $this->objDisplay->addHeader("Pragma", ""); 
     137 
     138        $this->objDisplay->response->body = $data; 
     139        $this->objDisplay->response->response(); 
     140        exit; 
    124141    } 
    125142 
  • branches/camp/camp-2_5-E/data/class/pages/admin/order/LC_Page_Admin_Order.php

    r19441 r19491  
    278278 
    279279                            // CSVを送信する。 
    280                             SC_Utils_Ex::sfCSVDownload($head.$data); 
     280                            list($fime_name, $data) = SC_Utils_Ex::sfGetCSVData($head.$data); 
     281                            $this->sendResponseCSV($fime_name, $data); 
    281282                            exit; 
    282283                            break; 
  • branches/camp/camp-2_5-E/data/class/util/SC_Utils.php

    r18871 r19491  
    395395 
    396396    function sfCSVDownload($data, $prefix = ""){ 
     397echo "sfGetCSVData()に移行してね。"; 
     398exit; 
    397399 
    398400        if($prefix == "") { 
     
    415417        /* データを出力 */ 
    416418        echo $data; 
     419    } 
     420 
     421    function sfGetCSVData($data, $prefix = ""){ 
     422        if($prefix == "") { 
     423            $dir_name = SC_Utils::sfUpDirName(); 
     424            $file_name = $dir_name . date("ymdHis") .".csv"; 
     425        } else { 
     426            $file_name = $prefix . date("ymdHis") .".csv"; 
     427        } 
     428 
     429        if (mb_internal_encoding() == CHAR_CODE){ 
     430            $data = mb_convert_encoding($data,'SJIS-Win',CHAR_CODE); 
     431        } 
     432 
     433        /* データを出力 */ 
     434        return array($file_name, $data); 
    417435    } 
    418436 
  • branches/camp/camp-2_5-E/html/admin/index.php

    r18701 r19491  
    2323// {{{ requires 
    2424require_once './require.php'; 
    25 require_once CLASS_EX_PATH . 'page_extends/admin/LC_Page_Admin_Ex.php'; 
     25require_once CLASS_EX_PATH . 'page_extends/admin/LC_Page_Admin_Index_Ex.php'; 
    2626 
    2727// }}} 
    2828// {{{ generate page 
    2929 
    30 $objPage = new LC_Page_Admin_Ex(); 
     30$objPage = new LC_Page_Admin_Index_Ex(); 
    3131register_shutdown_function(array($objPage, 'destroy')); 
    3232$objPage->init(); 
Note: See TracChangeset for help on using the changeset viewer.