BUG 0000 PM tables + Report tables have been unified
- finished
This commit is contained in:
@@ -47,20 +47,20 @@ if(isset($_POST['action'])) {
|
||||
break;
|
||||
|
||||
case 'exportexporView':
|
||||
global $G_PUBLISH;
|
||||
require_once ( 'classes/class.xmlfield_InputPM.php' );
|
||||
require_once 'classes/model/AdditionalTables.php';
|
||||
|
||||
$G_PUBLISH = new Publisher();
|
||||
|
||||
$oCriteria = new Criteria('workflow');
|
||||
$oCriteria->addSelectColumn(AdditionalTablesPeer::ADD_TAB_UID);
|
||||
$oCriteria->addSelectColumn(AdditionalTablesPeer::ADD_TAB_NAME);
|
||||
$oCriteria->addSelectColumn(AdditionalTablesPeer::ADD_TAB_DESCRIPTION);
|
||||
$oCriteria->add(AdditionalTablesPeer::ADD_TAB_UID, '', Criteria::NOT_EQUAL);
|
||||
global $G_PUBLISH;
|
||||
require_once ( 'classes/class.xmlfield_InputPM.php' );
|
||||
require_once 'classes/model/AdditionalTables.php';
|
||||
|
||||
$G_PUBLISH = new Publisher();
|
||||
|
||||
$oCriteria = new Criteria('workflow');
|
||||
$oCriteria->addSelectColumn(AdditionalTablesPeer::ADD_TAB_UID);
|
||||
$oCriteria->addSelectColumn(AdditionalTablesPeer::ADD_TAB_NAME);
|
||||
$oCriteria->addSelectColumn(AdditionalTablesPeer::ADD_TAB_DESCRIPTION);
|
||||
$oCriteria->add(AdditionalTablesPeer::ADD_TAB_UID, '', Criteria::NOT_EQUAL);
|
||||
|
||||
$G_PUBLISH->AddContent('propeltable', 'additionalTables/paged-table', 'additionalTables/additionalTablesExportList', $oCriteria);
|
||||
G::RenderPage('publish', 'raw');
|
||||
$G_PUBLISH->AddContent('propeltable', 'additionalTables/paged-table', 'additionalTables/additionalTablesExportList', $oCriteria);
|
||||
G::RenderPage('publish', 'raw');
|
||||
break;
|
||||
case 'updatePageSize':
|
||||
G::LoadClass('configuration');
|
||||
@@ -86,29 +86,29 @@ if(isset($_POST['action'])) {
|
||||
break;
|
||||
|
||||
case 'doExport':
|
||||
# @Author: Erik Amaru Ortiz <aortiz.erik@gmail.com>
|
||||
|
||||
require_once 'classes/model/AdditionalTables.php';
|
||||
|
||||
$tables = explode(',', $_POST['tables']);
|
||||
$schema = explode(',', $_POST['schema']);
|
||||
$data = explode(',', $_POST['data']);
|
||||
# @Author: Erik Amaru Ortiz <aortiz.erik@gmail.com>
|
||||
|
||||
G::LoadCLass('net');
|
||||
$net = new NET(G::getIpAddress());
|
||||
|
||||
require_once 'classes/model/AdditionalTables.php';
|
||||
|
||||
$tables = explode(',', $_POST['tables']);
|
||||
$schema = explode(',', $_POST['schema']);
|
||||
$data = explode(',', $_POST['data']);
|
||||
|
||||
G::LoadCLass('net');
|
||||
$net = new NET(G::getIpAddress());
|
||||
|
||||
G::LoadClass("system");
|
||||
|
||||
$META = " \n-----== ProcessMaker Open Source Private Tables ==-----\n".
|
||||
" @Ver: 1.0 Oct-2009\n".
|
||||
" @Processmaker version: ".System::getVersion()."\n".
|
||||
" -------------------------------------------------------\n".
|
||||
" @Export Date: ".date("l jS \of F Y h:i:s A")."\n".
|
||||
" @Server address: ".getenv('SERVER_NAME')." (".getenv('SERVER_ADDR').")\n".
|
||||
" @Client address: ".$net->hostname."\n".
|
||||
" @Workspace: ".SYS_SYS."\n".
|
||||
" @Export trace back:\n\n";
|
||||
|
||||
" @Ver: 1.0 Oct-2009\n".
|
||||
" @Processmaker version: ".System::getVersion()."\n".
|
||||
" -------------------------------------------------------\n".
|
||||
" @Export Date: ".date("l jS \of F Y h:i:s A")."\n".
|
||||
" @Server address: ".getenv('SERVER_NAME')." (".getenv('SERVER_ADDR').")\n".
|
||||
" @Client address: ".$net->hostname."\n".
|
||||
" @Workspace: ".SYS_SYS."\n".
|
||||
" @Export trace back:\n\n";
|
||||
|
||||
|
||||
$EXPORT_TRACEBACK = Array();
|
||||
$c = 0;
|
||||
@@ -117,34 +117,29 @@ if(isset($_POST['action'])) {
|
||||
$aTable = new additionalTables();
|
||||
$tRecord = $aTable->load($uid);
|
||||
$oAdditionalTables = new additionalTables();
|
||||
$ocaux = $oAdditionalTables->getDataCriteria($uid);
|
||||
|
||||
$rs = AdditionalTablesPeer::DoSelectRs ($ocaux);
|
||||
$rs->setFetchmode (ResultSet::FETCHMODE_ASSOC);
|
||||
|
||||
$rows = Array();
|
||||
while($rs->next()){
|
||||
$rows[] = $rs->getRow();
|
||||
}
|
||||
|
||||
array_push($EXPORT_TRACEBACK, Array(
|
||||
'uid' => $uid,
|
||||
'name' => $tRecord['ADD_TAB_NAME'],
|
||||
'num_regs' => sizeof($rows),
|
||||
'schema' => in_array($uid, $schema)? 'yes': 'no',
|
||||
'data' => in_array($uid, $data)? 'yes': 'no'
|
||||
$table = $oAdditionalTables->getAllData($uid);
|
||||
|
||||
$rows = $table['rows'];
|
||||
$count = $table['count'];
|
||||
|
||||
array_push($EXPORT_TRACEBACK, Array(
|
||||
'uid' => $uid,
|
||||
'name' => $tRecord['ADD_TAB_NAME'],
|
||||
'num_regs' => sizeof($rows),
|
||||
'schema' => in_array($uid, $schema)? 'yes': 'no',
|
||||
'data' => in_array($uid, $data)? 'yes': 'no'
|
||||
// 'schema' => ($schema[$c]=='Export')? 'yes': 'no',
|
||||
// 'data' => ($data[$c]=='Export')? 'yes': 'no'
|
||||
));
|
||||
}
|
||||
// 'data' => ($data[$c]=='Export')? 'yes': 'no'
|
||||
));
|
||||
}
|
||||
|
||||
$sTrace = "TABLE UID\t\t\t\tTABLE NAME\tREGS\tSCHEMA\tDATA\n";
|
||||
foreach($EXPORT_TRACEBACK as $row){
|
||||
$sTrace .= "{$row['uid']}\t{$row['name']}\t\t{$row['num_regs']}\t{$row['schema']}\t{$row['data']}\n";
|
||||
$sTrace .= "{$row['uid']}\t{$row['name']}\t\t{$row['num_regs']}\t{$row['schema']}\t{$row['data']}\n";
|
||||
}
|
||||
|
||||
$META .= $sTrace;
|
||||
|
||||
|
||||
///////////////EXPORT PROCESS
|
||||
$PUBLIC_ROOT_PATH = PATH_DATA.'sites'.PATH_SEP.SYS_SYS.PATH_SEP.'public'.PATH_SEP;
|
||||
$filenameOnly = 'SYS-'.strtoupper(SYS_SYS)."_".date("Y-m-d").'_'.date("Hi").".pmt";
|
||||
@@ -152,71 +147,70 @@ if(isset($_POST['action'])) {
|
||||
$fp = fopen( $filename, "wb");
|
||||
$bytesSaved = 0;
|
||||
|
||||
$bufferType = '@META';
|
||||
$fsData = sprintf("%09d", strlen($META));
|
||||
$fsbufferType = sprintf("%09d", strlen($bufferType));
|
||||
$bufferType = '@META';
|
||||
$fsData = sprintf("%09d", strlen($META));
|
||||
$fsbufferType = sprintf("%09d", strlen($bufferType));
|
||||
$bytesSaved += fwrite($fp, $fsbufferType); //writing the size of $oData
|
||||
$bytesSaved += fwrite($fp, $bufferType); //writing the $oData
|
||||
$bytesSaved += fwrite($fp, $fsData); //writing the size of $oData
|
||||
$bytesSaved += fwrite($fp, $META); //writing the $oData
|
||||
|
||||
foreach($EXPORT_TRACEBACK as $record){
|
||||
|
||||
|
||||
if($record['schema'] == 'yes'){
|
||||
$oAdditionalTables = new AdditionalTables();
|
||||
$aData = $oAdditionalTables->load($record['uid'], true);
|
||||
|
||||
$bufferType = '@SCHEMA';
|
||||
$SDATA = serialize($aData);
|
||||
$fsUid = sprintf("%09d", strlen($record['uid']));
|
||||
$fsData = sprintf("%09d", strlen ($SDATA));
|
||||
$oAdditionalTables = new AdditionalTables();
|
||||
$aData = $oAdditionalTables->load($record['uid'], true);
|
||||
|
||||
$bufferType = '@SCHEMA';
|
||||
$SDATA = serialize($aData);
|
||||
$fsUid = sprintf("%09d", strlen($record['uid']));
|
||||
$fsData = sprintf("%09d", strlen ($SDATA));
|
||||
$fsbufferType = sprintf("%09d", strlen($bufferType));
|
||||
|
||||
$bytesSaved += fwrite($fp, $fsbufferType); //writing the size of $oData
|
||||
$bytesSaved += fwrite($fp, $bufferType); //writing the $oData
|
||||
$bytesSaved += fwrite($fp, $bufferType); //writing the $oData
|
||||
$bytesSaved += fwrite($fp, $fsUid ); //writing the size of xml file
|
||||
$bytesSaved += fwrite($fp, $record['uid'] ); //writing the xmlfile
|
||||
$bytesSaved += fwrite($fp, $fsData); //writing the size of xml file
|
||||
$bytesSaved += fwrite($fp, $SDATA); //writing the xmlfile
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
if($record['data'] == 'yes'){
|
||||
//export data
|
||||
$oAdditionalTables = new additionalTables();
|
||||
$ocaux = $oAdditionalTables->getDataCriteria($record['uid']);
|
||||
$rs = AdditionalTablesPeer::DoSelectRs ($ocaux);
|
||||
$rs->setFetchmode (ResultSet::FETCHMODE_ASSOC);
|
||||
$rows = Array();
|
||||
while($rs->next()) $rows[] = $rs->getRow();
|
||||
|
||||
$bufferType = '@DATA';
|
||||
$SDATA = serialize($rows);
|
||||
$fsUid = sprintf("%09d", strlen($record['name']));
|
||||
$fsData = sprintf("%09d", strlen ($SDATA));
|
||||
$fsbufferType = sprintf("%09d", strlen($bufferType));
|
||||
|
||||
$bytesSaved += fwrite($fp, $fsbufferType); //writing the size of $oData
|
||||
$bytesSaved += fwrite($fp, $bufferType); //writing the $oData
|
||||
$bytesSaved += fwrite($fp, $fsUid ); //writing the size of xml file
|
||||
$bytesSaved += fwrite($fp, $record['name'] ); //writing the xmlfile
|
||||
$bytesSaved += fwrite($fp, $fsData); //writing the size of xml file
|
||||
$bytesSaved += fwrite($fp, $SDATA); //writing the xmlfile
|
||||
|
||||
//export data
|
||||
$oAdditionalTables = new additionalTables();
|
||||
$table = $oAdditionalTables->getAllData($uid);
|
||||
|
||||
$rows = $table['rows'];
|
||||
$count = $table['count'];
|
||||
|
||||
$bufferType = '@DATA';
|
||||
$SDATA = serialize($rows);
|
||||
$fsUid = sprintf("%09d", strlen($record['name']));
|
||||
$fsData = sprintf("%09d", strlen ($SDATA));
|
||||
$fsbufferType = sprintf("%09d", strlen($bufferType));
|
||||
|
||||
$bytesSaved += fwrite($fp, $fsbufferType); //writing the size of $oData
|
||||
$bytesSaved += fwrite($fp, $bufferType); //writing the $oData
|
||||
$bytesSaved += fwrite($fp, $fsUid ); //writing the size of xml file
|
||||
$bytesSaved += fwrite($fp, $record['name'] ); //writing the xmlfile
|
||||
$bytesSaved += fwrite($fp, $fsData); //writing the size of xml file
|
||||
$bytesSaved += fwrite($fp, $SDATA); //writing the xmlfile
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
fclose ($fp);
|
||||
|
||||
$filenameLink = "doExport?f={$filenameOnly}";
|
||||
$aFields['SIZE'] = round(($bytesSaved/1024), 2)." Kb";
|
||||
$aFields['META'] = "<pre>".$META."</pre>";
|
||||
$aFields['FILENAME'] = $filenameOnly;
|
||||
$aFields['FILENAME_LINK'] = $filenameLink;
|
||||
|
||||
$G_PUBLISH = new Publisher();
|
||||
$G_PUBLISH->AddContent('xmlform', 'xmlform', 'additionalTables/doExport', '', $aFields, '');
|
||||
G::RenderPage('publish', 'raw');
|
||||
|
||||
fclose ($fp);
|
||||
|
||||
$filenameLink = "../additionalTables/doExport?f={$filenameOnly}";
|
||||
$aFields['SIZE'] = round(($bytesSaved/1024), 2)." Kb";
|
||||
$aFields['META'] = "<pre>".$META."</pre>";
|
||||
$aFields['FILENAME'] = $filenameOnly;
|
||||
$aFields['FILENAME_LINK'] = $filenameLink;
|
||||
|
||||
$G_PUBLISH = new Publisher();
|
||||
$G_PUBLISH->AddContent('xmlform', 'xmlform', 'additionalTables/doExport', '', $aFields, '');
|
||||
G::RenderPage('publish', 'raw');
|
||||
|
||||
break;
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user