Changeset 20142


Ignore:
Timestamp:
2011/02/11 18:57:25 (13 years ago)
Author:
kimoto
Message:

LC_Page_Mypage_MailViewリファクタリング #981

File:
1 edited

Legend:

Unmodified
Added
Removed
  • branches/version-2_5-dev/data/class/pages/mypage/LC_Page_Mypage_MailView.php

    r20116 r20142  
    2323 
    2424// {{{ requires 
    25 require_once(CLASS_REALDIR . "pages/LC_Page.php"); 
     25require_once(CLASS_REALDIR . "pages/mypage/LC_Page_AbstractMypage.php"); 
    2626 
    2727/** 
     
    3232 * @version $Id$ 
    3333 */ 
    34 class LC_Page_Mypage_MailView extends LC_Page { 
     34class LC_Page_Mypage_MailView extends LC_Page_AbstractMypage { 
    3535 
    3636    // }}} 
     
    5454    function process() { 
    5555        parent::process(); 
    56         $this->action(); 
    57         $this->sendResponse(); 
    5856    } 
    5957 
     
    6563    function action() { 
    6664        $objCustomer = new SC_Customer(); 
    67  
    68         // ログインチェック 
    69         if(!$objCustomer->isLoginSuccess(true)) { 
     65        if(!SC_Utils_Ex::sfIsInt($_GET['send_id'])) { 
    7066            SC_Utils_Ex::sfDispSiteError(CUSTOMER_ERROR); 
    7167        } 
    7268 
    73         if(SC_Utils_Ex::sfIsInt($_GET['send_id'])) { 
    74             $objQuery = new SC_Query(); 
    75             $col = "subject, mail_body"; 
    76             $where = "send_id = ? AND customer_id = ?"; 
    77             $arrval = array($_GET['send_id'], $objCustomer->getValue('customer_id')); 
    78             $arrRet = $objQuery->select($col, "dtb_mail_history LEFT JOIN dtb_order USING(order_id)", $where, $arrval); 
     69        $arrMailView = $this->lfGetMailView($_GET['send_id'], $objCustomer->getValue('customer_id')); 
    7970 
    80             if (empty($arrRet)) { 
    81                 SC_Utils_Ex::sfDispSiteError(CUSTOMER_ERROR); 
    82             } 
    83             $this->tpl_subject = $arrRet[0]['subject']; 
    84             $this->tpl_body = $arrRet[0]['mail_body']; 
     71        if (empty($arrMailView)) { 
     72            SC_Utils_Ex::sfDispSiteError(CUSTOMER_ERROR); 
    8573        } 
    8674 
    87         if (Net_UserAgent_Mobile::isMobile() === true){ 
    88             $this->tpl_title = 'メール履歴詳細'; 
     75        $this->tpl_subject  = $arrMailView[0]['subject']; 
     76        $this->tpl_body     = $arrMailView[0]['mail_body']; 
     77 
     78        if (SC_Display::detectDevice() === DEVICE_TYPE_PC){ 
     79            $this->setTemplate('mypage/mail_view.tpl'); 
     80        } else { 
     81            $this->tpl_title    = 'メール履歴詳細'; 
    8982            $this->tpl_mainpage = 'mypage/mail_view.tpl'; 
    90         } else { 
    91             $this->setTemplate('mypage/mail_view.tpl'); 
    9283        } 
    9384    } 
     
    10192        parent::destroy(); 
    10293    } 
     94 
     95 
     96    /** 
     97     * GETで指定された受注idのメール送信内容を返す 
     98     * 
     99     * @param mixed $send_id 
     100     * @param mixed $customer_id 
     101     * @access private 
     102     * @return array 
     103     */ 
     104    function lfGetMailView($send_id, $customer_id) { 
     105        $objQuery   = SC_Query::getSingletonInstance(); 
     106        $col        = "subject, mail_body"; 
     107        $where      = "send_id = ? AND customer_id = ?"; 
     108        $arrval     = array($send_id, $customer_id); 
     109        return $objQuery->select($col, "dtb_mail_history LEFT JOIN dtb_order USING(order_id)", $where, $arrval); 
     110    } 
    103111} 
    104 ?> 
Note: See TracChangeset for help on using the changeset viewer.