"Date->Nice") */ protected $fieldCasting = array(); /** * Construct a OrderReport. * * @param name Name of the data report * @param title Title of the data report as displayed in the CMS. * @param value The value of the data report as a form field, usually could be a empty string * @param form The form that the containing the date report, usually dose matter if set null * @param baseClass the base object that this report works oon * @param fieldMap A mapthat works out Header cell of report table and which content will be for the colums, using array of "$k=>$v"s * @param headFields If keys in fieldMap is numerical, header of the report table can be worked out here * @param filter The filter on the object for the report, usually this filter is "=" type filter for the database table field. * @param dateFilter The dateFitler on the object for the report, usually this filter is for time and works on Created using "Between ... And ..." * @param join The joined database table is put in this parameter * @param sort The sort clause will be made from this parameter */ function __construct($name, $title, $value, $form, $baseClass, $fieldMap=null, $headFields=null, $filter=null, $dateFilter=null, $sort=null, $join=null) { $this->baseClass = $baseClass; //Work out $filters, $sort, $join, $filters need to be further processed in getRecords(); if($filter) $this->filter = $filter; if($dateFilter) $this->dateFilter=$dateFilter; if($sort) $this->sort = $sort; if($join) $this->join = $join; //Work out $headFields, $dataFields if($fieldMap){ if(is_array($fieldMap)){ foreach($fieldMap as $k => $v){ $fields[] = $v; if(!$headFields) $heads[] = $k; } } } if($fields) $this->dataFields = $fields; if(!$headFields) $this->headFields = $heads; else $this->headFields = $headFields; parent::__construct($name, $title, $value, $form); } /*protected function expandWildcards($fieldMap){ $records = $this->getRecords(); if($records){ foreach($records as $record){ Debug::show($record); die('here'); } } }*/ /** * @todo: to set export flag to be $export */ public function setExport($export){ $this->export = $export; } /** * Todo: to export the reported table as a CSV */ function exportToCSV( $fileName ) { $fileData = $this->columnheaders( 'csvRow', 'csvHeadCell' ) . $this->datacells('csvRow', 'csvDataCell' ); HTTP::sendFileToBrowser($fileData, $fileName); } /** * @todo: to overwrite its parent's FieldHolder, the returned HTML