2008-10-08 06:31:29 +02:00
|
|
|
<?php
|
|
|
|
/**
|
2010-05-28 04:34:37 +02:00
|
|
|
* Base "abstract" class creating reports on your data.
|
2008-10-09 04:52:08 +02:00
|
|
|
*
|
2010-05-28 04:34:37 +02:00
|
|
|
* Creating reports
|
|
|
|
* ================
|
2008-10-09 04:52:08 +02:00
|
|
|
*
|
2010-05-28 04:34:37 +02:00
|
|
|
* Creating a new report is a matter overloading a few key methods
|
2008-10-09 04:52:08 +02:00
|
|
|
*
|
2010-05-28 04:34:37 +02:00
|
|
|
* {@link title()}: Return the title - i18n is your responsibility
|
|
|
|
* {@link description()}: Return the description - i18n is your responsibility
|
2011-10-26 07:39:21 +02:00
|
|
|
* {@link sourceQuery()}: Return a SS_List of the search results
|
2010-05-28 04:34:37 +02:00
|
|
|
* {@link columns()}: Return information about the columns in this report.
|
2011-10-26 07:35:51 +02:00
|
|
|
* {@link parameterFields()}: Return a FieldList of the fields that can be used to filter this
|
2010-05-28 04:34:37 +02:00
|
|
|
* report.
|
2008-10-09 04:52:08 +02:00
|
|
|
*
|
2010-05-28 04:34:37 +02:00
|
|
|
* If you wish to modify the report in more extreme ways, you could overload these methods instead.
|
|
|
|
*
|
|
|
|
* {@link getReportField()}: Return a FormField in the place where your report's TableListField
|
|
|
|
* usually appears.
|
2011-10-26 07:35:51 +02:00
|
|
|
* {@link getCMSFields()}: Return the FieldList representing the complete right-hand area of the
|
2010-05-28 04:34:37 +02:00
|
|
|
* report, including the title, description, parameter fields, and results.
|
|
|
|
*
|
|
|
|
* Showing reports to the user
|
|
|
|
* ===========================
|
|
|
|
*
|
2012-04-03 08:06:35 +02:00
|
|
|
* Right now, all subclasses of SS_Report will be shown in the ReportAdmin. In SS3 there is only
|
|
|
|
* one place where reports can go, so this class is greatly simplifed from from its version in SS2.
|
2008-10-09 04:52:08 +02:00
|
|
|
*
|
|
|
|
* @package cms
|
|
|
|
* @subpackage reports
|
2008-10-08 06:31:29 +02:00
|
|
|
*/
|
API CHANGE: Renamed conflicting classes to have an "SS_" namespace, and renamed existing "SS" namespace to "SS_". The affected classes are: HTTPRequest, HTTPResponse, Query, Database, SSBacktrace, SSCli, SSDatetime, SSDatetimeTest, SSLog, SSLogTest, SSLogEmailWriter, SSLogErrorEmailFormatter, SSLogErrorFileFormatter, SSLogFileWriter and SSZendLog.
MINOR: Replaced usage of renamed classes with the new namespaced name.
From: Sam Minnee <sam@silverstripe.com>
git-svn-id: svn://svn.silverstripe.com/silverstripe/open/modules/cms/trunk@90076 467b73ca-7a2a-4603-9d3b-597d59a354a9
2009-10-26 04:06:42 +01:00
|
|
|
class SS_Report extends ViewableData {
|
2008-10-08 06:31:29 +02:00
|
|
|
/**
|
|
|
|
* This is the title of the report,
|
|
|
|
* used by the ReportAdmin templates.
|
|
|
|
*
|
|
|
|
* @var string
|
|
|
|
*/
|
|
|
|
protected $title = '';
|
|
|
|
|
|
|
|
/**
|
|
|
|
* This is a description about what this
|
|
|
|
* report does. Used by the ReportAdmin
|
|
|
|
* templates.
|
|
|
|
*
|
|
|
|
* @var string
|
|
|
|
*/
|
|
|
|
protected $description = '';
|
2010-05-28 04:34:37 +02:00
|
|
|
|
|
|
|
/**
|
|
|
|
* The class of object being managed by this report.
|
|
|
|
* Set by overriding in your subclass.
|
|
|
|
*/
|
|
|
|
protected $dataClass = 'SiteTree';
|
2012-04-03 08:06:35 +02:00
|
|
|
|
|
|
|
/**
|
|
|
|
* A field that specifies the sort order of this report
|
|
|
|
* @var int
|
|
|
|
*/
|
|
|
|
protected $sort = 0;
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Reports which should not be collected and returned in get_reports
|
|
|
|
* @var array
|
2013-03-18 11:47:15 +01:00
|
|
|
* @config
|
2012-04-03 08:06:35 +02:00
|
|
|
*/
|
2013-03-18 11:47:15 +01:00
|
|
|
private static $excluded_reports = array(
|
2012-04-03 08:06:35 +02:00
|
|
|
'SS_Report',
|
|
|
|
'SS_ReportWrapper',
|
|
|
|
'SideReportWrapper'
|
|
|
|
);
|
2010-05-28 04:34:37 +02:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Return the title of this report.
|
|
|
|
*
|
|
|
|
* You have two ways of specifying the description:
|
|
|
|
* - overriding description(), which lets you support i18n
|
|
|
|
* - defining the $description property
|
|
|
|
*/
|
2012-09-19 12:07:46 +02:00
|
|
|
public function title() {
|
2010-05-28 04:34:37 +02:00
|
|
|
return $this->title;
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Return the description of this report.
|
|
|
|
*
|
|
|
|
* You have two ways of specifying the description:
|
|
|
|
* - overriding description(), which lets you support i18n
|
|
|
|
* - defining the $description property
|
|
|
|
*/
|
2012-09-19 12:07:46 +02:00
|
|
|
public function description() {
|
2010-05-28 04:34:37 +02:00
|
|
|
return $this->description;
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Return the {@link SQLQuery} that provides your report data.
|
|
|
|
*/
|
2012-09-19 12:07:46 +02:00
|
|
|
public function sourceQuery($params) {
|
2010-05-28 04:34:37 +02:00
|
|
|
if($this->hasMethod('sourceRecords')) {
|
2012-07-12 16:14:17 +02:00
|
|
|
return $this->sourceRecords()->dataQuery();
|
2010-05-28 04:34:37 +02:00
|
|
|
} else {
|
|
|
|
user_error("Please override sourceQuery()/sourceRecords() and columns() or, if necessary, override getReportField()", E_USER_ERROR);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
2011-10-26 07:39:21 +02:00
|
|
|
* Return a SS_List records for this report.
|
2010-05-28 04:34:37 +02:00
|
|
|
*/
|
2012-09-19 12:07:46 +02:00
|
|
|
public function records($params) {
|
2012-07-12 16:14:17 +02:00
|
|
|
if($this->hasMethod('sourceRecords')) {
|
|
|
|
return $this->sourceRecords($params, null, null);
|
|
|
|
} else {
|
2010-05-28 04:34:37 +02:00
|
|
|
$query = $this->sourceQuery();
|
2012-07-12 16:14:17 +02:00
|
|
|
$results = new ArrayList();
|
|
|
|
foreach($query->execute() as $data) {
|
|
|
|
$class = $this->dataClass();
|
|
|
|
$result = new $class($data);
|
|
|
|
$results->push($result);
|
|
|
|
}
|
|
|
|
return $results;
|
2010-05-28 04:34:37 +02:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
2012-04-03 08:06:35 +02:00
|
|
|
* Return the data class for this report
|
2010-05-28 04:34:37 +02:00
|
|
|
*/
|
2012-09-19 12:07:46 +02:00
|
|
|
public function dataClass() {
|
2012-04-03 08:06:35 +02:00
|
|
|
return $this->dataClass;
|
2010-05-28 04:34:37 +02:00
|
|
|
}
|
2012-04-03 08:06:35 +02:00
|
|
|
|
2012-09-19 12:07:46 +02:00
|
|
|
public function getLink($action = null) {
|
2012-04-10 01:15:29 +02:00
|
|
|
return Controller::join_links(
|
|
|
|
'admin/reports/',
|
|
|
|
"$this->class",
|
|
|
|
'/', // trailing slash needed if $action is null!
|
|
|
|
"$action"
|
|
|
|
);
|
2012-04-04 07:58:16 +02:00
|
|
|
}
|
|
|
|
|
2010-05-28 04:34:37 +02:00
|
|
|
/**
|
2012-04-04 00:58:48 +02:00
|
|
|
* Exclude certain reports classes from the list of Reports in the CMS
|
|
|
|
* @param $reportClass Can be either a string with the report classname or an array of reports classnames
|
2010-05-28 04:34:37 +02:00
|
|
|
*/
|
2012-09-19 12:07:46 +02:00
|
|
|
static public function add_excluded_reports($reportClass) {
|
2012-04-04 00:58:48 +02:00
|
|
|
if (is_array($reportClass)) {
|
2013-03-18 11:47:15 +01:00
|
|
|
self::config()->excluded_reports = array_merge(self::config()->excluded_reports, $reportClass);
|
2012-04-04 00:58:48 +02:00
|
|
|
} else {
|
|
|
|
if (is_string($reportClass)) {
|
|
|
|
//add to the excluded reports, so this report doesn't get used
|
2013-03-18 11:47:15 +01:00
|
|
|
self::config()->excluded_reports = array($reportClass);
|
2012-04-04 00:58:48 +02:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Return an array of excluded reports. That is, reports that will not be included in
|
|
|
|
* the list of reports in report admin in the CMS.
|
2013-03-18 11:47:15 +01:00
|
|
|
*
|
|
|
|
* @deprecated 3.2 Use the "Report.excluded_reports" config setting instead
|
2012-04-04 00:58:48 +02:00
|
|
|
* @return array
|
|
|
|
*/
|
2012-09-19 12:07:46 +02:00
|
|
|
static public function get_excluded_reports() {
|
2013-03-18 11:47:15 +01:00
|
|
|
Deprecation::notice('3.2', 'Use the "Report.excluded_reports" config setting instead');
|
|
|
|
return self::config()->excluded_reports;
|
2010-05-28 04:34:37 +02:00
|
|
|
}
|
2012-04-03 08:06:35 +02:00
|
|
|
|
2010-05-28 04:34:37 +02:00
|
|
|
/**
|
2012-04-03 08:06:35 +02:00
|
|
|
* Return the SS_Report objects making up the given list.
|
2012-12-13 00:46:17 +01:00
|
|
|
* @return Array of SS_Report objects
|
2010-05-28 04:34:37 +02:00
|
|
|
*/
|
2012-09-19 12:07:46 +02:00
|
|
|
static public function get_reports() {
|
2012-04-03 08:06:35 +02:00
|
|
|
$reports = ClassInfo::subclassesFor(get_called_class());
|
|
|
|
|
|
|
|
$reportsArray = array();
|
|
|
|
if ($reports && count($reports) > 0) {
|
|
|
|
//collect reports into array with an attribute for 'sort'
|
|
|
|
foreach($reports as $report) {
|
2013-03-18 11:47:15 +01:00
|
|
|
if (in_array($report, self::config()->excluded_reports)) continue; //don't use the SS_Report superclass
|
2012-04-20 06:32:39 +02:00
|
|
|
$reflectionClass = new ReflectionClass($report);
|
|
|
|
if ($reflectionClass->isAbstract()) continue; //don't use abstract classes
|
|
|
|
|
2012-04-03 08:06:35 +02:00
|
|
|
$reportObj = new $report;
|
|
|
|
if (method_exists($reportObj,'sort')) $reportObj->sort = $reportObj->sort(); //use the sort method to specify the sort field
|
2012-04-04 07:58:16 +02:00
|
|
|
$reportsArray[$report] = $reportObj;
|
2012-04-03 08:06:35 +02:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2012-12-13 00:46:17 +01:00
|
|
|
uasort($reportsArray, function($a, $b) {
|
|
|
|
if($a->sort == $b->sort) return 0;
|
|
|
|
else return ($a->sort < $b->sort) ? -1 : 1;
|
|
|
|
});
|
2012-04-03 08:06:35 +02:00
|
|
|
|
2012-12-13 00:46:17 +01:00
|
|
|
return $reportsArray;
|
2010-05-28 04:34:37 +02:00
|
|
|
}
|
|
|
|
|
2012-04-03 08:06:35 +02:00
|
|
|
/////////////////////// UI METHODS ///////////////////////
|
|
|
|
|
2008-10-08 06:31:29 +02:00
|
|
|
|
|
|
|
/**
|
2011-10-26 07:35:51 +02:00
|
|
|
* Returns a FieldList with which to create the CMS editing form.
|
2011-10-29 06:39:40 +02:00
|
|
|
* You can use the extend() method of FieldList to create customised forms for your other
|
2008-10-08 06:31:29 +02:00
|
|
|
* data objects.
|
|
|
|
*
|
|
|
|
* @uses getReportField() to render a table, or similar field for the report. This
|
2010-05-28 04:35:56 +02:00
|
|
|
* method should be defined on the SS_Report subclasses.
|
2008-10-08 06:31:29 +02:00
|
|
|
*
|
2011-10-26 07:35:51 +02:00
|
|
|
* @return FieldList
|
2008-10-08 06:31:29 +02:00
|
|
|
*/
|
2012-09-19 12:07:46 +02:00
|
|
|
public function getCMSFields() {
|
2012-07-12 16:14:17 +02:00
|
|
|
$fields = new FieldList();
|
|
|
|
|
|
|
|
if($title = $this->title()) {
|
|
|
|
$fields->push(new LiteralField('ReportTitle', "<h3>{$title}</h3>"));
|
|
|
|
}
|
2010-05-28 04:34:37 +02:00
|
|
|
|
2012-07-12 16:14:17 +02:00
|
|
|
if($description = $this->description()) {
|
|
|
|
$fields->push(new LiteralField('ReportDescription', "<p>" . $description . "</p>"));
|
|
|
|
}
|
2010-05-28 04:34:37 +02:00
|
|
|
|
|
|
|
// Add search fields is available
|
2012-07-12 16:29:58 +02:00
|
|
|
if($this->hasMethod('parameterFields') && $fields = $this->parameterFields()) {
|
2012-07-12 16:14:17 +02:00
|
|
|
foreach($fields as $field) {
|
|
|
|
// Namespace fields for easier handling in form submissions
|
|
|
|
$field->setName(sprintf('filters[%s]', $field->getName()));
|
|
|
|
$field->addExtraClass('no-change-track'); // ignore in changetracker
|
|
|
|
$fields->push($field);
|
2010-05-28 04:34:37 +02:00
|
|
|
}
|
2008-10-08 06:31:29 +02:00
|
|
|
|
2010-05-28 04:34:37 +02:00
|
|
|
// Add a search button
|
2012-07-12 16:14:17 +02:00
|
|
|
$fields->push(new FormAction('updatereport', _t('GridField.Filter')));
|
2010-05-28 04:34:37 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
$fields->push($this->getReportField());
|
2012-07-12 16:14:17 +02:00
|
|
|
|
2010-05-28 04:34:37 +02:00
|
|
|
$this->extend('updateCMSFields', $fields);
|
|
|
|
|
2008-10-08 06:31:29 +02:00
|
|
|
return $fields;
|
|
|
|
}
|
2009-01-05 07:17:59 +01:00
|
|
|
|
2012-09-19 12:07:46 +02:00
|
|
|
public function getCMSActions() {
|
2011-04-15 11:37:15 +02:00
|
|
|
// getCMSActions() can be extended with updateCMSActions() on a extension
|
2011-10-26 07:35:51 +02:00
|
|
|
$actions = new FieldList();
|
2010-05-28 04:34:37 +02:00
|
|
|
$this->extend('updateCMSActions', $actions);
|
|
|
|
return $actions;
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
2012-07-12 16:14:17 +02:00
|
|
|
* Return a field, such as a {@link GridField} that is
|
2010-05-28 04:34:37 +02:00
|
|
|
* used to show and manipulate data relating to this report.
|
|
|
|
*
|
|
|
|
* Generally, you should override {@link columns()} and {@link records()} to make your report,
|
|
|
|
* but if they aren't sufficiently flexible, then you can override this method.
|
|
|
|
*
|
|
|
|
* @return FormField subclass
|
|
|
|
*/
|
2012-09-19 12:07:46 +02:00
|
|
|
public function getReportField() {
|
2012-07-12 16:14:17 +02:00
|
|
|
// TODO Remove coupling with global state
|
|
|
|
$params = isset($_REQUEST['filters']) ? $_REQUEST['filters'] : array();
|
|
|
|
$items = $this->sourceRecords($params, null, null);
|
|
|
|
|
|
|
|
$gridFieldConfig = GridFieldConfig::create()->addComponents(
|
|
|
|
new GridFieldToolbarHeader(),
|
|
|
|
new GridFieldSortableHeader(),
|
|
|
|
new GridFieldDataColumns(),
|
|
|
|
new GridFieldPaginator(),
|
|
|
|
new GridFieldPrintButton(),
|
|
|
|
new GridFieldExportButton()
|
|
|
|
);
|
2013-01-14 16:05:00 +01:00
|
|
|
$gridField = new GridField('Report',false, $items, $gridFieldConfig);
|
2012-07-12 16:14:17 +02:00
|
|
|
$columns = $gridField->getConfig()->getComponentByType('GridFieldDataColumns');
|
|
|
|
$displayFields = array();
|
2010-05-28 04:34:37 +02:00
|
|
|
$fieldCasting = array();
|
2012-07-12 16:14:17 +02:00
|
|
|
$fieldFormatting = array();
|
|
|
|
|
2010-05-28 04:34:37 +02:00
|
|
|
// Parse the column information
|
|
|
|
foreach($this->columns() as $source => $info) {
|
|
|
|
if(is_string($info)) $info = array('title' => $info);
|
|
|
|
|
|
|
|
if(isset($info['formatting'])) $fieldFormatting[$source] = $info['formatting'];
|
|
|
|
if(isset($info['csvFormatting'])) $csvFieldFormatting[$source] = $info['csvFormatting'];
|
|
|
|
if(isset($info['casting'])) $fieldCasting[$source] = $info['casting'];
|
2012-07-12 16:14:17 +02:00
|
|
|
|
|
|
|
if(isset($info['link']) && $info['link']) {
|
|
|
|
$link = singleton('CMSPageEditController')->Link('show');
|
|
|
|
$fieldFormatting[$source] = '<a href=\"' . $link . '/$ID\">$value</a>';
|
|
|
|
}
|
|
|
|
|
|
|
|
$displayFields[$source] = isset($info['title']) ? $info['title'] : $source;
|
2010-05-28 04:34:37 +02:00
|
|
|
}
|
2012-07-12 16:14:17 +02:00
|
|
|
$columns->setDisplayFields($displayFields);
|
|
|
|
$columns->setFieldCasting($fieldCasting);
|
|
|
|
$columns->setFieldFormatting($fieldFormatting);
|
2010-05-28 04:34:37 +02:00
|
|
|
|
2012-07-12 16:14:17 +02:00
|
|
|
return $gridField;
|
2010-05-28 04:34:37 +02:00
|
|
|
}
|
|
|
|
|
2009-01-05 07:17:59 +01:00
|
|
|
/**
|
|
|
|
* @param Member $member
|
|
|
|
* @return boolean
|
|
|
|
*/
|
2012-09-19 12:07:46 +02:00
|
|
|
public function canView($member = null) {
|
2009-01-05 07:17:59 +01:00
|
|
|
if(!$member && $member !== FALSE) {
|
|
|
|
$member = Member::currentUser();
|
|
|
|
}
|
|
|
|
|
|
|
|
return true;
|
|
|
|
}
|
2010-05-28 04:34:37 +02:00
|
|
|
|
2008-10-08 06:31:29 +02:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Return the name of this report, which
|
|
|
|
* is used by the templates to render the
|
|
|
|
* name of the report in the report tree,
|
|
|
|
* the left hand pane inside ReportAdmin.
|
|
|
|
*
|
|
|
|
* @return string
|
|
|
|
*/
|
2012-09-19 12:07:46 +02:00
|
|
|
public function TreeTitle() {
|
2012-04-03 08:06:35 +02:00
|
|
|
return $this->title();
|
2008-10-08 06:31:29 +02:00
|
|
|
}
|
2010-05-28 04:34:37 +02:00
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
2010-05-28 04:35:56 +02:00
|
|
|
* SS_ReportWrapper is a base class for creating report wappers.
|
2010-05-28 04:34:37 +02:00
|
|
|
*
|
|
|
|
* Wrappers encapsulate an existing report to alter their behaviour - they are implementations of
|
|
|
|
* the standard GoF decorator pattern.
|
|
|
|
*
|
|
|
|
* This base class ensure that, by default, wrappers behave in the same way as the report that is
|
|
|
|
* being wrapped. You should override any methods that need to behave differently in your subclass
|
2010-05-28 04:35:56 +02:00
|
|
|
* of SS_ReportWrapper.
|
2010-05-28 04:34:37 +02:00
|
|
|
*
|
|
|
|
* It also makes calls to 2 empty methods that you can override {@link beforeQuery()} and
|
|
|
|
* {@link afterQuery()}
|
2010-10-04 08:16:03 +02:00
|
|
|
*
|
|
|
|
* @package cms
|
|
|
|
* @subpackage reports
|
2010-05-28 04:34:37 +02:00
|
|
|
*/
|
2010-05-28 04:35:56 +02:00
|
|
|
abstract class SS_ReportWrapper extends SS_Report {
|
2010-05-28 04:34:37 +02:00
|
|
|
protected $baseReport;
|
|
|
|
|
2012-09-19 12:07:46 +02:00
|
|
|
public function __construct($baseReport) {
|
2010-05-28 04:34:37 +02:00
|
|
|
$this->baseReport = is_string($baseReport) ? new $baseReport : $baseReport;
|
|
|
|
$this->dataClass = $this->baseReport->dataClass();
|
|
|
|
parent::__construct();
|
|
|
|
}
|
|
|
|
|
2012-09-19 12:07:46 +02:00
|
|
|
public function ID() {
|
2010-05-28 04:34:37 +02:00
|
|
|
return get_class($this->baseReport) . '_' . get_class($this);
|
|
|
|
}
|
|
|
|
|
|
|
|
///////////////////////////////////////////////////////////////////////////////////////////
|
|
|
|
// Filtering
|
|
|
|
|
2012-09-19 12:07:46 +02:00
|
|
|
public function parameterFields() {
|
2010-05-28 04:34:37 +02:00
|
|
|
return $this->baseReport->parameterFields();
|
|
|
|
}
|
|
|
|
|
|
|
|
///////////////////////////////////////////////////////////////////////////////////////////
|
|
|
|
// Columns
|
|
|
|
|
2012-09-19 12:07:46 +02:00
|
|
|
public function columns() {
|
2010-05-28 04:34:37 +02:00
|
|
|
return $this->baseReport->columns();
|
|
|
|
}
|
|
|
|
|
|
|
|
///////////////////////////////////////////////////////////////////////////////////////////
|
|
|
|
// Querying
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Override this method to perform some actions prior to querying.
|
|
|
|
*/
|
2012-09-19 12:07:46 +02:00
|
|
|
public function beforeQuery($params) {
|
2010-05-28 04:34:37 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Override this method to perform some actions after querying.
|
|
|
|
*/
|
2012-09-19 12:07:46 +02:00
|
|
|
public function afterQuery() {
|
2010-05-28 04:34:37 +02:00
|
|
|
}
|
|
|
|
|
2012-09-19 12:07:46 +02:00
|
|
|
public function sourceQuery($params) {
|
2010-05-28 04:34:37 +02:00
|
|
|
if($this->baseReport->hasMethod('sourceRecords')) {
|
|
|
|
// The default implementation will create a fake query from our sourceRecords() method
|
|
|
|
return parent::sourceQuery($params);
|
|
|
|
|
|
|
|
} else if($this->baseReport->hasMethod('sourceQuery')) {
|
|
|
|
$this->beforeQuery($params);
|
|
|
|
$query = $this->baseReport->sourceQuery($params);
|
|
|
|
$this->afterQuery();
|
|
|
|
return $query;
|
|
|
|
|
|
|
|
} else {
|
|
|
|
user_error("Please override sourceQuery()/sourceRecords() and columns() in your base report", E_USER_ERROR);
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
2012-09-19 12:07:46 +02:00
|
|
|
public function sourceRecords($params = array(), $sort = null, $limit = null) {
|
2010-05-28 04:34:37 +02:00
|
|
|
$this->beforeQuery($params);
|
|
|
|
$records = $this->baseReport->sourceRecords($params, $sort, $limit);
|
|
|
|
$this->afterQuery();
|
|
|
|
return $records;
|
|
|
|
}
|
2008-10-08 06:31:29 +02:00
|
|
|
|
2010-05-28 04:34:37 +02:00
|
|
|
|
|
|
|
///////////////////////////////////////////////////////////////////////////////////////////
|
|
|
|
// Pass-through
|
|
|
|
|
2012-09-19 12:07:46 +02:00
|
|
|
public function title() {
|
2010-05-28 04:34:37 +02:00
|
|
|
return $this->baseReport->title();
|
|
|
|
}
|
2010-10-04 07:41:57 +02:00
|
|
|
|
2012-09-19 12:07:46 +02:00
|
|
|
public function group() {
|
2010-10-04 07:41:57 +02:00
|
|
|
return $this->baseReport->hasMethod('group') ? $this->baseReport->group() : 'Group';
|
|
|
|
}
|
|
|
|
|
2012-09-19 12:07:46 +02:00
|
|
|
public function sort() {
|
2010-10-04 07:41:57 +02:00
|
|
|
return $this->baseReport->hasMethod('sort') ? $this->baseReport->sort() : 0;
|
|
|
|
}
|
2010-05-28 04:34:37 +02:00
|
|
|
|
2012-09-19 12:07:46 +02:00
|
|
|
public function description() {
|
2011-09-22 18:07:45 +02:00
|
|
|
return $this->baseReport->description();
|
2010-05-28 04:34:37 +02:00
|
|
|
}
|
|
|
|
|
2012-09-19 12:07:46 +02:00
|
|
|
public function canView($member = null) {
|
2012-03-27 06:05:11 +02:00
|
|
|
return $this->baseReport->canView($member);
|
2010-05-28 04:34:37 +02:00
|
|
|
}
|
|
|
|
|
2008-10-08 06:31:29 +02:00
|
|
|
}
|
|
|
|
|
2012-02-13 21:40:49 +01:00
|
|
|
|