controller($attributes, $actions = array (), $scaffold = false)
11: public function controller($attributes, $actions = array (), $scaffold = false) {
13: $attributes = ltrim($attributes, '/');
14: $localization = explode('/', $attributes);
15:
17: $controller_name = inflector :: singularize(end($localization));
18: $controller_name = $controller_name . '_controller';
19:
21: array_pop($localization);
22:
24: self :: $directory = 'controllers';
25:
27: self :: create_localization_path($localization);
28:
30: $path = self :: $directory . $controller_name . '.php';
31:
33: $controller_name = inflector :: camelize($controller_name);
34:
36: ob_start();
37: include DIR_GENERATE . "/templates/controller";
38: $template = ob_get_contents();
39: ob_end_clean();
40:
42: self :: save_file("", $path);
43: }
File: lib/generate/generate.php, #line 11
create_localization_path($localization)
45: public function create_localization_path($localization) {
46: array_unshift($localization, self :: $directory);
47: self :: $directory = APP_ROOT . '/app/';
48:
50: foreach ($localization as $folder) {
51: self :: $directory .= $folder . '/';
52:
53: if (!is_dir(self :: $directory)) {
54: if (mkdir(self :: $directory)) {
55: echo "t create " . self :: short_path(self :: $directory) . "n";
56: }
57: } else {
58: echo "t exists " . self :: short_path(self :: $directory) . " n";
59: }
60: }
61:
62: }
File: lib/generate/generate.php, #line 45
helper($attributes)
69: public function helper($attributes) {
70: $attributes = ltrim($attributes, '/');
71: $localization = explode('/', $attributes);
72:
74: $helper_name = inflector :: singularize(end($localization));
75: $helper_name = $helper_name . '_helper';
76:
78: array_pop($localization);
79:
81: self :: $directory = 'helpers';
82:
84: self :: create_localization_path($localization);
85:
87: $path = self :: $directory . $helper_name . '.php';
88:
90: $helper_name = inflector :: camelize($helper_name);
91:
93: ob_start();
94: include DIR_GENERATE . "/templates/helper";
95: $template = ob_get_contents();
96: ob_end_clean();
97:
99: self :: save_file("", $path);
100: }
File: lib/generate/generate.php, #line 69
view($attributes, $methods, $scaffold = array ())
107: public function view($attributes, $methods, $scaffold = array ()) {
109: $attributes = ltrim($attributes, '/');
110: $localization = explode('/', $attributes);
111:
113: $view_name = inflector :: singularize(end($localization));
114:
116: array_pop($localization);
117:
119: $localization[] = $view_name;
120:
122: $directory = DIR_APP_VIEWS . '/';
123:
125: self :: $directory = 'views';
126:
128: self :: create_localization_path($localization);
129:
131: $path = self::$directory;
132:
134: foreach ($methods as $method) {
136: $method_path_file = $path . $method . '.phtml';
137:
139: ob_start();
140: include DIR_GENERATE . "/templates/view";
141: $template = ob_get_contents();
142: ob_end_clean();
143:
145: self :: save_file($template, $method_path_file);
146: }
147: }
File: lib/generate/generate.php, #line 107
model($attribute)
154: public function model($attribute) {
156: $args = split('/', $attribute);
157: $model = inflector :: singularize(end($args));
158:
160: $model_name = inflector :: camelize($model);
161:
163: $path = DIR_APP_MODELS . '/' . $model . '.php';
164:
166: ob_start();
167: include DIR_GENERATE . "/templates/model";
168: $template = ob_get_contents();
169: ob_end_clean();
170:
172: self :: save_file("", $path);
173: }
File: lib/generate/generate.php, #line 154
migration($attributes)
180: public function migration($attributes) {
181: foreach ($attributes as $name) {
182: $attribute = !$attribute ? $attribute = $name : $attribute .= '_' . $name;
183: }
184:
186: $migration_files = Migrator :: get_migration_files();
188: $current = 0;
189:
192: foreach ($migration_files as $file) {
194: $version = substr($file, 0, 3) / 1;
195:
197: if (strtolower(substr($file, 4)) == strtolower($attribute . '.php')) {
198: echo "t exists db/migrate/{$file} n";
199: exit;
200: }
202: if ($version > $current) {
203: $current = $version;
204: }
205: }
206:
208: $current = Migrator :: version_to_str($current +1);
209:
211: $migration_name = strtolower($current . '_' . $attribute);
212:
214: $path = DIR_MIGRATE . '/' . $migration_name . '.php';
215:
217: $migration_name = inflector :: camelize($attribute);
218:
220: ob_start();
221: include DIR_GENERATE . "/templates/migration";
222: $template = ob_get_contents();
223: ob_end_clean();
224:
226: self :: save_file("", $path);
227:
228: }
File: lib/generate/generate.php, #line 180
testing($attributes)
233: public function testing($attributes) {
234:
235: }
File: lib/generate/generate.php, #line 233
scaffold($attributes)
241: public function scaffold($attributes) {
242:
243: }
File: lib/generate/generate.php, #line 241
