*/ include '../configuration.inc'; $zend_db = Database::getConnection(); foreach ($zend_db->listTables() as $tableName) { $fields = array(); $primary_keys = array(); foreach ($zend_db->describeTable($tableName) as $row) { $type = preg_replace("/[^a-z]/","",strtolower($row['DATA_TYPE'])); // Translate database datatypes into PHP datatypes if (preg_match('/int/',$type)) { $type = 'int'; } if (preg_match('/enum/',$type) || preg_match('/varchar/',$type)) { $type = 'string'; } $fields[] = array('field'=>$row['COLUMN_NAME'],'type'=>$type); if ($row['PRIMARY']) { $primary_keys[] = $row['COLUMN_NAME']; } } // Only generate code for tables that have a single-column primary key // Code for other tables will need to be created by hand if (count($primary_keys) != 1) { continue; } $key = $primary_keys[0]; $tableName = strtolower($tableName); $className = Inflector::classify($tableName); $variableName = Inflector::singularize($tableName); $acl_resource = ucfirst($tableName); /** * Generate the list block */ $getId = "get".ucwords($key); $HTML = "