2
0
forked from Wavyzz/dolibarr

Fix: uniform code

replace all $html by $form with exceptions "$htmlname, $htmltooltip"
This commit is contained in:
Regis Houssin
2011-11-08 17:18:45 +08:00
parent 9549c0c608
commit f0c327c070
214 changed files with 1401 additions and 1401 deletions

View File

@@ -302,21 +302,21 @@ class PHPExcel_Writer_HTML implements PHPExcel_Writer_IWriter {
}
// Construct HTML
$html = '<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">' . PHP_EOL;
$html .= '<!-- Generated by PHPExcel - http://www.phpexcel.net -->' . PHP_EOL;
$html .= '<html>' . PHP_EOL;
$html .= ' <head>' . PHP_EOL;
$html .= ' <meta http-equiv="Content-Type" content="text/html; charset=utf-8">' . PHP_EOL;
$html .= ' <title>' . htmlspecialchars($this->_phpExcel->getProperties()->getTitle()) . '</title>' . PHP_EOL;
$form = '<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">' . PHP_EOL;
$form .= '<!-- Generated by PHPExcel - http://www.phpexcel.net -->' . PHP_EOL;
$form .= '<html>' . PHP_EOL;
$form .= ' <head>' . PHP_EOL;
$form .= ' <meta http-equiv="Content-Type" content="text/html; charset=utf-8">' . PHP_EOL;
$form .= ' <title>' . htmlspecialchars($this->_phpExcel->getProperties()->getTitle()) . '</title>' . PHP_EOL;
if ($pIncludeStyles) {
$html .= $this->generateStyles(true);
$form .= $this->generateStyles(true);
}
$html .= ' </head>' . PHP_EOL;
$html .= '' . PHP_EOL;
$html .= ' <body>' . PHP_EOL;
$form .= ' </head>' . PHP_EOL;
$form .= '' . PHP_EOL;
$form .= ' <body>' . PHP_EOL;
// Return
return $html;
return $form;
}
/**
@@ -345,13 +345,13 @@ class PHPExcel_Writer_HTML implements PHPExcel_Writer_IWriter {
}
// Construct HTML
$html = '';
$form = '';
// Loop all sheets
$sheetId = 0;
foreach ($sheets as $sheet) {
// Write table header
$html .= $this->_generateTableHeader($sheet);
$form .= $this->_generateTableHeader($sheet);
// Get worksheet dimension
$dimension = explode(':', $sheet->calculateWorksheetDimension());
@@ -384,12 +384,12 @@ class PHPExcel_Writer_HTML implements PHPExcel_Writer_IWriter {
while($row++ < $rowMax) {
// <thead> ?
if ($row == $theadStart) {
$html .= ' <thead>' . PHP_EOL;
$form .= ' <thead>' . PHP_EOL;
}
// <tbody> ?
if ($row == $tbodyStart) {
$html .= ' <tbody>' . PHP_EOL;
$form .= ' <tbody>' . PHP_EOL;
}
// Write row if there are HTML table cells in it
@@ -406,27 +406,27 @@ class PHPExcel_Writer_HTML implements PHPExcel_Writer_IWriter {
$rowData[$column] = '';
}
}
$html .= $this->_generateRow($sheet, $rowData, $row - 1);
$form .= $this->_generateRow($sheet, $rowData, $row - 1);
}
// </thead> ?
if ($row == $theadEnd) {
$html .= ' </thead>' . PHP_EOL;
$form .= ' </thead>' . PHP_EOL;
}
// </tbody> ?
if ($row == $tbodyEnd) {
$html .= ' </tbody>' . PHP_EOL;
$form .= ' </tbody>' . PHP_EOL;
}
}
// Write table footer
$html .= $this->_generateTableFooter();
$form .= $this->_generateTableFooter();
// Writing PDF?
if ($this->_isPdf) {
if (is_null($this->_sheetIndex) && $sheetId + 1 < $this->_phpExcel->getSheetCount()) {
$html .= '<div style="page-break-before:always" />';
$form .= '<div style="page-break-before:always" />';
}
}
@@ -435,7 +435,7 @@ class PHPExcel_Writer_HTML implements PHPExcel_Writer_IWriter {
}
// Return
return $html;
return $form;
}
/**
@@ -460,24 +460,24 @@ class PHPExcel_Writer_HTML implements PHPExcel_Writer_IWriter {
}
// Construct HTML
$html = '';
$form = '';
// Only if there are more than 1 sheets
if (count($sheets) > 1) {
// Loop all sheets
$sheetId = 0;
$html .= '<ul class="navigation">' . PHP_EOL;
$form .= '<ul class="navigation">' . PHP_EOL;
foreach ($sheets as $sheet) {
$html .= ' <li class="sheet' . $sheetId . '"><a href="#sheet' . $sheetId . '">' . $sheet->getTitle() . '</a></li>' . PHP_EOL;
$form .= ' <li class="sheet' . $sheetId . '"><a href="#sheet' . $sheetId . '">' . $sheet->getTitle() . '</a></li>' . PHP_EOL;
++$sheetId;
}
$html .= '</ul>' . PHP_EOL;
$form .= '</ul>' . PHP_EOL;
}
return $html;
return $form;
}
/**
@@ -490,7 +490,7 @@ class PHPExcel_Writer_HTML implements PHPExcel_Writer_IWriter {
*/
private function _writeImageTagInCell(PHPExcel_Worksheet $pSheet, $coordinates) {
// Construct HTML
$html = '';
$form = '';
// Write images
foreach ($pSheet->getDrawingCollection() as $drawing) {
@@ -514,14 +514,14 @@ class PHPExcel_Writer_HTML implements PHPExcel_Writer_IWriter {
// Convert UTF8 data to PCDATA
$filename = htmlspecialchars($filename);
$html .= PHP_EOL;
$html .= ' <img style="position: relative; left: ' . $drawing->getOffsetX() . 'px; top: ' . $drawing->getOffsetY() . 'px; width: ' . $drawing->getWidth() . 'px; height: ' . $drawing->getHeight() . 'px;" src="' . $filename . '" border="0" width="' . $drawing->getWidth() . '" height="' . $drawing->getHeight() . '" />' . PHP_EOL;
$form .= PHP_EOL;
$form .= ' <img style="position: relative; left: ' . $drawing->getOffsetX() . 'px; top: ' . $drawing->getOffsetY() . 'px; width: ' . $drawing->getWidth() . 'px; height: ' . $drawing->getHeight() . 'px;" src="' . $filename . '" border="0" width="' . $drawing->getWidth() . '" height="' . $drawing->getHeight() . '" />' . PHP_EOL;
}
}
}
// Return
return $html;
return $form;
}
/**
@@ -541,28 +541,28 @@ class PHPExcel_Writer_HTML implements PHPExcel_Writer_IWriter {
$css = $this->buildCSS($generateSurroundingHTML);
// Construct HTML
$html = '';
$form = '';
// Start styles
if ($generateSurroundingHTML) {
$html .= ' <style type="text/css">' . PHP_EOL;
$html .= ' html { ' . $this->_assembleCSS($css['html']) . ' }' . PHP_EOL;
$form .= ' <style type="text/css">' . PHP_EOL;
$form .= ' html { ' . $this->_assembleCSS($css['html']) . ' }' . PHP_EOL;
}
// Write all other styles
foreach ($css as $styleName => $styleDefinition) {
if ($styleName != 'html') {
$html .= ' ' . $styleName . ' { ' . $this->_assembleCSS($styleDefinition) . ' }' . PHP_EOL;
$form .= ' ' . $styleName . ' { ' . $this->_assembleCSS($styleDefinition) . ' }' . PHP_EOL;
}
}
// End styles
if ($generateSurroundingHTML) {
$html .= ' </style>' . PHP_EOL;
$form .= ' </style>' . PHP_EOL;
}
// Return
return $html;
return $form;
}
/**
@@ -852,12 +852,12 @@ class PHPExcel_Writer_HTML implements PHPExcel_Writer_IWriter {
*/
public function generateHTMLFooter() {
// Construct HTML
$html = '';
$html .= ' </body>' . PHP_EOL;
$html .= '</html>' . PHP_EOL;
$form = '';
$form .= ' </body>' . PHP_EOL;
$form .= '</html>' . PHP_EOL;
// Return
return $html;
return $form;
}
/**
@@ -871,19 +871,19 @@ class PHPExcel_Writer_HTML implements PHPExcel_Writer_IWriter {
$sheetIndex = $pSheet->getParent()->getIndex($pSheet);
// Construct HTML
$html = '';
$form = '';
if (!$this->_useInlineCss) {
$gridlines = $pSheet->getShowGridLines() ? ' gridlines' : '';
$html .= ' <table border="0" cellpadding="0" cellspacing="0" id="sheet' . $sheetIndex . '" class="sheet' . $sheetIndex . $gridlines . '">' . PHP_EOL;
$form .= ' <table border="0" cellpadding="0" cellspacing="0" id="sheet' . $sheetIndex . '" class="sheet' . $sheetIndex . $gridlines . '">' . PHP_EOL;
} else {
$style = isset($this->_cssStyles['table']) ?
$this->_assembleCSS($this->_cssStyles['table']) : '';
if ($this->_isPdf && $pSheet->getShowGridLines()) {
$html .= ' <table border="1" cellpadding="1" id="sheet' . $sheetIndex . '" cellspacing="4" style="' . $style . '">' . PHP_EOL;
$form .= ' <table border="1" cellpadding="1" id="sheet' . $sheetIndex . '" cellspacing="4" style="' . $style . '">' . PHP_EOL;
} else {
$html .= ' <table border="0" cellpadding="1" id="sheet' . $sheetIndex . '" cellspacing="4" style="' . $style . '">' . PHP_EOL;
$form .= ' <table border="0" cellpadding="1" id="sheet' . $sheetIndex . '" cellspacing="4" style="' . $style . '">' . PHP_EOL;
}
}
@@ -892,16 +892,16 @@ class PHPExcel_Writer_HTML implements PHPExcel_Writer_IWriter {
$i = -1;
while($i++ < $highestColumnIndex) {
if (!$this->_useInlineCss) {
$html .= ' <col class="col' . $i . '">' . PHP_EOL;
$form .= ' <col class="col' . $i . '">' . PHP_EOL;
} else {
$style = isset($this->_cssStyles['table.sheet' . $sheetIndex . ' col.col' . $i]) ?
$this->_assembleCSS($this->_cssStyles['table.sheet' . $sheetIndex . ' col.col' . $i]) : '';
$html .= ' <col style="' . $style . '">' . PHP_EOL;
$form .= ' <col style="' . $style . '">' . PHP_EOL;
}
}
// Return
return $html;
return $form;
}
/**
@@ -911,11 +911,11 @@ class PHPExcel_Writer_HTML implements PHPExcel_Writer_IWriter {
*/
private function _generateTableFooter() {
// Construct HTML
$html = '';
$html .= ' </table>' . PHP_EOL;
$form = '';
$form .= ' </table>' . PHP_EOL;
// Return
return $html;
return $form;
}
/**
@@ -930,7 +930,7 @@ class PHPExcel_Writer_HTML implements PHPExcel_Writer_IWriter {
private function _generateRow(PHPExcel_Worksheet $pSheet, $pValues = null, $pRow = 0) {
if (is_array($pValues)) {
// Construct HTML
$html = '';
$form = '';
// Sheet index
$sheetIndex = $pSheet->getParent()->getIndex($pSheet);
@@ -942,24 +942,24 @@ class PHPExcel_Writer_HTML implements PHPExcel_Writer_IWriter {
// check if a break is needed before this row
if (isset($breaks['A' . $pRow])) {
// close table: </table>
$html .= $this->_generateTableFooter();
$form .= $this->_generateTableFooter();
// insert page break
$html .= '<div style="page-break-before:always" />';
$form .= '<div style="page-break-before:always" />';
// open table again: <table> + <col> etc.
$html .= $this->_generateTableHeader($pSheet);
$form .= $this->_generateTableHeader($pSheet);
}
}
// Write row start
if (!$this->_useInlineCss) {
$html .= ' <tr class="row' . $pRow . '">' . PHP_EOL;
$form .= ' <tr class="row' . $pRow . '">' . PHP_EOL;
} else {
$style = isset($this->_cssStyles['table.sheet' . $sheetIndex . ' tr.row' . $pRow])
? $this->_assembleCSS($this->_cssStyles['table.sheet' . $sheetIndex . ' tr.row' . $pRow]) : '';
$html .= ' <tr style="' . $style . '">' . PHP_EOL;
$form .= ' <tr style="' . $style . '">' . PHP_EOL;
}
// Write cells
@@ -1085,9 +1085,9 @@ class PHPExcel_Writer_HTML implements PHPExcel_Writer_IWriter {
// Write
if ($writeCell) {
// Column start
$html .= ' <td';
$form .= ' <td';
if (!$this->_useInlineCss) {
$html .= ' class="' . $cssClass . '"';
$form .= ' class="' . $cssClass . '"';
} else {
//** Necessary redundant code for the sake of PHPExcel_Writer_PDF **
// We must explicitly write the width of the <td> element because TCPDF
@@ -1110,24 +1110,24 @@ class PHPExcel_Writer_HTML implements PHPExcel_Writer_IWriter {
}
//** end of redundant code **
$html .= ' style="' . $this->_assembleCSS($cssClass) . '"';
$form .= ' style="' . $this->_assembleCSS($cssClass) . '"';
}
if ($colSpan > 1) {
$html .= ' colspan="' . $colSpan . '"';
$form .= ' colspan="' . $colSpan . '"';
}
if ($rowSpan > 1) {
$html .= ' rowspan="' . $rowSpan . '"';
$form .= ' rowspan="' . $rowSpan . '"';
}
$html .= '>';
$form .= '>';
// Image?
$html .= $this->_writeImageTagInCell($pSheet, $coordinate);
$form .= $this->_writeImageTagInCell($pSheet, $coordinate);
// Cell data
$html .= $cellData;
$form .= $cellData;
// Column end
$html .= '</td>' . PHP_EOL;
$form .= '</td>' . PHP_EOL;
}
// Next column
@@ -1135,10 +1135,10 @@ class PHPExcel_Writer_HTML implements PHPExcel_Writer_IWriter {
}
// Write row end
$html .= ' </tr>' . PHP_EOL;
$form .= ' </tr>' . PHP_EOL;
// Return
return $html;
return $form;
} else {
throw new Exception("Invalid parameters passed.");
}