svn: /pear2/sandbox/SimpleChannelFrontend/trunk/ src/SimpleChannelFrontend/Category.php src/SimpleChannelFrontend/Main.php www/templates/html/Categories.tpl.php www/templates/html/Category.tpl.php

[email protected] (Michael Gauthier)
Newsgroups php.pear.cvs,php.pear.core
Message-ID <[email protected]>
gauthierm                                Thu, 17 Jun 2010 21:24:06 +0000

Revision: http://svn.php.net/viewvc?view=revision&revision=300547

Log:
Add category page to SCF.

Changed paths:
    A   pear2/sandbox/SimpleChannelFrontend/trunk/src/SimpleChannelFrontend/Category.php
    U   pear2/sandbox/SimpleChannelFrontend/trunk/src/SimpleChannelFrontend/Main.php
    U   pear2/sandbox/SimpleChannelFrontend/trunk/www/templates/html/Categories.tpl.php
    A   pear2/sandbox/SimpleChannelFrontend/trunk/www/templates/html/Category.tpl.php

Added: pear2/sandbox/SimpleChannelFrontend/trunk/src/SimpleChannelFrontend/Category.php
===================================================================
--- pear2/sandbox/SimpleChannelFrontend/trunk/src/SimpleChannelFrontend/Category.php	                        (rev 0)
+++ pear2/sandbox/SimpleChannelFrontend/trunk/src/SimpleChannelFrontend/Category.php	2010-06-17 21:24:06 UTC (rev 300547)
@@ -0,0 +1,30 @@
+<?php
+namespace PEAR2\SimpleChannelFrontend;
+class Category implements \IteratorAggregate
+{
+    /**
+     * @var \PEAR2\Pyrus\Channel\RemoteCategory
+     */
+    protected $_category;
+
+    public function __construct($options = array())
+    {
+        $this->_category = $options['frontend']::$channel->remotecategories[$options['category']];
+        $this->rewind();
+    }
+
+    public function __get($var)
+    {
+        return $this->_category->$var;
+    }
+
+    public function __call($method, $args)
+    {
+        return call_user_func_array(array($this->_category, $method), $args);
+    }
+
+    public function getIterator()
+    {
+        return $this->_category;
+    }
+}


Property changes on: pear2/sandbox/SimpleChannelFrontend/trunk/src/SimpleChannelFrontend/Category.php
___________________________________________________________________
Added: svn:keywords
   + Id Rev Revision
Added: svn:eol-style
   + native

Modified: pear2/sandbox/SimpleChannelFrontend/trunk/src/SimpleChannelFrontend/Main.php
===================================================================
--- pear2/sandbox/SimpleChannelFrontend/trunk/src/SimpleChannelFrontend/Main.php	2010-06-17 20:36:38 UTC (rev 300546)
+++ pear2/sandbox/SimpleChannelFrontend/trunk/src/SimpleChannelFrontend/Main.php	2010-06-17 21:24:06 UTC (rev 300547)
@@ -45,6 +45,7 @@
                                        'release'    => 'PEAR2\SimpleChannelFrontend\PackageRelease',
                                        'latest'     => 'PEAR2\SimpleChannelFrontend\LatestReleases',
                                        'categories' => 'PEAR2\SimpleChannelFrontend\Categories',
+                                       'category'   => 'PEAR2\SimpleChannelFrontend\Category',
                                        'support'    => 'PEAR2\SimpleChannelFrontend\Support',
                                        'search'     => 'PEAR2\SimpleChannelFrontend\Search');


Modified: pear2/sandbox/SimpleChannelFrontend/trunk/www/templates/html/Categories.tpl.php
===================================================================
--- pear2/sandbox/SimpleChannelFrontend/trunk/www/templates/html/Categories.tpl.php	2010-06-17 20:36:38 UTC (rev 300546)
+++ pear2/sandbox/SimpleChannelFrontend/trunk/www/templates/html/Categories.tpl.php	2010-06-17 21:24:06 UTC (rev 300547)
@@ -11,7 +11,7 @@
 <?php
     foreach ($context as $category) : ?>
     <li id="category-1" class="category category-clear">
-        <h3><a href=""><span class="category-title"><?php echo $category->name; ?></span></a><span class="category-count"> (<?php echo count($category); ?>)</span></h3>
+        <h3><a href="<?php echo PEAR2\SimpleChannelFrontend\Main::getURL(); ?>categories/<?php echo $category->name; ?>"><span class="category-title"><?php echo $category->name; ?></span></a><span class="category-count"> (<?php echo count($category); ?>)</span></h3>
         <div><?php
         if (count($category)) {
             echo '<ul>';

Added: pear2/sandbox/SimpleChannelFrontend/trunk/www/templates/html/Category.tpl.php
===================================================================
--- pear2/sandbox/SimpleChannelFrontend/trunk/www/templates/html/Category.tpl.php	                        (rev 0)
+++ pear2/sandbox/SimpleChannelFrontend/trunk/www/templates/html/Category.tpl.php	2010-06-17 21:24:06 UTC (rev 300547)
@@ -0,0 +1,17 @@
+<?php
+$parent->context->page_title = $context->name . ' | Categories | ' . PEAR2\SimpleChannelFrontend\Main::$channel->name; ?>
+
+<div class="grid_8 left">
+ <div class="packages-header">
+  <h2 class="category-title"><?php echo $context->name; ?></h2>
+ </div>
+ <?php
+ if (count($context)) {
+    echo '<ul>';
+    foreach ($context as $package) {
+        echo '<li><a href="'.PEAR2\SimpleChannelFrontend\Main::getURL().$package->name.'">'.$package->name.'</a></li>';
+    }
+    echo '</ul>';
+ }
+ ?>
+</div>


Property changes on: pear2/sandbox/SimpleChannelFrontend/trunk/www/templates/html/Category.tpl.php
___________________________________________________________________
Added: svn:keywords
   + Id Rev Revision
Added: svn:eol-style
   + native
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.