reportDataAbstract is an interface to various dynamic functions that can be inserted into reports by the writers that support them. This allows for more advance control of especially spreadsheets - but allows this control to still be used by the more basic reportWriterBase components.
This abstract class provides the shared logic that all reportData functions will use. All sub-classes need to implement the reportDataAbstract::render() method.
In most cases these functions will operate on the last set of data e.g. if the writer is at row 10, column 5, then the function will receive row 10 column 4. For summing rows, the render() method will still receive the current row, from which 1 should be substracted (totals are always last).
reportDataAbstract inherits from baseOptionsSet allowing options to be set on a per class basis for additional control. What these options are will depend on the implemented class.
public __construct([$inRow = null], [$inColumn = null], [$inStringValue = null], [$inStringFormat = null], [$inOptions = array()])
Creates a new instance of the function
The constructor should be overloaded to provide suitable defaults for the data type the class is for. For example: sum and average set the default string value to 0 (zero) instead of null.
If overloading, be sure to call into the parent __construct():
class myFunction extends reportDataAbstract {
function __construct($inRow = 1, $inColumn = 1, $inStringValue = 'My String', array $inOptions = array()) {
parent::__construct($inRow, $inColumn, $inStringValue, $inOptions);
}
}
public __toString()
Returns a string if this class is used as a string
public reset()
Resets the object to defaults
public abstract render($startRow, $startCol, $endRow, $endCol, [$sheetRowStart = 5])
Returns control as a string using the provided data as the current data points
public getStringValue()
Returns the string to use for writers that cannot use formulae
public setStringValue($inStringValue)
Set the string value (can be integer, or float as well)
public getStringFormat()
Returns the string formatting controls
public setStringFormat($inStringFormat)
Set the string formatting options for the string value
This is passed into the PHP function sprintf - any valid format that sprintf can take can be used here. Note: the only value that will be passed is the reportDataAbstract::$_StringValue. No other data points can be used unless the data formatter is customised to permit it via the options array.
public getRow()
Returns the specific row to operate on
public setRow($inRow)
Set the specific row to operate on, rather than the row the writer is currently processing
public getColumn()
Returns a specific column to be operated on
public setColumn($inColumn)
Set a specific column to operate on, this should be the numeric index starting at 1
Posted by: Scorpio Documentor (Writer), in Report on 05 Aug 2010 @ 03:02
Tags: baseoptionsset, countable, iteratoraggregate, report, reportdataabstract, traversable,
This
work is licenced under a
Creative Commons Licence.