From a9a7913736a77313a730d21de67118ac5bf656bc Mon Sep 17 00:00:00 2001 From: Erich Eckner Date: Tue, 19 Feb 2019 10:08:22 +0100 Subject: groups.php: show list of groups --- groups.php | 47 ++++++++++++++++++++++++++++++++++++++++++++--- 1 file changed, 44 insertions(+), 3 deletions(-) (limited to 'groups.php') diff --git a/groups.php b/groups.php index 349cc0b..cfea8f4 100644 --- a/groups.php +++ b/groups.php @@ -36,11 +36,52 @@ if (count($uri_parts) != 0) { } if (count($uri_parts) == 0) { - // TODO: display overwiev - print 'Good so far, but the rest is yet to be implemented.'; - die(); + $sort = ''; + if (array_key_exists('sort', $_GET)) { + $criterium = $_GET['sort']; + if ( + array_key_exists($criterium, $grouplist_sorts) && + array_key_exists('mysql', $grouplist_sorts[$criterium]) + ) + $sort = $grouplist_sorts[$criterium]['mysql'] . ','; + elseif (substr($criterium, 0, 1) == '-') { + $criterium = substr($criterium, 1); + if ( + array_key_exists($criterium, $grouplist_sorts) && + array_key_exists('mysql', $grouplist_sorts[$criterium]) + ) + $sort = $grouplist_sorts[$criterium]['mysql'] . ' DESC,'; + } + } + + $result = mysql_run_query( + 'SELECT ' . + '`install_targets`.`name`,' . + 'COUNT(DISTINCT `install_target_providers`.`package`) AS `count`,' . + 'MAX(`binary_packages_in_repositories`.`last_moved`) AS `last_moved`,' . + '`architectures`.`name` AS `arch`' . + ' FROM `install_targets`' . + mysql_join_install_targets_install_target_providers() . + mysql_join_install_target_providers_binary_packages_in_repositories() . + mysql_join_binary_packages_in_repositories_repositories() . + ' AND `repositories`.`is_on_master_mirror`' . + mysql_join_repositories_architectures() . + ' WHERE `install_target_providers`.`install_target_is_group`' . + ' GROUP BY CONCAT(`architectures`.`name`,"/",`install_targets`.`name`)' . + ' ORDER BY ' . $sort . '`install_targets`.`name`,`architectures`.`name`' + ); + $groups = array(); + while ($row = $result -> fetch_assoc()) { + $row['move_date'] = substr($row['last_moved'], 0, 10); + $groups[] = $row; + } + print_header('Package Groups'); + print_listing($groups, true, 'group'); + print_footer(); + + die(); } if (count($uri_parts) != 1) -- cgit v1.2.3-70-g09d2