This is an automated email from the git hooks/post-receive script. It was
generated because a ref change was pushed to the repository containing
the project "FusionForge".

The branch, master has been updated
       via  2c159179736feca7e005f17b379e2e1837575082 (commit)
       via  ec5b26dae6461507d130f51cce69607cd2631f07 (commit)
      from  88667f087450583fdbef0454cd930d696aba106a (commit)

Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.

- Log -----------------------------------------------------------------
https://scm.fusionforge.org/anonscm/gitweb/?p=fusionforge/fusionforge.git;a=commitdiff;h=2c159179736feca7e005f17b379e2e1837575082

commit 2c159179736feca7e005f17b379e2e1837575082
Author: Franck Villaume <[email protected]>
Date:   Tue Jun 15 19:35:02 2021 +0200

    display Stats on Top Voted Projects

diff --git a/src/common/include/Stats.class.php 
b/src/common/include/Stats.class.php
index 80d9d9e..34ff842 100644
--- a/src/common/include/Stats.class.php
+++ b/src/common/include/Stats.class.php
@@ -5,8 +5,8 @@
  * Copyright 1999-2001, VA Linux Systems, Inc.
  * Copyright 2002, GForge, LLC
  * Copyright 2009, Roland Mas
- * Copyright © 2012
- *     Thorsten Glaser <[email protected]>
+ * Copyright 2012, Thorsten Glaser <[email protected]>
+ * Copyright 2021, Franck Villaume - TrivialDev
  *
  * This file is part of FusionForge. FusionForge is free software;
  * you can redistribute it and/or modify it under the terms of the
@@ -71,8 +71,8 @@ class Stats extends FFError {
        }
 
        /**
-       * Returns a resultset containing unix_group_name, group_name, and items 
- the count of
-       * the messages posted on that group's forums
+       * Returns a _name, group_name, and items - the count of
+       * the messages posted on that group's forumsresultset containing 
unix_group
        *
        * @return resource a resultset of unix_group_name, group_name, items
        */
@@ -105,9 +105,10 @@ class Stats extends FFError {
                                        array ('A'),
                                        100) ;
        }
-}
 
-// Local Variables:
-// mode: php
-// c-file-style: "bsd"
-// End:
+       function getTopVotedProjects() {
+               return db_query_params('SELECT g.group_name, g.unix_group_name, 
gv.group_id, COUNT(*) AS counter FROM group_votes AS gv, groups AS g WHERE 
gv.group_id = g.group_id AND g.status = $1 GROUP BY gv.group_id, g.group_name, 
g.unix_group_name ORDER BY counter DESC',
+                                       array('A'),
+                                       100);
+       }
+}
diff --git a/src/common/widget/Widget_HomeStats.class.php 
b/src/common/widget/Widget_HomeStats.class.php
index 1e04d1f..b3e3745 100644
--- a/src/common/widget/Widget_HomeStats.class.php
+++ b/src/common/widget/Widget_HomeStats.class.php
@@ -1,6 +1,6 @@
 <?php
 /**
- * Copyright 2016, Franck Villaume - TrivialDev
+ * Copyright 2016,2021, Franck Villaume - TrivialDev
  * This file is a part of Fusionforge.
  *
  * Fusionforge is free software; you can redistribute it and/or modify
@@ -41,6 +41,8 @@ class Widget_HomeStats extends Widget {
                }
                $return .= $HTML->boxMiddle(_('Most Active This Week'), 
'Most_Active_This_Week');
                $return .= show_highest_ranked_projects();
+               $return .= $HTML->boxMiddle(_('Top Voted Projects'), 
'Top_Voted_Projects');
+               $return .= show_top_voted_project();
                $return .= $HTML->boxMiddle(_('Recently Registered Projects'), 
'Recently_Registered_Projects');
                $return .= show_newest_projects();
                $params['return'] = &$return;
diff --git a/src/www/include/features_boxes.php 
b/src/www/include/features_boxes.php
index 17252a0..2c68cea 100644
--- a/src/www/include/features_boxes.php
+++ b/src/www/include/features_boxes.php
@@ -3,7 +3,7 @@
  *
  * Copyright 1999-2001 (c) VA Linux Systems
  * Copyright (C) 2011 Alain Peyrat - Alcatel-Lucent
- * Copyright 2012,2016, Franck Villaume - TrivialDev
+ * Copyright 2012,2016,2021, Franck Villaume - TrivialDev
  * http://fusionforge.org
  *
  * This file is part of FusionForge. FusionForge is free software;
@@ -255,7 +255,29 @@ function show_highest_ranked_projects() {
        return $return;
 }
 
-// Local Variables:
-// mode: php
-// c-file-style: "bsd"
-// End:
+function show_top_voted_project() {
+       global $HTML;
+       $stats = new Stats();
+       $result = $stats->getTopVotedProjects();
+       $return = '' ;
+       $count = 1 ;
+       while(($row = db_fetch_array($result)) && ($count <= 20)) {
+               if (!forge_check_perm('project_read', $row['group_id'])) {
+                       continue ;
+               }
+
+               $t_prj_link = util_make_link_g($row['unix_group_name'], 
$row['group_id'], $row['group_name']);
+
+               $return .= "<tr>";
+               $return .= '<td class="width-stat-col1">'. $row['counter'] . 
"</td>";
+               $return .= '<td>' . $t_prj_link . '</td>';
+               $return .= "</tr>\n";
+
+               $count++ ;
+       }
+       if ( $return == "" ) {
+               return $HTML->warning_msg(_('No stats available.'));
+       } else {
+               return $HTML->listTableTop().$return.$HTML->listTableBottom();
+       }
+}

https://scm.fusionforge.org/anonscm/gitweb/?p=fusionforge/fusionforge.git;a=commitdiff;h=ec5b26dae6461507d130f51cce69607cd2631f07

commit ec5b26dae6461507d130f51cce69607cd2631f07
Author: Franck Villaume <[email protected]>
Date:   Tue Jun 15 14:09:26 2021 +0200

    fix widget category

diff --git a/src/common/widget/Widget_HomeLatestDiaryNotes.class.php 
b/src/common/widget/Widget_HomeLatestDiaryNotes.class.php
index 9e66453..cd78cf4 100644
--- a/src/common/widget/Widget_HomeLatestDiaryNotes.class.php
+++ b/src/common/widget/Widget_HomeLatestDiaryNotes.class.php
@@ -28,6 +28,10 @@ class Widget_HomeLatestDiaryNotes extends Widget {
                }
        }
 
+       function getCategory() {
+               return _('Diary Notes');
+       }
+
        function getTitle() {
                return $this->content['title'];
        }

-----------------------------------------------------------------------

Summary of changes:
 src/common/include/Stats.class.php                 | 19 +++++++------
 .../widget/Widget_HomeLatestDiaryNotes.class.php   |  4 +++
 src/common/widget/Widget_HomeStats.class.php       |  4 ++-
 src/www/include/features_boxes.php                 | 32 ++++++++++++++++++----
 4 files changed, 44 insertions(+), 15 deletions(-)


hooks/post-receive
-- 
FusionForge

_______________________________________________
Fusionforge-commits mailing list
[email protected]
http://lists.fusionforge.org/cgi-bin/mailman/listinfo/fusionforge-commits

Reply via email to