Changeset 6336
- Timestamp:
- 2006/10/13 18:28:45 (20 years ago)
- File:
-
- 1 edited
-
temp/trunk/data/update/admin/products/category.php (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
temp/trunk/data/update/admin/products/category.php
r6335 r6336 17 17 } 18 18 19 $conn = new SC_DBConn();20 $objPage = new UC_Page();21 $objView = new SC_AdminView();22 $objSess = new SC_Session();23 19 24 // ǧ¾Ú²ÄÈݤÎȽÄê 25 sfIsSuccess($objSess); 26 27 // ¥Ñ¥é¥á¡¼¥¿´ÉÍý¥¯¥é¥¹ 28 $objFormParam = new SC_FormParam(); 29 30 // ¥Ñ¥é¥á¡¼¥¿¾ðÊó¤Î½é´ü²½ 31 lfInitParam(); 32 // POSTÃͤμèÆÀ 33 $objFormParam->setParam($_POST); 34 35 // Ä̾ï»þ¤Ï¿Æ¥«¥Æ¥´¥ê¤ò0¤ËÀßÄꤹ¤ë¡£ 36 $objPage->arrForm['parent_category_id'] = $_POST['parent_category_id']; 37 38 switch($_POST['mode']) { 39 case 'edit': 40 $objFormParam->convParam(); 41 $arrRet = $objFormParam->getHashArray(); 42 $objPage->arrErr = lfCheckError($arrRet); 20 function lfCategoryPHP() { 21 $conn = new SC_DBConn(); 22 $objPage = new UC_Page(); 23 $objView = new SC_AdminView(); 24 $objSess = new SC_Session(); 43 25 44 if(count($objPage->arrErr) == 0) { 45 if($_POST['category_id'] == "") { 46 $objQuery = new SC_Query(); 47 $count = $objQuery->count("dtb_category"); 48 if($count < CATEGORY_MAX) { 49 lfInsertCat($_POST['parent_category_id']); 26 // ǧ¾Ú²ÄÈݤÎȽÄê 27 sfIsSuccess($objSess); 28 29 // ¥Ñ¥é¥á¡¼¥¿´ÉÍý¥¯¥é¥¹ 30 $objFormParam = new SC_FormParam(); 31 32 // ¥Ñ¥é¥á¡¼¥¿¾ðÊó¤Î½é´ü²½ 33 lfInitParam(); 34 // POSTÃͤμèÆÀ 35 $objFormParam->setParam($_POST); 36 37 // Ä̾ï»þ¤Ï¿Æ¥«¥Æ¥´¥ê¤ò0¤ËÀßÄꤹ¤ë¡£ 38 $objPage->arrForm['parent_category_id'] = $_POST['parent_category_id']; 39 40 switch($_POST['mode']) { 41 case 'edit': 42 $objFormParam->convParam(); 43 $arrRet = $objFormParam->getHashArray(); 44 $objPage->arrErr = lfCheckError($arrRet); 45 46 if(count($objPage->arrErr) == 0) { 47 if($_POST['category_id'] == "") { 48 $objQuery = new SC_Query(); 49 $count = $objQuery->count("dtb_category"); 50 if($count < CATEGORY_MAX) { 51 lfInsertCat($_POST['parent_category_id']); 52 } else { 53 print("¥«¥Æ¥´¥ê¤ÎÅÐÏ¿ºÇÂç¿ô¤òͤ¨¤Þ¤·¤¿¡£"); 54 } 50 55 } else { 51 print("¥«¥Æ¥´¥ê¤ÎÅÐÏ¿ºÇÂç¿ô¤òͤ¨¤Þ¤·¤¿¡£");56 lfUpdateCat($_POST['category_id']); 52 57 } 53 58 } else { 54 lfUpdateCat($_POST['category_id']); 59 $objPage->arrForm = array_merge($objPage->arrForm, $objFormParam->getHashArray()); 60 $objPage->arrForm['category_id'] = $_POST['category_id']; 55 61 } 56 } else { 57 $objPage->arrForm = array_merge($objPage->arrForm, $objFormParam->getHashArray()); 62 break; 63 case 'pre_edit': 64 // ÊÔ½¸¹àÌܤΥ«¥Æ¥´¥ê̾¤òDB¤è¤ê¼èÆÀ¤¹¤ë¡£ 65 $oquery = new SC_Query(); 66 $where = "category_id = ?"; 67 $cat_name = $oquery->get("dtb_category", "category_name", $where, array($_POST['category_id'])); 68 // ÆþÎϹàÌܤ˥«¥Æ¥´¥ê̾¤òÆþÎϤ¹¤ë¡£ 69 $objPage->arrForm['category_name'] = $cat_name; 70 // POST¥Ç¡¼¥¿¤ò°ú¤·Ñ¤° 58 71 $objPage->arrForm['category_id'] = $_POST['category_id']; 72 break; 73 case 'delete': 74 $objQuery = new SC_Query(); 75 // »Ò¥«¥Æ¥´¥ê¤Î¥Á¥§¥Ã¥¯ 76 $where = "parent_category_id = ? AND del_flg = 0"; 77 $count = $objQuery->count("dtb_category", $where, array($_POST['category_id'])); 78 if($count != 0) { 79 $objPage->arrErr['category_name'] = "¢¨ »Ò¥«¥Æ¥´¥ê¤¬Â¸ºß¤¹¤ë¤¿¤áºï½ü¤Ç¤¤Þ¤»¤ó¡£<br>"; 80 } 81 // ÅÐÏ¿¾¦ÉʤΥÁ¥§¥Ã¥¯ 82 $where = "category_id = ? AND del_flg = 0"; 83 $count = $objQuery->count("dtb_products", $where, array($_POST['category_id'])); 84 if($count != 0) { 85 $objPage->arrErr['category_name'] = "¢¨ ¥«¥Æ¥´¥êÆâ¤Ë¾¦Éʤ¬Â¸ºß¤¹¤ë¤¿¤áºï½ü¤Ç¤¤Þ¤»¤ó¡£<br>"; 86 } 87 88 if(!isset($objPage->arrErr['category_name'])) { 89 // ¥é¥ó¥¯ÉÕ¤¥ì¥³¡¼¥É¤Îºï½ü(¢¨½èÍýÉé²Ù¤ò¹Íθ¤·¤Æ¥ì¥³¡¼¥É¤´¤Èºï½ü¤¹¤ë¡£) 90 sfDeleteRankRecord("dtb_category", "category_id", $_POST['category_id'], "", true); 91 } 92 break; 93 case 'up': 94 $objQuery = new SC_Query(); 95 $objQuery->begin(); 96 $up_id = lfGetUpRankID($objQuery, "dtb_category", "parent_category_id", "category_id", $_POST['category_id']); 97 if($up_id != "") { 98 // ¾å¤Î¥°¥ë¡¼¥×¤Îrank¤«¤é¸º»»¤¹¤ë¿ô 99 $my_count = lfCountChilds($objQuery, "dtb_category", "parent_category_id", "category_id", $_POST['category_id']); 100 // ¼«Ê¬¤Î¥°¥ë¡¼¥×¤Îrank¤Ë²Ã»»¤¹¤ë¿ô 101 $up_count = lfCountChilds($objQuery, "dtb_category", "parent_category_id", "category_id", $up_id); 102 if($my_count > 0 && $up_count > 0) { 103 // ¼«Ê¬¤Î¥°¥ë¡¼¥×¤Ë²Ã»» 104 lfUpRankChilds($objQuery, "dtb_category", "parent_category_id", "category_id", $_POST['category_id'], $up_count); 105 // ¾å¤Î¥°¥ë¡¼¥×¤«¤é¸º»» 106 lfDownRankChilds($objQuery, "dtb_category", "parent_category_id", "category_id", $up_id, $my_count); 107 } 108 } 109 $objQuery->commit(); 110 break; 111 case 'down': 112 $objQuery = new SC_Query(); 113 $objQuery->begin(); 114 $down_id = lfGetDownRankID($objQuery, "dtb_category", "parent_category_id", "category_id", $_POST['category_id']); 115 if($down_id != "") { 116 // ²¼¤Î¥°¥ë¡¼¥×¤Îrank¤Ë²Ã»»¤¹¤ë¿ô 117 $my_count = lfCountChilds($objQuery, "dtb_category", "parent_category_id", "category_id", $_POST['category_id']); 118 // ¼«Ê¬¤Î¥°¥ë¡¼¥×¤Îrank¤«¤é¸º»»¤¹¤ë¿ô 119 $down_count = lfCountChilds($objQuery, "dtb_category", "parent_category_id", "category_id", $down_id); 120 if($my_count > 0 && $down_count > 0) { 121 // ¼«Ê¬¤Î¥°¥ë¡¼¥×¤«¤é¸º»» 122 lfUpRankChilds($objQuery, "dtb_category", "parent_category_id", "category_id", $down_id, $my_count); 123 // ²¼¤Î¥°¥ë¡¼¥×¤Ë²Ã»» 124 lfDownRankChilds($objQuery, "dtb_category", "parent_category_id", "category_id", $_POST['category_id'], $down_count); 125 } 126 } 127 $objQuery->commit(); 128 break; 129 case 'tree': 130 break; 131 default: 132 $objPage->arrForm['parent_category_id'] = 0; 133 break; 59 134 } 60 break;61 case 'pre_edit':62 // ÊÔ½¸¹àÌܤΥ«¥Æ¥´¥ê̾¤òDB¤è¤ê¼èÆÀ¤¹¤ë¡£63 $oquery = new SC_Query();64 $where = "category_id = ?";65 $cat_name = $oquery->get("dtb_category", "category_name", $where, array($_POST['category_id']));66 // ÆþÎϹàÌܤ˥«¥Æ¥´¥ê̾¤òÆþÎϤ¹¤ë¡£67 $objPage->arrForm['category_name'] = $cat_name;68 // POST¥Ç¡¼¥¿¤ò°ú¤·Ñ¤°69 $objPage->arrForm['category_id'] = $_POST['category_id'];70 break;71 case 'delete':72 $objQuery = new SC_Query();73 // »Ò¥«¥Æ¥´¥ê¤Î¥Á¥§¥Ã¥¯74 $where = "parent_category_id = ? AND del_flg = 0";75 $count = $objQuery->count("dtb_category", $where, array($_POST['category_id']));76 if($count != 0) {77 $objPage->arrErr['category_name'] = "¢¨ »Ò¥«¥Æ¥´¥ê¤¬Â¸ºß¤¹¤ë¤¿¤áºï½ü¤Ç¤¤Þ¤»¤ó¡£<br>";78 }79 // ÅÐÏ¿¾¦ÉʤΥÁ¥§¥Ã¥¯80 $where = "category_id = ? AND del_flg = 0";81 $count = $objQuery->count("dtb_products", $where, array($_POST['category_id']));82 if($count != 0) {83 $objPage->arrErr['category_name'] = "¢¨ ¥«¥Æ¥´¥êÆâ¤Ë¾¦Éʤ¬Â¸ºß¤¹¤ë¤¿¤áºï½ü¤Ç¤¤Þ¤»¤ó¡£<br>";84 }85 135 86 if(!isset($objPage->arrErr['category_name'])) { 87 // ¥é¥ó¥¯ÉÕ¤¥ì¥³¡¼¥É¤Îºï½ü(¢¨½èÍýÉé²Ù¤ò¹Íθ¤·¤Æ¥ì¥³¡¼¥É¤´¤Èºï½ü¤¹¤ë¡£) 88 sfDeleteRankRecord("dtb_category", "category_id", $_POST['category_id'], "", true); 89 } 90 break; 91 case 'up': 92 $objQuery = new SC_Query(); 93 $objQuery->begin(); 94 $up_id = lfGetUpRankID($objQuery, "dtb_category", "parent_category_id", "category_id", $_POST['category_id']); 95 if($up_id != "") { 96 // ¾å¤Î¥°¥ë¡¼¥×¤Îrank¤«¤é¸º»»¤¹¤ë¿ô 97 $my_count = lfCountChilds($objQuery, "dtb_category", "parent_category_id", "category_id", $_POST['category_id']); 98 // ¼«Ê¬¤Î¥°¥ë¡¼¥×¤Îrank¤Ë²Ã»»¤¹¤ë¿ô 99 $up_count = lfCountChilds($objQuery, "dtb_category", "parent_category_id", "category_id", $up_id); 100 if($my_count > 0 && $up_count > 0) { 101 // ¼«Ê¬¤Î¥°¥ë¡¼¥×¤Ë²Ã»» 102 lfUpRankChilds($objQuery, "dtb_category", "parent_category_id", "category_id", $_POST['category_id'], $up_count); 103 // ¾å¤Î¥°¥ë¡¼¥×¤«¤é¸º»» 104 lfDownRankChilds($objQuery, "dtb_category", "parent_category_id", "category_id", $up_id, $my_count); 105 } 106 } 107 $objQuery->commit(); 108 break; 109 case 'down': 110 $objQuery = new SC_Query(); 111 $objQuery->begin(); 112 $down_id = lfGetDownRankID($objQuery, "dtb_category", "parent_category_id", "category_id", $_POST['category_id']); 113 if($down_id != "") { 114 // ²¼¤Î¥°¥ë¡¼¥×¤Îrank¤Ë²Ã»»¤¹¤ë¿ô 115 $my_count = lfCountChilds($objQuery, "dtb_category", "parent_category_id", "category_id", $_POST['category_id']); 116 // ¼«Ê¬¤Î¥°¥ë¡¼¥×¤Îrank¤«¤é¸º»»¤¹¤ë¿ô 117 $down_count = lfCountChilds($objQuery, "dtb_category", "parent_category_id", "category_id", $down_id); 118 if($my_count > 0 && $down_count > 0) { 119 // ¼«Ê¬¤Î¥°¥ë¡¼¥×¤«¤é¸º»» 120 lfUpRankChilds($objQuery, "dtb_category", "parent_category_id", "category_id", $down_id, $my_count); 121 // ²¼¤Î¥°¥ë¡¼¥×¤Ë²Ã»» 122 lfDownRankChilds($objQuery, "dtb_category", "parent_category_id", "category_id", $_POST['category_id'], $down_count); 123 } 124 } 125 $objQuery->commit(); 126 break; 127 case 'tree': 128 break; 129 default: 130 $objPage->arrForm['parent_category_id'] = 0; 131 break; 136 $objPage->arrList = lfGetCat($objPage->arrForm['parent_category_id']); 137 $objPage->arrTree = sfGetCatTree($objPage->arrForm['parent_category_id']); 138 139 $objView->assignobj($objPage); 140 $objView->display(MAIN_FRAME); 132 141 } 133 134 print("test");135 136 $objPage->arrList = lfGetCat($objPage->arrForm['parent_category_id']);137 $objPage->arrTree = sfGetCatTree($objPage->arrForm['parent_category_id']);138 139 $objView->assignobj($objPage);140 $objView->display(MAIN_FRAME);141 142 exit;143 142 144 143 //-----------------------------------------------------------------------------------------------------------------------------------
Note: See TracChangeset
for help on using the changeset viewer.
