function start($cli=false, $mods='', $overwrite='')
{
-
+ $ff = HTML_Flexyframework::get();
$this->scanModules();
//echo '<PRE>'; print_r($this->modtables); exit;
$proj = 'pman'; //ucfirst(basename($options['database']));
// we are going to generate all of the code into a temporay foldler..
- $options['rootDir'] = ini_get('session.save_path').'/temp_'. $proj;
+ $user = posix_getpwuid(posix_getuid());
+
+ $options['rootDir'] = ini_get('session.save_path').'/temp_'. $proj.'_'. $user['name'];
$options['cli'] = $cli;
$options['mods'] = empty($mods) ? array() : explode('/',$mods);
- $ff = HTML_FlexyFramework::get();
{
$options = &PEAR::getStaticProperty('DB_DataObject','options');
+ $ff = HTML_Flexyframework::get();
+
$url = parse_url($options['database']);
// hide stuff for web..
$cli = $options['cli'];
require_once 'System.php';
$cat = System::which('cat');
$mysql = System::which('mysql');
-
+ //print_r($ff);
+ //print_r($options['mods'] );
foreach($this->modsql as $m => $fl)
{
if ($cli && isset($options['database_'. $m])) {
(!empty($url['pass']) ? ' -p' . escapeshellarg($url['pass']) : '') .
' ' . basename($url['path']);
-
+ echo $mysql_cmd . "\n" ;
if (!empty($options['mods'] ) && !in_array($m, $options['mods'] )) {
continue;
}
+
foreach($fl as $f) {
- $fn = $this->page->rootDir. "/Pman/$m/DataObjects/$f";
+ $fn = $ff->page->rootDir. "/Pman/$m/DataObjects/$f";
$cmd = $cat . ' ' . escapeshellarg($fn) . " | $mysql_cmd -f ";
echo $cmd. ($cli ? "\n" : "<BR>\n");
if ($cli) {
return;
}
+ $ff = HTML_Flexyframework::get();
-
- $top = $this->page->rootDir .'/Pman';
+ $top = $ff->page->rootDir .'/Pman';
$this->modtables = array();
$this->modmap = array();
$this->modmapsql = array();
+
foreach(scandir($top) as $m) {
if (!strlen($m) ||
$options['modtables'] = $this->modtables;
$options['modmap'] = $this->modmap;
$options['modsql'] = $this->modsql;
+ // print_r($options);
}
/**
$this->scanModules();
}
$options = &PEAR::getStaticProperty('DB_DataObject','options');
+ $builder_options = PEAR::getStaticProperty('Pman_Builder','options');
+ $ignore = empty($builder_options['skip_tables']) ? array() : $builder_options['skip_tables'];
+
$mods = $options['mods'];
$inis = array();
$this->_newConfig = '';
$tn = strtolower($this->table);
//print_r($this->modmap);//[$tn]);//
+
+
+
if (!isset($this->modmap[$tn])) {
- die("No existing DataObject file found for table {$this->table} \n".
- "- create an empty file in the related Module/DataObjects directory
- eg.
- touch Pman/????/DataObjects/".ucfirst($this->table).".php
- \n");
+
+ if (in_array($this->table, $ignore)) {
+ continue;
+ }
+
+
+ die("No existing DataObject file found for table {$this->table}
+
+- either add it to Pman_Builder[skip_tables] or\n
+- create an empty file in the related Module/DataObjects directory
+eg.
+touch Pman/????/DataObjects/".ucfirst($this->table).".php
+
+");
}
$mod = $this->modmap[$tn];
// print_R($this->modmap);
// die("generateClasses");
$options = &PEAR::getStaticProperty('DB_DataObject','options');
+
+ $ff = HTML_Flexyframework::get();
+
$rd = $options['rootDir'];
$mods = $options['mods'];
$this->_extends = 'DB_DataObject';
$outfilename = $rd.'/'.$mod.'/'. ucfirst($this->table).'.php';
- $orig = $this->page->rootDir .'/Pman/'.$mod.'/DataObjects/'. ucfirst($this->table).'.php';
+ $orig = $ff->page->rootDir .'/Pman/'.$mod.'/DataObjects/'. ucfirst($this->table).'.php';
// file_get_contents???
// function generateClasses() { }
var $jsHeader = "//<script type=\"text/javascript\">\n";
-
+ /**
+ *
+ * generate the reader tables..
+ * I'm not sure if this is needed any more, as our desktop builder
+ * generates that data anyway.
+ *
+ */
function generateRoo()
{
-
+
$options = &PEAR::getStaticProperty('DB_DataObject','options');
$mods = $options['mods'];
$this->rootDir = $options['rootDir'];
function _generateReaders($m)
{
-
- $udb = ucfirst($this->_database);
+ $ff = HTML_FlexyFramework::get();
+
$ret = $this->jsHeader;
$j = new Pman_Builder_Generator_JSON();
$j->indent = 0;
}
}
$this->readersArgs[$this->table]['xtype'] = 'JsonReader';
- $ret.="\n$udb.Readers.$utable = ";
+ $ret.="\n{$ff->project}.Readers.$utable = ";
$x = $j->encodeUnsafe($this->readersArgs[$this->table]);
$ret .= trim(substr($x, 0, -1)) . ",\n"; // strip of trailing ;};
$ret .= $j->tab . "fields : [\n". $j->tab.$j->tab;
'id' => 'id', // primary key!!?
);
- $d = $this->tableToData($this->_definitions[$table]);
+ $d = $this->tableToData($table, $this->_definitions[$table]);
$this->tablekeys[$this->table] = $d['tablekey'];
// store the globals
$this->def['order'][$table] = $d['order'];
$this->def['readers'][$table]= $d['readers'];
- $this->def['colmodels'][$table] = $d['colmodes'];
+ $this->def['colmodels'][$table] = $d['colmodels'];
$this->def['forms'][$table] = $d['forms'];
$this->readersArgs[$table] = $d['args'];
}
-
+
+
+
function parseConfig()
{
- $ff = HTML_FlexyFramework::get();
- $dirs = array($this->page->rootDir.'/Pman/DataObjects'); // not used anymore!
- foreach($ff->page->modtables as $m=>$ts) {
- $dirs[] = $this->page->rootDir.'/Pman/'.$m.'/DataObjects';
+ $options = &PEAR::getStaticProperty('DB_DataObject','options');
+
+ if (isset($options['modtables'])) {
+ $this->modtables = $options['modtables'];
+ $this->modmap = $options['modmap'];
+ $this->modsql = $options['modsql'];
+ }
+
+ $ff = HTML_Flexyframework::get();
+ $dirs = array($ff->page->rootDir.'/Pman/DataObjects'); // not used anymore!
+ foreach($this->modtables as $m=>$ts) {
+ $dirs[] = $ff->page->rootDir.'/Pman/'.$m.'/DataObjects';
}
$ini = array('database__render' => array());
foreach($dirs as $d) {
$ini['database__render'] = array_merge($ini['database__render'] , $r);
}
//echo '<PRE>';print_R($ini);//exit;
-
+
+
if (!isset($ini['database__render'])) {
die("database__render not available in links files.");
return;
function mergeConfig($table, $conf, $render)
{
$this->mapcols[$table] = array();
+ $options = &PEAR::getStaticProperty('DB_DataObject','options');
+ if (isset($options['modtables'])) {
+ $this->modtables = $options['modtables'];
+ $this->modmap = $options['modmap'];
+ $this->modsql = $options['modsql'];
+ }
+
foreach($conf as $ocol=>$info) {
// format col => showval..