MaxDB PHP Generator online Help
Prev | Return to chapter overview | Next |
Print & Export enability methods
The following methods allow to enable/disable various print and export abilities for a page.
Signature |
Description |
setPrintListAvailable($value) |
Allows to print all records from a grid. |
setExportListAvailable(array $exportFormats) |
Allows to export all records from a grid to the given formats. |
setAllowPrintSelectedRecords($value) |
Allows to print the selected records from a grid. |
setExportSelectedRecordsAvailable(array $exportFormats) |
Allows to export the selected records from a grid to the given formats. |
setPrintListRecordAvailable($value) |
Allows to print a single record from a grid. |
setExportListRecordAvailable(array $exportFormats) |
Allows to export a single record from a grid to the given formats. |
setPrintOneRecordAvailable($value) |
Allows to print a record from a view form. |
setExportOneRecordAvailable(array $exportFormats) |
Allows to export a record from a view form to the given formats. |
The $exportFormats array can include the following values: 'pdf', 'excel', 'word', 'xml', 'csv'.
The code in the examples below should be placed into the OnPreparePage event handler:
Example 1:
To allow to export the selected records in 'pdf' and 'word' formats only, use the following code:
$this->setExportSelectedRecordsAvailable(array('pdf', 'word'));
Example 2:
To allow to execute any print operations only for users with admin permissions, use the following code:
$isPageAdmin = $this->IsLoggedInAsAdmin();
$this->setPrintListAvailable($isPageAdmin);
$this->setAllowPrintSelectedRecords($isPageAdmin);
$this->setPrintListRecordAvailable($isPageAdmin);
$this->setPrintOneRecordAvailable($isPageAdmin);
Example 3:
To disable any export operations for ordinary users, use the following code:
$isOrdinaryUser = !$this->IsLoggedInAsAdmin();
if ($isOrdinaryUser) {
$this->setExportListAvailable(array());
$this->setExportSelectedRecordsAvailable(array());
$this->setExportListRecordAvailable(array());
$this->setExportOneRecordAvailable(array());
}
Prev | Return to chapter overview | Next |