Version: current

     1 <?php
     2
     3 class SiteInfo extends DashboardPlugin {
     4     static $position = "left";
     5     static $sort = 0;
     6     static $title = "Site info";
     7     static $icon = "dashboard/images/22/blackbox.png";
     8
     9     /**
    10      * SiteInfo gets a quick summary of all items in SiteTree, all Files (excluding folders) and members.
    11      *
    12      * @return DataObjectSet
    13      */
    14     public function Site() {
    15         $output = new DataObjectSet();
    16
    17         $pages      = DataObject::get('SiteTree');
    18         $pages      = $pages ? $pages->Count() : 0;
    19         $pagesStr   = ($pages == 1) ? 'Страниц' : 'Страниц';
    20         $output->push(new ArrayData(array(
    21             'Number' => $pages,
    22             'Item' => $pagesStr
    23         )));
    24
    25         $files      = DataObject::get('File', "ClassName <> 'Folder'");
    26         $files      = $files ? $files->Count() : 0;
    27         $filesStr   = ($files == 1) ? 'Файл' : 'Файл';
    28         $output->push(new ArrayData(array(
    29             'Number' => $files,
    30             'Item' => $filesStr
    31         )));
    32
    33         $members    = DataObject::get('Member');
    34         $members    = $members ? $members->Count() : 0;
    35         $membersStr = ($members == 1) ? 'Пользователей' : 'Пользователей';
    36         $output->push(new ArrayData(array(
    37             'Number' => $members,
    38             'Item' => $membersStr
    39         )));
    40
    41         return $output;
    42     }
    43 }?>

[Raise a SilverStripe Framework issue/bug](https://github.com/silverstripe/silverstripe-framework/issues/new)
- [Raise a SilverStripe CMS issue/bug](https://github.com/silverstripe/silverstripe-cms/issues/new)
- Please use the Silverstripe Forums to ask development related questions. -