mirror of
https://github.com/silverstripe/silverstripe-cms
synced 2024-10-22 08:05:56 +02:00
qhoxie: basics of tabular data for stats
(merged from branches/gsoc) git-svn-id: svn://svn.silverstripe.com/silverstripe/open/modules/cms/trunk@41923 467b73ca-7a2a-4603-9d3b-597d59a354a9
This commit is contained in:
parent
4d0960ad9e
commit
1b5c8ee6a8
@ -8,9 +8,12 @@ class StatisticsAdmin extends LeftAndMain {
|
||||
* Initialisation method called before accessing any functionality that BulkLoaderAdmin has to offer
|
||||
*/
|
||||
public function init() {
|
||||
//Requirements::javascript('cms/javascript/StatisticsAdmin_left.js');
|
||||
//Requirements::javascript('cms/javascript/StatisticsAdmin_right.js');
|
||||
parent::init();
|
||||
|
||||
Requirements::javascript("jsparty/plotr.js");
|
||||
Requirements::javascript("jsparty/tablekit.js");
|
||||
|
||||
Requirements::css("cms/css/StatisticsAdmin.css");
|
||||
}
|
||||
|
||||
public function Link($action=null) {
|
||||
@ -20,15 +23,8 @@ class StatisticsAdmin extends LeftAndMain {
|
||||
/**
|
||||
* Form that will be shown when we open one of the items
|
||||
*/
|
||||
public function getEditForm($id = null) {
|
||||
return new Form($this, "EditForm",
|
||||
new FieldSet(
|
||||
new ReadonlyField('id #',$id)
|
||||
),
|
||||
new FieldSet(
|
||||
new FormAction('go')
|
||||
)
|
||||
);
|
||||
public function EditForm() {
|
||||
|
||||
}
|
||||
|
||||
function getSiteTreeFor($className) {
|
||||
@ -59,19 +55,13 @@ class StatisticsAdmin extends LeftAndMain {
|
||||
return $this->getSiteTreeFor("SiteTree");
|
||||
}
|
||||
|
||||
public function versions() {
|
||||
/*$pageID = $this->urlParams['ID'];
|
||||
//$pageID = "1";
|
||||
$page = $this->getRecord($pageID);
|
||||
if($page) {
|
||||
$versions = $page->allVersions($_REQUEST['unpublished'] ? "" : "`SiteTree_versions`.WasPublished = 1");
|
||||
return array(
|
||||
'Versions' => $versions,
|
||||
);
|
||||
} else {
|
||||
return "Can't find page #$pageID";
|
||||
}*/
|
||||
function UserCount($date = null) {
|
||||
$allUsers = DataObject::get('Member');
|
||||
return $allUsers->TotalItems();
|
||||
}
|
||||
|
||||
function UserTableRecords() {
|
||||
return DataObject::get('Member');
|
||||
}
|
||||
|
||||
}
|
||||
|
44
css/StatisticsAdmin.css
Normal file
44
css/StatisticsAdmin.css
Normal file
@ -0,0 +1,44 @@
|
||||
table.statstable {
|
||||
border-collapse: collapse;
|
||||
width: 90%;
|
||||
margin: 20px 0 20px 0;
|
||||
font-size: 12px;
|
||||
|
||||
}
|
||||
|
||||
.statstable td,.statstable th {
|
||||
padding: 0.2em;
|
||||
border: 1px solid #CCC;
|
||||
|
||||
}
|
||||
|
||||
.statstable th {
|
||||
background: #CAE8EA url(../images/statistics/bg_header.jpg) no-repeat;
|
||||
|
||||
}
|
||||
|
||||
.statstable td.id {
|
||||
background: #CAE8EA url(../images/statistics/bg_header.jpg) no-repeat;
|
||||
|
||||
}
|
||||
|
||||
.statstable th.nobg {
|
||||
background: #fff;
|
||||
border-top: none;
|
||||
border-left: none;
|
||||
}
|
||||
|
||||
.statstable thead,.statstable tfoot {
|
||||
background-color: #DDD;
|
||||
|
||||
}
|
||||
|
||||
.statstable tr.rowodd {
|
||||
background-color: #fff;
|
||||
|
||||
}
|
||||
|
||||
.statstable tr.roweven {
|
||||
background-color: #F0FBFD;
|
||||
|
||||
}
|
BIN
images/statistics/bg_header.jpg
Normal file
BIN
images/statistics/bg_header.jpg
Normal file
Binary file not shown.
After Width: | Height: | Size: 1.8 KiB |
44
templates/Includes/StatisticsAdmin_Graph.ss
Normal file
44
templates/Includes/StatisticsAdmin_Graph.ss
Normal file
@ -0,0 +1,44 @@
|
||||
<script>
|
||||
// Define a dataset.
|
||||
var dataset = {
|
||||
<% control DataSets %>
|
||||
'$SetName':
|
||||
'myFirstDataset': [[0, 3], [1, 2], [2, 1.414], [3, 2.3]],
|
||||
'mySecondDataset': [[0, 1.4], [1, 2.67], [2, 1.34], [3, 1.2]],
|
||||
'myThirdDataset': [[0, 0.46], [1, 1.45], [2, 1.0], [3, 1.6]],
|
||||
'myFourthDataset': [[0, 0.3], [1, 0.83], [2, 0.7], [3, 0.2]]
|
||||
<% end_control %>
|
||||
};
|
||||
|
||||
// Define options.
|
||||
var options = {
|
||||
// Define a padding for the canvas node
|
||||
padding: {left: 30, right: 0, top: 10, bottom: 30},
|
||||
|
||||
// Background color to render.
|
||||
backgroundColor: '#f2f2f2',
|
||||
|
||||
// Use the predefined blue colorscheme.
|
||||
colorScheme: '$colorScheme',
|
||||
|
||||
// Set the labels.
|
||||
xTicks: [
|
||||
{v:0, label:'January'},
|
||||
{v:1, label:'February'},
|
||||
{v:2, label:'March'},
|
||||
{v:3, label:'April'}
|
||||
]
|
||||
};
|
||||
|
||||
<% if $chartType = line %>
|
||||
var chart = new Plotr.LineChart('$',options);
|
||||
<% else_if $chartType = bar %>
|
||||
var chart = new Plotr.BarChart('$',options);
|
||||
<% else_if $chartType = pie %>
|
||||
var chart = new Plotr.PieChart('$',options);
|
||||
<% end_if %>
|
||||
|
||||
chart.addDataset(dataset);
|
||||
|
||||
chart.render();
|
||||
</script>
|
@ -3,9 +3,8 @@
|
||||
<div id="treepanes">
|
||||
<div id="sitetree_holder">
|
||||
<ul id="statsleft_tree" class="tree unformatted">
|
||||
<ul><li><a href="$rootLink">Overview</a></li></ul>
|
||||
<ul><li><a href="$rootLink">Users</a></li></ul>
|
||||
$SiteTreeAsUL
|
||||
<li><a href="$rootLink">Overview</a></li>
|
||||
<li><a href="$rootLink">Users</a></li>
|
||||
</ul>
|
||||
</div>
|
||||
</div>
|
||||
|
@ -3,9 +3,29 @@
|
||||
<% if EditForm %>
|
||||
$EditForm
|
||||
<% else %>
|
||||
<form id="Form_EditForm" action="admin/assets/?executeForm=EditForm" method="post" enctype="multipart/form-data">
|
||||
<p>Welcome to the $ApplicationName statistics section. Please choose a specific report from the left.</p>
|
||||
<form id="Form_EditForm" action="" method="post" enctype="multipart/form-data">
|
||||
<p>Total users: $UserCount</p>
|
||||
|
||||
|
||||
<% if UserTableRecords %>
|
||||
<table class="sortable statstable" cellspacing="0">
|
||||
<thead>
|
||||
<tr><th class="nobg"></th><th>Email</th><th>Type</th></tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<% control UserTableRecords %>
|
||||
<tr><td class="id">$Iteration</td><td>$Email</td><td>$ClassName</td></tr>
|
||||
<% end_control %>
|
||||
</tbody>
|
||||
</table>
|
||||
<% else %>
|
||||
<p>No tabular data available!</p>
|
||||
<% end_if %>
|
||||
|
||||
|
||||
</form>
|
||||
<% end_if %>
|
||||
|
||||
|
||||
|
||||
<p id="statusMessage" style="visibility:hidden"></p>
|
||||
|
Loading…
Reference in New Issue
Block a user