Ignore:
Timestamp:
2011/02/19 18:38:11 (13 years ago)
Author:
fukuda
Message:

・SC_Helper_Mail::sfGetMailTemplateの引数を簡潔に
・SC_Utils_Ex::sfCheckNumLength()をSC_Utils_Ex::sfIsInt()に統合
・ガイドラインに合わない $this->list_data を修正

Location:
branches/version-2_5-dev/data/class
Files:
9 edited

Legend:

Unmodified
Added
Removed
  • branches/version-2_5-dev/data/class/helper/SC_Helper_Mail.php

    r20198 r20203  
    331331    /** 
    332332     * 保存されているメールテンプレートの取得 
    333      * @param array $arrParams 特定IDのテンプレートを取り出したい時は$arrParams['template_id']で指定 
     333     * @param integer 特定IDのテンプレートを取り出したい時はtemplate_idを指定。未指定時は全件取得 
    334334     * @return array メールテンプレート情報を格納した配列 
    335335     * @todo   表示順も引数で変更できるように 
    336336     */ 
    337     function sfGetMailTemplate($arrParams = array()){ 
     337    function sfGetMailTemplate($template_id = null){ 
    338338        // 初期化 
    339339        $where = ''; 
    340         $arrValues = array(); 
    341340        $objQuery =& SC_Query::getSingletonInstance(); 
    342341         
     
    345344        $arrValues[] = 0; 
    346345        //template_id指定時 
    347         if (isset($arrParams['template_id'])) { 
     346        if (SC_Utils_Ex::sfIsInt($template_id) === true) { 
    348347            $where .= 'AND template_id = ?'; 
    349             $arrValues[] = $arrParams['template_id']; 
     348            $arrValues[] = $template_id; 
    350349        } 
    351350         
  • branches/version-2_5-dev/data/class/pages/admin/basis/LC_Page_Admin_Basis_Mail.php

    r20168 r20203  
    8080            // テンプレートプルダウン変更時 
    8181 
    82             if ( SC_Utils_Ex::sfCheckNumLength( $_POST['template_id']) ){ 
     82            if ( SC_Utils_Ex::sfIsInt( $_POST['template_id']) ){ 
    8383                $result = $this->lfGetMailTemplateByTemplateID($_POST['template_id']); 
    8484                if ( $result ){ 
     
    9090            break; 
    9191        case 'regist': 
    92             if (SC_Utils_Ex::sfCheckNumLength( $_POST['template_id']) ){ 
     92            if (SC_Utils_Ex::sfIsInt( $_POST['template_id']) ){ 
    9393 
    9494                // POSTデータの引き継ぎ 
  • branches/version-2_5-dev/data/class/pages/admin/contents/LC_Page_Admin_Contents_Recommend.php

    r20116 r20203  
    116116 
    117117        // カテゴリID取得 無いときはトップページ 
    118         if ( SC_Utils_Ex::sfCheckNumLength($_POST['category_id']) ){ 
     118        if ( SC_Utils_Ex::sfIsInt($_POST['category_id']) ){ 
    119119            $this->category_id = $_POST['category_id']; 
    120120        } else { 
  • branches/version-2_5-dev/data/class/pages/admin/mail/LC_Page_Admin_Mail.php

    r20198 r20203  
    173173             query:配信履歴「確認」 
    174174            */ 
    175             if (SC_Utils_Ex::sfCheckNumLength($_GET["send_id"])) { 
     175            if (SC_Utils_Ex::sfIsInt($_GET["send_id"])) { 
    176176                // 送信履歴より、送信条件確認画面 
    177177                $sql = "SELECT search_data FROM dtb_send_history WHERE send_id = ?"; 
     
    675675    function getTemplateData(&$objQuery, $id){ 
    676676 
    677         if ( SC_Utils_Ex::sfCheckNumLength($id) ){ 
     677        if ( SC_Utils_Ex::sfIsInt($id) ){ 
    678678            $sql = "SELECT * FROM dtb_mailmaga_template WHERE template_id = ? ORDER BY template_id DESC"; 
    679679            $result = $objQuery->getAll( $sql, array($id) ); 
  • branches/version-2_5-dev/data/class/pages/admin/mail/LC_Page_Admin_Mail_History.php

    r20116 r20203  
    8282        case 'delete': 
    8383            // 削除時 
    84             if (SC_Utils_Ex::sfCheckNumLength($_GET['send_id'])) { 
     84            if (SC_Utils_Ex::sfIsInt($_GET['send_id'])) { 
    8585                $sql = "UPDATE dtb_send_history SET del_flg = 1 WHERE send_id = ?"; 
    8686                $objQuery->query($sql, array($_GET['send_id']) ); 
  • branches/version-2_5-dev/data/class/pages/admin/mail/LC_Page_Admin_Mail_Preview.php

    r20198 r20203  
    7070        SC_Utils_Ex::sfIsSuccess($objSess); 
    7171 
    72         if (!isset($_POST['body'])) $_POST['body'] = ""; 
    73         if (!isset($_REQUEST['method'])) $_REQUEST['method'] = ""; 
    74         if (!isset($_REQUEST['id'])) $_REQUEST['id'] = ""; 
    75         if (!isset($_GET['send_id'])) $_GET['send_id'] = ""; 
    76  
    77         if ( $_POST['body'] ){ 
    78             $this->body = $_POST['body']; 
    79  
    80             // HTMLメールテンプレートのプレビュー 
    81         } elseif ($_REQUEST["method"] == "template" 
    82                   && SC_Utils_Ex::sfCheckNumLength($_REQUEST['id'])) { 
    83  
    84             $sql = "SELECT * FROM dtb_mailmaga_template WHERE template_id = ?"; 
    85             $result = $objQuery->getAll($sql, array($_REQUEST["id"])); 
    86             $this->list_data = $result[0]; 
    87  
    88             // メイン商品の情報取得 
    89             // FIXME SC_Product クラスを使用した実装 
    90             $sql = "SELECT name, main_image, point_rate, deliv_fee, price01_min, price01_max, price02_min, price02_max FROM vw_products_allclass AS allcls WHERE product_id = ?"; 
    91             $main = $objQuery->getAll($sql, array($this->list_data["main_product_id"])); 
    92             $this->list_data["main"] = $main[0]; 
    93  
    94             // サブ商品の情報取得 
    95             // FIXME SC_Product クラスを使用した実装 
    96             $sql = "SELECT product_id, name, main_list_image, price01_min, price01_max, price02_min, price02_max FROM vw_products_allclass WHERE product_id = ?"; 
    97             $k = 0; 
    98             $l = 0; 
    99             for ($i = 1; $i <= 12; $i ++) { 
    100                 if ($l == 4) { 
    101                     $l = 0; 
    102                     $k ++; 
    103                 } 
    104                 $result = ""; 
    105                 $j = sprintf("%02d", $i); 
    106                 if ($i > 0 && $i < 5 ) $k = 0; 
    107                 if ($i > 4 && $i < 9 ) $k = 1; 
    108                 if ($i > 8 && $i < 13 ) $k = 2; 
    109  
    110                 if (is_numeric($this->list_data["sub_product_id" .$j])) { 
    111                     $result = $objQuery->getAll($sql, array($this->list_data["sub_product_id" .$j])); 
    112                     $this->list_data["sub"][$k][$l] = $result[0]; 
    113                     $this->list_data["sub"][$k]["data_exists"] = "OK";  //当該段にデータが1つ以上存在するフラグ 
    114                 } 
    115                 $l ++; 
    116             } 
    117             $this->tpl_mainpage = 'mail/html_template.tpl'; 
    118  
    119         } elseif (SC_Utils_Ex::sfCheckNumLength($_GET['send_id']) 
    120                    || SC_Utils_Ex::sfCheckNumLength($_GET['id'])){ 
     72        if (SC_Utils_Ex::sfIsInt($_GET['send_id']) 
     73                   || SC_Utils_Ex::sfIsInt($_GET['id'])){ 
     74                        
    12175            if (is_numeric($_GET["send_id"])) { 
    12276                $id = $_GET["send_id"]; 
     
    13286                    // テキスト形式の時はタグ文字をエスケープ 
    13387                    $this->escape_flag = 1; 
    134                 } 
     88                }     
    13589                $this->body = $result[0]["body"]; 
    13690            } 
  • branches/version-2_5-dev/data/class/pages/admin/mail/LC_Page_Admin_Mail_Template.php

    r20198 r20203  
    7878        switch ($this->getMode()) { 
    7979        case 'delete': 
    80             if ( SC_Utils_Ex::sfCheckNumLength($_GET['id'])===true ){ 
     80            if ( SC_Utils_Ex::sfIsInt($_GET['id'])===true ){ 
    8181                $this->lfDeleteMailTemplate($_GET['id']); 
    8282                $this->objDisplay->reload(null, true); 
     
    8686            break; 
    8787        } 
    88         $this->list_data = $objMailHelper->sfGetMailTemplate(); 
     88        $this->arrTemplates = $objMailHelper->sfGetMailTemplate(); 
    8989    } 
    9090 
     
    105105    function lfDeleteMailTemplate($template_id){ 
    106106        $objQuery =& SC_Query::getSingletonInstance(); 
    107         $sqlval["del_flg"] = "1"; 
    108         $arrValIn[] = $template_id; 
    109         $objQuery->update("dtb_mailmaga_template", $sqlval, "template_id = ?", $arrValIn); 
     107        $objQuery->update("dtb_mailmaga_template", 
     108                          array('del_flg' =>1), 
     109                          "template_id = ?", 
     110                          array($template_id)); 
    110111    } 
    111112 
  • branches/version-2_5-dev/data/class/pages/admin/mail/LC_Page_Admin_Mail_TemplateInput.php

    r20116 r20203  
    9191        case 'edit': 
    9292            // モードによる処理分岐 
    93             if ( SC_Utils_Ex::sfCheckNumLength($_GET['template_id'])===true ){ 
     93            if ( SC_Utils_Ex::sfIsInt($_GET['template_id'])===true ){ 
    9494                // 編集 
    9595                $sql = "SELECT * FROM dtb_mailmaga_template WHERE template_id = ? AND del_flg = 0"; 
  • branches/version-2_5-dev/data/class/util/SC_Utils.php

    r20133 r20203  
    671671    } 
    672672 
    673     /* DBに渡す数値のチェック 
    674      * 10桁以上はオーバーフローエラーを起こすので。 
    675      */ 
    676     function sfCheckNumLength( $value ){ 
    677         if ( ! is_numeric($value)  ){ 
    678             return false; 
    679         } 
    680  
    681         if ( strlen($value) > 9 ) { 
    682             return false; 
    683         } 
    684  
    685         return true; 
    686     } 
    687  
    688673    // 一致した値のキー名を取得 
    689674    function sfSearchKey($array, $word, $default) { 
Note: See TracChangeset for help on using the changeset viewer.