[Fusionforge-general] get_public_active_projects_asc() added - Was: Re: [Fusionforge-commits] r16122 - trunk/src/common/include
Olivier Berger
olivier.berger at it-sudparis.eu
Wed Aug 22 12:27:53 CEST 2012
Hi.
I'm not so sure whether I did it right, so would appreciate any review
of that change, and improvement commits.
The thing is we didn't seem to have a way to list "public" active
projects in a function, i.e. being able to replicate in a plugin (admssw
in that case) a loop over the same list of projects as the one available
in softwaretrove/full_list.php.
So I added one, and changed full_list.php too, but maybe it should make
use of the $GROUP_OBJ cache (?) as other group_get_*() functions do ?
Any comments welcome.
Best regards,
Olivier Berger <olberger at fusionforge.org> writes:
> Author: olberger
> Date: 2012-08-21 16:50:35 +0200 (Tue, 21 Aug 2012)
> New Revision: 16122
>
> Modified:
> trunk/src/common/include/Group.class.php
> Log:
> Extract from trove's full list the query for public active projects
>
> Modified: trunk/src/common/include/Group.class.php
> ===================================================================
> --- trunk/src/common/include/Group.class.php 2012-08-21 14:50:07 UTC (rev 16121)
> +++ trunk/src/common/include/Group.class.php 2012-08-21 14:50:35 UTC (rev 16122)
> @@ -150,6 +150,32 @@
> return group_get_object(db_result($res, 0, 'group_id'), $res);
> }
>
> +/**
> + * get_public_active_projects_asc() - Get a list of rows for public active projects (initially in trove/full_list)
> + *
> + * @param int Opional Maximum number of rows to limit query length
> + */
> +function get_public_active_projects_asc($max_query_limit = -1) {
> +
> + $res_grp = db_query_params ('
> + SELECT group_id, group_name, unix_group_name, short_description, register_time
> + FROM groups
> + WHERE status = $1 AND type_id=1 AND group_id>4 AND register_time > 0
> + ORDER BY group_name ASC
> + ',
> + array ('A'),
> + $max_query_limit);
> + $projects = array();
> + while ($row_grp = db_fetch_array($res_grp)) {
> + if (!forge_check_perm ('project_read', $row_grp['group_id'])) {
> + continue ;
> + }
> + $projects[] = $row_grp;
> + }
> + return $projects;
> +}
> +
> +
> class Group extends Error {
> /**
> * Associative array of data from db.
>
>
> _______________________________________________
> Fusionforge-commits mailing list
> Fusionforge-commits at lists.fusionforge.org
> http://lists.fusionforge.org/cgi-bin/mailman/listinfo/fusionforge-commits
>
--
Olivier BERGER
http://www-public.it-sudparis.eu/~berger_o/ - OpenPGP-Id: 2048R/5819D7E8
Ingenieur Recherche - Dept INF
Institut Mines-Telecom, Telecom SudParis, Evry (France)
More information about the Fusionforge-general
mailing list