mirror of
https://github.com/silverstripe/silverstripe-framework
synced 2024-08-27 21:15:40 +02:00
Conflicts: .travis.yml README.md admin/code/LeftAndMain.php admin/css/screen.css admin/scss/screen.scss api/RestfulService.php conf/ConfigureFromEnv.php control/injector/ServiceConfigurationLocator.php control/injector/SilverStripeServiceConfigurationLocator.php core/ClassInfo.php core/Object.php css/AssetUploadField.css css/ComplexTableField_popup.css dev/CSSContentParser.php dev/DevelopmentAdmin.php docs/en/changelogs/index.md docs/en/misc/contributing/code.md docs/en/reference/execution-pipeline.md filesystem/GD.php filesystem/ImagickBackend.php filesystem/Upload.php forms/Form.php forms/FormField.php forms/HtmlEditorConfig.php forms/gridfield/GridFieldDetailForm.php forms/gridfield/GridFieldSortableHeader.php lang/en.yml model/Aggregate.php model/DataList.php model/DataObject.php model/DataQuery.php model/Image.php model/MySQLDatabase.php model/SQLQuery.php model/fieldtypes/HTMLText.php model/fieldtypes/Text.php scss/AssetUploadField.scss search/filters/SearchFilter.php security/Authenticator.php security/LoginForm.php security/Member.php security/MemberAuthenticator.php security/MemberLoginForm.php security/Security.php tests/behat/features/bootstrap/SilverStripe/Framework/Test/Behaviour/CmsFormsContext.php tests/control/HTTPTest.php tests/control/RequestHandlingTest.php tests/filesystem/UploadTest.php tests/forms/FormTest.php tests/forms/NumericFieldTest.php tests/model/DataListTest.php tests/model/DataObjectTest.php tests/model/TextTest.php tests/security/MemberAuthenticatorTest.php tests/security/SecurityDefaultAdminTest.php tests/view/SSViewerCacheBlockTest.php tests/view/SSViewerTest.php
59 lines
1.4 KiB
PHP
59 lines
1.4 KiB
PHP
<?php
|
|
/**
|
|
* Adding this class to a {@link GridFieldConfig} of a {@link GridField} adds
|
|
* a footer bar to that field.
|
|
*
|
|
* The footer looks just like the {@link GridFieldPaginator} control, except
|
|
* without the pagination controls.
|
|
*
|
|
* It only display the "Viewing 1-8 of 8" status text and (optionally) a
|
|
* configurable status message.
|
|
*
|
|
* The purpose of this class is to have a footer that can round off
|
|
* {@link GridField} without having to use pagination.
|
|
*
|
|
* @package forms
|
|
* @subpackage fields-gridfield
|
|
*/
|
|
class GridFieldFooter implements GridField_HTMLProvider {
|
|
|
|
/**
|
|
* @var string - a message to display in the footer
|
|
*/
|
|
protected $message = null;
|
|
protected $showrecordcount;
|
|
|
|
/**
|
|
*
|
|
* @param string $message - a message to display in the footer
|
|
*/
|
|
public function __construct($message = null, $showrecordcount = true) {
|
|
if($message) {
|
|
$this->message = $message;
|
|
}
|
|
$this->showrecordcount = $showrecordcount;
|
|
}
|
|
|
|
|
|
public function getHTMLFragments($gridField) {
|
|
$count = $gridField->getList()->count();
|
|
|
|
$forTemplate = new ArrayData(array(
|
|
'ShowRecordCount' => $this->showrecordcount,
|
|
'Message' => $this->message,
|
|
'FirstShownRecord' => 1,
|
|
'LastShownRecord' => $count,
|
|
'NumRecords' => $count
|
|
));
|
|
|
|
return array(
|
|
'footer' => $forTemplate->renderWith(
|
|
'GridFieldFooter',
|
|
array(
|
|
'Colspan' => count($gridField->getColumns())
|
|
)
|
|
)
|
|
);
|
|
}
|
|
}
|