Changeset 11155 for trunk/include/ws_functions.inc.php
- Timestamp:
- May 31, 2011, 10:25:40 PM (13 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/include/ws_functions.inc.php
r11118 r11155 433 433 global $user,$conf; 434 434 435 if ($params['tree_output']) 436 { 437 if (!isset($_GET['format']) or !in_array($_GET['format'], array('php', 'json'))) 438 { 439 // the algorithm used to build a tree from a flat list of categories 440 // keeps original array keys, which is not compatible with 441 // PwgNamedArray. 442 // 443 // PwgNamedArray is useful to define which data is an attribute and 444 // which is an element in the XML output. The "hierarchy" output is 445 // only compatible with json/php output. 446 447 return new PwgError(405, "The tree_output option is only compatible with json/php output formats"); 448 } 449 } 450 435 451 $where = array('1=1'); 436 452 $join_type = 'INNER'; … … 472 488 473 489 $query = ' 474 SELECT id, name, permalink, uppercats, global_rank, 490 SELECT id, name, permalink, uppercats, global_rank, id_uppercat, 475 491 comment, 476 492 nb_images, count_images AS total_nb_images, … … 515 531 } 516 532 usort($cats, 'global_rank_compare'); 517 return array( 518 'categories' => new PwgNamedArray( 519 $cats, 520 'category', 521 array( 522 'id', 523 'url', 524 'nb_images', 525 'total_nb_images', 526 'nb_categories', 527 'date_last', 528 'max_date_last', 533 534 if ($params['tree_output']) 535 { 536 return categories_flatlist_to_tree($cats); 537 } 538 else 539 { 540 return array( 541 'categories' => new PwgNamedArray( 542 $cats, 543 'category', 544 array( 545 'id', 546 'url', 547 'nb_images', 548 'total_nb_images', 549 'nb_categories', 550 'date_last', 551 'max_date_last', 552 ) 529 553 ) 530 ) 531 );554 ); 555 } 532 556 } 533 557
Note: See TracChangeset
for help on using the changeset viewer.