class DocumentBase in Forena Reports 8
Hierarchy
- class \Drupal\forena\FrxPlugin\Document\DocumentBase implements DocumentInterface uses FrxAPI
Expanded class hierarchy of DocumentBase
4 files declare their use of DocumentBase
- DocRaptorPDF.php in forena_pdf/
src/ FrxPlugin/ Document/ DocRaptorPDF.php - PrincePDF
- FrxAPI.php in src/
FrxAPI.php - FrxAPI.incL General Forena Reporting Class
- MPDF.php in forena_pdf/
src/ FrxPlugin/ Document/ MPDF.php - MPDF.inc PDF document via MPDF Library @author davidmetzler
- PrincePDF.php in forena_pdf/
src/ FrxPlugin/ Document/ PrincePDF.php - PrincePDF
File
- src/
FrxPlugin/ Document/ DocumentBase.php, line 15 - DocumentBase.inc Given a report, render the appropriate output given the document format. @author davidmetzler
Namespace
Drupal\forena\FrxPlugin\DocumentView source
class DocumentBase implements DocumentInterface {
use FrxAPI;
public $format = '';
public $buffer = TRUE;
protected $filename = '';
public $parameters_form = [];
// Reort Write buffer.
protected $write_buffer;
// Contains CSS and Java script libraries
public $libraries;
// Page or report title
public $title;
// Ajax Commands
protected $commands;
// Skin definition
protected $skin;
// Skin assocatiated with the report
protected $skin_name;
public $file_name;
public $content_type = '';
public $charset = 'UTF-8';
public $headers;
public function clear() {
$this->write_buffer = '';
$this->pre_commands = [];
$this->parameters_form = [];
$this->commands = [];
}
/**
* Default implementation to put in content type based headers.
*/
public function header() {
$this->write_buffer = '';
if ($this->content_type) {
$this->headers = [];
$this->headers['Content-Type'] = $this->content_type . ' ;charset=' . $this->charset;
$this->headers['Cache-Control'] = '';
$this->headers['Pragma'] = '';
//$file_name = basename($_GET['q']);
if ($this->file_name) {
$this->headers['Content-Disposition:'] = 'attachment; filename="' . $this->file_name . '"';
}
}
}
/**
* @param string $skin_name
* name/path of the skin to load.
*/
public function setSkin($skin_name) {
$this->skin_name = $skin_name;
$this->skin = Skin::instance($skin_name);
}
public function setFilename($filename) {
$this->file_name = $filename;
}
// All document objects must implement this method.
public function flush() {
return $this->write_buffer;
}
public function write($buffer) {
if ($this->buffer) {
$this->write_buffer .= $buffer;
}
}
/**
* Wrapper function for check output to default the right type.
* @param string $output
*/
public function check_markup($output) {
return check_markup($output, \Drupal::config('forena.settings')
->get('input_format'));
}
/**
* Perform character set conversion
* @param $data
* @param string $default_encoding
* @return string
*/
public function convertCharset($data, $default_encoding = 'UTF-8') {
if (isset($_SERVER['HTTP_ACCEPT_CHARSET'])) {
$parts = @explode(';', $_SERVER['HTTP_ACCEPT_CHARSET']);
$parts = @explode(',', $parts[0]);
$to_encoding = @$parts[0];
}
else {
$to_encoding = $default_encoding;
}
if ($to_encoding != 'UTF-8') {
$this->charset = $to_encoding;
$data = mb_convert_encoding($data, $to_encoding, 'UTF-8');
}
return $data;
}
/**
* @param array $ajax
* The Array of coommand objects
* @param string $event
* 'pre' implies pre replacement firing of events.
*/
public function addAjaxCommand($ajax, $event) {
$command = $ajax['command'];
$plugins = AppService::instance()
->getAjaxPlugins();
if (isset($plugins[$command])) {
$class = $plugins[$command];
/** @var AjaxCommandInterface $command */
$command = new $class();
$ajax_command = $command
->commandFromSettings($ajax);
if ($ajax_command) {
$this->commands[$event][] = $ajax_command;
}
}
}
/**
* @return array
* Array of ajax commands that are built.
*/
public function getAjaxCommands() {
return $this->commands;
}
/**
* No default footer.
*/
public function footer() {
}
}
Members
Name | Modifiers | Type | Description | Overrides |
---|---|---|---|---|
DocumentBase:: |
public | property | ||
DocumentBase:: |
public | property | ||
DocumentBase:: |
protected | property | ||
DocumentBase:: |
public | property | ||
DocumentBase:: |
protected | property | ||
DocumentBase:: |
public | property | ||
DocumentBase:: |
public | property | ||
DocumentBase:: |
public | property | ||
DocumentBase:: |
public | property | ||
DocumentBase:: |
public | property | ||
DocumentBase:: |
protected | property | ||
DocumentBase:: |
protected | property | ||
DocumentBase:: |
public | property | ||
DocumentBase:: |
protected | property | ||
DocumentBase:: |
public | function | ||
DocumentBase:: |
public | function | Wrapper function for check output to default the right type. | |
DocumentBase:: |
public | function |
Clear the buffer Overrides DocumentInterface:: |
|
DocumentBase:: |
public | function | Perform character set conversion | |
DocumentBase:: |
public | function |
Write the output to disk. Overrides DocumentInterface:: |
9 |
DocumentBase:: |
public | function |
No default footer. Overrides DocumentInterface:: |
1 |
DocumentBase:: |
public | function | ||
DocumentBase:: |
public | function |
Default implementation to put in content type based headers. Overrides DocumentInterface:: |
8 |
DocumentBase:: |
public | function |
Overrides DocumentInterface:: |
|
DocumentBase:: |
public | function |
Overrides DocumentInterface:: |
|
DocumentBase:: |
public | function |
Write Overrides DocumentInterface:: |
|
FrxAPI:: |
public | function | Returns containing application service | |
FrxAPI:: |
public | function | Get the current data context. | |
FrxAPI:: |
public | function | ||
FrxAPI:: |
public | function | Returns the data manager service | |
FrxAPI:: |
public | function | Return Data Service | |
FrxAPI:: |
public | function | Returns the fornea document manager | |
FrxAPI:: |
public | function | Report an error | |
FrxAPI:: |
public | function | Get the context of a specific id. | |
FrxAPI:: |
public | function | Get the current document | |
FrxAPI:: |
public | function | Load the contents of a file in the report file system. | |
FrxAPI:: |
function | Enter description here... | 1 | |
FrxAPI:: |
public | function | Pop data off of the stack. | |
FrxAPI:: |
public | function | Push data onto the Stack | |
FrxAPI:: |
public | function | Run a report with a particular format. | 1 |
FrxAPI:: |
public | function | Get the current report file system. | |
FrxAPI:: |
public | function | Set Data context by id. | |
FrxAPI:: |
public | function | Change to a specific document type. | |
FrxAPI:: |
public | function | Get list of skins. |