pictcode / lib / Cake / Console / Templates / default / classes / controller.ctp @ 635eef61
履歴 | 表示 | アノテート | ダウンロード (2.156 KB)
1 | 635eef61 | spyder1211 | <?php |
---|---|---|---|
2 | /** |
||
3 | * Controller bake template file |
||
4 | * |
||
5 | * Allows templating of Controllers generated from bake. |
||
6 | * |
||
7 | * CakePHP(tm) : Rapid Development Framework (http://cakephp.org) |
||
8 | * Copyright (c) Cake Software Foundation, Inc. (http://cakefoundation.org) |
||
9 | * |
||
10 | * Licensed under The MIT License |
||
11 | * For full copyright and license information, please see the LICENSE.txt |
||
12 | * Redistributions of files must retain the above copyright notice. |
||
13 | * |
||
14 | * @copyright Copyright (c) Cake Software Foundation, Inc. (http://cakefoundation.org) |
||
15 | * @link http://cakephp.org CakePHP(tm) Project |
||
16 | * @package Cake.Console.Templates.default.classes |
||
17 | * @since CakePHP(tm) v 1.3 |
||
18 | * @license http://www.opensource.org/licenses/mit-license.php MIT License |
||
19 | */ |
||
20 | |||
21 | echo "<?php\n"; |
||
22 | echo "App::uses('{$plugin}AppController', '{$pluginPath}Controller');\n"; |
||
23 | ?> |
||
24 | /** |
||
25 | * <?php echo $controllerName; ?> Controller |
||
26 | <?php |
||
27 | if (!$isScaffold) { |
||
28 | $defaultModel = Inflector::singularize($controllerName); |
||
29 | echo " *\n"; |
||
30 | echo " * @property {$defaultModel} \${$defaultModel}\n"; |
||
31 | if (!empty($components)) { |
||
32 | foreach ($components as $component) { |
||
33 | echo " * @property {$component}Component \${$component}\n"; |
||
34 | } |
||
35 | } |
||
36 | } |
||
37 | ?> |
||
38 | */ |
||
39 | class <?php echo $controllerName; ?>Controller extends <?php echo $plugin; ?>AppController { |
||
40 | |||
41 | <?php if ($isScaffold): ?> |
||
42 | /** |
||
43 | * Scaffold |
||
44 | * |
||
45 | * @var mixed |
||
46 | */ |
||
47 | public $scaffold; |
||
48 | |||
49 | <?php else: |
||
50 | |||
51 | if (count($helpers)): |
||
52 | echo "/**\n * Helpers\n *\n * @var array\n */\n"; |
||
53 | echo "\tpublic \$helpers = array("; |
||
54 | for ($i = 0, $len = count($helpers); $i < $len; $i++): |
||
55 | if ($i != $len - 1): |
||
56 | echo "'" . Inflector::camelize($helpers[$i]) . "', "; |
||
57 | else: |
||
58 | echo "'" . Inflector::camelize($helpers[$i]) . "'"; |
||
59 | endif; |
||
60 | endfor; |
||
61 | echo ");\n\n"; |
||
62 | endif; |
||
63 | |||
64 | if (count($components)): |
||
65 | echo "/**\n * Components\n *\n * @var array\n */\n"; |
||
66 | echo "\tpublic \$components = array("; |
||
67 | for ($i = 0, $len = count($components); $i < $len; $i++): |
||
68 | if ($i != $len - 1): |
||
69 | echo "'" . Inflector::camelize($components[$i]) . "', "; |
||
70 | else: |
||
71 | echo "'" . Inflector::camelize($components[$i]) . "'"; |
||
72 | endif; |
||
73 | endfor; |
||
74 | echo ");\n\n"; |
||
75 | endif; |
||
76 | |||
77 | if (!empty($actions)) { |
||
78 | echo trim($actions) . "\n"; |
||
79 | } |
||
80 | |||
81 | endif; ?> |
||
82 | } |