// cmd tpl1 $xml = csv2xmlByHead(isset($io_options['in']) ? $io_options['in'] : $file, 'EVENTO', 1); $xml = XML_HEADER1 . str_replace('<br>', '<br/>', $xml); //die($xml); if (isset($io_options['xsltFile'])) { $xsl2 = $io_options['xsltFile']; $xsl1 = str_replace('.xsl', '_pre.xsl', $xsl2); $sdoc = new SimpleXMLElement($xml); /// GAMBI pelo bug de XSLT com xsl_getCsvRow() $sdoc = transformToDom($xsl1, $sdoc); $tmp = $sdoc->saveXML(); $tmp = preg_replace_callback('#<DIA id="([^"]+)">#s', function ($m) { return $m[0] . "<infoGrupo>" . gambi_getCsvRow('programacaoGrupoDia', $m[1]) . "</infoGrupo>"; }, $tmp); $sdoc = new SimpleXMLElement($tmp); $xml = transformToXML($xsl2, $sdoc); } die("{$xml}\n"); } elseif (isset($io_options['convCsv'])) { // cmd convCsv convCsv($io_options['in']); die("\n"); } elseif (isset($io_options['in'])) { // demais cmd's $file = $io_options['in']; if (is_dir($file)) { $file = trim($file); if (substr($file, -1, 1) != '/') { $file .= '/'; } $OUT = '';
// check for files to exist // $ret = checkForFiles( $excel, $mapper->getColByName( "filename" ), $uploadsMap ); // if( $ret !== 0 ) { // View::debug( "Could not find file ".$ret, 1 ); // // break; // } $xml_source = null; $md5r = null; // generate all Resources $rowErrors = array(); $rowWarnings = array(); $res = getResources($excel, $mapper, $template, $uploadsMap, $rowErrors, $rowWarnings); $rowsValid = rowValidator($rowErrors, $rowWarnings); if ($filesystemValid === 0 && $tableValid === 0 && $rowsValid === 0) { // transform to XML format $xml = transformToXML($res); $xml->save($excel->getSource() . ".xml"); // echo $xml->saveXML(); //$xml->saveXML();//proftpd //pathinfo string [] $xml_source = $xml->saveXML(); $xml_source = escape_check($xml_source); $xml_source = str_replace("\\n", "", $xml_source); $md5r = md5($scramble_key . $xml_source); // echo $scramble_key; foreach ($res as $r) { $r->updateResource(); } } View::importXML($filesystemValid, $filesystemErrors, $filesystemWarnings, $tableValid, $tableErrors, $tableWarnings, $rowsValid, $rowErrors, $rowWarnings, $baseurl . "/uploads/" . basename($excel->getSource()) . ".xml", $xml_source, $md5r); include '../../../include/footer.php'; break;