- Timestamp:
- 2011/02/11 11:55:39 (12 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/version-2_5-dev/data/class/pages/admin/LC_Page_Admin_Home.php
r20116 r20134 66 66 */ 67 67 function action() { 68 $objQuery = new SC_Query();69 $objSess = new SC_Session();70 68 71 69 // 認証可否の判定 72 SC_Utils_Ex::sfIsSuccess( $objSess);70 SC_Utils_Ex::sfIsSuccess(new SC_Session()); 73 71 74 72 // DBバージョンの取得 75 $objDb = new SC_Helper_DB_Ex(); 76 $this->db_version = $objDb->sfGetDBVersion(); 73 $this->db_version = $this->lfGetDBVersion(); 77 74 78 75 // PHPバージョンの取得 79 $this->php_version = "PHP " . phpversion();76 $this->php_version = $this->lfGetPHPVersion(); 80 77 81 78 // 現在の会員数 82 $this->customer_cnt = $this->lfGetCustomerCnt( $objQuery);79 $this->customer_cnt = $this->lfGetCustomerCnt(); 83 80 84 81 // 昨日の売上高 85 $this->order_yesterday_amount = $this->lfGetOrderYesterday( $objQuery,"SUM");82 $this->order_yesterday_amount = $this->lfGetOrderYesterday("SUM"); 86 83 87 84 // 昨日の売上件数 88 $this->order_yesterday_cnt = $this->lfGetOrderYesterday( $objQuery,"COUNT");85 $this->order_yesterday_cnt = $this->lfGetOrderYesterday("COUNT"); 89 86 90 87 // 今月の売上高 91 $this->order_month_amount = $this->lfGetOrderMonth( $objQuery,"SUM");88 $this->order_month_amount = $this->lfGetOrderMonth("SUM"); 92 89 93 90 // 今月の売上件数 94 $this->order_month_cnt = $this->lfGetOrderMonth( $objQuery,"COUNT");91 $this->order_month_cnt = $this->lfGetOrderMonth("COUNT"); 95 92 96 93 // 顧客の累計ポイント … … 98 95 99 96 //昨日のレビュー書き込み数 100 $this->review_yesterday_cnt = $this->lfGetReviewYesterday( $objQuery);97 $this->review_yesterday_cnt = $this->lfGetReviewYesterday(); 101 98 102 99 //レビュー書き込み非表示数 103 $this->review_nondisp_cnt = $this->lfGetReviewNonDisp( $objQuery);100 $this->review_nondisp_cnt = $this->lfGetReviewNonDisp(); 104 101 105 102 // 品切れ商品 … … 107 104 108 105 // 新規受付一覧 109 $arrNewOrder = $this->lfGetNewOrder(); 110 111 foreach ($arrNewOrder as $key => $val){ 112 $arrNewOrder[$key]['create_date'] = str_replace("-", "/", substr($val['create_date'], 0,19)); 113 114 } 115 $this->arrNewOrder = $arrNewOrder; 106 $this->arrNewOrder = $this->lfGetNewOrder(); 116 107 117 108 // お知らせ一覧の取得 … … 128 119 } 129 120 130 // 会員数 131 function lfGetCustomerCnt(&$objQuery){ 132 133 $sql = "SELECT COUNT(customer_id) FROM dtb_customer WHERE del_flg = 0 AND status = 2"; 134 $return = $objQuery->getOne($sql); 135 return $return; 136 } 137 138 // 昨日の売上高・売上件数 139 function lfGetOrderYesterday(&$objQuery, $method){ 140 if ( $method == 'SUM' or $method == 'COUNT'){ 141 $dbFactory = SC_DB_DBFactory::getInstance(); 142 $sql = $dbFactory->getOrderYesterdaySql($method); 143 $return = $objQuery->getOne($sql); 144 } 145 return $return; 146 } 147 148 function lfGetOrderMonth(&$objQuery, $method){ 149 121 /** 122 * PHPバージョンの取得 123 * 124 * @return string PHPバージョン情報 125 */ 126 function lfGetPHPVersion() { 127 return "PHP " . phpversion(); 128 } 129 130 /** 131 * DBバージョンの取得 132 * 133 * @return mixed DBバージョン情報 134 */ 135 function lfGetDBVersion() { 136 $objDb = new SC_Helper_DB_Ex(); 137 return $objDb->sfGetDBVersion(); 138 } 139 140 /** 141 * 現在の会員数の取得 142 * 143 * @return integer 会員数 144 */ 145 function lfGetCustomerCnt(){ 146 $objQuery =& SC_Query::getSingletonInstance(); 147 $col = "COUNT(customer_id)"; 148 $table = "dtb_customer"; 149 $where = "del_flg = 0 AND status = 2"; 150 return $objQuery->get($col, $table, $where); 151 } 152 153 /** 154 * 昨日の売上データの取得 155 * 156 * @param string $method 取得タイプ 件数:"COUNT" or 金額:"SUM" 157 * @return integer 結果数値 158 */ 159 function lfGetOrderYesterday($method){ 160 $objQuery =& SC_Query::getSingletonInstance(); 161 162 // TODO: DBFactory使わないでも共通化できそうな気もしますが 163 $dbFactory = SC_DB_DBFactory::getInstance(); 164 $sql = $dbFactory->getOrderYesterdaySql($method); 165 return $objQuery->getOne($sql); 166 } 167 168 /** 169 * 今月の売上データの取得 170 * 171 * @param string $method 取得タイプ 件数:"COUNT" or 金額:"SUM" 172 * @return integer 結果数値 173 */ 174 function lfGetOrderMonth($method){ 175 $objQuery =& SC_Query::getSingletonInstance(); 150 176 $month = date("Y/m", mktime()); 151 152 if ( $method == 'SUM' or $method == 'COUNT'){ 153 $dbFactory = SC_DB_DBFactory::getInstance(); 154 $sql = $dbFactory->getOrderMonthSql($method); 155 $return = $objQuery->getOne($sql, array($month)); 156 } 157 return $return; 158 } 159 177 178 // TODO: DBFactory使わないでも共通化できそうな気もしますが 179 $dbFactory = SC_DB_DBFactory::getInstance(); 180 $sql = $dbFactory->getOrderMonthSql($method); 181 return $objQuery->getOne($sql, array($month)); 182 } 183 184 /** 185 * 顧客の保持ポイント合計の取得 186 * 187 * @return integer 顧客の保持ポイント合計 188 */ 160 189 function lfGetTotalCustomerPoint() { 161 $objQuery = new SC_Query(); 190 $objQuery =& SC_Query::getSingletonInstance(); 191 162 192 $col = "SUM(point)"; 163 193 $where = "del_flg = 0"; 164 194 $from = "dtb_customer"; 165 $ret = $objQuery->get($col, $from, $where); 166 return $ret; 167 } 168 169 function lfGetReviewYesterday(&$objQuery){ 195 return $objQuery->get($col, $from, $where); 196 } 197 198 /** 199 * 昨日のレビュー書き込み数の取得 200 * 201 * @return integer 昨日のレビュー書き込み数 202 */ 203 function lfGetReviewYesterday(){ 204 $objQuery =& SC_Query::getSingletonInstance(); 205 206 // TODO: DBFactory使わないでも共通化できそうな気もしますが 170 207 $dbFactory = SC_DB_DBFactory::getInstance(); 171 208 $sql = $dbFactory->getReviewYesterdaySql(); 172 $return = $objQuery->getOne($sql); 173 return $return; 174 } 175 176 function lfGetReviewNonDisp(&$objQuery){ 177 $sql = "SELECT COUNT(*) FROM dtb_review AS A LEFT JOIN dtb_products AS B ON A.product_id = B.product_id WHERE A.del_flg=0 AND A.status=2 AND B.del_flg=0"; 178 $return = $objQuery->getOne($sql); 179 return $return; 180 } 181 182 // 品切れ商品IDの取得 209 return $objQuery->getOne($sql); 210 } 211 212 /** 213 * レビュー書き込み非表示数の取得 214 * 215 * @return integer レビュー書き込み非表示数 216 */ 217 function lfGetReviewNonDisp(){ 218 $objQuery =& SC_Query::getSingletonInstance(); 219 220 $table = "dtb_review AS A LEFT JOIN dtb_products AS B ON A.product_id = B.product_id"; 221 $where = "A.del_flg = 0 AND A.status = 2 AND B.del_flg = 0"; 222 return $objQuery->count($table, $where); 223 } 224 225 /** 226 * 品切れ商品の取得 227 * 228 * @return array 品切れ商品一覧 229 */ 183 230 function lfGetSoldOut() { 184 $objQuery = new SC_Query(); 185 $where = "product_id IN (SELECT product_id FROM dtb_products_class WHERE stock_unlimited = 0 AND stock <= 0)"; 186 $arrRet = $objQuery->select("product_id, name", "dtb_products", $where); 187 return $arrRet; 188 } 189 190 // 新規受付一覧 231 $objQuery =& SC_Query::getSingletonInstance(); 232 233 $cols = "product_id, name"; 234 $table = "dtb_products"; 235 $where = "product_id IN (" 236 . "SELECT product_id FROM dtb_products_class " 237 . "WHERE stock_unlimited = ? AND stock <= 0)"; 238 return $objQuery->select($cols, $table, $where, array(UNLIMITED_FLG_LIMITED)); 239 } 240 241 /** 242 * 新規受付一覧の取得 243 * 244 * @return array 新規受付一覧配列 245 */ 191 246 function lfGetNewOrder() { 192 $objQuery = new SC_Query(); 247 $objQuery =& SC_Query::getSingletonInstance(); 248 193 249 $sql = "SELECT 194 250 ord.order_id, … … 228 284 create_date DESC LIMIT 10 OFFSET 0 229 285 ) AS ord"; 230 $arrRet = $objQuery->getAll($sql); 231 return $arrRet; 286 $arrNewOrder = $objQuery->getAll($sql); 287 foreach ($arrNewOrder as $key => $val){ 288 $arrNewOrder[$key]['create_date'] = str_replace("-", "/", substr($val['create_date'], 0,19)); 289 290 } 291 return $arrNewOrder; 232 292 } 233 293 … … 235 295 * リリース情報を取得する. 236 296 * 237 * @return unknown297 * @return array 取得した情報配列 238 298 */ 239 299 function lfGetInfo() { 300 // 更新情報の取得ON/OFF確認 301 if (!ECCUBE_INFO) return array(); 240 302 241 303 // パラメータ「UPDATE_HTTP」が空文字の場合、処理しない。 … … 252 314 253 315 $url = UPDATE_HTTP . $query; 254 $jsonStr = @file_get_contents($url); 316 317 // タイムアウト時間設定 318 $context = array('http' => array('timeout' => HTTP_REQUEST_TIMEOUT)); 319 320 $jsonStr = @file_get_contents($url, false, stream_context_create($context)); 255 321 256 322 $objJson = new Services_JSON; … … 261 327 return array(); 262 328 } 263 264 329 $arrInfo = array(); 265 330 foreach ($arrTmpData as $objData) { 266 331 $arrInfo[] = get_object_vars($objData); 267 332 } 268 269 333 return $arrInfo; 270 334 }
Note: See TracChangeset
for help on using the changeset viewer.