1192284623a66c80266b4114c42d08096a110e39
Author: Mark Story
Date: 2009-06-14 21:17:44 -0400
diff --git a/controllers/api_packages_controller.php b/controllers/api_packages_controller.php
index 06aa70e..2364aff 100644
--- a/controllers/api_packages_controller.php
+++ b/controllers/api_packages_controller.php
@@ -49,4 +49,21 @@ class ApiPackagesController extends ApiGeneratorAppController {
$this->set('packageIndex', $packageIndex);
}
+/**
+ * View a package, and all contained classes.
+ *
+ * @return void
+ **/
+ public function view($slug = null) {
+ if (!$slug) {
+ $this->Session->setFlash(__('No package name was given', true));
+ $this->redirect($this->referer());
+ }
+ $apiPackage = $this->ApiPackage->findBySlug($slug);
+ if (empty($apiPackage)) {
+ $this->_notFound(__('No package exists in the index with that name', true));
+ }
+ $classIndex = $this->ApiPackage->ApiClass->getClassIndex();
+ $this->set(compact('apiPackage', 'classIndex'));
+ }
}
\ No newline at end of file
diff --git a/views/api_packages/view.ctp b/views/api_packages/view.ctp
new file mode 100644
index 0000000..7cb9e1e
--- /dev/null
+++ b/views/api_packages/view.ctp
@@ -0,0 +1,25 @@
+<?php
+$apiDoc->setClassIndex($classIndex);
+?>
+<h1><?php printf(__('%s Package', true), $apiPackage['ApiPackage']['name']); ?></h1>
+
+<?php if(!empty($apiPackage['ParentPackage'])): ?>
+ <h3><?php __('Parent Package'); ?> </h3>
+ <p><?php echo $apiDoc->packageLink($apiPackage['ParentPackage']['name']); ?></p>
+<?php endif; ?>
+
+<?php if (!empty($apiPackage['ChildPackage'])): ?>
+ <h3><?php __('Child Packages'); ?></h3>
+ <ul>
+ <?php foreach ($apiPackage['ChildPackage'] as $child): ?>
+ <li><?php echo $apiDoc->packageLink($apiPackage['ApiPackage']['name']); ?></li>
+ <?php endforeach; ?>
+ </ul>
+<?php endif;?>
+
+<h3><?php printf(__('Classes in %s', true), $apiPackage['ApiPackage']['name']); ?> </h3>
+<ul>
+<?php foreach ($apiPackage['ApiClass'] as $class): ?>
+ <li><?php echo $apiDoc->classLink($class['name']); ?></li>
+<?php endforeach; ?>
+</ul>
\ No newline at end of file
