private function reporteTBSOO($informe) { define('BASE', sfConfig::get('sf_app_module_dir') . '/informes/lib/'); require_once BASE . 'tbs_class_php5.php'; require_once BASE . 'tbsooo_class.php'; $OOo = new clsTinyButStrongOOo(); $OOo->noErr = true; $OOo->SetZipBinary('zip'); $OOo->SetUnzipBinary('unzip'); $OOo->SetProcessDir(sfConfig::get('sf_informe_dir')); $OOo->SetDataCharset('UTF8'); $OOo->NewDocFromTpl(sfConfig::get('sf_informe_dir') . DIRECTORY_SEPARATOR . $informe->getAdjunto()->getRuta()); $OOo->LoadXmlFromDoc('content.xml'); $aVariable = $this->leerTemplate($OOo->Source); $aDato = array(); //busco en las variables encontradas en el template y reemplaza contenido $aDato = $this->llenarVariables($aVariable); //agregando datos del registro informe $aDato['informe'] = $informe->toArray(); // variables adicionales dinamicas de los formulario if ($informe->getVariables()) { $aDato['variable'] = array(); $variables = explode(";", $informe->getVariables()); foreach ($variables as $variable) { $pos = stripos($variable, ":"); if ($pos) { $variable = substr($variable, 0, $pos); } $aDato['variable'] = array_merge($aDato['variable'], array($variable => $this->getRequestParameter($variable))); } } // lleno finalmente de diferente forma si es un array (ciclo) o no (variable comun) if (is_array($aDato)) { foreach ($aDato as $idx => $dato) { if ($this->isNotAssocArray($dato)) { $OOo->MergeBlock($idx, "array", $dato); } else { $OOo->MergeField($idx, $dato); } } } $OOo->SaveXmlToDoc(); // OJO hay headers locos para que funcione en internet explorer header('Content-type: ' . $OOo->GetMimetypeDoc()); //header("Content-Type: application/force-download"); //para que funcione en konqueror header("Cache-Control: public, must-revalidate"); header("Pragma: hack"); header('Content-Length: ' . filesize($OOo->GetPathnameDoc())); header('Content-Disposition: attachment; filename="informe' . $informe->getNombre() . '.odt"'); header("Content-Transfer-Encoding: binary"); $OOo->FlushDoc(); $OOo->RemoveDoc(); }