Changeset 1861 for trunk/include/functions_html.inc.php
- Timestamp:
- Feb 27, 2007, 2:56:16 AM (17 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/include/functions_html.inc.php
r1855 r1861 236 236 * categories string returned contains categories as given in the input 237 237 * array $cat_informations. $cat_informations array must be an association 238 * of {category_id => category_name}. If url input parameter is null,238 * of {category_id => array( id, name) }. If url input parameter is null, 239 239 * returns only the categories name without links. 240 240 * … … 252 252 $output = ''; 253 253 $is_first = true; 254 foreach ($cat_informations as $id => $name) 255 { 254 foreach ($cat_informations as $id => $cat) 255 { 256 is_array($cat) or trigger_error( 257 'get_cat_display_name wrong type for cat '.$id, E_USER_WARNING 258 ); 256 259 if ($is_first) 257 260 { … … 265 268 if ( !isset($url) ) 266 269 { 267 $output.= $ name;270 $output.= $cat['name']; 268 271 } 269 272 elseif ($url == '') … … 272 275 .make_index_url( 273 276 array( 274 'category'=>$id, 275 'cat_name'=>$name 277 'category' => $cat, 276 278 ) 277 279 ) 278 280 .'">'; 279 $output.= $ name.'</a>';281 $output.= $cat['name'].'</a>'; 280 282 } 281 283 else 282 284 { 283 285 $output.= '<a href="'.PHPWG_ROOT_PATH.$url.$id.'">'; 284 $output.= $ name.'</a>';286 $output.= $cat['name'].'</a>'; 285 287 } 286 288 } … … 312 314 $replace_space = true) 313 315 { 314 global $ca t_names, $conf;315 316 if (!isset($ca t_names))316 global $cache, $conf; 317 318 if (!isset($cache['cat_names'])) 317 319 { 318 320 $query = ' 319 SELECT id, name321 SELECT id, name 320 322 FROM '.CATEGORIES_TABLE.' 321 323 ;'; 322 324 $result = pwg_query($query); 323 while ($row = mysql_fetch_a rray($result))324 { 325 $ca t_names[$row['id']] = $row['name'];325 while ($row = mysql_fetch_assoc($result)) 326 { 327 $cache['cat_names'][$row['id']] = $row; 326 328 } 327 329 } … … 331 333 foreach (explode(',', $uppercats) as $category_id) 332 334 { 333 $ name = $cat_names[$category_id];335 $cat = $cache['cat_names'][$category_id]; 334 336 335 337 if ($is_first) … … 344 346 if ( !isset($url) ) 345 347 { 346 $output.= $ name;348 $output.= $cat['name']; 347 349 } 348 350 elseif ($url == '') … … 352 354 .make_index_url( 353 355 array( 354 'category'=>$category_id, 355 'cat_name'=>$name 356 'category' => $cat, 356 357 ) 357 358 ) 358 .'">'.$ name.'</a>';359 .'">'.$cat['name'].'</a>'; 359 360 } 360 361 else 361 362 { 362 363 $output.= ' 363 <a href="'.PHPWG_ROOT_PATH.$url.$category_id.'">'.$ name.'</a>';364 <a href="'.PHPWG_ROOT_PATH.$url.$category_id.'">'.$cat['name'].'</a>'; 364 365 } 365 366 } … … 385 386 * @return string 386 387 */ 387 function get_html_menu_category($categories )388 { 389 global $ page, $lang;388 function get_html_menu_category($categories, $selected_category) 389 { 390 global $lang; 390 391 391 392 $ref_level = 0; … … 393 394 $menu = ''; 394 395 395 // $page_cat value remains 0 for special sections396 $page_cat = 0;397 if (isset($page['category']))398 {399 $page_cat = $page['category'];400 }401 402 396 foreach ($categories as $category) 403 397 { … … 420 414 421 415 $menu.= "\n\n".'<li'; 422 if ($category['id'] == $page_cat)416 if ($category['id'] == @$selected_category['id']) 423 417 { 424 418 $menu.= ' class="selected"'; … … 428 422 $url = make_index_url( 429 423 array( 430 'category'=>$category['id'], 431 'cat_name'=>$category['name'] 424 'category' => $category 432 425 ) 433 426 ); 434 427 435 428 $menu.= "\n".'<a href="'.$url.'"'; 436 if ($ page_cat != 0437 and $category['id'] == $ page['cat_id_uppercat'])429 if ($selected_category!=null 430 and $category['id'] == $selected_category['id_uppercat']) 438 431 { 439 432 $menu.= ' rel="up"'; … … 510 503 { 511 504 $cat_info = get_cat_info($cat_id); 512 return get_cat_display_name($cat_info[' name'], $url, $replace_space);505 return get_cat_display_name($cat_info['upper_names'], $url, $replace_space); 513 506 } 514 507
Note: See TracChangeset
for help on using the changeset viewer.