3 * Copyright (C) 2008-2009 Alcatel-Lucent
4 * Copyright 2015,2017, Franck Villaume - TrivialDev
6 * This file is part of FusionForge. FusionForge is free software;
7 * you can redistribute it and/or modify it under the terms of the
8 * GNU General Public License as published by the Free Software
9 * Foundation; either version 2 of the Licence, or (at your option)
12 * FusionForge is distributed in the hope that it will be useful,
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 * GNU General Public License for more details.
17 * You should have received a copy of the GNU General Public License along
18 * with FusionForge; if not, write to the Free Software Foundation, Inc.,
19 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
23 * Standard Alcatel-Lucent disclaimer for contributing to open source
25 * "The Tag Cloud ("Contribution") has not been tested and/or
26 * validated for release as or in products, combinations with products or
27 * other commercial use. Any use of the Contribution is entirely made at
28 * the user's own responsibility and the user can not rely on any features,
29 * functionalities or performances Alcatel-Lucent has attributed to the
32 * THE CONTRIBUTION BY ALCATEL-LUCENT IS PROVIDED AS IS, WITHOUT WARRANTY
33 * OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE
34 * WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, COMPLIANCE,
35 * NON-INTERFERENCE AND/OR INTERWORKING WITH THE SOFTWARE TO WHICH THE
36 * CONTRIBUTION HAS BEEN MADE, TITLE AND NON-INFRINGEMENT. IN NO EVENT SHALL
37 * ALCATEL-LUCENT BE LIABLE FOR ANY DAMAGES OR OTHER LIABLITY, WHETHER IN
38 * CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
39 * CONTRIBUTION OR THE USE OR OTHER DEALINGS IN THE CONTRIBUTION, WHETHER
40 * TOGETHER WITH THE SOFTWARE TO WHICH THE CONTRIBUTION RELATES OR ON A STAND
44 require_once '../env.inc.php';
45 require_once $gfcommon.'include/pre.php';
46 require_once $gfwww.'include/trove.php';
47 require_once $gfcommon.'include/tag_cloud.php';
48 require_once $gfwww.'people/people_utils.php';
50 if (!forge_get_config('use_project_tags')) {
56 $HTML->header(array('title'=>_('Tag Cloud'),'pagename'=>'softwaremap'));
57 $HTML->printSoftwareMapLinks();
59 $selected_tag = getStringFromRequest('tag');
61 echo tag_cloud(array('selected' => $selected_tag, 'nb_max' => 100)) . '<br /><br />';
66 if (session_loggedin()) {
67 if (getStringFromRequest('setpaging')) {
68 /* store paging preferences */
69 $paging = getIntFromRequest('nres');
73 $LUSER->setPreference('paging', $paging);
75 /* logged in users get configurable paging */
76 $paging = $LUSER->getPreference('paging');
77 $userRoles = $LUSER->getRoles();
78 if (count($userRoles)) {
79 foreach ($userRoles as $r) {
80 $role_id .= ', '.$r->getID();
85 if(!isset($paging) || !$paging) {
89 $start = getIntFromRequest('start');
94 $nbProjects = FusionForge::getInstance()->getNumberOfProjectsUsingTags(array('groups.status' => 'A', 'groups.is_template' => 0, 'LOWER(name)' => strtolower($selected_tag)), 'register_time > 0 AND groups.group_id in (select ref_id FROM pfo_role_setting WHERE section_name = \'project_read\' and perm_val = 1 and role_id IN ('.$role_id.'))');
95 $projects = group_get_readable_projects_using_tag_asc($selected_tag, $paging, $start);
97 $max = ($nbProjects > ($start + $paging)) ? ($start + $paging) : $nbProjects;
98 echo $HTML->paging_top($start, $paging, $nbProjects, $max, '/softwaremap/tag_cloud.php?tag='.$selected_tag);
102 // #################################################################
103 // print actual project listings
104 for ($i_proj = 0; $i_proj < count($projects); $i_proj++) {
105 $row_grp = $projects[$i_proj];
107 echo $HTML->listTableTop(array(), array(), 'full');
109 $content = util_make_link ('/projects/'. strtolower($row_grp['unix_group_name']).'/',
110 '<strong>'.$row_grp['group_name'].'</strong> ');
111 if ($row_grp['short_description']) {
112 $content .= "- " . $row_grp['short_description'];
114 if (forge_get_config('use_trove')) {
115 $cells[] = array($content, 'colspan' => 2);
117 $cells[][] = $content;
119 echo $HTML->multiTableRow(array('class' => 'top'), $cells);
122 if (forge_get_config('use_trove')) {
123 $cells[] = array(_('Tags') . _(': ') . list_project_tag($row_grp['group_id']), 'colspan' => 2);
125 $cells[][] = _('Tags') . _(': ') . list_project_tag($row_grp['group_id']);
127 echo $HTML->multiTableRow(array('class' => 'top'), $cells);
129 if (forge_get_config('use_trove')) {
130 $cells[][] = trove_getcatlisting($row_grp['group_id'], 0, 1, 0);
132 $res = db_query_params('SELECT percentile, ranking FROM project_weekly_metric WHERE group_id = $1', array($row_grp['group_id']));
133 $nb_line = db_numrows($res);
135 $percentile = html_e('strong', array(), sprintf('%3.0f', number_format(db_result($res, 0, 'percentile'))));
136 $ranking = html_e('strong', array(), sprintf('%d', number_format(db_result($res, 0, 'ranking'))));
138 $percentile = _('N/A');
141 $content = html_e('br')._('Activity Percentile')._(': ').$percentile;
142 $content .= html_e('br')._('Activity Ranking')._(': ').$ranking;
143 $content .= html_e('br').sprintf(_('Registered') . _(': '));
144 $content .= html_e('strong', array(), date(_('Y-m-d H:i'),$row_grp['register_time']));
145 $cells[] = array($content, 'class' => 'align-right');
146 echo $HTML->multiTableRow(array('class' => 'top'), $cells);
147 if (forge_get_config('use_people') && people_group_has_job($row_grp['group_id'])) {
149 $cells[] = array(util_make_link('/people/?group_id='.$row_grp['group_id'],_('[This project needs help]')), 'colspan' => 2, 'class' => 'align-center');
150 echo $HTML->multiTableRow(array('class' => 'top'), $cells);
152 echo $HTML->listTableBottom();
155 echo $HTML->paging_bottom($start, $paging, $nbProjects, '/softwaremap/tag_cloud.php?tag='.$selected_tag);