dependencies.php 1.2 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849
  1. <?php
  2. /**
  3. * Shows a table of plugin dependecies for ElggPlugin in $vars['plugin'].
  4. *
  5. * This uses a table because it's a table of data.
  6. *
  7. * @package Elgg.Core
  8. * @subpackage Admin.Plugins
  9. */
  10. $plugin = elgg_extract('plugin', $vars, false);
  11. $deps = $plugin->getPackage()->checkDependencies(true);
  12. $columns = array('type', 'name', 'expected_value', 'local_value', 'comment');
  13. echo '<table class="elgg-plugin-dependencies styled"><tr>';
  14. foreach ($columns as $column) {
  15. $column = elgg_echo("admin:plugins:dependencies:$column");
  16. echo "<th class=\"pas\">$column</th>";
  17. }
  18. echo '</tr>';
  19. $row = 'odd';
  20. foreach ($deps as $dep) {
  21. $fields = _elgg_get_plugin_dependency_strings($dep);
  22. $type = $dep['type'];
  23. if ($dep['status']) {
  24. $class = "elgg-state-success elgg-dependency elgg-dependency-$type";
  25. } elseif ($dep['type'] == 'suggests') {
  26. $class = "elgg-state-warning elgg-dependency elgg-dependency-$type";
  27. } else {
  28. $class = "elgg-state-error elgg-dependency elgg-dependency-$type";
  29. }
  30. echo "<tr class=\"$row\">";
  31. foreach ($columns as $column) {
  32. echo "<td class=\"pas $class\">{$fields[$column]}</td>";
  33. }
  34. echo '</tr>';
  35. $row = ($row == 'odd') ? 'even' : 'odd';
  36. }
  37. echo '</table>';