cvs: pearweb /include pear-database.php /public_html account-info.php

From: Date: Sat, 13 Jan 2007 12:51:49 +0000
Subject: cvs: pearweb /include pear-database.php /public_html account-info.php
Groups: php.pear.cvs php.pear.core 
Request: Send a blank email to pear-core+get-5347@lists.php.net to get a copy of this message
mj Sat Jan 13 12:51:49 2007 UTC Modified files: /pearweb/include pear-database.php /pearweb/public_html account-info.php Log: * Moved methods to get a developer's packages and notes into pear-database.php * Only show bottom part of the profile table if there are actually packages or notes for the developer. http://cvs.php.net/viewvc.cgi/pearweb/include/pear-database.php?r1=1.326&r2=1.327&diff_format=u Index: pearweb/include/pear-database.php diff -u pearweb/include/pear-database.php:1.326 pearweb/include/pear-database.php:1.327 --- pearweb/include/pear-database.php:1.326 Mon Dec 11 22:25:57 2006 +++ pearweb/include/pear-database.php Sat Jan 13 12:51:49 2007 @@ -18,7 +18,7 @@ | Martin Jansen <mj@php.net> | | Gregory Beaver <cellog@php.net> | +----------------------------------------------------------------------+ - $Id: pear-database.php,v 1.326 2006/12/11 22:25:57 arnaud Exp $ + $Id: pear-database.php,v 1.327 2007/01/13 12:51:49 mj Exp $ */ require_once 'DB/storage.php'; @@ -2501,6 +2501,17 @@ } // }}} + // {{{ + + function getAll($user) + { + global $dbh; + return $dbh->getAll('SELECT id, nby, ntime, note FROM notes' + . ' WHERE uid = ? ORDER BY ntime', + array($user)); + } + + // }}} } class user @@ -2642,6 +2653,20 @@ } // }}} + // {{{ + + function getPackages($user) + { + global $dbh; + $query = 'SELECT p.id, p.name, m.role, m.active' + . ' FROM packages p, maintains m' + . ' WHERE m.handle = ? AND p.id = m.package AND p.package_type = "pear"' + . ' ORDER BY p.name'; + + return $dbh->getAll($query, array($user)); + } + + // }}} // {{{ proto string user::info(string, [string]) API 1.0 function info($user, $field = null) http://cvs.php.net/viewvc.cgi/pearweb/public_html/account-info.php?r1=1.47&r2=1.48&diff_format=u Index: pearweb/public_html/account-info.php diff -u pearweb/public_html/account-info.php:1.47 pearweb/public_html/account-info.php:1.48 --- pearweb/public_html/account-info.php:1.47 Sat Jan 13 12:38:17 2007 +++ pearweb/public_html/account-info.php Sat Jan 13 12:51:49 2007 @@ -15,7 +15,7 @@ +----------------------------------------------------------------------+ | Authors: | +----------------------------------------------------------------------+ - $Id: account-info.php,v 1.47 2007/01/13 12:38:17 mj Exp $ + $Id: account-info.php,v 1.48 2007/01/13 12:51:49 mj Exp $ */ /** @@ -185,28 +185,28 @@ </td> </tr> +<?php +$packages = user::getPackages($handle); +$notes = note::getAll($handle); + +if (count($packages) > 0 || count($notes) > 0) { +?> + <tr> <th class="headrow" style="width: 50%">&raquo; Maintains These Packages</th> <th class="headrow" style="width: 50%">&raquo; Notes Regarding User</th> </tr> <tr> <td valign="top"> - <ul> <?php - -$query = 'SELECT p.id, p.name, m.role, m.active' - . ' FROM packages p, maintains m' - . ' WHERE m.handle = ? AND p.id = m.package AND p.package_type = "pear"' - . ' ORDER BY p.name'; - -$packages = $dbh->query($query, array($handle)); - -if ($packages->numRows() == 0) { - echo '<p>This user does not maintain any PEAR packages.</p>'; +if (count($packages) == 0) { + echo '<p>This user does not maintain any packages.</p>'; } - -while ($row = $packages->fetchRow(DB_FETCHMODE_ASSOC)) { +?> + <ul> +<?php +foreach ($packages as $row) { echo '<li>'; print_link('/package/' . htmlspecialchars($row['name']), htmlspecialchars($row['name'])); @@ -221,14 +221,13 @@ </ul> </td> <td valign="top"> +<?php +if (count($notes) == 0) { + echo '<p>There are no notes for this user.</p>'; +} +?> <ul> - <?php - -$notes = $dbh->getAll('SELECT id, nby, ntime, note FROM notes' - . ' WHERE uid = ? ORDER BY ntime', - array($handle)); - foreach ($notes as $nid => $data) { echo ' <li>' . "\n"; echo '' . $data['nby'] . ' '; @@ -242,6 +241,9 @@ </ul> </td> </tr> +<?php +} +?> </table> <?php

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