Commit 0020a52d authored by Evan Goldenberg's avatar Evan Goldenberg
Browse files

add rankings from mahara.org to the admin home page


Signed-off-by: default avatarEvan Goldenberg <evang@catalyst.net.nz>
parent 107078e9
......@@ -172,6 +172,8 @@ $string['statsmaxquotaused'] = 'Has used about %s of disk quota (most is <a href
$string['groupcountsbytype'] = 'Number of groups by Group Type';
$string['groupcountsbyjointype'] = 'Number of groups by Access Type';
$string['blockcountsbytype'] = 'Most frequently used blocks in Portfolio Views:';
$string['Rank'] = 'Rank';
$string['rankingsupdated'] = 'Rankings last updated: %s';
// Site options
$string['adminsonly'] = 'Administrators only';
......
......@@ -2274,12 +2274,16 @@ function cron_send_registration_data() {
require_once(get_config('libroot') . 'registration.php');
$result = registration_send_data();
$data = json_decode($result->data);
if ($result->data != '1') {
if ($data->status != 1) {
log_info($result);
}
else {
set_config('registration_lastsent', time());
set_config('usersrank', $data->usersrank);
set_config('groupsrank', $data->groupsrank);
set_config('viewsrank', $data->viewsrank);
}
}
......
......@@ -90,8 +90,9 @@ function register_submit(Pieform $form, $values) {
global $SESSION;
$result = registration_send_data();
$data = json_decode($result->data);
if ($result->data != '1') {
if ($data->status != 1) {
log_info($result);
$SESSION->add_error_msg(get_string('registrationfailedtrylater', 'admin', $result->info['http_code']));
}
......@@ -176,6 +177,8 @@ function registration_data() {
}
}
$data_to_send['newstats'] = 1;
return $data_to_send;
}
......@@ -248,6 +251,21 @@ function site_statistics($full=false) {
$data['diskusage'] = get_field('site_data', 'value', 'type', 'disk-usage');
$data['cronrunning'] = !record_exists_select('cron', 'nextrun < CURRENT_DATE');
// root user doesn't count
$data['users'] = count_records_select('usr', 'deleted = 0') - 1;
$data['groups'] = count_records_select('group', 'deleted = 0');
$data['views'] = count_records_select('view');
$data['rank'] = array(
'users' => get_config('usersrank'),
'groups' => get_config('groupsrank'),
'views' => get_config('viewsrank'),
);
$data['strrankingsupdated'] = get_string('rankingsupdated', 'admin', date('Y-m-d H:i', get_config('registration_lastsent')));
// FIXME: actually do this
$data['usersloggedin'] = 0;
return($data);
}
......
......@@ -10,22 +10,15 @@ addLoadEvent(function () {literal}{{/literal}
{/if}
<div class="fl">
<p><strong>{str tag=siteinstalled section=admin}:</strong> {$sitedata.installdate}</p>
{if $sitedata.users}
<p><strong>{str tag=users}:</strong> {$sitedata.users}{if $sitedata.rank.users} ({str tag=Rank section=admin}: $sitedata.rank.users}){/if}</p>
<p><strong>{str tag=users}:</strong> {$sitedata.users}{if $sitedata.rank.users} ({str tag=Rank section=admin}: {$sitedata.rank.users}){/if}</p>
<p>&nbsp;{str tag=activeusers section=admin}: {$sitedata.usersloggedin}</p>
{/if}
{if $sitedata.groups}
<p><strong>{str tag=groups}:</strong> {$sitedata.groups}{if $sitedata.rank.groups} ({str tag=Rank section=admin}: $sitedata.rank.groups}){/if}</p>
<p><strong>{str tag=groups}:</strong> {$sitedata.groups}{if $sitedata.rank.groups} ({str tag=Rank section=admin}: {$sitedata.rank.groups}){/if}</p>
<p>&nbsp;{$sitedata.strgroupmemberaverage}</p>
{/if}
{if $sitedata.views}
<p><strong>{str tag=views}:</strong> {$sitedata.views}{if $sitedata.rank.views} ({str tag=Rank section=admin}: $sitedata.rank.views}){/if}</p>
<p><strong>{str tag=views}:</strong> {$sitedata.views}{if $sitedata.rank.views} ({str tag=Rank section=admin}: {$sitedata.rank.views}){/if}</p>
<p>&nbsp;{$sitedata.strviewsperuser}</p>
{/if}
<p>{$sitedata.strrankingsupdated}</p>
<p><strong>{str tag=databasesize section=admin}:</strong> {$sitedata.dbsize|display_size}</p>
{if $sitedata.diskusage}
<p><strong>{str tag=diskusage section=admin}:</strong> {$sitedata.diskusage|display_size}</p>
{/if}
<p><strong>{str tag=maharaversion section=admin}:</strong> {$sitedata.release}</p>
<p><strong>{str tag=Cron section=admin}:</strong> {if $sitedata.cronrunning}{str tag=runningnormally section=admin}{else}{str tag=cronnotrunning section=admin}{/if}</p>
</div>
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment