Changeset 17766 for branches/2.4/admin/tags.php
- Timestamp:
- Sep 5, 2012, 10:49:12 PM (12 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/2.4/admin/tags.php
r12922 r17766 46 46 ;'; 47 47 $existing_names = array_from_query($query, 'name'); 48 48 49 49 50 50 $current_name_of = array(); … … 59 59 $current_name_of[ $row['id'] ] = $row['name']; 60 60 } 61 61 62 62 $updates = array(); 63 63 // we must not rename tag with an already existing name … … 118 118 $destination_tag_id = $_POST['destination_tag']; 119 119 $tag_ids = explode(',', $_POST['merge_list']); 120 120 121 121 if (is_array($tag_ids) and count($tag_ids) > 1) 122 122 { … … 134 134 $name_of_tag[ $row['id'] ] = trigger_event('render_tag_name', $row['name']); 135 135 } 136 136 137 137 $tag_ids_to_delete = array_diff( 138 138 $tag_ids, … … 189 189 $tags_deleted[] = $name_of_tag[$tag_id]; 190 190 } 191 191 192 192 array_push( 193 193 $page['infos'], … … 217 217 218 218 delete_tags($_POST['tags']); 219 219 220 220 array_push( 221 221 $page['infos'], 222 222 l10n_dec( 223 'The following tag was deleted', 223 'The following tag was deleted', 224 224 'The %d following tags were deleted', 225 225 count($tag_names)).' : '. … … 235 235 { 236 236 check_pwg_token(); 237 237 238 238 delete_orphan_tags(); 239 239 $_SESSION['page_infos'] = array(l10n('Orphan tags deleted')); … … 269 269 ) 270 270 ); 271 271 272 272 array_push( 273 273 $page['infos'], … … 332 332 // +-----------------------------------------------------------------------+ 333 333 334 335 // tag counters 336 $query = ' 337 SELECT tag_id, COUNT(image_id) AS counter 338 FROM '.IMAGE_TAG_TABLE.' 339 GROUP BY tag_id'; 340 $tag_counters = simple_hash_from_query($query, 'tag_id', 'counter'); 341 342 // all tags 343 $query = ' 344 SELECT * 345 FROM '.TAGS_TABLE.' 346 ;'; 347 $result = pwg_query($query); 348 $all_tags = array(); 349 while ($tag = pwg_db_fetch_assoc($result)) 350 { 351 $raw_name = $tag['name']; 352 $tag['name'] = trigger_event('render_tag_name', $raw_name); 353 $tag['counter'] = intval(@$tag_counters[ $tag['id'] ]); 354 $tag['U_VIEW'] = make_index_url(array('tags'=>array($tag))); 355 $tag['U_EDIT'] = 'admin.php?page=batch_manager&cat=tag-'.$tag['id']; 356 357 $alt_names = trigger_event('get_tag_alt_names', array(), $raw_name); 358 $alt_names = array_diff( array_unique($alt_names), array($tag['name']) ); 359 if (count($alt_names)) 360 { 361 $tag['alt_names'] = implode(', ', $alt_names); 362 } 363 $all_tags[] = $tag; 364 } 365 usort($all_tags, 'tag_alpha_compare'); 366 367 368 334 369 $template->assign( 335 370 array( 336 'TAG_SELECTION' => get_html_tag_selection( 337 get_all_tags(), 338 'tags' 339 ), 371 'all_tags' => $all_tags, 340 372 ) 341 373 ); … … 348 380 $list_name = 'MERGE_TAGS_LIST'; 349 381 } 350 382 351 383 $template->assign( 352 384 array(
Note: See TracChangeset
for help on using the changeset viewer.