Частичная синхронизация с CMS
This commit is contained in:
parent
312f18a20a
commit
b26e521657
62 changed files with 827 additions and 5992 deletions
|
|
@ -6,7 +6,7 @@ class Excel_Number
|
|||
|
||||
function __construct($value)
|
||||
{
|
||||
$this->value = $value;
|
||||
$this->value = intval($value);
|
||||
}
|
||||
|
||||
function getString()
|
||||
|
|
@ -70,13 +70,13 @@ class TableRow
|
|||
*/
|
||||
class ExcelTable
|
||||
{
|
||||
static $index;
|
||||
static $index;
|
||||
private $name;
|
||||
private $style;
|
||||
protected $rows = array();
|
||||
protected $rows = array();
|
||||
|
||||
protected $splitVertical = false;
|
||||
protected $splitHorizontal = false;
|
||||
protected $_splitVertical = false;
|
||||
protected $_splitHorizontal = false;
|
||||
|
||||
function __construct()
|
||||
{
|
||||
|
|
@ -94,7 +94,8 @@ class ExcelTable
|
|||
if(! isset($this->rows[$x])) {
|
||||
$this->rows[$x] = new TableRow();
|
||||
}
|
||||
$this->rows[$x]->setCell($y, $value);
|
||||
/*.TableRow.*/$row = $this->rows[$x];
|
||||
$row->setCell($y, $value);
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
@ -142,12 +143,13 @@ class ExcelTable
|
|||
* @param $cell Номер столбца
|
||||
* @param $merge Количество клеток для обьединения
|
||||
*/
|
||||
function setCellMerge ($row, $cell, $merge)
|
||||
function setCellMerge($x, $cell, $merge)
|
||||
{
|
||||
assert(is_numeric($row) && $row > 0);
|
||||
assert(is_numeric($x) && $x > 0);
|
||||
assert(is_numeric($cell) && $cell > 0);
|
||||
|
||||
$this->rows[$row]->cells[$cell]->merge = $merge;
|
||||
/*.TableRow.*/$row = $this->rows[$x];
|
||||
$row->cells[$cell]->merge = $merge;
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
@ -181,7 +183,8 @@ class ExcelTable
|
|||
*/
|
||||
function getRows()
|
||||
{
|
||||
return max(array_keys($this->rows));
|
||||
/*.array.*/$keys = array_keys($this->rows);
|
||||
return max($keys);
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
@ -189,27 +192,26 @@ class ExcelTable
|
|||
*
|
||||
* @return int
|
||||
*/
|
||||
function getRowCells($row)
|
||||
function getRowCells(TableRow $row)
|
||||
{
|
||||
return max(array_keys($row->cells));
|
||||
/*.array.*/$keys = array_keys($row->cells);
|
||||
return max($keys);
|
||||
}
|
||||
|
||||
/**
|
||||
* Разделяет таблицу на две части по вертикали
|
||||
* @param $n integer Количество столбцов слева
|
||||
*/
|
||||
function splitVertical($n)
|
||||
{
|
||||
$this->splitVertical = $n;
|
||||
function splitVertical($n) {
|
||||
$this->_splitVertical = $n;
|
||||
}
|
||||
|
||||
/**
|
||||
* Разделяет таблицу на две части по горизонтали
|
||||
* @param $n integer Количество столбцов сверху
|
||||
*/
|
||||
function splitHorizontal($n)
|
||||
{
|
||||
$this->splitHorizontal = $n;
|
||||
function splitHorizontal($n) {
|
||||
$this->_splitHorizontal = $n;
|
||||
}
|
||||
|
||||
|
||||
|
|
@ -218,8 +220,7 @@ class ExcelTable
|
|||
*
|
||||
* @return int
|
||||
*/
|
||||
function getColumns()
|
||||
{
|
||||
function getColumns() {
|
||||
return max(array_map(array($this, 'getRowCells'), $this->rows));
|
||||
}
|
||||
|
||||
|
|
@ -231,7 +232,7 @@ class ExcelTable
|
|||
/**
|
||||
* Генерация клетки таблицы (Переработать)
|
||||
*/
|
||||
function createCell ($ncell, XMLWriter $doc, $j, $value, $setIndex) {
|
||||
function createCell (TableCell $ncell, XMLWriter $doc, $j, /*.any.*/$value, $setIndex) {
|
||||
$doc->startElement("Cell");
|
||||
|
||||
if ($ncell->style) {
|
||||
|
|
@ -291,7 +292,7 @@ class ExcelTable
|
|||
$doc->writeAttribute('ss:Height', $this->rows[$i]->height);
|
||||
}
|
||||
|
||||
$nrow = $this->rows[$i];
|
||||
/*.TableRow.*/$nrow = $this->rows[$i];
|
||||
// Флаг индикатор подстановки номера столбца
|
||||
$setIndex = false;
|
||||
for ($j = 1; $j <= $columns; $j++) {
|
||||
|
|
@ -321,17 +322,17 @@ class ExcelTable
|
|||
$doc->writeAttribute('xmlns', 'urn:schemas-microsoft-com:office:excel');
|
||||
|
||||
$doc->writeElement('FrozenNoSplit');
|
||||
if ($this->splitVertical) {
|
||||
$doc->writeElement('SplitVertical', $this->splitVertical);
|
||||
$doc->writeElement('LeftColumnRightPane', $this->splitVertical);
|
||||
if ($this->_splitVertical) {
|
||||
$doc->writeElement('SplitVertical', $this->_splitVertical);
|
||||
$doc->writeElement('LeftColumnRightPane', $this->_splitVertical);
|
||||
}
|
||||
if ($this->splitHorizontal) {
|
||||
$doc->writeElement('SplitHorizontal', $this->splitHorizontal);
|
||||
$doc->writeElement('TopRowBottomPane', $this->splitHorizontal);
|
||||
if ($this->_splitHorizontal) {
|
||||
$doc->writeElement('SplitHorizontal', $this->_splitHorizontal);
|
||||
$doc->writeElement('TopRowBottomPane', $this->_splitHorizontal);
|
||||
}
|
||||
if ($this->splitHorizontal && $this->splitVertical) {
|
||||
if ($this->_splitHorizontal && $this->_splitVertical) {
|
||||
$doc->writeElement('ActivePane', 0);
|
||||
} else if($this->splitHorizontal) {
|
||||
} else if($this->_splitHorizontal) {
|
||||
$doc->writeElement('ActivePane', 2);
|
||||
}
|
||||
$doc->endElement();
|
||||
|
|
@ -377,6 +378,7 @@ class ExcelDocument {
|
|||
if ($type == 'Borders') {
|
||||
$doc->startElement('Borders');
|
||||
foreach ($s as $border) {
|
||||
/*.array.*/$border = $border;
|
||||
$doc->startElement('Border');
|
||||
foreach ($border as $key => $value) {
|
||||
$doc->writeAttribute('ss:' . $key, $value);
|
||||
|
|
@ -403,7 +405,7 @@ class ExcelDocument {
|
|||
function clean ($s) {
|
||||
assert(is_string($s));
|
||||
|
||||
return strtr($s, array ("\n" => ' '));
|
||||
return strtr($s, array ("\n" => " "));
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
@ -412,7 +414,7 @@ class ExcelDocument {
|
|||
*/
|
||||
function save($filename)
|
||||
{
|
||||
$doc = new xmlWriter();
|
||||
$doc = new XMLWriter();
|
||||
$doc->openURI($filename);
|
||||
$doc->setIndent(false);
|
||||
$doc->startDocument('1.0','utf-8');
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue