Changeset 21751
- Timestamp:
- Mar 20, 2013, 6:58:57 PM (12 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
extensions/community/main.inc.php
r19654 r21751 246 246 'community_ws_categories_getList', 247 247 array( 248 'cat_id' => array('default'=>0), 249 'recursive' => array('default'=>false), 250 'public' => array('default'=>false), 251 'fullname' => array('default'=>false), 248 'cat_id' => array('default'=>0), 249 'recursive' => array('default'=>false), 250 'public' => array('default'=>false), 251 'tree_output' => array('default'=>false), 252 'fullname' => array('default'=>false), 252 253 ), 253 254 'retrieves a list of categories' … … 269 270 global $user, $conf; 270 271 272 if ($params['tree_output']) 273 { 274 if (!isset($_GET['format']) or !in_array($_GET['format'], array('php', 'json'))) 275 { 276 // the algorithm used to build a tree from a flat list of categories 277 // keeps original array keys, which is not compatible with 278 // PwgNamedArray. 279 // 280 // PwgNamedArray is useful to define which data is an attribute and 281 // which is an element in the XML output. The "hierarchy" output is 282 // only compatible with json/php output. 283 284 return new PwgError(405, "The tree_output option is only compatible with json/php output formats"); 285 } 286 } 287 271 288 $where = array('1=1'); 272 289 $join_type = 'LEFT'; … … 364 381 } 365 382 usort($cats, 'global_rank_compare'); 366 return array( 367 'categories' => new PwgNamedArray( 368 $cats, 369 'category', 370 array( 371 'id', 372 'url', 373 'nb_images', 374 'total_nb_images', 375 'nb_categories', 376 'date_last', 377 'max_date_last', 383 384 if ($params['tree_output']) 385 { 386 return categories_flatlist_to_tree($cats); 387 } 388 else 389 { 390 return array( 391 'categories' => new PwgNamedArray( 392 $cats, 393 'category', 394 array( 395 'id', 396 'url', 397 'nb_images', 398 'total_nb_images', 399 'nb_categories', 400 'date_last', 401 'max_date_last', 402 ) 378 403 ) 379 ) 380 );404 ); 405 } 381 406 } 382 407
Note: See TracChangeset
for help on using the changeset viewer.