mirror of
https://github.com/silverstripe/silverstripe-reports
synced 2024-10-22 11:05:53 +02:00
MINOR Converted spaces to tabs for code syntax consistency in ReportAdmin.
MINOR Added TODOs for areas of code that needs some work, either in documentation or code cleanup. git-svn-id: svn://svn.silverstripe.com/silverstripe/open/modules/cms/trunk@63458 467b73ca-7a2a-4603-9d3b-597d59a354a9
This commit is contained in:
parent
e0982889b5
commit
f60c0c7ed7
@ -1,6 +1,11 @@
|
||||
<?php
|
||||
/**
|
||||
* Reports section of the CMS
|
||||
* Reports section of the CMS.
|
||||
*
|
||||
* @TODO If reports need to subclass Report in order
|
||||
* to show, then why don't we have an abstract Report
|
||||
* class around?'
|
||||
*
|
||||
* @package cms
|
||||
* @subpackage reports
|
||||
*/
|
||||
@ -10,20 +15,20 @@ class ReportAdmin extends LeftAndMain {
|
||||
|
||||
public function init() {
|
||||
parent::init();
|
||||
|
||||
|
||||
// @TODO determine what is not necessary to include here
|
||||
Requirements::javascript(MCE_ROOT . "tiny_mce_src.js");
|
||||
Requirements::javascript(THIRDPARTY_DIR . "/tiny_mce_improvements.js");
|
||||
|
||||
|
||||
Requirements::javascript(THIRDPARTY_DIR . "/hover.js");
|
||||
Requirements::javascript(THIRDPARTY_DIR . "/scriptaculous/controls.js");
|
||||
|
||||
Requirements::javascript(CMS_DIR . "/javascript/SecurityAdmin.js");
|
||||
|
||||
Requirements::javascript(CMS_DIR . "/javascript/LeftAndMain_left.js");
|
||||
Requirements::javascript(CMS_DIR . "/javascript/LeftAndMain_left.js");
|
||||
Requirements::javascript(CMS_DIR . "/javascript/LeftAndMain_right.js");
|
||||
Requirements::javascript(CMS_DIR . "/javascript/CMSMain_left.js");
|
||||
|
||||
|
||||
Requirements::javascript(CMS_DIR . "/javascript/CMSMain_left.js");
|
||||
|
||||
Requirements::javascript(CMS_DIR . "/javascript/ReportAdmin_left.js");
|
||||
Requirements::javascript(CMS_DIR . "/javascript/ReportAdmin_right.js");
|
||||
|
||||
@ -42,7 +47,7 @@ class ReportAdmin extends LeftAndMain {
|
||||
if(Director::fileExists(project() . "/css/DataReportCMSMain.css")) {
|
||||
Requirements::javascript(project() . "/javascript/DataReport.js");
|
||||
}
|
||||
|
||||
|
||||
// We don't want this showing up in every ajax-response, it should always be present in a CMS-environment
|
||||
if(!Director::is_ajax()) {
|
||||
Requirements::javascriptTemplate("cms/javascript/tinymce.template.js", array(
|
||||
@ -72,7 +77,7 @@ class ReportAdmin extends LeftAndMain {
|
||||
if($subClass != 'Report') $processedReports[] = new $subClass();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
$reports = new DataObjectSet($processedReports);
|
||||
|
||||
return $reports;
|
||||
@ -114,17 +119,17 @@ class ReportAdmin extends LeftAndMain {
|
||||
return array();
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* For the current report that the user is viewing,
|
||||
* return a Form instance with the fields for that
|
||||
* report.
|
||||
*
|
||||
* @return Form
|
||||
*/
|
||||
public function EditForm() {
|
||||
|
||||
/**
|
||||
* For the current report that the user is viewing,
|
||||
* return a Form instance with the fields for that
|
||||
* report.
|
||||
*
|
||||
* @return Form
|
||||
*/
|
||||
public function EditForm() {
|
||||
$ids = array();
|
||||
$id = isset($_REQUEST['ID']) ? $_REQUEST['ID'] : Session::get('currentPage');
|
||||
$id = isset($_REQUEST['ID']) ? $_REQUEST['ID'] : Session::get('currentPage');
|
||||
$subClasses = ClassInfo::subclassesFor('Report');
|
||||
|
||||
if($subClasses) {
|
||||
@ -135,11 +140,11 @@ class ReportAdmin extends LeftAndMain {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
if($id && in_array($id, $ids)) return $this->reportEditFormFor($id);
|
||||
else return false;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Return a Form instance with fields for the
|
||||
* particular report currently viewed.
|
||||
@ -159,15 +164,15 @@ class ReportAdmin extends LeftAndMain {
|
||||
if(is_numeric($id)) $page = DataObject::get_by_id('SiteTree', $id);
|
||||
$reportClass = is_object($page) ? 'Report_' . $page->ClassName : $id;
|
||||
|
||||
$obj = new $reportClass();
|
||||
if($obj) $fields = $obj->getCMSFields();
|
||||
$obj = new $reportClass();
|
||||
if($obj) $fields = $obj->getCMSFields();
|
||||
|
||||
$idField = new HiddenField('ID');
|
||||
$idField->setValue($id);
|
||||
$fields->push($idField);
|
||||
|
||||
$form = new Form($this, 'EditForm', $fields, $actions);
|
||||
|
||||
|
||||
return $form;
|
||||
}
|
||||
|
||||
@ -197,4 +202,4 @@ class ReportAdmin extends LeftAndMain {
|
||||
}
|
||||
}
|
||||
|
||||
?>
|
||||
?>
|
Loading…
Reference in New Issue
Block a user