svn: /pear2/sandbox/SimpleChannelFrontend/trunk/ src/SimpleChannelFrontend/Categories.php src/SimpleChannelFrontend/Package.php
src/SimpleChannelFrontend/PackageList.php www/templates/Categories.tpl.php www/templates/Package.tpl.php www/templates/PackageList.tpl.php

From: Date: Thu, 19 Nov 2009 16:33:58 +0000
Subject: svn: /pear2/sandbox/SimpleChannelFrontend/trunk/ src/SimpleChannelFrontend/Categories.php src/SimpleChannelFrontend/Package.php
src/SimpleChannelFrontend/PackageList.php www/templates/Categories.tpl.php www/templates/Package.tpl.php www/templates/PackageList.tpl.php
Groups: php.pear.cvs php.pear.core 
Request: Send a blank email to pear-core+get-9039@lists.php.net to get a copy of this message
saltybeagle Thu, 19 Nov 2009 16:33:58 +0000 Revision: http://svn.php.net/viewvc?view=revision&revision=291011 Log: Simplify by extending the Pyrus\Channel\Remote* objects. Add download links. Changed paths: U pear2/sandbox/SimpleChannelFrontend/trunk/src/SimpleChannelFrontend/Categories.php U pear2/sandbox/SimpleChannelFrontend/trunk/src/SimpleChannelFrontend/Package.php U pear2/sandbox/SimpleChannelFrontend/trunk/src/SimpleChannelFrontend/PackageList.php U pear2/sandbox/SimpleChannelFrontend/trunk/www/templates/Categories.tpl.php U pear2/sandbox/SimpleChannelFrontend/trunk/www/templates/Package.tpl.php U pear2/sandbox/SimpleChannelFrontend/trunk/www/templates/PackageList.tpl.php Modified: pear2/sandbox/SimpleChannelFrontend/trunk/src/SimpleChannelFrontend/Categories.php =================================================================== --- pear2/sandbox/SimpleChannelFrontend/trunk/src/SimpleChannelFrontend/Categories.php 2009-11-19 16:31:24 UTC (rev 291010) +++ pear2/sandbox/SimpleChannelFrontend/trunk/src/SimpleChannelFrontend/Categories.php 2009-11-19 16:33:58 UTC (rev 291011) @@ -1,11 +1,10 @@ <?php namespace pear2\SimpleChannelFrontend; -class Categories +class Categories extends \pear2\Pyrus\Channel\Remotecategories { - public $categories; function __construct($options = array()) { - $this->categories = $options['frontend']::$channel->remotecategories; + parent::__construct($options['frontend']::$channel); } } \ No newline at end of file Modified: pear2/sandbox/SimpleChannelFrontend/trunk/src/SimpleChannelFrontend/Package.php =================================================================== --- pear2/sandbox/SimpleChannelFrontend/trunk/src/SimpleChannelFrontend/Package.php 2009-11-19 16:31:24 UTC (rev 291010) +++ pear2/sandbox/SimpleChannelFrontend/trunk/src/SimpleChannelFrontend/Package.php 2009-11-19 16:33:58 UTC (rev 291011) @@ -1,12 +1,66 @@ <?php namespace pear2\SimpleChannelFrontend; -class Package +class Package implements \ArrayAccess, \Iterator { - public $package; + public $_package; function __construct($options = array()) { - $this->package = $options['frontend']::$channel->remotepackage[$options['package']]; + $this->_package = $options['frontend']::$channel->remotepackage[$options['package']]; } + + function __get($var) + { + return $this->_package->$var; + } + + function __call($method, $args) + { + return call_user_func_array(array($this->_package, $method), $args); + } + + function offsetExists($offset) + { + return $this->_package->offsetExists($offset); + } + + function offsetGet($offset) + { + return $this->_package->offsetGet($offset); + } + + function offsetSet($offset, $val) + { + return $this->_package->offsetSet($offset, $val); + } + + function offsetUnset($offset) + { + return $this->_package->offsetUnset($offset); + } + + function current() + { + return $this->_package->current(); + } + + function next() + { + return $this->_package->next(); + } + + function key() + { + return $this->_package->key(); + } + + function valid() + { + return $this->_package->valid(); + } + + function rewind() + { + return $this->_package->rewind(); + } } -?> \ No newline at end of file Modified: pear2/sandbox/SimpleChannelFrontend/trunk/src/SimpleChannelFrontend/PackageList.php =================================================================== --- pear2/sandbox/SimpleChannelFrontend/trunk/src/SimpleChannelFrontend/PackageList.php 2009-11-19 16:31:24 UTC (rev 291010) +++ pear2/sandbox/SimpleChannelFrontend/trunk/src/SimpleChannelFrontend/PackageList.php 2009-11-19 16:33:58 UTC (rev 291011) @@ -1,17 +1,20 @@ <?php namespace pear2\SimpleChannelFrontend; -class PackageList +class PackageList extends \pear2\Pyrus\Channel\Remotepackages { public $directory; public $packages = array(); + /** + * Remote packages object + * + * @var \pear2\Pyrus\Channel\Remotepackages + */ + protected $_remotepackages; + function __construct($options = array()) { - $this->packages = array(); - foreach ($options['frontend']::$channel->remotepackages as $package) { - $this->packages[] = $package->name; - } - sort($this->packages); + parent::__construct($options['frontend']::$channel); } } Modified: pear2/sandbox/SimpleChannelFrontend/trunk/www/templates/Categories.tpl.php =================================================================== --- pear2/sandbox/SimpleChannelFrontend/trunk/www/templates/Categories.tpl.php 2009-11-19 16:31:24 UTC (rev 291010) +++ pear2/sandbox/SimpleChannelFrontend/trunk/www/templates/Categories.tpl.php 2009-11-19 16:33:58 UTC (rev 291011) @@ -6,10 +6,10 @@ <h2 class="category-title">Categories</h2> </div> <?php -if (count($context->categories)) : ?> +if (count($context)) : ?> <ul class="categories"> <?php - foreach ($context->categories as $category) : ?> + foreach ($context as $category) : ?> <li id="category-1" class="category category-clear"> <h3><a href=""><span class="category-title"><?php echo $category->name; ?></span> <span class="category-count"><?php echo count($category); ?></span></a></h3> <div><?php Modified: pear2/sandbox/SimpleChannelFrontend/trunk/www/templates/Package.tpl.php =================================================================== --- pear2/sandbox/SimpleChannelFrontend/trunk/www/templates/Package.tpl.php 2009-11-19 16:31:24 UTC (rev 291010) +++ pear2/sandbox/SimpleChannelFrontend/trunk/www/templates/Package.tpl.php 2009-11-19 16:33:58 UTC (rev 291011) @@ -1,28 +1,32 @@ <?php // Set the title for the main template -$parent->context->page_title = $context->package->name.' | '.pear2\SimpleChannelFrontend\Main::$channel->name; +$parent->context->page_title = $context->name.' | '.pear2\SimpleChannelFrontend\Main::$channel->name; ?> <div class="package"> <div class="grid_8 left"> - <h2>Package :: <?php echo $context->package->name; ?></h2> + <h2>Package :: <?php echo $context->name; ?></h2> <p> <?php - echo nl2br(trim($context->package->description)); + echo nl2br(trim($context->description)); ?> </p> <h3>Installation</h3> <ol class="instructions"> - <li><code>$>php pyrus.phar channel-discover <?php echo $context->package->channel; ?></code></li> - <li><code>$>php pyrus.phar install <?php echo $context->package->channel . '/' . $context->package->name; ?></code></li> + <li><code>$>php pyrus.phar channel-discover <?php echo $context->channel; ?></code></li> + <li><code>$>php pyrus.phar install <?php echo $context->channel . '/' . $context->name; ?></code></li> </ol> </div> <div class="grid_4 right"> <h3>Releases</h3> <ul> <?php - foreach ($context->package as $version => $release): ?> - <li><?php echo $version; ?></li> + foreach ($context as $version => $release): ?> + <li> + <?php echo $version; ?> <span class="stability"><?php echo $release['stability']; ?></span> + <abbr class="releasedate" title="<?php echo $context->date.' '.$context->time; ?>"><?php echo $context->date; ?></abbr> + <a class="download" href="<?php echo $context->getDownloadURL('.tgz'); ?>">Download</a> + </li> <?php endforeach; ?> </ul> </div> -</div> \ No newline at end of file +</div> Modified: pear2/sandbox/SimpleChannelFrontend/trunk/www/templates/PackageList.tpl.php =================================================================== --- pear2/sandbox/SimpleChannelFrontend/trunk/www/templates/PackageList.tpl.php 2009-11-19 16:31:24 UTC (rev 291010) +++ pear2/sandbox/SimpleChannelFrontend/trunk/www/templates/PackageList.tpl.php 2009-11-19 16:33:58 UTC (rev 291011) @@ -6,10 +6,9 @@ <h1>Available Packages</h1> <ul> <?php - foreach ($context->packages as $package) { - echo '<li><a href="./?view=package&amp;package='.$package.'">'.$package.'</a></li>'; + foreach ($context as $package) { + echo '<li><a href="./?view=package&amp;package='.$package->name.'">'.$package->name.'</a></li>'; } - ?> </ul> </div> \ No newline at end of file

« previous php.pear.core (#9039) next »