summaryrefslogtreecommitdiff
path: root/web/lib
diff options
context:
space:
mode:
authorLukas Fleischer <archlinux@cryptocrack.de>2014-04-26 14:21:43 +0200
committerLukas Fleischer <archlinux@cryptocrack.de>2014-04-26 14:21:55 +0200
commit38eb8d2a3ab0b7f35618d151613211d45f6ec4d8 (patch)
tree974147a73e98fe18cbb0dcf7289f5216689ca12b /web/lib
parentcc3244ea8ae0202265df3d0fd2cfe86fbbeb9d30 (diff)
Display package groups on the details page
The groups field is hidden if a package doesn't belong to any group. Signed-off-by: Lukas Fleischer <archlinux@cryptocrack.de>
Diffstat (limited to 'web/lib')
-rw-r--r--web/lib/pkgfuncs.inc.php26
1 files changed, 26 insertions, 0 deletions
diff --git a/web/lib/pkgfuncs.inc.php b/web/lib/pkgfuncs.inc.php
index f80d4b4..6811767 100644
--- a/web/lib/pkgfuncs.inc.php
+++ b/web/lib/pkgfuncs.inc.php
@@ -105,6 +105,32 @@ function pkg_from_name($name="") {
}
/**
+ * Get package groups for a specific package
+ *
+ * @param int $pkgid The package to get groups for
+ *
+ * @return array All package groups for the package
+ */
+function pkg_groups($pkgid) {
+ $grps = array();
+ $pkgid = intval($pkgid);
+ if ($pkgid > 0) {
+ $dbh = DB::connect();
+ $q = "SELECT g.Name FROM Groups g ";
+ $q.= "INNER JOIN PackageGroups pg ON pg.GroupID = g.ID ";
+ $q.= "WHERE pg.PackageID = ". $pkgid;
+ $result = $dbh->query($q);
+ if (!$result) {
+ return array();
+ }
+ while ($row = $result->fetch(PDO::FETCH_COLUMN, 0)) {
+ $grps[] = $row;
+ }
+ }
+ return $grps;
+}
+
+/**
* Get package dependencies for a specific package
*
* @param int $pkgid The package to get dependencies for