$out .= __FILE__ . ": a table name should be given. [1201231050]\n"; $out .= "<br/><a href=\"" . $_CONFIG['rtvdir'] . "\">=Home</a>"; $isgo = false; } } else { $out .= "<script type=\"text/javascript\">currenttbl='" . $tbl . "';\ncurrentdb='" . $mydb . "';\n currentlistid= {};\n userinfo={'id':'" . $userid . "','email':'" . $user->getEmail() . "','group':'" . $user->getGroup() . "','branch':'" . $user->get('branchoffice') . "'};\n </script>\n"; } $out_header = $out; $out = ""; # re-init it if ($isgo) { $hmconf = GTbl::xml2hash($xmlpathpre, $elementsep, $db, $tbl); $gtbl = new GTbl($tbl, $hmconf[0], $elementsep); #print __FILE__.": hmconf:".print_r($hmconf); if ($_REQUEST['tit'] == '') { $tit = $gtbl->getTblCHN(); } # get detail path $module_path = ''; $levelcode = ''; $codelist = ''; $hm = $gtbl->execBy("select levelcode, linkname, modulename from " . $_CONFIG['tblpre'] . "info_menulist where modulename='" . str_replace($_CONFIG['tblpre'], "", $tbl) . "'", null); if ($hm[0]) { $levelcode = $hm[1][0]['levelcode']; $codelist = substr($levelcode, 0, 2) . "','" . substr($levelcode, 0, 4) . "','" . substr($levelcode, 0, 6) . "','" . substr($levelcode, 0, 8); # max 4 levels allowed $hm = $gtbl->execBy("select levelcode, linkname, modulename from " . $_CONFIG['tblpre'] . "info_menulist where levelcode in ('" . $codelist . "') order by levelcode", null); if ($hm[0]) { $hm = $hm[1]; $lastLinkName = ''; #print_r($hm);
$hmconf = GTbl::xml2hash($xmlpathpre, $elementsep, $db, $tbl); $gtbl = new GTbl($tbl, $hmconf[0], $elementsep); $out = ""; # no more output is needed, Mon Jul 2 17:57:35 CST 2012 $sql = "show tables"; $hm = $gtbl->execBy($sql, null); if ($hm[0]) { $hm = $hm[1]; #print_r($hm); foreach ($hm as $k => $v) { $tbl = $v['Tables_in_' . strtolower($db)]; #print "$k => ".$tbl."\n"; if ($tbl != "") { $tmpconf = GTbl::xml2hash($xmlpathpre, $elementsep, $db, $tbl); $tmpgtbl = new GTbl($tbl, $tmpconf[0], $elementsep); $tblchn = $tmpgtbl->getTblCHN(); #print "tbl:$tbl, chnname:".$tblchn; if ($tblchn == '') { $tblchn = $tbl; } $tmphm = $tmpgtbl->execBy("select id from {$objecttbl} where tblname='" . $tbl . "'", null); #print_r($tmphm); $objectid = $tmphm[1][0]['id']; if ($objectid > 0) { $sql = "update {$objecttbl} set objname='" . $tblchn . "',operator='sysop',updatetime=NOW() where tblname='" . $tbl . "'"; } else { $sql = "insert into {$objecttbl} set objname='" . $tblchn . "', tblname='" . $tbl . "',operator='sysop',updatetime=NOW()"; } #print "sql:$sql\n"; $tmpgtbl->execBy($sql, null); $out .= "<br/>" . $sql;