/** * @ignore */ protected function draw_cell(tabular_report_cellfmt $col, $val) { $attrs = array(); $attrs['class'] = array($col->get_key()); if ($class = $col->get_class()) { $attrs['class'][] = $class; } if ($aval = $col->get_alignment()) { $attrs['style'][] = "text-align: {$aval}"; } if ($col->get_span() > 1) { $attrs['colspan'] = $col->get_span(); } if ($this->_status == 'HEADER' || $this->_status == 'RPTHEADER') { $el = 'th'; } else { $el = 'td'; } if (isset($attrs['class']) && count($attrs['class'])) { $attrs['class'] = implode(' ', $attrs['class']); } if (isset($attrs['style']) && count($attrs['style'])) { $attrs['style'] = implode('; ', $attrs['style']); } $out = null; foreach ($attrs as $akey => $aval) { $out .= " {$akey}=\"{$aval}\""; } $this->_out .= "<{$el}{$out}><span>{$val}</span></{$el}>"; }
/** * Construct a new column definition. * A column definition defines how values in an entire column will be treated. * * @param string $key The name of the column (must match the defined columns in the report definition). * @param string $label The displayable label for this column. * @param string $fmt The smarty tempalte that defines how values in this column will be displayed. * @param string $align The alignment for cells in this column. */ public function __construct($key, $label, $fmt = null, $align = null, $sorting = null) { if (!$fmt) { $fmt = '{$val}'; } parent::__construct($key, $fmt, $align); $this->_label = $label; $this->_sorting = (int) $sorting; $this->_global_values = array(); $this->_group_values = array(); }