mirror of
https://github.com/silverstripe/silverstripe-framework
synced 2024-10-22 12:05:37 +00:00
MINOR Replaced calls to deprecated FormField->Name() with getName()
This commit is contained in:
parent
6e2eaed4fc
commit
96d18efa58
@ -65,9 +65,9 @@ class MemberTableField extends ComplexTableField {
|
||||
$this->group = $group;
|
||||
$members = $group->Members();
|
||||
|
||||
} elseif(isset($_REQUEST['ctf'][$this->Name()]["ID"]) && is_numeric($_REQUEST['ctf'][$this->Name()]["ID"])) {
|
||||
} elseif(isset($_REQUEST['ctf'][$this->getName()]["ID"]) && is_numeric($_REQUEST['ctf'][$this->getName()]["ID"])) {
|
||||
throw new Exception("Is this still being used? It's a hack and we should remove it.");
|
||||
$group = DataObject::get_by_id('Group', $_REQUEST['ctf'][$this->Name()]["ID"]);
|
||||
$group = DataObject::get_by_id('Group', $_REQUEST['ctf'][$this->getName()]["ID"]);
|
||||
$this->group = $group;
|
||||
$members = $group->Members();
|
||||
} else {
|
||||
|
@ -43,7 +43,7 @@ class AjaxUniqueTextField extends TextField {
|
||||
'type' => 'text',
|
||||
'class' => 'text' . ($this->extraClass() ? $this->extraClass() : ''),
|
||||
'id' => $this->id(),
|
||||
'name' => $this->Name(),
|
||||
'name' => $this->getName(),
|
||||
'value' => $this->Value(),
|
||||
'tabindex' => $this->getTabIndex(),
|
||||
'maxlength' => ($this->maxLength) ? $this->maxLength : null
|
||||
|
@ -254,7 +254,7 @@ JS;
|
||||
return null;
|
||||
}
|
||||
|
||||
$pageStart = (isset($_REQUEST['ctf'][$this->Name()]['start']) && is_numeric($_REQUEST['ctf'][$this->Name()]['start'])) ? $_REQUEST['ctf'][$this->Name()]['start'] : 0;
|
||||
$pageStart = (isset($_REQUEST['ctf'][$this->getName()]['start']) && is_numeric($_REQUEST['ctf'][$this->getName()]['start'])) ? $_REQUEST['ctf'][$this->getName()]['start'] : 0;
|
||||
|
||||
$output = new ArrayList();
|
||||
foreach($sourceItems as $pageIndex=>$item) {
|
||||
|
@ -115,7 +115,7 @@ class CompositeField extends FormField {
|
||||
$className = ($this->columnCount) ? "field CompositeField {$this->extraClass()} multicolumn" : "field CompositeField {$this->extraClass()}";
|
||||
$content = "<div class=\"$className\"$idAtt>";
|
||||
|
||||
foreach($fs as $subfield) {//echo ' subf'.$subfield->Name();
|
||||
foreach($fs as $subfield) {//echo ' subf'.$subfield->getName();
|
||||
if($this->columnCount) {
|
||||
$className = "column{$this->columnCount}";
|
||||
if(!next($fs)) $className .= " lastcolumn";
|
||||
|
@ -75,8 +75,8 @@ class FieldGroup extends CompositeField {
|
||||
$compositeTitle = '';
|
||||
$count = 0;
|
||||
foreach($fs as $subfield){
|
||||
$compositeTitle .= $subfield->Name();
|
||||
if($subfield->Name()) $count++;
|
||||
$compositeTitle .= $subfield->getName();
|
||||
if($subfield->getName()) $count++;
|
||||
}
|
||||
if($count == 1) $compositeTitle .= 'Group';
|
||||
return ereg_replace("[^a-zA-Z0-9]+","",$compositeTitle);
|
||||
|
@ -158,7 +158,7 @@ class FileField extends FormField {
|
||||
}
|
||||
|
||||
public function Value() {
|
||||
return $_FILES[$this->Name()];
|
||||
return $_FILES[$this->getName()];
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -48,7 +48,7 @@ class FileIFrameField extends FileField {
|
||||
*/
|
||||
public function dataClass() {
|
||||
if($this->form && $this->form->getRecord()) {
|
||||
$class = $this->form->getRecord()->has_one($this->Name());
|
||||
$class = $this->form->getRecord()->has_one($this->getName());
|
||||
return ($class) ? $class : 'File';
|
||||
} else {
|
||||
return 'File';
|
||||
@ -76,7 +76,7 @@ class FileIFrameField extends FileField {
|
||||
return $this->createTag (
|
||||
'iframe',
|
||||
array (
|
||||
'name' => $this->Name() . '_iframe',
|
||||
'name' => $this->getName() . '_iframe',
|
||||
'src' => Controller::join_links($this->Link(), $iframe),
|
||||
'style' => 'height: 152px; width: 100%; border: none;'
|
||||
)
|
||||
@ -85,7 +85,7 @@ class FileIFrameField extends FileField {
|
||||
array (
|
||||
'type' => 'hidden',
|
||||
'id' => $this->ID(),
|
||||
'name' => $this->Name() . 'ID',
|
||||
'name' => $this->getName() . 'ID',
|
||||
'value' => $this->attrValue()
|
||||
)
|
||||
);
|
||||
@ -104,7 +104,7 @@ class FileIFrameField extends FileField {
|
||||
* @return File|null
|
||||
*/
|
||||
public function AttachedFile() {
|
||||
return $this->form->getRecord() ? $this->form->getRecord()->{$this->Name()}() : null;
|
||||
return $this->form->getRecord() ? $this->form->getRecord()->{$this->getName()}() : null;
|
||||
}
|
||||
|
||||
/**
|
||||
@ -196,7 +196,7 @@ class FileIFrameField extends FileField {
|
||||
return;
|
||||
}
|
||||
|
||||
$this->form->getRecord()->{$this->Name() . 'ID'} = $fileObject->ID;
|
||||
$this->form->getRecord()->{$this->getName() . 'ID'} = $fileObject->ID;
|
||||
|
||||
$fileObject->OwnerID = (Member::currentUser() ? Member::currentUser()->ID : 0);
|
||||
$fileObject->write();
|
||||
@ -212,7 +212,7 @@ class FileIFrameField extends FileField {
|
||||
return;
|
||||
}
|
||||
|
||||
$this->form->getRecord()->{$this->Name() . 'ID'} = $fileObject->ID;
|
||||
$this->form->getRecord()->{$this->getName() . 'ID'} = $fileObject->ID;
|
||||
|
||||
if(!$fileObject instanceof $desiredClass) {
|
||||
$fileObject->ClassName = $desiredClass;
|
||||
@ -248,7 +248,7 @@ class FileIFrameField extends FileField {
|
||||
public function delete($data, $form) {
|
||||
// delete the actual file, or just un-attach it?
|
||||
if(isset($data['DeleteFile']) && $data['DeleteFile']) {
|
||||
$file = DataObject::get_by_id('File', $this->form->getRecord()->{$this->Name() . 'ID'});
|
||||
$file = DataObject::get_by_id('File', $this->form->getRecord()->{$this->getName() . 'ID'});
|
||||
|
||||
if($file) {
|
||||
$file->delete();
|
||||
@ -256,7 +256,7 @@ class FileIFrameField extends FileField {
|
||||
}
|
||||
|
||||
// then un-attach file from this record
|
||||
$this->form->getRecord()->{$this->Name() . 'ID'} = 0;
|
||||
$this->form->getRecord()->{$this->getName() . 'ID'} = 0;
|
||||
$this->form->getRecord()->write();
|
||||
|
||||
Director::redirectBack();
|
||||
|
@ -94,8 +94,8 @@ class GridFieldPresenter extends ViewableData {
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function Name() {
|
||||
return $this->getGridField()->Name();
|
||||
public function getName() {
|
||||
return $this->getGridField()->getName();
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -139,7 +139,7 @@ HTML;
|
||||
class HasManyComplexTableField_Item extends ComplexTableField_Item {
|
||||
|
||||
function MarkingCheckbox() {
|
||||
$name = $this->parent->Name() . '[]';
|
||||
$name = $this->parent->getName() . '[]';
|
||||
|
||||
if(!$this->parent->joinField) {
|
||||
user_error("joinField not set in HasManyComplexTableField '{$this->parent->name}'", E_USER_WARNING);
|
||||
|
@ -85,7 +85,7 @@ HTML;
|
||||
class HasOneComplexTableField_Item extends ComplexTableField_Item {
|
||||
|
||||
function MarkingCheckbox() {
|
||||
$name = $this->parent->Name() . '[]';
|
||||
$name = $this->parent->getName() . '[]';
|
||||
|
||||
$isOneToOne = $this->parent->isOneToOne;
|
||||
$joinVal = $this->parent->getControllerJoinID();
|
||||
|
@ -92,7 +92,7 @@ class ManyManyComplexTableField extends HasManyComplexTableField {
|
||||
class ManyManyComplexTableField_Item extends ComplexTableField_Item {
|
||||
|
||||
function MarkingCheckbox() {
|
||||
$name = $this->parent->Name() . '[]';
|
||||
$name = $this->parent->getName() . '[]';
|
||||
|
||||
if($this->parent->IsReadOnly)
|
||||
return "<input class=\"checkbox\" type=\"checkbox\" name=\"$name\" value=\"{$this->item->ID}\" disabled=\"disabled\"/>";
|
||||
|
@ -498,7 +498,7 @@ class TableField extends TableListField {
|
||||
if($items && $this->requiredFields && $items->count()) {
|
||||
foreach ($this->requiredFields as $field) {
|
||||
foreach($items as $item){
|
||||
$cellName = $this->Name().'['.$item->ID.']['.$field.']';
|
||||
$cellName = $this->getName().'['.$item->ID.']['.$field.']';
|
||||
$js .= "\n";
|
||||
if($fields->dataFieldByName($cellName)) {
|
||||
$js .= <<<JS
|
||||
@ -550,8 +550,8 @@ JS;
|
||||
if($this->requiredFields&&$sourceItemsNew&&$sourceItemsNew->count()) {
|
||||
foreach ($this->requiredFields as $field) {
|
||||
foreach($sourceItemsNew as $item){
|
||||
$cellName = $this->Name().'['.$item->ID.']['.$field.']';
|
||||
$cName = $this->Name().'[new]['.$field.'][]';
|
||||
$cellName = $this->getName().'['.$item->ID.']['.$field.']';
|
||||
$cName = $this->getName().'[new]['.$field.'][]';
|
||||
|
||||
if($fieldObj = $fields->dataFieldByName($cellName)) {
|
||||
if(!trim($fieldObj->Value())){
|
||||
@ -638,7 +638,7 @@ class TableField_Item extends TableListField_Item {
|
||||
$origFieldName = $field->getName();
|
||||
|
||||
// set unique fieldname with id
|
||||
$combinedFieldName = $this->parent->Name() . "[" . $this->ID() . "][" . $origFieldName . "]";
|
||||
$combinedFieldName = $this->parent->getName() . "[" . $this->ID() . "][" . $origFieldName . "]";
|
||||
// ensure to set field to nested array notation
|
||||
// if its an unsaved row, or the "add row" which is present by default
|
||||
if($this->isAddRow || $this->ID() == 'new') $combinedFieldName .= '[]';
|
||||
@ -703,7 +703,7 @@ class TableField_Item extends TableListField_Item {
|
||||
} else {
|
||||
$shortFieldName = $fieldName;
|
||||
}
|
||||
$combinedFieldName = $this->parent->Name() . "[new][" . $shortFieldName . "][]";
|
||||
$combinedFieldName = $this->parent->getName() . "[new][" . $shortFieldName . "][]";
|
||||
$fieldType = $this->fieldTypes[$fieldName];
|
||||
if(isset($fieldType->class) && is_subclass_of($fieldType, 'FormField')) {
|
||||
$field = clone $fieldType; // we can't use the same instance all over, as we change names
|
||||
@ -731,7 +731,7 @@ class TableField_Item extends TableListField_Item {
|
||||
$id = ($this->item->ID) ? $this->item->ID : "new";
|
||||
if($this->parent->getExtraData()) {
|
||||
foreach($this->parent->getExtraData() as $fieldName=>$fieldValue) {
|
||||
$name = $this->parent->Name() . "[" . $id . "][" . $fieldName . "]";
|
||||
$name = $this->parent->getName() . "[" . $id . "][" . $fieldName . "]";
|
||||
if($this->isAddRow) $name .= '[]';
|
||||
$field = new HiddenField($name, null, $fieldValue);
|
||||
$content .= $field->FieldHolder() . "\n";
|
||||
|
@ -302,27 +302,27 @@ JS
|
||||
function Headings() {
|
||||
$headings = array();
|
||||
foreach($this->fieldList as $fieldName => $fieldTitle) {
|
||||
$isSorted = (isset($_REQUEST['ctf'][$this->Name()]['sort']) && $fieldName == $_REQUEST['ctf'][$this->Name()]['sort']);
|
||||
$isSorted = (isset($_REQUEST['ctf'][$this->getName()]['sort']) && $fieldName == $_REQUEST['ctf'][$this->getName()]['sort']);
|
||||
// we can't allow sorting with partial summaries (groupByField)
|
||||
$isSortable = ($this->form && $this->isFieldSortable($fieldName) && !$this->groupByField);
|
||||
|
||||
// sorting links (only if we have a form to refresh with)
|
||||
if($this->form) {
|
||||
$sortLink = $this->Link();
|
||||
$sortLink = HTTP::setGetVar("ctf[{$this->Name()}][sort]", $fieldName, $sortLink,'&');
|
||||
$sortLink = HTTP::setGetVar("ctf[{$this->getName()}][sort]", $fieldName, $sortLink,'&');
|
||||
|
||||
// Apply sort direction to the current sort field
|
||||
if(!empty($_REQUEST['ctf'][$this->Name()]['sort']) && ($_REQUEST['ctf'][$this->Name()]['sort'] == $fieldName)) {
|
||||
$dir = isset($_REQUEST['ctf'][$this->Name()]['dir']) ? $_REQUEST['ctf'][$this->Name()]['dir'] : null;
|
||||
if(!empty($_REQUEST['ctf'][$this->getName()]['sort']) && ($_REQUEST['ctf'][$this->getName()]['sort'] == $fieldName)) {
|
||||
$dir = isset($_REQUEST['ctf'][$this->getName()]['dir']) ? $_REQUEST['ctf'][$this->getName()]['dir'] : null;
|
||||
$dir = trim(strtolower($dir));
|
||||
$newDir = ($dir == 'desc') ? null : 'desc';
|
||||
$sortLink = HTTP::setGetVar("ctf[{$this->Name()}][dir]", Convert::raw2xml($newDir), $sortLink,'&');
|
||||
$sortLink = HTTP::setGetVar("ctf[{$this->getName()}][dir]", Convert::raw2xml($newDir), $sortLink,'&');
|
||||
}
|
||||
|
||||
if(isset($_REQUEST['ctf'][$this->Name()]['search']) && is_array($_REQUEST['ctf'][$this->Name()]['search'])) {
|
||||
foreach($_REQUEST['ctf'][$this->Name()]['search'] as $parameter => $value) {
|
||||
if(isset($_REQUEST['ctf'][$this->getName()]['search']) && is_array($_REQUEST['ctf'][$this->getName()]['search'])) {
|
||||
foreach($_REQUEST['ctf'][$this->getName()]['search'] as $parameter => $value) {
|
||||
$XML_search = Convert::raw2xml($value);
|
||||
$sortLink = HTTP::setGetVar("ctf[{$this->Name()}][search][$parameter]", $XML_search, $sortLink,'&');
|
||||
$sortLink = HTTP::setGetVar("ctf[{$this->getName()}][search][$parameter]", $XML_search, $sortLink,'&');
|
||||
}
|
||||
}
|
||||
} else {
|
||||
@ -335,7 +335,7 @@ JS
|
||||
"IsSortable" => $isSortable,
|
||||
"SortLink" => $sortLink,
|
||||
"SortBy" => $isSorted,
|
||||
"SortDirection" => (isset($_REQUEST['ctf'][$this->Name()]['dir'])) ? $_REQUEST['ctf'][$this->Name()]['dir'] : null
|
||||
"SortDirection" => (isset($_REQUEST['ctf'][$this->getName()]['dir'])) ? $_REQUEST['ctf'][$this->getName()]['dir'] : null
|
||||
));
|
||||
}
|
||||
return new ArrayList($headings);
|
||||
@ -411,8 +411,8 @@ JS
|
||||
$items = clone $this->getDataList();
|
||||
|
||||
// TODO: Sorting could be implemented on regular SS_Lists.
|
||||
if(method_exists($items,'canSortBy') && isset($_REQUEST['ctf'][$this->Name()]['sort'])) {
|
||||
$sort = $_REQUEST['ctf'][$this->Name()]['sort'];
|
||||
if(method_exists($items,'canSortBy') && isset($_REQUEST['ctf'][$this->getName()]['sort'])) {
|
||||
$sort = $_REQUEST['ctf'][$this->getName()]['sort'];
|
||||
// TODO: sort direction
|
||||
if($items->canSortBy($sort)) $items = $items->sort($sort);
|
||||
}
|
||||
@ -421,8 +421,8 @@ JS
|
||||
// To disable pagination, set $this->showPagination to false.
|
||||
if($this->showPagination && $this->pageSize) {
|
||||
$SQL_limit = (int)$this->pageSize;
|
||||
if(isset($_REQUEST['ctf'][$this->Name()]['start']) && is_numeric($_REQUEST['ctf'][$this->Name()]['start'])) {
|
||||
$SQL_start = (isset($_REQUEST['ctf'][$this->Name()]['start'])) ? intval($_REQUEST['ctf'][$this->Name()]['start']) : "0";
|
||||
if(isset($_REQUEST['ctf'][$this->getName()]['start']) && is_numeric($_REQUEST['ctf'][$this->getName()]['start'])) {
|
||||
$SQL_start = (isset($_REQUEST['ctf'][$this->getName()]['start'])) ? intval($_REQUEST['ctf'][$this->getName()]['start']) : "0";
|
||||
} else {
|
||||
$SQL_start = 0;
|
||||
}
|
||||
@ -739,7 +739,7 @@ JS
|
||||
}
|
||||
|
||||
function ListStart() {
|
||||
return $_REQUEST['ctf'][$this->Name()]['start'];
|
||||
return $_REQUEST['ctf'][$this->getName()]['start'];
|
||||
}
|
||||
|
||||
/**
|
||||
@ -761,19 +761,19 @@ JS
|
||||
function FirstLink() {
|
||||
$start = 0;
|
||||
|
||||
if(!isset($_REQUEST['ctf'][$this->Name()]['start']) || !is_numeric($_REQUEST['ctf'][$this->Name()]['start']) || $_REQUEST['ctf'][$this->Name()]['start'] == 0) {
|
||||
if(!isset($_REQUEST['ctf'][$this->getName()]['start']) || !is_numeric($_REQUEST['ctf'][$this->getName()]['start']) || $_REQUEST['ctf'][$this->getName()]['start'] == 0) {
|
||||
return null;
|
||||
}
|
||||
$baseLink = ($this->paginationBaseLink) ? $this->paginationBaseLink : $this->Link();
|
||||
$link = Controller::join_links($baseLink, "?ctf[{$this->Name()}][start]={$start}");
|
||||
$link = Controller::join_links($baseLink, "?ctf[{$this->getName()}][start]={$start}");
|
||||
if($this->extraLinkParams) $link .= "&" . http_build_query($this->extraLinkParams);
|
||||
|
||||
// preserve sort options
|
||||
if(isset($_REQUEST['ctf'][$this->Name()]['sort'])) {
|
||||
$link .= "&ctf[{$this->Name()}][sort]=" . $_REQUEST['ctf'][$this->Name()]['sort'];
|
||||
if(isset($_REQUEST['ctf'][$this->getName()]['sort'])) {
|
||||
$link .= "&ctf[{$this->getName()}][sort]=" . $_REQUEST['ctf'][$this->getName()]['sort'];
|
||||
// direction
|
||||
if(isset($_REQUEST['ctf'][$this->Name()]['dir'])) {
|
||||
$link .= "&ctf[{$this->Name()}][dir]=" . $_REQUEST['ctf'][$this->Name()]['dir'];
|
||||
if(isset($_REQUEST['ctf'][$this->getName()]['dir'])) {
|
||||
$link .= "&ctf[{$this->getName()}][dir]=" . $_REQUEST['ctf'][$this->getName()]['dir'];
|
||||
}
|
||||
}
|
||||
|
||||
@ -781,24 +781,24 @@ JS
|
||||
}
|
||||
|
||||
function PrevLink() {
|
||||
$currentStart = isset($_REQUEST['ctf'][$this->Name()]['start']) ? $_REQUEST['ctf'][$this->Name()]['start'] : 0;
|
||||
$currentStart = isset($_REQUEST['ctf'][$this->getName()]['start']) ? $_REQUEST['ctf'][$this->getName()]['start'] : 0;
|
||||
|
||||
if($currentStart == 0) {
|
||||
return null;
|
||||
}
|
||||
|
||||
$start = ($_REQUEST['ctf'][$this->Name()]['start'] - $this->pageSize < 0) ? 0 : $_REQUEST['ctf'][$this->Name()]['start'] - $this->pageSize;
|
||||
$start = ($_REQUEST['ctf'][$this->getName()]['start'] - $this->pageSize < 0) ? 0 : $_REQUEST['ctf'][$this->getName()]['start'] - $this->pageSize;
|
||||
|
||||
$baseLink = ($this->paginationBaseLink) ? $this->paginationBaseLink : $this->Link();
|
||||
$link = Controller::join_links($baseLink, "?ctf[{$this->Name()}][start]={$start}");
|
||||
$link = Controller::join_links($baseLink, "?ctf[{$this->getName()}][start]={$start}");
|
||||
if($this->extraLinkParams) $link .= "&" . http_build_query($this->extraLinkParams);
|
||||
|
||||
// preserve sort options
|
||||
if(isset($_REQUEST['ctf'][$this->Name()]['sort'])) {
|
||||
$link .= "&ctf[{$this->Name()}][sort]=" . $_REQUEST['ctf'][$this->Name()]['sort'];
|
||||
if(isset($_REQUEST['ctf'][$this->getName()]['sort'])) {
|
||||
$link .= "&ctf[{$this->getName()}][sort]=" . $_REQUEST['ctf'][$this->getName()]['sort'];
|
||||
// direction
|
||||
if(isset($_REQUEST['ctf'][$this->Name()]['dir'])) {
|
||||
$link .= "&ctf[{$this->Name()}][dir]=" . $_REQUEST['ctf'][$this->Name()]['dir'];
|
||||
if(isset($_REQUEST['ctf'][$this->getName()]['dir'])) {
|
||||
$link .= "&ctf[{$this->getName()}][dir]=" . $_REQUEST['ctf'][$this->getName()]['dir'];
|
||||
}
|
||||
}
|
||||
|
||||
@ -807,21 +807,21 @@ JS
|
||||
|
||||
|
||||
function NextLink() {
|
||||
$currentStart = isset($_REQUEST['ctf'][$this->Name()]['start']) ? $_REQUEST['ctf'][$this->Name()]['start'] : 0;
|
||||
$currentStart = isset($_REQUEST['ctf'][$this->getName()]['start']) ? $_REQUEST['ctf'][$this->getName()]['start'] : 0;
|
||||
$start = ($currentStart + $this->pageSize < $this->TotalCount()) ? $currentStart + $this->pageSize : $this->TotalCount() % $this->pageSize > 0;
|
||||
if($currentStart >= $start-1) {
|
||||
return null;
|
||||
}
|
||||
$baseLink = ($this->paginationBaseLink) ? $this->paginationBaseLink : $this->Link();
|
||||
$link = Controller::join_links($baseLink, "?ctf[{$this->Name()}][start]={$start}");
|
||||
$link = Controller::join_links($baseLink, "?ctf[{$this->getName()}][start]={$start}");
|
||||
if($this->extraLinkParams) $link .= "&" . http_build_query($this->extraLinkParams);
|
||||
|
||||
// preserve sort options
|
||||
if(isset($_REQUEST['ctf'][$this->Name()]['sort'])) {
|
||||
$link .= "&ctf[{$this->Name()}][sort]=" . $_REQUEST['ctf'][$this->Name()]['sort'];
|
||||
if(isset($_REQUEST['ctf'][$this->getName()]['sort'])) {
|
||||
$link .= "&ctf[{$this->getName()}][sort]=" . $_REQUEST['ctf'][$this->getName()]['sort'];
|
||||
// direction
|
||||
if(isset($_REQUEST['ctf'][$this->Name()]['dir'])) {
|
||||
$link .= "&ctf[{$this->Name()}][dir]=" . $_REQUEST['ctf'][$this->Name()]['dir'];
|
||||
if(isset($_REQUEST['ctf'][$this->getName()]['dir'])) {
|
||||
$link .= "&ctf[{$this->getName()}][dir]=" . $_REQUEST['ctf'][$this->getName()]['dir'];
|
||||
}
|
||||
}
|
||||
|
||||
@ -832,20 +832,20 @@ JS
|
||||
$pageSize = ($this->TotalCount() % $this->pageSize > 0) ? $this->TotalCount() % $this->pageSize : $this->pageSize;
|
||||
$start = $this->TotalCount() - $pageSize;
|
||||
// Check if there is only one page, or if we are on last page
|
||||
if($this->TotalCount() <= $pageSize || (isset($_REQUEST['ctf'][$this->Name()]['start']) && $_REQUEST['ctf'][$this->Name()]['start'] >= $start)) {
|
||||
if($this->TotalCount() <= $pageSize || (isset($_REQUEST['ctf'][$this->getName()]['start']) && $_REQUEST['ctf'][$this->getName()]['start'] >= $start)) {
|
||||
return null;
|
||||
}
|
||||
|
||||
$baseLink = ($this->paginationBaseLink) ? $this->paginationBaseLink : $this->Link();
|
||||
$link = Controller::join_links($baseLink, "?ctf[{$this->Name()}][start]={$start}");
|
||||
$link = Controller::join_links($baseLink, "?ctf[{$this->getName()}][start]={$start}");
|
||||
if($this->extraLinkParams) $link .= "&" . http_build_query($this->extraLinkParams);
|
||||
|
||||
// preserve sort options
|
||||
if(isset($_REQUEST['ctf'][$this->Name()]['sort'])) {
|
||||
$link .= "&ctf[{$this->Name()}][sort]=" . $_REQUEST['ctf'][$this->Name()]['sort'];
|
||||
if(isset($_REQUEST['ctf'][$this->getName()]['sort'])) {
|
||||
$link .= "&ctf[{$this->getName()}][sort]=" . $_REQUEST['ctf'][$this->getName()]['sort'];
|
||||
// direction
|
||||
if(isset($_REQUEST['ctf'][$this->Name()]['dir'])) {
|
||||
$link .= "&ctf[{$this->Name()}][dir]=" . $_REQUEST['ctf'][$this->Name()]['dir'];
|
||||
if(isset($_REQUEST['ctf'][$this->getName()]['dir'])) {
|
||||
$link .= "&ctf[{$this->getName()}][dir]=" . $_REQUEST['ctf'][$this->getName()]['dir'];
|
||||
}
|
||||
}
|
||||
|
||||
@ -854,12 +854,12 @@ JS
|
||||
|
||||
function FirstItem() {
|
||||
if ($this->TotalCount() < 1) return 0;
|
||||
return isset($_REQUEST['ctf'][$this->Name()]['start']) ? $_REQUEST['ctf'][$this->Name()]['start'] + 1 : 1;
|
||||
return isset($_REQUEST['ctf'][$this->getName()]['start']) ? $_REQUEST['ctf'][$this->getName()]['start'] + 1 : 1;
|
||||
}
|
||||
|
||||
function LastItem() {
|
||||
if(isset($_REQUEST['ctf'][$this->Name()]['start'])) {
|
||||
return $_REQUEST['ctf'][$this->Name()]['start'] + min($this->pageSize, $this->TotalCount() - $_REQUEST['ctf'][$this->Name()]['start']);
|
||||
if(isset($_REQUEST['ctf'][$this->getName()]['start'])) {
|
||||
return $_REQUEST['ctf'][$this->getName()]['start'] + min($this->pageSize, $this->TotalCount() - $_REQUEST['ctf'][$this->getName()]['start']);
|
||||
} else {
|
||||
return min($this->pageSize, $this->TotalCount());
|
||||
}
|
||||
@ -1053,8 +1053,8 @@ JS
|
||||
|
||||
function PrintLink() {
|
||||
$link = Controller::join_links($this->Link(), 'printall');
|
||||
if(isset($_REQUEST['ctf'][$this->Name()]['sort'])) {
|
||||
$link = HTTP::setGetVar("ctf[{$this->Name()}][sort]",Convert::raw2xml($_REQUEST['ctf'][$this->Name()]['sort']), $link);
|
||||
if(isset($_REQUEST['ctf'][$this->getName()]['sort'])) {
|
||||
$link = HTTP::setGetVar("ctf[{$this->getName()}][sort]",Convert::raw2xml($_REQUEST['ctf'][$this->getName()]['sort']), $link);
|
||||
}
|
||||
return $link;
|
||||
}
|
||||
@ -1131,19 +1131,19 @@ JS
|
||||
// adding this to TODO probably add a method to the classes
|
||||
// to return they're translated string
|
||||
// added by ruibarreiros @ 27/11/2007
|
||||
return $this->sourceClass() ? singleton($this->sourceClass())->singular_name() : $this->Name();
|
||||
return $this->sourceClass() ? singleton($this->sourceClass())->singular_name() : $this->getName();
|
||||
}
|
||||
|
||||
function NameSingular() {
|
||||
// same as Title()
|
||||
// added by ruibarreiros @ 27/11/2007
|
||||
return $this->sourceClass() ? singleton($this->sourceClass())->singular_name() : $this->Name();
|
||||
return $this->sourceClass() ? singleton($this->sourceClass())->singular_name() : $this->getName();
|
||||
}
|
||||
|
||||
function NamePlural() {
|
||||
// same as Title()
|
||||
// added by ruibarreiros @ 27/11/2007
|
||||
return $this->sourceClass() ? singleton($this->sourceClass())->plural_name() : $this->Name();
|
||||
return $this->sourceClass() ? singleton($this->sourceClass())->plural_name() : $this->getName();
|
||||
}
|
||||
|
||||
function setTemplate($template) {
|
||||
@ -1153,9 +1153,9 @@ JS
|
||||
function CurrentLink() {
|
||||
$link = $this->Link();
|
||||
|
||||
if(isset($_REQUEST['ctf'][$this->Name()]['start']) && is_numeric($_REQUEST['ctf'][$this->Name()]['start'])) {
|
||||
$start = ($_REQUEST['ctf'][$this->Name()]['start'] < 0) ? 0 : $_REQUEST['ctf'][$this->Name()]['start'];
|
||||
$link = Controller::join_links($link, "?ctf[{$this->Name()}][start]={$start}");
|
||||
if(isset($_REQUEST['ctf'][$this->getName()]['start']) && is_numeric($_REQUEST['ctf'][$this->getName()]['start'])) {
|
||||
$start = ($_REQUEST['ctf'][$this->getName()]['start'] < 0) ? 0 : $_REQUEST['ctf'][$this->getName()]['start'];
|
||||
$link = Controller::join_links($link, "?ctf[{$this->getName()}][start]={$start}");
|
||||
}
|
||||
|
||||
if($this->extraLinkParams) $link .= "&" . http_build_query($this->extraLinkParams);
|
||||
@ -1461,7 +1461,7 @@ class TableListField_Item extends ViewableData {
|
||||
}
|
||||
|
||||
function MarkingCheckbox() {
|
||||
$name = $this->parent->Name() . '[]';
|
||||
$name = $this->parent->getName() . '[]';
|
||||
|
||||
if($this->parent->isReadonly())
|
||||
return "<input class=\"checkbox\" type=\"checkbox\" name=\"$name\" value=\"{$this->item->ID}\" disabled=\"disabled\" />";
|
||||
|
@ -239,7 +239,7 @@ class TreeDropdownField extends FormField {
|
||||
}
|
||||
}
|
||||
|
||||
$eval = '"<li id=\"selector-' . $this->Name() . '-{$child->' . $this->keyField . '}\" data-id=\"$child->' . $this->keyField . '\" class=\"class-$child->class"' .
|
||||
$eval = '"<li id=\"selector-' . $this->getName() . '-{$child->' . $this->keyField . '}\" data-id=\"$child->' . $this->keyField . '\" class=\"class-$child->class"' .
|
||||
' . $child->markingClasses() . "\"><a rel=\"$child->ID\">" . $child->' . $this->labelField . ' . "</a>"';
|
||||
|
||||
if($isSubTree) {
|
||||
|
@ -1493,7 +1493,7 @@ class Member_GroupSet extends ManyManyList {
|
||||
|
||||
} else {
|
||||
USER_ERROR("Member::setByCheckboxSetField() - No source items could be found for checkboxsetfield " .
|
||||
$checkboxsetfield->Name(), E_USER_WARNING);
|
||||
$checkboxsetfield->getName(), E_USER_WARNING);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -13,7 +13,7 @@ class NullableFieldTests extends SapphireTest {
|
||||
*/
|
||||
function testWithContent() {
|
||||
$a = new NullableField(new TextField("Field1", "Field 1", "abc"));
|
||||
$this->assertEquals("Field1", $a->Name());
|
||||
$this->assertEquals("Field1", $a->getName());
|
||||
$this->assertEquals("Field 1", $a->Title());
|
||||
$this->assertSame("abc", $a->Value());
|
||||
$this->assertSame("abc", $a->dataValue());
|
||||
@ -34,7 +34,7 @@ class NullableFieldTests extends SapphireTest {
|
||||
*/
|
||||
function testWithEmpty() {
|
||||
$a = new NullableField(new TextField("Field1", "Field 1", ""));
|
||||
$this->assertEquals("Field1", $a->Name());
|
||||
$this->assertEquals("Field1", $a->getName());
|
||||
$this->assertEquals("Field 1", $a->Title());
|
||||
$this->assertSame("", $a->Value());
|
||||
$this->assertSame("", $a->dataValue());
|
||||
@ -55,7 +55,7 @@ class NullableFieldTests extends SapphireTest {
|
||||
*/
|
||||
function testWithNull() {
|
||||
$a = new NullableField(new TextField("Field1", "Field 1", null));
|
||||
$this->assertEquals("Field1", $a->Name());
|
||||
$this->assertEquals("Field1", $a->getName());
|
||||
$this->assertEquals("Field 1", $a->Title());
|
||||
$this->assertSame(null, $a->Value());
|
||||
$this->assertSame(null, $a->dataValue());
|
||||
|
Loading…
x
Reference in New Issue
Block a user