summaryrefslogtreecommitdiff
blob: f56fa9cf9a79e48feb50404aaca5527406f9a37d (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
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>'.str_replace(str_repeat('&nbsp;', 4), "\t", 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>';
	}
}
?>