[Svn-src-all:1192] [version-2_5-dev 20080] リファクタリング #979

kimoto admin @ mail.ec-cube.net
2011年 2月 3日 (木) 20:51:29 JST


Subversion committed to /home/svn/open 20080
http://svn.ec-cube.net/open_trac/changeset/20080
┌────────────────────────────┐
│更新者 :  kimoto                                       │
│更新日時:  2011-02-03 20:51:29 +0900 (木, 03  2月 2011)│
└────────────────────────────┘

Log:
--------------------------------------------------------
リファクタリング #979


Changed:                      [U:修正,A:追加,D:削除]
--------------------------------------------------------
U   branches/version-2_5-dev/data/class/pages/entry/LC_Page_Entry_Kiyaku.php

変更: branches/version-2_5-dev/data/class/pages/entry/LC_Page_Entry_Kiyaku.php
===================================================================
--- branches/version-2_5-dev/data/class/pages/entry/LC_Page_Entry_Kiyaku.php	2011-02-03 11:51:22 UTC (rev 20079)
+++ branches/version-2_5-dev/data/class/pages/entry/LC_Page_Entry_Kiyaku.php	2011-02-03 11:51:29 UTC (rev 20080)
@@ -63,24 +63,16 @@
      */
     function action() {
 
-        // 規約内容の取得
-        $objQuery = new SC_Query();
-        $objQuery->setOrder("rank DESC");
-        $arrRet = $objQuery->select("kiyaku_title, kiyaku_text", "dtb_kiyaku", "del_flg <> 1");
-        $this->max = count($arrRet);
-        
+        $arrKiyaku = $this->lfGetKiyakuData();
+        $this->max = count($arrKiyaku);
+
+        $offset    = '';
         // mobile時はGETでページ指定
         if ( Net_UserAgent_Mobile::isMobile() === true ){
-        	$this->offset = is_numeric($_GET['offset'])===true ? $offset = intval($_GET['offset']) : 1;
+            $this->offset = $this->lfSetOffset($_GET['offset']);
         }
 
-        // 規約文の作成
-        $this->tpl_kiyaku_text = "";
-        for ($i = 0; $i < $this->max; $i++) {
-        	if ($this->offset !== null && ($this->offset - 1) <> $i) continue;
-            $this->tpl_kiyaku_text.=$arrRet[$i]['kiyaku_title'] . "\n\n";
-            $this->tpl_kiyaku_text.=$arrRet[$i]['kiyaku_text'] . "\n\n";
-        }
+        $this->tpl_kiyaku_text = $this->lfMakeKiyakuText($arrKiyaku, $this->max, $this->offset);
     }
 
     /**
@@ -91,5 +83,55 @@
     function destroy() {
         parent::destroy();
     }
+
+    /**
+     * lfMakeKiyakuText
+     *
+     * 規約文の作成
+     *
+     * @param mixed $arrKiyaku
+     * @param mixed $max
+     * @param mixed $offset
+     * @access public
+     * @return void
+     */
+    function lfMakeKiyakuText($arrKiyaku, $max, $offset) {
+        $this->tpl_kiyaku_text = "";
+        for ($i = 0; $i < $max; $i++) {
+        	if ($offset !== null && ($offset - 1) <> $i) continue;
+            $tpl_kiyaku_text.=$arrKiyaku[$i]['kiyaku_title'] . "\n\n";
+            $tpl_kiyaku_text.=$arrKiyaku[$i]['kiyaku_text'] . "\n\n";
+        }
+        return $tpl_kiyaku_text;
+    }
+
+    /**
+     * lfGetKiyakuData
+     *
+     * 規約内容の取得
+     *
+     * @access public
+     * @return void
+     */
+    function lfGetKiyakuData() {
+
+        $objQuery = new SC_Query();
+        $objQuery->setOrder("rank DESC");
+        $arrRet = $objQuery->select("kiyaku_title, kiyaku_text", "dtb_kiyaku", "del_flg <> 1");
+
+        return $arrRet;
+    }
+
+    /**
+     * lfSetOffset
+     *
+     * @param mixed $offset
+     * @access public
+     * @return void
+     */
+    function lfSetOffset($offset) {
+       return is_numeric($offset) === true ? intval($offset) : 1;
+    }
+
 }
 ?>




Svn-src-all メーリングリストの案内