public function __construct ($class, $id = false) { metaclass::loadClass($class); $classVars = metaclass::getClassVars($class); $this->definitions = $classVars['propertyDefinitions']; $this->table = $classVars['table']; $this->type = $class; $this->title = $classVars['title']; $this->keyField = $classVars['keyField']; if (strlen(id) > 0) { $this->populate($id); $this->id = $id; $this->action = 'updating'; } else { $this->action = 'creating'; } $this->urlbase = explode('?', $_SERVER['REQUEST_URI']); $this->urlbase = $this->urlbase[0]; }
/** * Perform the standard operations to load a metaclass. Basically re-inventing autoloading for the specific purpose. * * @param string $class Name of the class. * @param string $rel Extra path to the class, used for datatypes primarily. * @return object An instance of the required class, ready for use. */ public static function create ($class, $rel = null) { $classString = ($rel ? $rel . '/' : null) . $class; metaclass::loadClass($class, $rel); return new $class(); }