Skip to content

Commit

Permalink
new script for dumping smartforms and templates based on a table def
Browse files Browse the repository at this point in the history
  • Loading branch information
weyrick committed Jan 10, 2008
1 parent 4d15e5a commit a7690d3
Showing 1 changed file with 32 additions and 0 deletions.
32 changes: 32 additions & 0 deletions bin/dumpSmartForm.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
#!/usr/local/bin/php
<?php

if ($argc < 5) {
die("usage: {$argv[0]} <username> <password> <database> <table> [form/tpt]\n");
}

$SM_siteName = "Form Dumper";
$SM_siteID = "FORMDUMP";
require('siteManager.inc');
require('contrib/lib/smSaveForm.inc');

$dbSettings = array('DSN' => "mysql:host=localhost;dbname={$argv[3]}",
'userName' => $argv[1],
'passWord' => $argv[2]
);
$SM_siteManager->defineDBconnection('default',$dbSettings);

$dS = array('tableName' => $argv[4]);
$m = $SM_siteManager->loadModule('dbGui');
$m->configure($dS);
$m->run();

$form = $m->getResource('myForm');
if ($argv[5] == 'tpt') {
echo join("\n",$form->template->htmlTemplate);
}
else {
echo SM_saveForm($form);
}

?>

0 comments on commit a7690d3

Please sign in to comment.