5 * Copyright 1999-2001 (c) VA Linux Systems
6 * http://fusionforge.org/
8 * This file is part of FusionForge. FusionForge is free software;
9 * you can redistribute it and/or modify it under the terms of the
10 * GNU General Public License as published by the Free Software
11 * Foundation; either version 2 of the Licence, or (at your option)
14 * FusionForge is distributed in the hope that it will be useful,
15 * but WITHOUT ANY WARRANTY; without even the implied warranty of
16 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17 * GNU General Public License for more details.
19 * You should have received a copy of the GNU General Public License along
20 * with FusionForge; if not, write to the Free Software Foundation, Inc.,
21 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
24 require_once '../env.inc.php';
25 require_once 'pre.php';
26 require_once 'trove.php';
28 require_once 'common/include/escapingUtils.php';
29 require_once 'TroveCategory.class.php';
30 require_once 'TroveCategoryFactory.class.php';
31 require_once 'include/utils.php';
33 if (!forge_get_config('use_trove')) {
37 $categoryId = getIntFromGet('form_cat');
39 // assign default if not defined
41 $categoryId = forge_get_config('default_trove_cat');
44 $category = new TroveCategory($categoryId);
45 $HTML->header(array('title'=>_('Trove Map')));
48 // We check current filtering directives and display them
50 $filter = getStringFromGet('discrim');
54 // check and clean the array
55 $filterArray = explode(',', $filter);
56 $cleanArray = array();
57 $count = max(6, sizeof($filterArray));
58 for ($i = 0; $i < $count; $i++) {
59 if(is_numeric($filterArray[$i]) && $filterArray[$i] != 0) {
60 $cleanArray[] = (int) $filterArray[$i];
63 $filterArray = array_unique($cleanArray);
64 if(!empty($filterArray)) {
65 $filterCategories = TroveCategoryFactory::getCategories($filterArray);
67 echo '<p><span style="color:red;">'._('Limiting View').'</span>';
69 for($i=0, $count = sizeof($filterCategories); $i < $count; $i++) {
70 $filterCategory =& $filterCategories[$i];
71 echo '<br /> '
72 .$filterCategory->getFullPath()
73 .' <a href="?form_cat='.$category->getID()
74 .getFilterUrl($filterArray, $filterCategory->getID()).'">['._('Remove Filter').']'
81 $category->setFilter($filterArray);
84 // We display the trove
87 <table class="fullwidth">
89 <td class="halfwidth">
91 // here we print list of root level categories, and use open folder for current
92 $rootCategories = TroveCategoryFactory::getRootCategories();
93 echo _('Browse By')._(':');
94 for($i = 0, $count = sizeof($rootCategories); $i < $count; $i++) {
95 $rootCategory =& $rootCategories[$i];
97 // print open folder if current, otherwise closed
98 // also make anchor if not current
101 if (($rootCategory->getID() == $category->getRootParentId())
102 || ($rootCategory->getID() == $category->getID())) {
104 echo $HTML->getOpenFolderPic();
105 echo ' <strong>'.$rootCategory->getLocalizedLabel().'</strong>';
107 echo '<a href="?form_cat='.$rootCategory->getID().@$discrim_url.'">';
108 echo $HTML->getFolderPic();
109 echo ' '.$rootCategory->getLocalizedLabel();
115 <td class="halfwidth">
118 $parentCategories =& $category->getParents();
119 for ($i=0, $count = sizeof($parentCategories); $i < $count; $i++) {
120 echo str_repeat(' ', $i * 2);
122 echo $HTML->getOpenFolderPic();
124 if($parentCategories[$i]['id'] != $category->getID()) {
125 echo '<a href="?form_cat='.$parentCategories[$i]['id'].$discrim_url.'">';
129 echo $parentCategories[$i]['name'];
130 if($parentCategories[$i]['id'] != $category->getID()) {
138 $childrenCategories =& $category->getChildren();
140 $currentIndent .= str_repeat(' ', sizeof($parentCategories) * 2);
142 for($i = 0, $count = sizeof($childrenCategories); $i < $count; $i++) {
143 $childCategory =& $childrenCategories[$i];
146 echo '<a href="?form_cat='.$childCategory->getID().@$discrim_url.'">';
147 echo $HTML->getFolderPic();
148 echo ' '.$childCategory->getLocalizedLabel().'</a>';
150 .sprintf(_('%s projects'), $childCategory->getSubProjectsCount())
160 // We display projects
162 $offset = getIntFromGet('offset');
163 $page = getIntFromGet('page');
165 $projectsResult = $category->getProjects($offset);
167 // store this as a var so it can be printed later as well
168 $html_limit = '<span style="text-align:center;font-size:smaller">';
169 $html_limit .= sprintf (ngettext ('<strong>%d</strong> project in result set.',
170 '<strong>%d</strong> projects in result set.',
174 // only display pages stuff if there is more to display
175 if ($querytotalcount > $TROVE_BROWSELIMIT) {
176 $html_limit .= ' ' . sprintf(
177 _('Displaying %d projects per page. Projects sorted by activity ranking.'),
181 // display all the numbers
182 for ($i=1;$i<=ceil($querytotalcount/$TROVE_BROWSELIMIT);$i++) {
184 $displayed_i = "<$i>" ;
186 $html_limit .= "<strong>$displayed_i</strong>" ;
188 $html_limit .= util_make_link("/softwaremap/trove_list.php?form_cat=$form_cat&page=$i",
195 $html_limit .= '</span>';
197 print $html_limit."<hr />\n";
199 ?><table class="fullwidth"><?php
200 while($project = db_fetch_array($projectsResult)) {
203 <td colspan="2"><?php
205 echo util_make_link_g ($project['unix_group_name'],
206 $project['group_id'],
207 '<strong>'.htmlspecialchars($project['group_name']).'</strong>');
208 if ($project['short_description']) {
209 echo ' - '.htmlspecialchars($project['short_description']);
217 // list all trove categories
218 //print trove_getcatlisting($row_grp['group_id'],1,0);
220 <td class="align-right">
221 Activity Percentile: <strong><?php echo number_format($project['percentile'],2) ?></strong>
222 <br />Activity Ranking: <strong><?php echo number_format($project['ranking'],2) ?></strong>
223 <br />Register Date: <strong><?php echo date($sys_datefmt, $project['register_time']) ?></strong>
227 <td colspan="2"><hr /></td>
233 // print bottom navigation if there are more projects to display
234 if ($querytotalcount > $TROVE_BROWSELIMIT) {