Changeset 614 for trunk/admin/update.php
- Timestamp:
- Nov 23, 2004, 11:31:24 PM (20 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/admin/update.php
r610 r614 38 38 39 39 /** 40 * order categories (update categories.rank database field)40 * order categories (update categories.rank and global_rank database fields) 41 41 * 42 42 * the purpose of this function is to give a rank for all categories 43 43 * (insides its sub-category), even the newer that have none at te 44 44 * beginning. For this, ordering function selects all categories ordered by 45 * rank ASC then name ASC for each uppercat. 45 * rank ASC then name ASC for each uppercat. It also updates the global rank 46 * which is able to order any two categorie in the whole tree 46 47 * 47 48 * @returns void … … 69 70 SET rank = '.++$current_rank.' 70 71 WHERE id = '.$row['id'].' 72 ;'; 73 pwg_query($query); 74 } 75 // global rank update 76 $query = ' 77 UPDATE '.CATEGORIES_TABLE.' 78 SET global_rank = rank 79 WHERE id_uppercat IS NULL 80 ;'; 81 pwg_query($query); 82 83 $query = ' 84 SELECT DISTINCT(id_uppercat) 85 FROM '.CATEGORIES_TABLE.' 86 WHERE id_uppercat IS NOT NULL 87 ;'; 88 $result = pwg_query($query); 89 while ($row = mysql_fetch_array($result)) 90 { 91 $query = ' 92 SELECT global_rank 93 FROM '.CATEGORIES_TABLE.' 94 WHERE id = '.$row['id_uppercat'].' 95 ;'; 96 list($uppercat_global_rank) = mysql_fetch_array(pwg_query($query)); 97 $query = ' 98 UPDATE '.CATEGORIES_TABLE.' 99 SET global_rank = CONCAT(\''.$uppercat_global_rank.'\', \'.\', rank) 100 WHERE id_uppercat = '.$row['id_uppercat'].' 71 101 ;'; 72 102 pwg_query($query); … … 572 602 573 603 $query = ' 574 SELECT id 604 SELECT id,name,uppercats,global_rank 575 605 FROM '.CATEGORIES_TABLE.' 576 WHERE site_id != 1 577 ;'; 578 $result = pwg_query($query); 579 while ($row = mysql_fetch_array($result)) 580 { 581 array_push($user['restrictions'], $row['id']); 582 } 583 $user['forbidden_categories'] = implode(',', $user['restrictions']); 584 $user['expand'] = true; 585 $structure = create_user_structure(''); 586 display_select_categories($structure, 587 ' ', 588 array(), 589 'introduction.category_option', 590 array()); 606 WHERE site_id = 1 607 ;'; 608 display_select_cat_wrapper($query, 609 array(), 610 'introduction.category_option', 611 false); 591 612 } 592 613 // +-----------------------------------------------------------------------+
Note: See TracChangeset
for help on using the changeset viewer.