Ignore:
Timestamp:
2007/03/11 06:27:25 (17 years ago)
Author:
nanasess
Message:

r11729 の変更を取消

File:
1 edited

Legend:

Unmodified
Added
Removed
  • branches/comu/html/admin/products/category.php

    r11729 r11730  
    1414        $this->tpl_subno = 'category'; 
    1515        $this->tpl_onload = " fnSetFocus('category_name'); "; 
    16         $this->tpl_subtitle = 'カテゴリー登録'; 
     16        $this->tpl_subtitle = '¥«¥Æ¥´¥ê¡¼ÅÐÏ¿'; 
    1717    } 
    1818} 
     
    2323$objSess = new SC_Session(); 
    2424 
    25 // 認証可否の判定 
     25// ǧ¾Ú²ÄÈݤÎȽÄê 
    2626sfIsSuccess($objSess); 
    2727 
    28 // パラメータ管理クラス 
     28// ¥Ñ¥é¥á¡¼¥¿´ÉÍý¥¯¥é¥¹ 
    2929$objFormParam = new SC_FormParam(); 
    30 // パラメータ情報の初期化 
     30// ¥Ñ¥é¥á¡¼¥¿¾ðÊó¤Î½é´ü²½ 
    3131lfInitParam(); 
    32 // POST値の取得 
     32// POSTÃͤμèÆÀ 
    3333$objFormParam->setParam($_POST); 
    3434 
    35 // 通常時は親カテゴリを0に設定する。 
     35// Ä̾ï»þ¤Ï¿Æ¥«¥Æ¥´¥ê¤ò0¤ËÀßÄꤹ¤ë¡£ 
    3636$objPage->arrForm['parent_category_id'] = $_POST['parent_category_id']; 
    3737 
     
    4949                lfInsertCat($_POST['parent_category_id']); 
    5050            } else { 
    51                 print("カテゴリの登録最大数を超えました。"); 
     51                print("¥«¥Æ¥´¥ê¤ÎÅÐÏ¿ºÇÂç¿ô¤òĶ¤¨¤Þ¤·¤¿¡£"); 
    5252            } 
    5353        } else { 
     
    6060    break; 
    6161case 'pre_edit': 
    62     // 編集項目のカテゴリ名をDBより取得する。 
     62    // ÊÔ½¸¹àÌܤΥ«¥Æ¥´¥ê̾¤òDB¤è¤ê¼èÆÀ¤¹¤ë¡£ 
    6363    $oquery = new SC_Query(); 
    6464    $where = "category_id = ?"; 
    6565    $cat_name = $oquery->get("dtb_category", "category_name", $where, array($_POST['category_id'])); 
    66     // 入力項目にカテゴリ名を入力する。 
     66    // ÆþÎϹàÌܤ˥«¥Æ¥´¥ê̾¤òÆþÎϤ¹¤ë¡£ 
    6767    $objPage->arrForm['category_name'] = $cat_name; 
    68     // POSTデータを引き継ぐ 
     68    // POST¥Ç¡¼¥¿¤ò°ú¤­·Ñ¤° 
    6969    $objPage->arrForm['category_id'] = $_POST['category_id']; 
    7070    break; 
    7171case 'delete': 
    7272    $objQuery = new SC_Query(); 
    73     // 子カテゴリのチェック 
     73    // »Ò¥«¥Æ¥´¥ê¤Î¥Á¥§¥Ã¥¯ 
    7474    $where = "parent_category_id = ? AND del_flg = 0"; 
    7575    $count = $objQuery->count("dtb_category", $where, array($_POST['category_id'])); 
    7676    if($count != 0) { 
    77         $objPage->arrErr['category_name'] = "※ 子カテゴリが存在するため削除できません。<br>"; 
    78     } 
    79     // 登録商品のチェック 
     77        $objPage->arrErr['category_name'] = "¢¨ »Ò¥«¥Æ¥´¥ê¤¬Â¸ºß¤¹¤ë¤¿¤áºï½ü¤Ç¤­¤Þ¤»¤ó¡£<br>"; 
     78    } 
     79    // ÅÐÏ¿¾¦ÉʤΥÁ¥§¥Ã¥¯ 
    8080    $where = "category_id = ? AND del_flg = 0"; 
    8181    $count = $objQuery->count("dtb_products", $where, array($_POST['category_id'])); 
    8282    if($count != 0) { 
    83         $objPage->arrErr['category_name'] = "※ カテゴリ内に商品が存在するため削除できません。<br>"; 
     83        $objPage->arrErr['category_name'] = "¢¨ ¥«¥Æ¥´¥êÆâ¤Ë¾¦Éʤ¬Â¸ºß¤¹¤ë¤¿¤áºï½ü¤Ç¤­¤Þ¤»¤ó¡£<br>"; 
    8484    }    
    8585     
    8686    if(!isset($objPage->arrErr['category_name'])) { 
    87         // ランク付きレコードの削除(※処理負荷を考慮してレコードごと削除する。) 
     87        // ¥é¥ó¥¯ÉÕ¤­¥ì¥³¡¼¥É¤Îºï½ü(¢¨½èÍýÉé²Ù¤ò¹Íθ¤·¤Æ¥ì¥³¡¼¥É¤´¤Èºï½ü¤¹¤ë¡£) 
    8888        sfDeleteRankRecord("dtb_category", "category_id", $_POST['category_id'], "", true); 
    8989    } 
     
    9494    $up_id = lfGetUpRankID($objQuery, "dtb_category", "parent_category_id", "category_id", $_POST['category_id']); 
    9595    if($up_id != "") { 
    96         // 上のグループのrankから減算する数 
     96        // ¾å¤Î¥°¥ë¡¼¥×¤Îrank¤«¤é¸º»»¤¹¤ë¿ô 
    9797        $my_count = lfCountChilds($objQuery, "dtb_category", "parent_category_id", "category_id", $_POST['category_id']); 
    98         // 自分のグループのrankに加算する数 
     98        // ¼«Ê¬¤Î¥°¥ë¡¼¥×¤Îrank¤Ë²Ã»»¤¹¤ë¿ô 
    9999        $up_count = lfCountChilds($objQuery, "dtb_category", "parent_category_id", "category_id", $up_id); 
    100100        if($my_count > 0 && $up_count > 0) { 
    101             // 自分のグループに加算 
     101            // ¼«Ê¬¤Î¥°¥ë¡¼¥×¤Ë²Ã»» 
    102102            lfUpRankChilds($objQuery, "dtb_category", "parent_category_id", "category_id", $_POST['category_id'], $up_count); 
    103             // 上のグループから減算 
     103            // ¾å¤Î¥°¥ë¡¼¥×¤«¤é¸º»» 
    104104            lfDownRankChilds($objQuery, "dtb_category", "parent_category_id", "category_id", $up_id, $my_count); 
    105105        } 
     
    112112    $down_id = lfGetDownRankID($objQuery, "dtb_category", "parent_category_id", "category_id", $_POST['category_id']); 
    113113    if($down_id != "") { 
    114         // 下のグループのrankに加算する数 
     114        // ²¼¤Î¥°¥ë¡¼¥×¤Îrank¤Ë²Ã»»¤¹¤ë¿ô 
    115115        $my_count = lfCountChilds($objQuery, "dtb_category", "parent_category_id", "category_id", $_POST['category_id']); 
    116         // 自分のグループのrankから減算する数 
     116        // ¼«Ê¬¤Î¥°¥ë¡¼¥×¤Îrank¤«¤é¸º»»¤¹¤ë¿ô 
    117117        $down_count = lfCountChilds($objQuery, "dtb_category", "parent_category_id", "category_id", $down_id); 
    118118        if($my_count > 0 && $down_count > 0) { 
    119             // 自分のグループから減算 
     119            // ¼«Ê¬¤Î¥°¥ë¡¼¥×¤«¤é¸º»» 
    120120            lfUpRankChilds($objQuery, "dtb_category", "parent_category_id", "category_id", $down_id, $my_count); 
    121             // 下のグループに加算 
     121            // ²¼¤Î¥°¥ë¡¼¥×¤Ë²Ã»» 
    122122            lfDownRankChilds($objQuery, "dtb_category", "parent_category_id", "category_id", $_POST['category_id'], $down_count); 
    123123        } 
     
    139139//----------------------------------------------------------------------------------------------------------------------------------- 
    140140 
    141 // カテゴリの新規追加 
     141// ¥«¥Æ¥´¥ê¤Î¿·µ¬Äɲà
    142142function lfInsertCat($parent_category_id) { 
    143143    global $objFormParam; 
    144144     
    145145    $objQuery = new SC_Query(); 
    146     $objQuery->begin(); // トランザクションの開始 
     146    $objQuery->begin(); // ¥È¥é¥ó¥¶¥¯¥·¥ç¥ó¤Î³«»Ï 
    147147     
    148148     
    149149    if($parent_category_id == 0) { 
    150         // ROOT階層で最大のランクを取得する。       
     150        // ROOT³¬ÁؤǺÇÂç¤Î¥é¥ó¥¯¤ò¼èÆÀ¤¹¤ë¡£        
    151151        $where = "parent_category_id = ?"; 
    152152        $rank = $objQuery->max("dtb_category", "rank", $where, array($parent_category_id)) + 1; 
    153153    } else { 
    154         // 親のランクを自分のランクとする。 
     154        // ¿Æ¤Î¥é¥ó¥¯¤ò¼«Ê¬¤Î¥é¥ó¥¯¤È¤¹¤ë¡£ 
    155155        $where = "category_id = ?"; 
    156156        $rank = $objQuery->get("dtb_category", "rank", $where, array($parent_category_id)); 
    157         // 追加レコードのランク以上のレコードを一つあげる。 
     157        // Äɲå쥳¡¼¥É¤Î¥é¥ó¥¯°Ê¾å¤Î¥ì¥³¡¼¥É¤ò°ì¤Ä¤¢¤²¤ë¡£ 
    158158        $sqlup = "UPDATE dtb_category SET rank = (rank + 1) WHERE rank >= ?"; 
    159159        $objQuery->exec($sqlup, array($rank)); 
     
    161161     
    162162    $where = "category_id = ?"; 
    163     // 自分のレベルを取得する(親のレベル + 1)    
     163    // ¼«Ê¬¤Î¥ì¥Ù¥ë¤ò¼èÆÀ¤¹¤ë(¿Æ¤Î¥ì¥Ù¥ë + 1)    
    164164    $level = $objQuery->get("dtb_category", "level", $where, array($parent_category_id)) + 1; 
    165165     
    166     // 入力データを渡す。 
     166    // ÆþÎϥǡ¼¥¿¤òÅϤ¹¡£ 
    167167    $sqlval = $objFormParam->getHashArray(); 
    168168    $sqlval['create_date'] = "Now()"; 
     
    173173    $sqlval['level'] = $level; 
    174174     
    175     // INSERTの実行 
     175    // INSERT¤Î¼Â¹Ô 
    176176    $objQuery->insert("dtb_category", $sqlval); 
    177177     
    178     $objQuery->commit();    // トランザクションの終了 
    179 } 
    180  
    181 // カテゴリの編集 
     178    $objQuery->commit();    // ¥È¥é¥ó¥¶¥¯¥·¥ç¥ó¤Î½ªÎ» 
     179} 
     180 
     181// ¥«¥Æ¥´¥ê¤ÎÊÔ½¸ 
    182182function lfUpdateCat($category_id) { 
    183183    global $objFormParam; 
    184184    $objQuery = new SC_Query(); 
    185     // 入力データを渡す。 
     185    // ÆþÎϥǡ¼¥¿¤òÅϤ¹¡£ 
    186186    $sqlval = $objFormParam->getHashArray(); 
    187187    $sqlval['update_date'] = "Now()"; 
     
    190190} 
    191191 
    192 // カテゴリの取得 
     192// ¥«¥Æ¥´¥ê¤Î¼èÆÀ 
    193193function lfGetCat($parent_category_id) { 
    194194    $objQuery = new SC_Query(); 
     
    205205} 
    206206 
    207 /* パラメータ情報の初期化 */ 
     207/* ¥Ñ¥é¥á¡¼¥¿¾ðÊó¤Î½é´ü²½ */ 
    208208function lfInitParam() { 
    209209    global $objFormParam; 
    210     $objFormParam->addParam("カテゴリ名", "category_name", STEXT_LEN, "KVa", array("EXIST_CHECK","SPTAB_CHECK","MAX_LENGTH_CHECK")); 
    211 } 
    212  
    213 /* 入力内容のチェック */ 
     210    $objFormParam->addParam("¥«¥Æ¥´¥ê̾", "category_name", STEXT_LEN, "KVa", array("EXIST_CHECK","SPTAB_CHECK","MAX_LENGTH_CHECK")); 
     211} 
     212 
     213/* ÆþÎÏÆâÍƤΥÁ¥§¥Ã¥¯ */ 
    214214function lfCheckError($array) { 
    215215    global $objFormParam; 
     
    217217    $objErr->arrErr = $objFormParam->checkError(); 
    218218     
    219     // 階層チェック 
     219    // ³¬ÁØ¥Á¥§¥Ã¥¯ 
    220220    if(!isset($objErr->arrErr['category_name'])) { 
    221221        $objQuery = new SC_Query(); 
     
    223223         
    224224        if($level >= LEVEL_MAX) { 
    225             $objErr->arrErr['category_name'] = "※ ".LEVEL_MAX."階層以上の登録はできません。<br>"; 
     225            $objErr->arrErr['category_name'] = "¢¨ ".LEVEL_MAX."³¬Áذʾå¤ÎÅÐÏ¿¤Ï¤Ç¤­¤Þ¤»¤ó¡£<br>"; 
    226226        } 
    227227    } 
    228228         
    229     // 重複チェック 
     229    // ½ÅÊ£¥Á¥§¥Ã¥¯ 
    230230    if(!isset($objErr->arrErr['category_name'])) { 
    231231        $objQuery = new SC_Query(); 
    232232        $where = "parent_category_id = ? AND category_name = ?"; 
    233233        $arrRet = $objQuery->select("category_id, category_name", "dtb_category", $where, array($_POST['parent_category_id'], $array['category_name'])); 
    234         // 編集中のレコード以外に同じ名称が存在する場合 
     234        // ÊÔ½¸Ãæ¤Î¥ì¥³¡¼¥É°Ê³°¤ËƱ¤¸Ì¾¾Î¤¬Â¸ºß¤¹¤ë¾ì¹ç 
    235235        if ($arrRet[0]['category_id'] != $_POST['category_id'] && $arrRet[0]['category_name'] == $_POST['category_name']) { 
    236             $objErr->arrErr['category_name'] = "※ 既に同じ内容の登録が存在します。<br>"; 
     236            $objErr->arrErr['category_name'] = "¢¨ ´û¤ËƱ¤¸ÆâÍƤÎÅÐÏ¿¤¬Â¸ºß¤·¤Þ¤¹¡£<br>"; 
    237237        } 
    238238    } 
     
    242242 
    243243 
    244 // 並びが1つ下のIDを取得する。 
     244// ʤӤ¬1¤Ä²¼¤ÎID¤ò¼èÆÀ¤¹¤ë¡£ 
    245245function lfGetDownRankID($objQuery, $table, $pid_name, $id_name, $id) { 
    246     // 親IDを取得する。 
     246    // ¿ÆID¤ò¼èÆÀ¤¹¤ë¡£ 
    247247    $col = "$pid_name"; 
    248248    $where = "$id_name = ?"; 
    249249    $pid = $objQuery->get($table, $col, $where, $id); 
    250     // すべての子を取得する。 
     250    // ¤¹¤Ù¤Æ¤Î»Ò¤ò¼èÆÀ¤¹¤ë¡£ 
    251251    $col = "$id_name"; 
    252252    $where = "del_flg = 0 AND $pid_name = ? ORDER BY rank DESC"; 
     
    263263} 
    264264 
    265 // 並びが1つ上のIDを取得する。 
     265// ʤӤ¬1¤Ä¾å¤ÎID¤ò¼èÆÀ¤¹¤ë¡£ 
    266266function lfGetUpRankID($objQuery, $table, $pid_name, $id_name, $id) { 
    267     // 親IDを取得する。 
     267    // ¿ÆID¤ò¼èÆÀ¤¹¤ë¡£ 
    268268    $col = "$pid_name"; 
    269269    $where = "$id_name = ?"; 
    270270    $pid = $objQuery->get($table, $col, $where, $id); 
    271     // すべての子を取得する。 
     271    // ¤¹¤Ù¤Æ¤Î»Ò¤ò¼èÆÀ¤¹¤ë¡£ 
    272272    $col = "$id_name"; 
    273273    $where = "del_flg = 0 AND $pid_name = ? ORDER BY rank DESC"; 
     
    285285 
    286286function lfCountChilds($objQuery, $table, $pid_name, $id_name, $id) { 
    287     // 子ID一覧を取得 
     287    // »ÒID°ìÍ÷¤ò¼èÆÀ 
    288288    $arrRet = sfGetChildrenArray($table, $pid_name, $id_name, $id);  
    289289    return count($arrRet); 
     
    291291 
    292292function lfUpRankChilds($objQuery, $table, $pid_name, $id_name, $id, $count) { 
    293     // 子ID一覧を取得 
     293    // »ÒID°ìÍ÷¤ò¼èÆÀ 
    294294    $arrRet = sfGetChildrenArray($table, $pid_name, $id_name, $id);  
    295295    $line = sfGetCommaList($arrRet); 
     
    301301 
    302302function lfDownRankChilds($objQuery, $table, $pid_name, $id_name, $id, $count) { 
    303     // 子ID一覧を取得 
     303    // »ÒID°ìÍ÷¤ò¼èÆÀ 
    304304    $arrRet = sfGetChildrenArray($table, $pid_name, $id_name, $id);  
    305305    $line = sfGetCommaList($arrRet); 
Note: See TracChangeset for help on using the changeset viewer.