Pelzini

This is the code documentation for the Pelzini project

source of /viewer/controllers/interface.php

Shows information about a specific interface
  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 information about a specific interface
  23.  *
  24.  * @package Viewer
  25.  * @author Josh Heidenreich
  26.  * @since 0.1
  27.  * @see ParserInterface
  28.  * @tag i18n-done
  29.  **/
  30.  
  31. require_once 'functions.php';
  32.  
  33.  
  34. // Get the details of this interface
  35. $sql_name = db_quote($_GET['name']);
  36. $q = "SELECT interfaces.id, interfaces.name, namespaces.name AS namespace, interfaces.description, files.name AS filename,
  37. interfaces.sinceid, interfaces.deprecated
  38. FROM interfaces
  39. INNER JOIN files ON interfaces.fileid = files.id
  40. LEFT JOIN namespaces ON interfaces.namespaceid = namespaces.id
  41. WHERE interfaces.name = {$sql_name}
  42. AND interfaces.projectid = {$project['id']}
  43. LIMIT 1";
  44. $res = db_query ($q);
  45.  
  46. if (! $interface = db_fetch_assoc ($res)) {
  47. require_once 'head.php';
  48. echo '<h2>', str(STR_ERROR_TITLE), '</h2>';
  49. echo '<p>', str(STR_INTERFACE_INVALID), '</p>';
  50. require_once 'foot.php';
  51. }
  52.  
  53. $skin['page_name'] = str(STR_INTERFACE_BROWSER_TITLE, 'name', $interface['name']);
  54. require_once 'head.php';
  55.  
  56.  
  57. // Show basic details
  58. echo '<h2>', str(STR_INTERFACE_PAGE_TITLE, 'name', $interface['name']), '</h2>';
  59.  
  60. if ($interface['deprecated'] !== null) {
  61. echo '<p><span class="deprecated">', str(STR_INTERFACE_DEPRECATED), '</span></p>';
  62. if ($interface['deprecated']) echo '<br>', process_inline($interface['deprecated']);
  63. echo '</p>';
  64. }
  65.  
  66. echo process_inline($interface['description']);
  67.  
  68.  
  69. echo '<ul>';
  70. echo '<li>', str(STR_FILE, 'filename', $interface['filename']), '</li>';
  71.  
  72. if ($interface['namespace'] != null) {
  73. echo '<li>', str(STR_NAMESPACE, 'name', get_namespace_link($interface['namespace'])), '</li>';
  74. }
  75.  
  76. if ($interface['sinceid']) {
  77. echo '<li>', str(STR_AVAIL_SINCE, 'version', get_since_version($interface['sinceid'])), '</li>';
  78. }
  79. echo '</ul>';
  80.  
  81.  
  82.  
  83. show_authors ($interface['id'], LINK_TYPE_INTERFACE);
  84. show_tables ($interface['id'], LINK_TYPE_INTERFACE);
  85.  
  86.  
  87. // Show implementors
  88. $name = db_quote($interface['name']);
  89. $q = "SELECT classes.id, classes.name
  90. FROM classes
  91. INNER JOIN class_implements ON class_implements.classid = classes.id
  92. WHERE class_implements.name = {$name}";
  93. $res = db_query ($q);
  94. if (db_num_rows($res) > 0) {
  95. echo '<h3>', str(STR_INTERFACE_IMPLEMENTORS), '</h3>';
  96. echo "<ul>";
  97. while ($row = db_fetch_assoc ($res)) {
  98. echo "<li>", get_object_link($row['name']);
  99. }
  100. echo "</ul>";
  101. }
  102.  
  103.  
  104. // Show functions
  105. $q = "SELECT id, name, description, arguments, visibility FROM functions WHERE interfaceid = {$interface['id']}";
  106. $res = db_query($q);
  107. if (db_num_rows($res) > 0) {
  108. while ($row = db_fetch_assoc ($res)) {
  109. if ($row['description'] == null) {
  110. $row['description'] = '<em>This function does not have a description</em>';
  111. }
  112.  
  113. // display
  114. echo "<h3>{$row['visibility']} ", get_function_link($interface['name'], $row['name']);
  115. echo "</h3>";
  116.  
  117. show_function_usage ($row['id']);
  118. echo '<br>';
  119. echo process_inline($row['description']);
  120. }
  121. }
  122.  
  123.  
  124. show_tags ($interface['id'], LINK_TYPE_INTERFACE);
  125. show_see_also ($interface['id'], LINK_TYPE_INTERFACE);
  126.  
  127.  
  128. require_once 'foot.php';
  129. ?>
  130.