summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorEudyptula <eitan@mosenkis.net>2009-06-18 11:35:53 -0400
committerEudyptula <eitan@mosenkis.net>2009-06-18 11:35:53 -0400
commitfe4cc29b274573e93a369522ace49494345f9df7 (patch)
tree416151579f82ebd3f7387bf0f442578bdcc16759
parentUpdates to sql_row_obj, index.php (diff)
downloadingenue-fe4cc29b274573e93a369522ace49494345f9df7.tar.gz
ingenue-fe4cc29b274573e93a369522ace49494345f9df7.tar.bz2
ingenue-fe4cc29b274573e93a369522ace49494345f9df7.zip
Created class from SQL table frontend, generated sql_builds class
-rw-r--r--frontend/pages/newclass.php17
-rw-r--r--shared/classes/build.php39
2 files changed, 56 insertions, 0 deletions
diff --git a/frontend/pages/newclass.php b/frontend/pages/newclass.php
new file mode 100644
index 0000000..44d1bf7
--- /dev/null
+++ b/frontend/pages/newclass.php
@@ -0,0 +1,17 @@
+<?php
+function init_newclass() {
+ return array('title' => 'New class');
+}
+function body_newclass() {
+ global $request;
+ if (isset($request['class']) && isset($request['table'])) {
+ $class=$request['class'];
+ $table=$request['table'];
+ eval("class $class extends sql_row_obj {\nvar \$table='$table';\n}\n");
+ $o=new $class();
+ echo '<pre>'.highlight_string('<?php'."\n".$o->to_php().'?>', true),'</pre>';
+ } else {
+ echo '<form action="'.url('newclass').'">Class name: <input name="class" /><br/>Table name: <input name="table" /><br/><input type="submit" value="Submit" /></form>';
+ }
+}
+?>
diff --git a/shared/classes/build.php b/shared/classes/build.php
new file mode 100644
index 0000000..f2fb443
--- /dev/null
+++ b/shared/classes/build.php
@@ -0,0 +1,39 @@
+<?php
+class sql_build extends sql_row_obj {
+ protected $table='builds', $columns=array(
+ 'id' => array (
+ 'type' => 'CHAR',
+ 'length' => 6,
+ 'not_null' => true
+ ),
+ 'owner' => array (
+ 'type' => 'INT',
+ 'length' => 10,
+ 'unsigned' => true,
+ 'not_null' => true
+ ),
+ 'name' => array (
+ 'type' => 'VARCHAR',
+ 'length' => 255
+ ),
+ 'status' => array (
+ 'type' => 'VARCHAR',
+ 'length' => 255,
+ 'not_null' => true
+ ),
+ 'start' => array (
+ 'type' => 'INT',
+ 'length' => 10,
+ 'unsigned' => true,
+ 'not_null' => true
+ ),
+ 'finish' => array (
+ 'type' => 'INT',
+ 'length' => 10,
+ 'unsigned' => true,
+ 'not_null' => true
+ )
+
+ );
+}
+?>