mirror of
https://github.com/silverstripe/silverstripe-framework
synced 2024-10-22 14:05:37 +02:00
getSummaryFields() will also get those summary fields defined in Member's decorator applied to the results and export
git-svn-id: svn://svn.silverstripe.com/silverstripe/open/modules/sapphire/trunk@61509 467b73ca-7a2a-4603-9d3b-597d59a354a9
This commit is contained in:
parent
413b309d17
commit
6a897d7bfa
@ -2466,8 +2466,9 @@ class DataObject extends ViewableData implements DataObjectInterface {
|
||||
if ($this->hasField('Name')) $fields['Name'] = 'Name';
|
||||
if ($this->hasField('Title')) $fields['Title'] = 'Title';
|
||||
if ($this->hasField('Description')) $fields['Description'] = 'Description';
|
||||
if ($this->hasField('Firstname')) $fields['Firstname'] = 'Firstname';
|
||||
if ($this->hasField('FirstName')) $fields['FirstName'] = 'First Name';
|
||||
}
|
||||
$this->extend("updateSummaryFields", $fields);
|
||||
|
||||
// Final fail-over, just list all the fields :-S
|
||||
if(!$fields) {
|
||||
|
@ -138,7 +138,7 @@ class CheckboxSetField extends OptionsetField {
|
||||
* Return the CheckboxSetField value, as an array of the selected item keys
|
||||
*/
|
||||
function dataValue() {
|
||||
if($this->value){
|
||||
if($this->value&&is_array($this->value)){
|
||||
// Filter items to those who aren't 0
|
||||
$filtered = array();
|
||||
foreach($this->value as $item) if($item) $filtered[] = str_replace(",", "{comma}", $item);
|
||||
|
@ -670,7 +670,7 @@ JS
|
||||
/**
|
||||
* @return array
|
||||
*/
|
||||
function getPermissions($arr) {
|
||||
function getPermissions() {
|
||||
return $this->permissions;
|
||||
}
|
||||
|
||||
@ -707,8 +707,10 @@ JS
|
||||
|
||||
/**
|
||||
* @param array
|
||||
* @deprecated Put the query string onto your form's link instead :-)
|
||||
*/
|
||||
function setExtraLinkParams($params){
|
||||
user_error("TableListField::setExtraLinkParams() deprecated - put the query string onto your form's FormAction instead; it will be handed down to all field with special handlers", E_USER_NOTICE);
|
||||
$this->extraLinkParams = $params;
|
||||
}
|
||||
|
||||
@ -725,7 +727,7 @@ JS
|
||||
if(!isset($_REQUEST['ctf'][$this->Name()]['start']) || !is_numeric($_REQUEST['ctf'][$this->Name()]['start']) || $_REQUEST['ctf'][$this->Name()]['start'] == 0) {
|
||||
return null;
|
||||
}
|
||||
$link = $this->Link() . "/?ctf[{$this->Name()}][start]={$start}";
|
||||
$link = Controller::join_links($this->Link(), "ajax_refresh?ctf[{$this->Name()}][start]={$start}");
|
||||
if($this->extraLinkParams) $link .= "&" . http_build_query($this->extraLinkParams);
|
||||
return $link;
|
||||
}
|
||||
@ -739,18 +741,19 @@ JS
|
||||
|
||||
$start = ($_REQUEST['ctf'][$this->Name()]['start'] - $this->pageSize < 0) ? 0 : $_REQUEST['ctf'][$this->Name()]['start'] - $this->pageSize;
|
||||
|
||||
$link = $this->Link() . "/?ctf[{$this->Name()}][start]={$start}";
|
||||
$link = Controller::join_links($this->Link(), "ajax_refresh?ctf[{$this->Name()}][start]={$start}");
|
||||
if($this->extraLinkParams) $link .= "&" . http_build_query($this->extraLinkParams);
|
||||
return $link;
|
||||
}
|
||||
|
||||
|
||||
function NextLink() {
|
||||
$currentStart = isset($_REQUEST['ctf'][$this->Name()]['start']) ? $_REQUEST['ctf'][$this->Name()]['start'] : 0;
|
||||
$start = ($currentStart + $this->pageSize < $this->TotalCount()) ? $currentStart + $this->pageSize : $this->TotalCount() % $this->pageSize > 0;
|
||||
if($currentStart >= $start-1) {
|
||||
return null;
|
||||
}
|
||||
$link = $this->Link() . "/?ctf[{$this->Name()}][start]={$start}";
|
||||
$link = Controller::join_links($this->Link(), "ajax_refresh?ctf[{$this->Name()}][start]={$start}");
|
||||
if($this->extraLinkParams) $link .= "&" . http_build_query($this->extraLinkParams);
|
||||
return $link;
|
||||
}
|
||||
@ -763,7 +766,7 @@ JS
|
||||
return null;
|
||||
}
|
||||
|
||||
$link = $this->Link() . "/?ctf[{$this->Name()}][start]={$start}";
|
||||
$link = Controller::join_links($this->Link(), "ajax_refresh?ctf[{$this->Name()}][start]={$start}");
|
||||
if($this->extraLinkParams) $link .= "&" . http_build_query($this->extraLinkParams);
|
||||
return $link;
|
||||
}
|
||||
@ -866,12 +869,10 @@ JS
|
||||
* @todo Make relation-syntax available (at the moment you'll have to use custom sql)
|
||||
*/
|
||||
function export() {
|
||||
|
||||
$now = Date("d-m-Y-H-i");
|
||||
$fileName = "export-$now.csv";
|
||||
$separator = $this->csvSeparator;
|
||||
$csvColumns = ($this->fieldListCsv) ? $this->fieldListCsv : $this->fieldList;
|
||||
|
||||
$fileData = "";
|
||||
|
||||
if($this->csvHasHeader) {
|
||||
@ -929,6 +930,7 @@ JS
|
||||
*/
|
||||
function ExportLink() {
|
||||
$exportLink = Controller::join_links($this->Link(), 'export');
|
||||
|
||||
if($this->extraLinkParams) $exportLink .= "?" . http_build_query($this->extraLinkParams);
|
||||
return $exportLink;
|
||||
}
|
||||
@ -985,8 +987,8 @@ JS
|
||||
// pagination and filters are respected on template accessors
|
||||
//$this->sourceItems();
|
||||
|
||||
$response = $this->renderWith($this->template);
|
||||
FormResponse::update_dom_id($this->id(), $response);
|
||||
$response = $this->renderWith($this->template);echo($response);die('here');
|
||||
FormResponse::update_dom_id($this->id(), $response, 1);
|
||||
FormResponse::set_non_ajax_content($response);
|
||||
return FormResponse::respond();
|
||||
}
|
||||
|
@ -66,6 +66,12 @@ class Member extends DataObject {
|
||||
'Email',
|
||||
);
|
||||
|
||||
static $summary_fields = array(
|
||||
'FirstName',
|
||||
'Surname',
|
||||
'Email',
|
||||
);
|
||||
|
||||
|
||||
/**
|
||||
* {@link PasswordValidator} object for validating user's password
|
||||
|
Loading…
Reference in New Issue
Block a user