_xml;
}
/**
*
* @return CreateExcelSharedStrings
* @static
*/
public static function getInstance()
{
if (self::$_instance == NULL) {
self::$_instance = new CreateExcelSharedStrings();
}
return self::$_instance;
}
/**
* Create excel shared strings
*
* @param string $args[0]
* @param string $args[1]
* @access public
*/
public function createExcelSharedStrings()
{
$this->_xml = '';
$args = func_get_args();
$type = $args[1];
$dats = $args[0];
$tamDatos = count($dats);
foreach ($dats as $ind => $data) {
$tamCols = count($data);
break;
}
$tamDatos = count($dats);
if (strpos($type, 'pie') !== false) {
$tamCols = 1;
} else {
$tamDatos--;
}
$this->generateSST($tamDatos + $tamCols + 2);
for ($i = 0; $i < $tamCols; $i++) {
if (strpos($type, 'pie') !== false) {
$this->generateSI();
$this->generateT('0');
break;
}else
$this->generateSI();
$this->generateT($dats[0][$i]);
}
foreach ($dats as $ind => $val) {
if ($ind == '0')
continue;
$this->generateSI();
$this->generateT($ind);
}
$this->generateSI();
$this->generateT(' ', 'preserve');
$msg = 'To change the range size of values,
drag the bottom right corner';
$this->generateSI();
$this->generateT($msg);
$this->cleanTemplate();
}
/**
* Generate sst
*
* @param string $num
* @access protected
*/
protected function generateSST($num)
{
$this->_xml = '__GENERATESST__';
}
/**
* Generate si
* @access protected
*/
protected function generateSI()
{
$xml = '__GENERATESI____GENERATESST__';
$this->_xml = str_replace('__GENERATESST__', $xml, $this->_xml);
}
/**
* Generate t
*
* @param string $name
* @param string $space
* @access protected
*/
protected function generateT($name, $space = '')
{
$xmlAux = '';
$this->_xml = str_replace('__GENERATESI__', $xmlAux, $this->_xml);
}
}