Move to sane directory structure. Don't make 'cms' the top level of the silverstripe...
[silverstripe-elijah.git] / silverstripe-gsoc / cms / code / StatisticsAdmin.php
blob8adda630636f1d13f70d89cdcb5bfaaf5496bc1e
1 <?php
3 class StatisticsAdmin extends LeftAndMain {
4 static $tree_class = "SiteTree";
5 static $subitem_class = "Member";
7 /**
8 * Initialisation method called before accessing any functionality that BulkLoaderAdmin has to offer
9 */
10 public function init() {
11 parent::init();
13 Requirements::javascript("jsparty/plotr.js");
14 Requirements::javascript("jsparty/tablekit.js");
16 Requirements::css("cms/css/StatisticsAdmin.css");
19 public function Link($action=null) {
20 return "admin/statistics/$action";
23 /**
24 * Form that will be shown when we open one of the items
25 */
26 public function EditForm() {
30 function getSiteTreeFor($className) {
31 $obj = singleton($className);
32 $obj->markPartialTree();
33 if($p = $this->currentPage()) $obj->markToExpose($p);
35 // getChildrenAsUL is a flexible and complex way of traversing the tree
36 $siteTree = $obj->getChildrenAsUL("", '
37 "<li id=\"record-$child->ID\" class=\"" . $child->CMSTreeClasses($extraArg) . "\">" .
38 "<a href=\"" . Director::link(substr($extraArg->Link(),0,-1), "show", $child->ID) . "\" " . (($child->canEdit() || $child->canAddChildren()) ? "" : "class=\"disabled\"") . " title=\"Page type: ".$child->class."\" >" .
39 ($child->TreeTitle()) .
40 "</a>"
42 ,$this, true);
44 // Wrap the root if needs be.
46 $rootLink = $this->Link() . '0';
47 $siteTree = "<ul id=\"sitetree\" class=\"tree unformatted\"><li id=\"record-0\" class=\"Root nodelete\"><a href=\"$rootLink\">Pages</a>"
48 . $siteTree . "</li></ul>";
51 return $siteTree;
54 public function SiteTreeAsUL() {
55 return $this->getSiteTreeFor("SiteTree");
58 function UserCount($date = null) {
59 $allUsers = DataObject::get('Member');
60 return $allUsers->TotalItems();
63 function UserTableRecords() {
64 return DataObject::get('Member');