Changeset 11080
- Timestamp:
- 07/04/07 13:02:05 (2 years ago)
- Files:
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
branches/MidCOM_2_8/fi.protie.navigation/config/manifest.inc
r6038 r11080 1 1 'name' => 'fi.protie.navigation', 2 'version' => '1.0. 7',2 'version' => '1.0.8', 3 3 'state' => 'stable', 4 4 'purecode' => true, … … 21 21 'role' => 'lead', 22 22 ), 23 'netblade' => Array 24 ( 25 'name' => 'Oskari Kokko', 26 'email' => 'oskari.kokko@iki.fi', 27 'role' => 'lead', 28 ), 23 29 ), 24 30 'dependencies' => Array branches/MidCOM_2_8/fi.protie.navigation/main.php
r6038 r11080 168 168 169 169 /** 170 * Add first and last-class names to list item ul class name 171 * 172 * @access public 173 * @var boolean 174 */ 175 var $first_and_last_to_class = false; 176 177 /** 178 * CSS class for first 179 * 180 * @access public 181 * @var string 182 */ 183 var $css_first = 'first'; 184 185 /** 186 * CSS class for last 187 * 188 * @access public 189 * @var string 190 */ 191 var $css_last = 'last'; 192 193 /** 194 * CSS class for first and last together 195 * 196 * @access public 197 * @var string 198 */ 199 var $css_first_last = 'first_last'; 200 201 /** 202 * Check if item has childs and if so, add childs-class to list item ul class name 203 * 204 * @access public 205 * @var boolean 206 */ 207 var $has_childs_to_class = false; 208 209 /** 210 * CSS class for has childs 211 * 212 * @access public 213 * @var string 214 */ 215 var $css_has_childs = 'childs'; 216 217 /** 170 218 * CSS class for nodes 171 219 * … … 310 358 echo "{$indent}<ul class=\"{$this->css_list_style} node-{$id}\"{$element_id}>\n"; 311 359 360 $item_count = count($children); 361 $item_counter = 0; 362 312 363 // Draw each child element 313 364 foreach ($children as $child) 314 365 { 366 $item_counter++; 367 315 368 $selected = ''; 316 369 $active = ''; 317 370 $component = ''; 318 371 $url_name_to_class = ''; 372 $first_last = ''; 373 $has_childs = ''; 374 375 if($item_counter == 1 && $item_counter == $item_count) 376 { 377 $first_last = $this->css_first_last; 378 } 379 elseif($item_counter == 1) 380 { 381 $first_last = $this->css_first; 382 } 383 elseif($item_counter == $item_count) 384 { 385 $first_last = $this->css_last; 386 } 319 387 320 388 $item = $this->_nap->get_node($child); … … 326 394 } 327 395 396 if($this->has_childs_to_class) 397 { 398 $childs = $this->_nap->list_nodes($child[MIDCOM_NAV_ID]); 399 if(count($childs)>0) 400 { 401 $has_childs = $this->css_has_childs; 402 } 403 } 404 328 405 if (in_array($item[MIDCOM_NAV_ID], $this->node_path)) 329 406 { … … 336 413 } 337 414 338 $this->_display_element($item, $indent, $active, $selected, $component, $url_name_to_class );415 $this->_display_element($item, $indent, $active, $selected, $component, $url_name_to_class, $first_last, $has_childs); 339 416 } 340 417 echo "{$indent}</ul>\n"; … … 373 450 374 451 echo "{$indent}<ul class=\"{$this->css_list_style} node-{$id}\"{$element_id}>\n"; 375 452 453 $item_count = count($children); 454 $item_counter = 0; 455 376 456 // Draw each child element 377 457 foreach ($children as $child) 378 458 { 459 $item_counter++; 460 379 461 $selected = ''; 380 462 $active = ''; 381 463 $component = ''; 382 464 $url_name_to_class = ''; 383 465 $first_last = ''; 466 $has_childs = ''; 467 468 if($item_counter == 1 && $item_counter == $item_count) 469 { 470 $first_last = $this->css_first_last; 471 } 472 elseif($item_counter == 1) 473 { 474 $first_last = $this->css_first; 475 } 476 elseif($item_counter == $item_count) 477 { 478 $first_last = $this->css_last; 479 } 480 481 if($this->has_childs_to_class) 482 { 483 $childs = $this->_nap->list_child_elements($child[MIDCOM_NAV_ID]); 484 if(is_array($childs) && count($childs)>0) 485 { 486 $has_childs = $this->css_has_childs; 487 } 488 } 489 384 490 if ($child[MIDCOM_NAV_TYPE] === 'node') 385 491 { … … 389 495 continue; 390 496 } 497 391 498 392 499 $item = $this->_nap->get_node($child[MIDCOM_NAV_ID]); … … 412 519 $item = $this->_nap->get_leaf($child[MIDCOM_NAV_ID]); 413 520 521 414 522 // Place the corresponding css class for the currently active leaf) 415 523 if ($item[MIDCOM_NAV_ID] === $this->_nap->get_current_leaf()) … … 420 528 } 421 529 422 $this->_display_element($item, $indent, $active, $selected, $component, $url_name_to_class );530 $this->_display_element($item, $indent, $active, $selected, $component, $url_name_to_class, $first_last, $has_childs); 423 531 } 424 532 … … 426 534 } 427 535 428 function _display_element($item, $indent, $active, $selected, $component, $url_name_to_class )536 function _display_element($item, $indent, $active, $selected, $component, $url_name_to_class, $first_last, $has_childs) 429 537 { 430 538 // Check if user has requested URL name to be included in class … … 453 561 { 454 562 $css_class .= ' '.$url_name_to_class; 563 } 564 565 // Check if the first or last is supposed to be drawn 566 if ($this->first_and_last_to_class && $first_last !== '') 567 { 568 $css_class .= ' '.$first_last; 569 } 570 571 // Check if the has childs is supposed to be drawn 572 if ($this->has_childs_to_class && $has_childs !== '') 573 { 574 $css_class .= ' '.$has_childs; 455 575 } 456 576
