Changeset 23436 for branches/version-2_13-dev/data/class/pages
- Timestamp:
- 2014/05/21 12:33:38 (12 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/version-2_13-dev/data/class/pages/admin/products/LC_Page_Admin_Products_Category.php
r23435 r23436 345 345 public function doUp(&$objFormParam) 346 346 { 347 $objCategory = new SC_Helper_Category_Ex(false); 347 348 $category_id = $objFormParam->getValue('category_id'); 348 349 $objQuery =& SC_Query_Ex::getSingletonInstance(); 350 $objQuery->begin(); 351 $up_id = $this->lfGetUpRankID($objQuery, 'dtb_category', 'parent_category_id', 'category_id', $category_id); 352 if ($up_id != '') { 353 // 上のグループのrankから減算する数 354 $my_count = $this->lfCountChilds($objQuery, 'dtb_category', 'parent_category_id', 'category_id', $category_id); 355 // 自分のグループのrankに加算する数 356 $up_count = $this->lfCountChilds($objQuery, 'dtb_category', 'parent_category_id', 'category_id', $up_id); 357 if ($my_count > 0 && $up_count > 0) { 358 // 自分のグループに加算 359 $this->lfUpRankChilds($objQuery, 'dtb_category', 'parent_category_id', 'category_id', $category_id, $up_count); 360 // 上のグループから減算 361 $this->lfDownRankChilds($objQuery, 'dtb_category', 'parent_category_id', 'category_id', $up_id, $my_count); 362 } 363 } 364 $objQuery->commit(); 349 $objCategory->rankUp($category_id); 365 350 } 366 351 … … 373 358 public function doDown(&$objFormParam) 374 359 { 360 $objCategory = new SC_Helper_Category_Ex(false); 375 361 $category_id = $objFormParam->getValue('category_id'); 376 377 $objQuery =& SC_Query_Ex::getSingletonInstance(); 378 $objQuery->begin(); 379 $down_id = $this->lfGetDownRankID($objQuery, 'dtb_category', 'parent_category_id', 'category_id', $category_id); 380 if ($down_id != '') { 381 // 下のグループのrankに加算する数 382 $my_count = $this->lfCountChilds($objQuery, 'dtb_category', 'parent_category_id', 'category_id', $category_id); 383 // 自分のグループのrankから減算する数 384 $down_count = $this->lfCountChilds($objQuery, 'dtb_category', 'parent_category_id', 'category_id', $down_id); 385 if ($my_count > 0 && $down_count > 0) { 386 // 自分のグループから減算 387 $this->lfUpRankChilds($objQuery, 'dtb_category', 'parent_category_id', 'category_id', $down_id, $my_count); 388 // 下のグループに加算 389 $this->lfDownRankChilds($objQuery, 'dtb_category', 'parent_category_id', 'category_id', $category_id, $down_count); 390 } 391 } 392 $objQuery->commit(); 362 $objCategory->rankDown($category_id); 393 363 } 394 364 … … 497 467 * カテゴリの階層が上限を超えているかを判定する 498 468 * 499 * @param int eger親カテゴリID500 * @ param超えている場合 true469 * @param int $parent_category_id 親カテゴリID 470 * @return bool 超えている場合 true 501 471 */ 502 472 public function isOverLevel($parent_category_id) 503 473 { 504 $objQuery =& SC_Query_Ex::getSingletonInstance(); 505 $level = $objQuery->get('level', 'dtb_category', 'category_id = ?', array($parent_category_id)); 506 507 return $level >= LEVEL_MAX; 508 } 509 510 // 並びが1つ下のIDを取得する。 511 public function lfGetDownRankID($objQuery, $table, $pid_name, $id_name, $id) 512 { 513 // 親IDを取得する。 514 $col = "$pid_name"; 515 $where = "$id_name = ?"; 516 $pid = $objQuery->get($col, $table, $where, $id); 517 // 全ての子を取得する。 518 $col = "$id_name"; 519 $where = "del_flg = 0 AND $pid_name = ? ORDER BY rank DESC"; 520 $arrRet = $objQuery->select($col, $table, $where, array($pid)); 521 $max = count($arrRet); 522 $down_id = ''; 523 for ($cnt = 0; $cnt < $max; $cnt++) { 524 if ($arrRet[$cnt][$id_name] == $id) { 525 $down_id = $arrRet[($cnt + 1)][$id_name]; 526 break; 527 } 528 } 529 530 return $down_id; 531 } 532 533 // 並びが1つ上のIDを取得する。 534 public function lfGetUpRankID($objQuery, $table, $pid_name, $id_name, $id) 535 { 536 // 親IDを取得する。 537 $col = "$pid_name"; 538 $where = "$id_name = ?"; 539 $pid = $objQuery->get($col, $table, $where, $id); 540 // 全ての子を取得する。 541 $col = "$id_name"; 542 $where = "del_flg = 0 AND $pid_name = ? ORDER BY rank DESC"; 543 $arrRet = $objQuery->select($col, $table, $where, array($pid)); 544 $max = count($arrRet); 545 $up_id = ''; 546 for ($cnt = 0; $cnt < $max; $cnt++) { 547 if ($arrRet[$cnt][$id_name] == $id) { 548 $up_id = $arrRet[($cnt - 1)][$id_name]; 549 break; 550 } 551 } 552 553 return $up_id; 474 $objCategory = new SC_Helper_Category_Ex(); 475 $arrCategory = $objCategory->get($parent_category_id); 476 477 return $arrCategory['level'] >= LEVEL_MAX; 554 478 } 555 479
Note: See TracChangeset
for help on using the changeset viewer.
