Pelzini

This is the code documentation for the Pelzini project

source of /viewer/controllers/class_tree.php

Shows a list of all authors
  1. <?php
  2. /*
  3. Copyright 2008 Josh Heidenreich
  4.  
  5. This file is part of Pelzini.
  6.  
  7. Pelzini is free software: you can redistribute it and/or modify
  8. it under the terms of the GNU General Public License as published by
  9. the Free Software Foundation, either version 3 of the License, or
  10. (at your option) any later version.
  11.  
  12. Pelzini is distributed in the hope that it will be useful,
  13. but WITHOUT ANY WARRANTY; without even the implied warranty of
  14. MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  15. GNU General Public License for more details.
  16.  
  17. You should have received a copy of the GNU General Public License
  18. along with Pelzini. If not, see <http://www.gnu.org/licenses/>.
  19. */
  20.  
  21. /**
  22.  * Shows a list of all authors
  23.  *
  24.  * @package Viewer
  25.  * @author Josh Heidenreich
  26.  * @since 0.2
  27.  * @tag i18n-done
  28.  **/
  29.  
  30. require_once 'head.php';
  31.  
  32.  
  33. echo '<h2>', str(STR_CLASS_TREE_TITLE), '</h2>';
  34.  
  35. $root = create_classes_tree ();
  36. $top_nodes = $root->getChildren();
  37. usort($top_nodes, 'nodenamesort');
  38.  
  39. echo "<ul class=\"tree\">\n";
  40. foreach ($top_nodes as $node) {
  41. draw_class_tree($node);
  42. }
  43. echo "</ul>\n";
  44.  
  45. require_once 'foot.php';
  46.  
  47.  
  48. /**
  49.  * Draws the tree from this node and below as unordered lists within unordered lists
  50.  **/
  51. function draw_class_tree($node)
  52. {
  53. // Draw this item
  54. echo '<li>', get_object_link($node['name']);
  55.  
  56. // Draw its children if it has any
  57. $children = $node->getChildren();
  58. usort($children, 'nodenamesort');
  59.  
  60. if (count($children) > 0) {
  61. echo "\n<ul>\n";
  62. foreach ($children as $child) {
  63. draw_class_tree($child);
  64. }
  65. echo "</ul>\n";
  66. }
  67.  
  68. echo "</li>\n";
  69. }
  70.  
  71.  
  72. function nodenamesort($a, $b)
  73. {
  74. return strcasecmp($a['name'], $b['name']);
  75. }
  76.  
  77.  
  78. ?>
  79.