svn: /pear2/sandbox/pear2.php.net/trunk/www/templates/pear2/html/ Package.tpl.php

[email protected] (Michael Gauthier)
Newsgroups php.pear.cvs,php.pear.core
Message-ID <[email protected]>
gauthierm                                Wed, 23 Jun 2010 20:53:09 +0000

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

Log:
Display PHP version, extension and OS dependencies on pacakge details page.

Changed paths:
    U   pear2/sandbox/pear2.php.net/trunk/www/templates/pear2/html/Package.tpl.php

Modified: pear2/sandbox/pear2.php.net/trunk/www/templates/pear2/html/Package.tpl.php
===================================================================
--- pear2/sandbox/pear2.php.net/trunk/www/templates/pear2/html/Package.tpl.php	2010-06-23 20:23:39 UTC (rev 300709)
+++ pear2/sandbox/pear2.php.net/trunk/www/templates/pear2/html/Package.tpl.php	2010-06-23 20:53:09 UTC (rev 300710)
@@ -105,10 +105,54 @@

 <?php

+// php dependencies
+foreach ($context->dependencies['required']->php as $php) {
+
+    if ($php->min && $php->max) {
+        $phpTitle = 'PHP ≥ ' . $php->min . ' ≤ '. $php->max;
+    } else if ($php->min) {
+        $phpTitle = 'PHP ≥ ' . $php->min;
+    } else if ($php->max) {
+        $phpTitle = 'PHP ≤ ' . $php->max;
+    }
+
+    echo '<li>' . $phpTitle. '</li>';
+}
+
+
+// package dependencies
 foreach ($context->dependencies['required']->package as $name => $package) {
     echo '<li><a href="http://'.$name.'">' . $name . '</a></li>';
 }

+// extension dependencies
+foreach ($context->dependencies['required']->extension as $name => $extension) {
+
+    $extensionTitle = $name . ' extension';
+
+    if ($extension->min && $extension->max) {
+        $extensionTitle .= ' ≥ ' . $extension->min . ' ≤ '. $extension->max;
+    } else if ($extension->min) {
+        $extensionTitle .= ' ≥ ' . $extension->min;
+    } else if ($extension->max) {
+        $extensionTitle .= ' ≤ ' . $extension->max;
+    }
+
+    echo '<li>' . $extensionTitle . '</li>';
+}
+
+// os dependencies
+foreach ($context->dependencies['required']->os as $name => $supported) {
+
+    if ($supported) {
+        $osTitle = 'only works on ' . $name;
+    } else {
+        $osTitle = 'does not works on ' . $name;
+    }
+
+    echo '<li>' . $osTitle . '</li>';
+}
+
 ?>
         </ul>
     </div>
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.