Webylon 3.1 API Docs
  • Package
  • Class
  • Tree
  • Deprecated
  • Download
Version: current
  • 3.2
  • 3.1

Packages

  • auth
  • Booking
  • cart
    • shipping
    • steppedcheckout
  • Catalog
  • cms
    • assets
    • batchaction
    • batchactions
    • bulkloading
    • comments
    • content
    • core
    • export
    • newsletter
    • publishers
    • reports
    • security
    • tasks
  • Dashboard
  • DataObjectManager
  • event
  • faq
  • forms
    • actions
    • core
    • fields-basic
    • fields-dataless
    • fields-datetime
    • fields-files
    • fields-formatted
    • fields-formattedinput
    • fields-relational
    • fields-structural
    • transformations
    • validators
  • googlesitemaps
  • guestbook
  • installer
  • newsletter
  • None
  • photo
    • gallery
  • PHP
  • polls
  • recaptcha
  • sapphire
    • api
    • bulkloading
    • control
    • core
    • cron
    • dev
    • email
    • fields-formattedinput
    • filesystem
    • formatters
    • forms
    • i18n
    • integration
    • misc
    • model
    • parsers
    • search
    • security
    • tasks
    • testing
    • tools
    • validation
    • view
    • widgets
  • seo
    • open
      • graph
  • sfDateTimePlugin
  • spamprotection
  • stealth
    • captha
  • subsites
  • userform
    • pagetypes
  • userforms
  • webylon
  • widgets

Classes

  • BigFilesReport
  • BrokenLinksReport
  • CMSMain
  • CMSMainMarkingFilter
  • CMSMenu
  • CMSMenuItem
  • CMSSiteTreeFilter
  • CMSSiteTreeFilter_ChangedPages
  • CMSSiteTreeFilter_DeletedPages
  • CMSSiteTreeFilter_Search
  • NonUsedFilesReport
  • RedirectorPage
  • RedirectorPage_Controller
  • SideReport_BrokenFiles
  • SideReport_BrokenLinks
  • SideReport_BrokenRedirectorPages
  • SideReport_BrokenVirtualPages
  • SideReport_EmptyPages
  • SideReport_RecentlyEdited
  • SideReport_ToDo
  • SideReportView
  • SideReportWrapper
  • SilverStripeNavigator
  • SilverStripeNavigatorItem
  • SilverStripeNavigatorItem_ArchiveLink
  • SilverStripeNavigatorItem_CMSLink
  • SilverStripeNavigatorItem_LiveLink
  • SilverStripeNavigatorItem_StageLink
  • WidgetAreaEditor
  1 <?php
  2 
  3 /**
  4  * Content side-report listing big files
  5  * @package cms
  6  * @subpackage content
  7  */
  8 
  9 class BigFilesReport extends SS_Report {
 10 
 11     protected $dataClass = 'File';
 12 
 13     function title() {
 14         return _t('BigFilesReport.TITLE',"Top 100 big files");
 15     }
 16     
 17     function sourceRecords($params, $sort, $limit) {
 18         // limit max big files to 100
 19         if (!$limit) {
 20             $limit = array(
 21                 'limit' => 100,
 22                 'start' => 0
 23             );
 24         }
 25         if (!$sort) {
 26             $sort = "FileSize DESC";
 27         }
 28         return DataObject::get('File', "ClassName <> 'Folder'", $sort, '', $limit);
 29     }
 30     
 31     function columns() {
 32         $fields = array(
 33             "Title" => array(
 34                 "title" => _t('BigFilesReport.Title', 'Title')
 35             ),
 36             "Filename" => array(
 37                 "title" => _t('BigFilesReport.Filename', 'Filename'),
 38             ),
 39             'FileSize' => array(
 40                 'title' => _t('NonUsedFilesReport.Size', 'File size'),
 41                 'formatting' => '$Size'
 42             ),
 43             "Created" => array(
 44                 "title" => _t('BigFilesReport.Created', 'Created at'),
 45             ),
 46             "LastEdited" => array(
 47                 "title" => _t('BigFilesReport.LastEdited', 'Last edited at'),
 48             ),
 49             "Owner.Title" => array(
 50                 "title" => _t('BigFilesReport.OwnerTitle', 'Owner'),
 51             ),
 52             "UsageCount" => array(
 53                 "title" => _t('BigFilesReport.UsageCount', 'Usage count'),
 54                 'casting' => 'Int'
 55             ),
 56         );
 57         return $fields;
 58     }
 59     
 60     function sortColumns() {
 61         $fields = array(
 62             "Title",
 63             "Filename",
 64             'FileSize',
 65             "Created",
 66             "LastEdited"
 67         );
 68         return $fields;
 69     }
 70     
 71     function getReportField() {
 72         $columnTitles = array();
 73         $fieldFormatting = array();
 74         $csvFieldFormatting = array();
 75         $fieldCasting = array();
 76         
 77         // Parse the column information
 78         foreach($this->columns() as $source => $info) {
 79             if(is_string($info)) $info = array('title' => $info);
 80             
 81             if(isset($info['formatting'])) $fieldFormatting[$source] = $info['formatting'];
 82             if(isset($info['csvFormatting'])) $csvFieldFormatting[$source] = $info['csvFormatting'];
 83             if(isset($info['casting'])) $fieldCasting[$source] = $info['casting'];
 84             $columnTitles[$source] = isset($info['title']) ? $info['title'] : $source;
 85         }
 86         
 87         $tlf = new FileComplexTableField($this, 'ReportContent', $this->dataClass(), $columnTitles);
 88         $tlf->setCustomQuery($this->sourceQuery($_REQUEST));
 89         $tlf->setPageSize(20);
 90         $tlf->setHighlightConditions(array(
 91             array(
 92                 'rule' => '$UsageCount == 0',
 93                 'class' => 'fileNotUsed'
 94             ),
 95         ));
 96         
 97         
 98         if($fieldFormatting) $tlf->setFieldFormatting($fieldFormatting);
 99         if($csvFieldFormatting) $tlf->setCSVFieldFormatting($csvFieldFormatting);
100         if($fieldCasting) $tlf->setFieldCasting($fieldCasting);
101         
102         return $tlf;
103     }
104 }
105 
[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. -
Webylon 3.1 API Docs API documentation generated by ApiGen 2.8.0