added PDFTable
This commit is contained in:
parent
95b87c003f
commit
451c1c5e4c
|
@ -866,13 +866,14 @@ abstract class baseModule {
|
|||
* @param PDFTable $table table
|
||||
*/
|
||||
public function addPDFTable(&$result, $name, $table) {
|
||||
$first = true;
|
||||
if (empty($table->rows)) {
|
||||
return;
|
||||
}
|
||||
if (!empty($table->label)) {
|
||||
$result[get_class($this) . '_' . $name][] = '<block><tr><td><b>' . $table->label . ':</b></td></tr></block>';
|
||||
}
|
||||
foreach ($table->rows as $row) {
|
||||
$xml = '<block>';
|
||||
if ($first && !empty($table->label)) {
|
||||
$xml .= '<key>' . $table->label . '</key>';
|
||||
}
|
||||
$xml .= '<tr>';
|
||||
$xml = '<block><tr>';
|
||||
foreach ($row->cells as $cell) {
|
||||
$width = empty($cell->width) ? '' : ' width="' . $cell->width . '"';
|
||||
$content = ($cell->bold) ? '<b>' . $cell->content . '</b>' : $cell->content;
|
||||
|
@ -880,7 +881,6 @@ abstract class baseModule {
|
|||
}
|
||||
$xml .= '</tr></block>';
|
||||
$result[get_class($this) . '_' . $name][] = $xml;
|
||||
$first = false;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1828,6 +1828,15 @@ class PDFTable {
|
|||
/** list of PDFTableRow elements */
|
||||
public $rows = array();
|
||||
|
||||
/**
|
||||
* Constructor
|
||||
*
|
||||
* @param String $label label
|
||||
*/
|
||||
public function __construct($label = null) {
|
||||
$this->label = $label;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -1868,11 +1877,11 @@ class PDFTableCell {
|
|||
* Constructor.
|
||||
*
|
||||
* @param String $content cell content
|
||||
* @param String $align cell alignment (default: left)
|
||||
* @param String $width width (e.g. "20%")
|
||||
* @param String $align cell alignment (default: left)
|
||||
* @param boolean $bold print in bold
|
||||
*/
|
||||
public function __construct($content, $align = null, $width = null, $bold = false) {
|
||||
public function __construct($content, $width = null, $align = null, $bold = false) {
|
||||
$this->content = empty($content) ? ' ' : $content;
|
||||
$this->align = ($align == null) ? self::ALIGN_LEFT : $align;
|
||||
$this->width = $width;
|
||||
|
|
|
@ -819,10 +819,10 @@ class asteriskExtension extends baseModule {
|
|||
$entries = $this->load_extension_parts($extName);
|
||||
$pdfTable = new PDFTable();
|
||||
$pdfRow = new PDFTableRow();
|
||||
$pdfRow->cells[] = new PDFTableCell(_('Name'), null, '20%', true);
|
||||
$pdfRow->cells[] = new PDFTableCell(_('Application'), null, '30%', true);
|
||||
$pdfRow->cells[] = new PDFTableCell(_('Application data'), null, '30%', true);
|
||||
$pdfRow->cells[] = new PDFTableCell(_('Priority'), null, '20%', true);
|
||||
$pdfRow->cells[] = new PDFTableCell(_('Name'), '20%', null, true);
|
||||
$pdfRow->cells[] = new PDFTableCell(_('Application'), '30%', null, true);
|
||||
$pdfRow->cells[] = new PDFTableCell(_('Application data'), '30%', null, true);
|
||||
$pdfRow->cells[] = new PDFTableCell(_('Priority'), '20%', null, true);
|
||||
$pdfTable->rows[] = $pdfRow;
|
||||
for ($i = 0; $i < sizeof($entries); $i++) {
|
||||
$appdata = ' ';
|
||||
|
@ -830,10 +830,10 @@ class asteriskExtension extends baseModule {
|
|||
$appdata = $entries[$i]['astapplicationdata'][0];
|
||||
}
|
||||
$pdfRow = new PDFTableRow();
|
||||
$pdfRow->cells[] = new PDFTableCell($entries[$i]['cn'][0], null, '20%');
|
||||
$pdfRow->cells[] = new PDFTableCell($entries[$i]['astapplication'][0], null, '30%');
|
||||
$pdfRow->cells[] = new PDFTableCell($appdata, null, '30%');
|
||||
$pdfRow->cells[] = new PDFTableCell($entries[$i]['astpriority'][0], null, '20%');
|
||||
$pdfRow->cells[] = new PDFTableCell($entries[$i]['cn'][0], '20%');
|
||||
$pdfRow->cells[] = new PDFTableCell($entries[$i]['astapplication'][0], '30%');
|
||||
$pdfRow->cells[] = new PDFTableCell($appdata, '30%');
|
||||
$pdfRow->cells[] = new PDFTableCell($entries[$i]['astpriority'][0], '20%');
|
||||
$pdfTable->rows[] = $pdfRow;
|
||||
}
|
||||
$this->addPDFTable($return, 'rules', $pdfTable);
|
||||
|
|
Loading…
Reference in New Issue