Changeset 22581 for branches/version-2_12-dev/data/class/pages/frontparts/bloc/LC_Page_FrontParts_Bloc_News.php
- Timestamp:
- 2013/02/22 20:22:51 (11 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/version-2_12-dev/data/class/pages/frontparts/bloc/LC_Page_FrontParts_Bloc_News.php
r22567 r22581 67 67 { 68 68 69 $objNews = new SC_Helper_News_Ex(); 69 70 $objFormParam = new SC_FormParam_Ex(); 70 71 switch ($this->getMode()) { … … 75 76 $this->arrErr = $objFormParam->checkError(false); 76 77 if (empty($this->arrErr)) { 77 78 $json = $this->lfGetNewsForJson($ objFormParam);78 $arrData = $objFormParam->getHashArray(); 79 $json = $this->lfGetNewsForJson($arrData, $objNews); 79 80 echo $json; 80 81 SC_Response_Ex::actionExit(); … … 90 91 $this->arrErr = $objFormParam->checkError(false); 91 92 if (empty($this->arrErr)) { 92 93 $json = $this->lfGetNewsDetailForJson($ objFormParam);93 $arrData = $objFormParam->getHashArray(); 94 $json = $this->lfGetNewsDetailForJson($arrData, $objNews); 94 95 echo $json; 95 96 SC_Response_Ex::actionExit(); … … 100 101 break; 101 102 default: 102 $this-> newsCount = $this->lfGetNewsCount();103 $this-> arrNews = $this->lfGetNews(SC_Query_Ex::getSingletonInstance());103 $this->arrNews = $objNews->getList(); 104 $this->newsCount = $objNews->getCount(); 104 105 break; 105 106 } … … 135 136 * @return array $arrNewsList 新着情報の配列を返す 136 137 */ 137 function lfGetNews(&$objQuery) 138 { 139 $objQuery->setOrder('rank DESC '); 140 $arrNewsList = $objQuery->select('* , cast(news_date as date) as news_date_disp', 'dtb_news' ,'del_flg = 0'); 138 function lfGetNews($dispNumber, $pageNo, SC_Helper_News_Ex $objNews) 139 { 140 $arrNewsList = $objNews->getList($dispNumber, $pageNo); 141 141 142 142 // モバイルサイトのセッション保持 (#797) … … 159 159 * (ページと表示件数を指定) 160 160 * 161 * @param array $objFormParam フォームパラメータークラス 161 * @param array $arrData フォーム入力値 162 * @param object $objNews 162 163 * @return String $json 新着情報のJSONを返す 163 164 */ 164 function lfGetNewsForJson(&$objFormParam) 165 { 166 167 $objQuery =& SC_Query_Ex::getSingletonInstance(); 168 $arrData = $objFormParam->getHashArray(); 165 function lfGetNewsForJson($arrData, SC_Helper_News_Ex $objNews) 166 { 169 167 170 168 $dispNumber = $arrData['disp_number']; 171 169 $pageNo = $arrData['pageno']; 172 if (!empty($dispNumber) && !empty($pageNo)) { 173 $objQuery->setLimitOffset($dispNumber, (($pageNo - 1) * $dispNumber)); 174 } 175 176 $arrNewsList = $this->lfGetNews($objQuery); 170 $arrNewsList = $this->lfGetNews($dispNumber, $pageNo, $objNews); 177 171 178 172 //新着情報の最大ページ数をセット 179 $newsCount = $ this->lfGetNewsCount();173 $newsCount = $objNews->getCount(); 180 174 $arrNewsList['news_page_count'] = ceil($newsCount / 3); 181 175 … … 189 183 * (news_idを指定) 190 184 * 191 * @param array $objFormParam フォームパラメータークラス 185 * @param array $arrData フォーム入力値 186 * @param object $objNews 192 187 * @return String $json 新着情報1件分のJSONを返す 193 188 */ 194 function lfGetNewsDetailForJson(&$objFormParam) 195 { 196 197 $objQuery = SC_Query_Ex::getSingletonInstance(); 198 $arrData = $objFormParam->getHashArray(); 199 $newsId = $arrData['news_id']; 200 $arrNewsList = $objQuery->select(' * , cast(news_date as date) as news_date_disp ',' dtb_news '," del_flg = '0' AND news_id = ? ", array($newsId)); 201 189 function lfGetNewsDetailForJson($arrData, SC_Helper_News_Ex $objNews) 190 { 191 192 $arrNewsList = $objNews->get($arrData['news_id']); 202 193 $json = SC_Utils_Ex::jsonEncode($arrNewsList); //JSON形式 203 194 204 195 return $json; 205 }206 207 /**208 * 新着情報の件数を取得する209 *210 * @return Integer $count 新着情報の件数を返す211 */212 function lfGetNewsCount()213 {214 215 $count = 0;216 217 $objQuery = SC_Query_Ex::getSingletonInstance();218 $count = $objQuery->count('dtb_news', "del_flg = '0'");219 220 return $count;221 196 } 222 197
Note: See TracChangeset
for help on using the changeset viewer.