_table(); if (! $table) return 'No Table'; elseif (! $id AND empty($table[$id])) return ''; elseif (empty($table[$id])) return sprintf('No Value (%s)',$id); else return $table[$id]; } /** * Setup our class instantiation * @note This must be declared in the child class due to static scope */ public static function factory() { $x = get_called_class(); return new $x; } /** * Renders form input * * @param string Form name to render * @param string Default value to populate in the Form input. */ public static function form($name,$default='',$addblank=FALSE,array $attributes=NULL) { $table = self::factory()->_table(); if ($addblank) $table = array_merge(array(''=>' '),$table); return Form::Select($name,$table,$default,$attributes); } /** * Lists our available keys */ public static function keys() { return array_keys(self::factory()->_table()); } public static function table() { return self::factory()->_table(); } } ?>