Commit 16b0eeec authored by Richard Mansfield's avatar Richard Mansfield
Browse files

Reorganise admin home page and add basic statistics block


Signed-off-by: default avatarRichard Mansfield <richardm@catalyst.net.nz>
parent 41516fb6
......@@ -33,6 +33,7 @@ define('SECTION_PLUGINNAME', 'admin');
define('SECTION_PAGE', 'index');
require(dirname(dirname(__FILE__)).'/init.php');
require(get_config('libroot') . 'registration.php');
if (get_config('installed')) {
define('TITLE', get_string('administration', 'admin'));
}
......@@ -77,6 +78,9 @@ $smarty->assign('PAGEHEADING', hsc(get_string('administration', 'admin')));
// normal admin page starts here
$smarty->assign('upgrades', $upgrades);
if (empty($upgrades)) {
$smarty->assign('sitedata', site_statistics());
}
if (isset($register)) {
$smarty->assign('register', $register);
......
......@@ -145,6 +145,9 @@ $string['Open'] = 'Open';
$string['reopensite'] = 'Reopen Site';
$string['reopensitedetail'] = 'Your site is closed. Site administrators may stay logged in until an upgrade is detected.';
// Statistics
$string['sitestatistics'] = 'Site Statistics';
// Site options
$string['adminsonly'] = 'Administrators only';
$string['adminsandstaffonly'] = 'Administrators and Staff only';
......
......@@ -178,3 +178,14 @@ function registration_data() {
return $data_to_send;
}
function site_statistics() {
return array(
'name' => get_config('sitename'),
'users' => count_records_select('usr', 'id > 0 AND deleted = 0'),
'groups' => count_records('group', 'deleted', 0),
'views' => count_records_select('view', 'owner <> 0'),
);
}
?>
\ No newline at end of file
......@@ -155,6 +155,20 @@ input#register_register {
background: #fefefe;
}
.site-stats {
margin: 0 0 1em 0;
}
.site-stats h5 {
margin-bottom: .25em;
}
.site-stats p {
margin: .1em;
}
.admin-home-column {
width: 49%;
margin: 0 .1em;
}
/* CONFIGURE SITE > LINKS AND RESOURCES MENU */
#menuitemlist {
......
{include file='header.tpl'}
<div class="message" id="close-site">
{if $closed}
<h3>{str tag=reopensite section=admin}</h3>
{str tag=reopensitedetail section=admin}
{else}
<h3>{str tag=closesite section=admin}</h3>
{str tag=closesitedetail section=admin}
{/if}
{$closeform}
</div>
<div id="adminhome">
{if $upgrades}
<div id="runupgrade">
......@@ -24,6 +35,11 @@
</table>
</div>
{/if}
{if $sitedata}
{include file='admin/stats.tpl' cron=1}
{/if}
{if $register}
<div class="message" id="register-site">
<h3>{str tag=registeryourmaharasite section=admin}</h3>
......@@ -31,6 +47,13 @@
</div>
{/if}
</div>
<div class="cb"></div>
<div class="admin-home-column fl">
<h3>{str tag=configsite section=admin}</h3>
<ul>
<li><strong><a href="{$WWWROOT}admin/site/options.php">{str tag=siteoptions section=admin}</a></strong> - {str tag=siteoptionsdescription section=admin}</li>
......@@ -40,6 +63,16 @@
<li><strong><a href="{$WWWROOT}admin/site/views.php">{str tag=siteviews section=admin}</a></strong> - {str tag=siteviewsdescription section=admin}</li>
<li><strong><a href="{$WWWROOT}artefact/file/sitefiles.php">{str tag=sitefiles section=admin}</a></strong> - {str tag=sitefilesdescription section=admin}</li>
</ul>
<h3>{str tag=configextensions section=admin}</h3>
<ul>
<li><strong><a href="{$WWWROOT}admin/extensions/plugins.php">{str tag=pluginadmin section=admin}</a></strong> - {str tag=pluginadmindescription section=admin}</li>
<li><strong><a href="{$WWWROOT}admin/extensions/filter.php">{str tag=htmlfilters section=admin}</a></strong> - {str tag=htmlfiltersdescription section=admin}</li>
</ul>
</div>
<div class="admin-home-column fr">
<h3>{str tag=configusers section=admin}</h3>
<ul>
<li><strong><a href="{$WWWROOT}admin/users/search.php">{str tag=usersearch section=admin}</a></strong> - {str tag=usersearchdescription section=admin}</li>
......@@ -59,23 +92,7 @@
<li><strong><a href="{$WWWROOT}view/institutionviews.php">{str tag=institutionviews section=admin}</a></strong> - {str tag=institutionviewsdescription section=admin}</li>
<li><strong><a href="{$WWWROOT}artefact/file/institutionfiles.php">{str tag=institutionfiles section=admin}</a></strong> - {str tag=institutionfilesdescription section=admin}</li>
</ul>
<h3>{str tag=configextensions section=admin}</h3>
<ul>
<li><strong><a href="{$WWWROOT}admin/extensions/plugins.php">{str tag=pluginadmin section=admin}</a></strong> - {str tag=pluginadmindescription section=admin}</li>
<li><strong><a href="{$WWWROOT}admin/extensions/filter.php">{str tag=htmlfilters section=admin}</a></strong> - {str tag=htmlfiltersdescription section=admin}</li>
</ul>
</div>
<div class="message" id="close-site">
{if $closed}
<h3>{str tag=reopensite section=admin}</h3>
{str tag=reopensitedetail section=admin}
{else}
<h3>{str tag=closesite section=admin}</h3>
{str tag=closesitedetail section=admin}
{/if}
{$closeform}
</div>
<div class="cb"></div>
{include file='footer.tpl'}
<div class="site-stats">
<h5>{$sitedata.name}: {str tag=sitestatistics section=admin}</h5>
<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=groups}:</strong> {$sitedata.groups}{if $sitedata.rank.groups} ({str tag=Rank section=admin}: $sitedata.rank.groups}){/if}</p>
<p><strong>{str tag=views}:</strong> {$sitedata.views}{if $sitedata.rank.views} ({str tag=Rank section=admin}: $sitedata.rank.views}){/if}</p>
</div>
\ No newline at end of file
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