Indefero

Indefero Commit Details


Date:2011-02-23 07:29:01 (13 years 9 months ago)
Author:William MARTIN
Branch:develop, feature-issue_links, feature.better-home, feature.content-md5, feature.diff-whitespace, feature.download-md5, feature.issue-links, feature.issue-of-others, feature.issue-summary, feature.search-filter, feature.webrepos, feature.wiki-default-page, release-1.1, release-1.2, release-1.3
Commit:5e6d61b3a7e27698b166d216516d3ef068f093aa
Parents: 4e00051a1053687979c43fc82af6e67387c43a3d
Message:Add more statistics on the projects list page

Changes:

File differences

src/IDF/Views.php
4040
4141
4242
43
4344
4445
45
46
47
4648
4749
4850
......
343345
344346
345347
346
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
public function index($request, $match)
{
$projects = self::getProjects($request->user);
$stats = self::getProjectsStatistics ($projects);
return Pluf_Shortcuts_RenderToResponse('idf/index.html',
array('page_title' => __('Projects'),
'projects' => $projects),
'projects' => $projects,
'stats' => new Pluf_Template_ContextVars($stats)),
$request);
}
return Pluf::factory('IDF_Project')->getList(array('filter' => $sql,
'order' => 'name ASC'));
}
}
/**
* Returns statistics on a list of projects.
*
* @param ArrayObject IDF_Project
* @return Associative array of statistics
*/
public static function getProjectsStatistics($projects)
{
// Init the return var
$forgestats = array('downloads' => 0,
'reviews' => 0,
'issues' => 0,
'docpages' => 0,
'commits' => 0);
// Count for each projects
foreach ($projects as $p) {
$pstats = $p->getStats ();
$forgestats['downloads'] += $pstats['downloads'];
$forgestats['reviews'] += $pstats['reviews'];
$forgestats['issues'] += $pstats['issues'];
$forgestats['docpages'] += $pstats['docpages'];
$forgestats['commits'] += $pstats['commits'];
}
// Count projects
$forgestats['projects'] = count($projects);
// Count members
$db =& Pluf::db();
$sql = "SELECT count(id) as `nb` FROM indefero_users WHERE first_name != '---'";
$ret = $db->select ($sql);
$forgestats['members'] = $ret[0]['nb'];
return $forgestats;
}
}
src/IDF/templates/idf/index.html
11
2
2
33
44
55
......
1515
1616
1717
18
18
19
20
21
22
23
24
25
26
27
28
29
1930
2031
{extends "idf/base-simple.html"}
{block docclass}yui-t1{/block}
{block docclass}yui-t2{/block}
{block tabhome} class="active"{/block}
{block subtabs}<a href="{url 'IDF_Views::index'}" class="active">{trans 'Projects'}</a>{/block}
{block body}
{/if}
{/block}
{block context}
<p><strong>{trans 'Managed Projects:'}</strong> {$projects.count()}</p>
<div id="stats" class="issue-submit-info">
<h3 class="a-c">Forge statistics</h3>
<table>
<tr><td class="right">{trans 'Projects:'}</td><td>{$stats.projects}</td></tr>
<tr><td class="right">{trans 'Members:'}</td><td>{$stats.members}</td></tr>
<tr><td class="right">{trans 'Issues:'}</td><td>{$stats.issues}</td></tr>
<tr><td class="right">{trans 'Commits:'}</td><td>{$stats.commits}</td></tr>
<tr><td class="right">{trans 'Documentations:'}</td><td>{$stats.docpages}</td></tr>
<tr><td class="right">{trans 'Downloads:'}</td><td>{$stats.downloads}</td></tr>
<tr><td class="right">{trans 'Code reviews:'}</td><td>{$stats.reviews}</td></tr>
</table>
</div>
{/block}
{block foot}<div id="branding">Powered by <a href="http://www.indefero.net" title="InDefero, bug tracking and more">InDefero</a>,<br />a <a href="http://www.ceondo.com">CĂ©ondo Ltd</a> initiative.</div>{/block}
www/media/idf/css/style.css
994994
995995
996996
997
998
999
1000
1001
1002
1003
1004
1005
1006
1007
1008
1009
1010
1011
span.scm-action.property-changed {
background-color: blue;
}
/*
* Stats on index
*/
#stats > h3 {
text-decoration : underline;
}
#stats table tr td {
border-style: none;
}
#stats td {
padding: .2em;
}

Archive Download the corresponding diff file

Page rendered in 0.08728s using 13 queries.