added <tr> tag for PDF to fix layout issues
This commit is contained in:
parent
fdda8f8e4c
commit
c2de13f7c1
|
@ -1053,11 +1053,16 @@ name<span style="font-weight: bold; font-style: italic;"></key><value&g
|
|||
value<span style="font-weight: bold; font-style: italic;"></value></block></span></li>
|
||||
<li><span style="font-weight: bold;">table:</span> <span
|
||||
style="font-weight: bold; font-style: italic;"><block><key></span>attribute
|
||||
name<span style="font-weight: bold; font-style: italic;"></key><td></span>first
|
||||
value<span style="font-weight: bold; font-style: italic;"><td></block><block><td></span>second
|
||||
value<span style="font-weight: bold; font-style: italic;"></td></block><block><td></span><span
|
||||
style="font-weight: bold;"></span>third value<span
|
||||
style="font-weight: bold; font-style: italic;"></td></block></span></li>
|
||||
name<span style="font-weight: bold; font-style: italic;"></key><tr><td></span>value<span
|
||||
style="font-weight: bold; font-style: italic;"><td></span><span
|
||||
style="font-weight: bold; font-style: italic;"><td></span>value<span
|
||||
style="font-weight: bold; font-style: italic;"><td></span><span
|
||||
style="font-weight: bold; font-style: italic;"></tr></block><block><tr><td></span>value<span
|
||||
style="font-weight: bold; font-style: italic;"></td></span><span
|
||||
style="font-weight: bold; font-style: italic;"><td></span>value<span
|
||||
style="font-weight: bold; font-style: italic;"><td></span><span
|
||||
style="font-weight: bold; font-style: italic;"></tr></block></span><span
|
||||
style="font-weight: bold; font-style: italic;"></span></li>
|
||||
</ul>
|
||||
<br>
|
||||
Special commands:<br style="font-weight: bold;">
|
||||
|
@ -1066,11 +1071,14 @@ Special commands:<br style="font-weight: bold;">
|
|||
You can specify the alignment in <td> tags with <span
|
||||
style="font-weight: bold; font-style: italic;">align=(L|R|C)</span>
|
||||
(e.g. <td align=\"L\">)</li>
|
||||
<li><span style="font-weight: bold;">Cell width: <td></span>
|
||||
allows an attribute "width" to set the cell width (e.g. <td
|
||||
width=20%> or <td width=30>).<br>
|
||||
</li>
|
||||
<li><span style="font-weight: bold;">Line breaks:</span> Line breaks
|
||||
can be specified by adding a <span
|
||||
style="font-weight: bold; font-style: italic;"><br /></span>
|
||||
tag. The new line will start at the left border of the PDF document.<br>
|
||||
</li>
|
||||
tag. The new line will start at the left border of the PDF document.</li>
|
||||
</ul>
|
||||
<br>
|
||||
<span style="font-weight: bold; text-decoration: underline;">Examples:</span><br
|
||||
|
@ -1105,13 +1113,13 @@ to display more columns.<br>
|
|||
<span style="font-weight: bold;">'myAttribute'</span>
|
||||
=> <span style="font-weight: bold;">'<span
|
||||
style="font-style: italic;"><block><key></span></span>AttrName<span
|
||||
style="font-weight: bold; font-style: italic;"></key><td
|
||||
style="font-weight: bold; font-style: italic;"></key><tr><td
|
||||
align=\"L\"></span>123<span
|
||||
style="font-weight: bold; font-style: italic;"></td></block><block><td
|
||||
style="font-weight: bold; font-style: italic;"></td></tr></block><block><tr><td
|
||||
align=\"L\"></span>456<span
|
||||
style="font-weight: bold; font-style: italic;"></td></block><block><td
|
||||
style="font-weight: bold; font-style: italic;"></td></tr></block><block><tr><td
|
||||
align=\"L\"></span>789<span
|
||||
style="font-weight: bold; font-style: italic;"></td></block></span><span
|
||||
style="font-weight: bold; font-style: italic;"></td></tr></block></span><span
|
||||
style="font-weight: bold;">'</span><br>
|
||||
<br>
|
||||
This will give the following PDF output: <br>
|
||||
|
|
|
@ -449,19 +449,19 @@ class quota extends baseModule {
|
|||
function get_pdfEntries($account_type = "user") {
|
||||
if (sizeof($this->quota) > 0) {
|
||||
$quotas = array();
|
||||
$quotas[] = '<block>' .
|
||||
$quotas[] = '<block><tr>' .
|
||||
'<td width="20%"><b>' . _('Mountpoint') . '</b></td>' .
|
||||
'<td width="20%"><b>' . _('Soft block') . '</b></td>' .
|
||||
'<td width="20%"><b>' . _('Hard block') . '</b></td>' .
|
||||
'<td width="20%"><b>' . _('Soft inode') . '</b></td>' .
|
||||
'<td width="20%"><b>' . _('Hard inode') . '</b></td></block>';
|
||||
'<td width="20%"><b>' . _('Hard inode') . '</b></td></tr></block>';
|
||||
for ($i = 0; $i < sizeof($this->quota); $i++) {
|
||||
$quotas[] = '<block>' .
|
||||
$quotas[] = '<block><tr>' .
|
||||
'<td width="20%" align=\"L\">' . $this->quota[$i][0] . '</td>' .
|
||||
'<td width="20%" align=\"L\">' . $this->quota[$i][2] . '</td>' .
|
||||
'<td width="20%" align=\"L\">' . $this->quota[$i][3] . '</td>' .
|
||||
'<td width="20%" align=\"L\">' . $this->quota[$i][6] . '</td>' .
|
||||
'<td width="20%" align=\"L\">' . $this->quota[$i][7] . '</td></block>';
|
||||
'<td width="20%" align=\"L\">' . $this->quota[$i][7] . '</td></tr></block>';
|
||||
}
|
||||
return array(
|
||||
'quota_quotas' => $quotas);
|
||||
|
|
|
@ -225,6 +225,8 @@ function processLine($line,$first_td = true, $fontName) {
|
|||
$value_pattern = '/(<block>.*)<value>(.*)<\/value>(<\/block>)/';
|
||||
// PCRE matching a <td> tag
|
||||
$td_pattern = '/(<block>.*?)<td(.*?)>(.+?)<\/td>(.*<\/block>)/';
|
||||
// PCRE matching <tr> tag
|
||||
$tr_pattern = '/<tr><\/tr>/';
|
||||
// PCRE matching a <p> tag
|
||||
$p_pattern = '/(<block>.*)<p>(.+)<\/p>(.*<\/block>)/';
|
||||
// PCRE matching a <br> tag
|
||||
|
@ -236,14 +238,14 @@ function processLine($line,$first_td = true, $fontName) {
|
|||
$line_width = $line_width - 50;
|
||||
$format = processFormatTags($matches[2],'B');
|
||||
$return[] = array('setFont',array($fontName,$format[0],9));
|
||||
$return[] = array('Cell',array(50,0,$format[1] . ':',0,0,'R',0));
|
||||
$return[] = array('Cell',array(50,5,$format[1] . ':',0,0,'R',0));
|
||||
$return[] = array('setFont',array($fontName,'',9));
|
||||
return array_merge($return,processLine($matches[1] . $matches[3],false,$fontName));
|
||||
}
|
||||
elseif(preg_match($value_pattern,$line,$matches)) {
|
||||
$format = processFormatTags($matches[2],'');
|
||||
$return[] = array('setFont',array($fontName,$format[0],9));
|
||||
$return[] = array('MultiCell',array(0,0,$format[1],0,'L',0));
|
||||
$return[] = array('MultiCell',array(0,5,$format[1],0,'L',0));
|
||||
$return[] = array('setFont',array($fontName,'',9));
|
||||
return array_merge($return,processLine($matches[1] . $matches[3],true,$fontName));
|
||||
}
|
||||
|
@ -260,7 +262,7 @@ function processLine($line,$first_td = true, $fontName) {
|
|||
$return[] = array('Cell',array(50,5,'',0,0,'L',0));
|
||||
}
|
||||
$format = processFormatTags($matches[3],'');
|
||||
$attrs = processAttributes($matches[2],array('width' => $line_width,'height' => 0,'align' => 'L'));
|
||||
$attrs = processAttributes($matches[2],array('width' => $line_width,'height' => 5,'align' => 'L'));
|
||||
$return[] = array('setFont',array($fontName,$format[0],9));
|
||||
$return[] = array('Cell',array($attrs['width'],$attrs['height'],$format[1],0,0,$attrs['align'],0));
|
||||
$return[] = array('setFont',array($fontName,'',9));
|
||||
|
@ -270,6 +272,10 @@ function processLine($line,$first_td = true, $fontName) {
|
|||
return array(array('Ln',array(5)));
|
||||
}
|
||||
elseif(preg_match($block_pattern,$line,$matches)) {
|
||||
$line_width = LAMPDF_LINEWIDTH;
|
||||
return array();
|
||||
}
|
||||
elseif(preg_match($tr_pattern,$line,$matches)) {
|
||||
$line_width = LAMPDF_LINEWIDTH;
|
||||
return array(array('Ln',array(5)));
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue