Permalink
Browse files

new script for dumping smartforms and templates based on a table def

  • Loading branch information...
1 parent 4d15e5a commit a7690d3eda525c6bd9c6e1a7a3b8c110f55adb51 @weyrick committed Jan 10, 2008
Showing with 32 additions and 0 deletions.
  1. +32 −0 bin/dumpSmartForm.php
View
32 bin/dumpSmartForm.php
@@ -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.