- Timestamp:
- Dec 5, 2004, 11:47:46 PM (20 years ago)
- Location:
- trunk/admin
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/admin/include/functions.php
r637 r638 1165 1165 mass_updates(CATEGORIES_TABLE, $fields, $datas); 1166 1166 } 1167 1168 /** 1169 * order categories (update categories.rank and global_rank database fields) 1170 * 1171 * the purpose of this function is to give a rank for all categories 1172 * (insides its sub-category), even the newer that have none at te 1173 * beginning. For this, ordering function selects all categories ordered by 1174 * rank ASC then name ASC for each uppercat. 1175 * 1176 * @returns void 1177 */ 1178 function ordering() 1179 { 1180 $current_rank = 0; 1181 $current_uppercat = ''; 1182 1183 $query = ' 1184 SELECT id, if(id_uppercat is null,\'\',id_uppercat) AS id_uppercat 1185 FROM '.CATEGORIES_TABLE.' 1186 ORDER BY id_uppercat,rank,name 1187 ;'; 1188 $result = pwg_query($query); 1189 $datas = array(); 1190 while ($row = mysql_fetch_array($result)) 1191 { 1192 if ($row['id_uppercat'] != $current_uppercat) 1193 { 1194 $current_rank = 0; 1195 $current_uppercat = $row['id_uppercat']; 1196 } 1197 $data = array('id' => $row['id'], 'rank' => ++$current_rank); 1198 array_push($datas, $data); 1199 } 1200 1201 $fields = array('primary' => array('id'), 'update' => array('rank')); 1202 mass_updates(CATEGORIES_TABLE, $fields, $datas); 1203 } 1167 1204 ?> -
trunk/admin/remote_site.php
r610 r638 136 136 insert_remote_category($xml_content, $site_id, 'NULL', 0); 137 137 update_category(); 138 ordering(); 139 update_global_rank(); 138 140 139 141 $template->assign_block_vars( -
trunk/admin/update.php
r633 r638 36 36 // | functions | 37 37 // +-----------------------------------------------------------------------+ 38 39 /**40 * order categories (update categories.rank and global_rank database fields)41 *42 * the purpose of this function is to give a rank for all categories43 * (insides its sub-category), even the newer that have none at te44 * beginning. For this, ordering function selects all categories ordered by45 * rank ASC then name ASC for each uppercat.46 *47 * @returns void48 */49 function ordering()50 {51 $current_rank = 0;52 $current_uppercat = '';53 54 $query = '55 SELECT id, if(id_uppercat is null,\'\',id_uppercat) AS id_uppercat56 FROM '.CATEGORIES_TABLE.'57 ORDER BY id_uppercat,rank,name58 ;';59 $result = pwg_query($query);60 $datas = array();61 while ($row = mysql_fetch_array($result))62 {63 if ($row['id_uppercat'] != $current_uppercat)64 {65 $current_rank = 0;66 $current_uppercat = $row['id_uppercat'];67 }68 $data = array('id' => $row['id'], 'rank' => ++$current_rank);69 array_push($datas, $data);70 }71 72 $fields = array('primary' => array('id'), 'update' => array('rank'));73 mass_updates(CATEGORIES_TABLE, $fields, $datas);74 }75 38 76 39 function insert_local_category($id_uppercat)
Note: See TracChangeset
for help on using the changeset viewer.