OSDN Git Service

- added [-e|encoding] option to "ethna add-project" command.
[ethna/ethna.git] / skel / app.controller.php
1 <?php
2 /**
3  *  {$project_id}_Controller.php
4  *
5  *  @author     {$author}
6  *  @package    {$project_id}
7  *  @version    $Id$
8  */
9
10 /** Application base directory */
11 define('BASE', dirname(dirname(__FILE__)));
12
13 /** include_path setting (adding "/app" and "/lib" directory to include_path) */
14 $app = BASE . "/app";
15 $lib = BASE . "/lib";
16 ini_set('include_path', implode(PATH_SEPARATOR, array($app, $lib)) . PATH_SEPARATOR . ini_get('include_path'));
17
18
19 /** including application library. */
20 require_once 'Ethna/Ethna.php';
21 require_once '{$project_id}_Error.php';
22 require_once '{$project_id}_ActionClass.php';
23 require_once '{$project_id}_ActionForm.php';
24 require_once '{$project_id}_ViewClass.php';
25
26 /**
27  *  {$project_id} application Controller definition.
28  *
29  *  @author     {$author}
30  *  @access     public
31  *  @package    {$project_id}
32  */
33 class {$project_id}_Controller extends Ethna_Controller
34 {
35     /**#@+
36      *  @access private
37      */
38
39     /**
40      *  @var    string  Application ID(appid)
41      */
42     var $appid = '{$application_id}';
43
44     /**
45      *  @var    array   forward definition.
46      */
47     var $forward = array(
48         /*
49          *  TODO: write forward definition here.
50          *
51          *  Example:
52          *
53          *  'index'         => array(
54          *      'view_name' => '{$project_id}_View_Index',
55          *  ),
56          */
57     );
58
59     /**
60      *  @var    array   action definition.
61      */
62     var $action = array(
63         /*
64          *  TODO: write action definition here.
65          *
66          *  Example:
67          *
68          *  'index'     => array(),
69          */
70     );
71
72     /**
73      *  @var    array   SOAP action definition.
74      */
75     var $soap_action = array(
76         /*
77          *  TODO: write action definition for SOAP application here.
78          *  Example:
79          *
80          *  'sample'            => array(),
81          */
82     );
83
84     /**
85      *  @var    array       application directory.
86      */
87     var $directory = array(
88         'action'        => 'app/action',
89         'action_cli'    => 'app/action_cli',
90         'action_xmlrpc' => 'app/action_xmlrpc',
91         'app'           => 'app',
92         'plugin'        => 'app/plugin',
93         'bin'           => 'bin',
94         'etc'           => 'etc',
95         'filter'        => 'app/filter',
96         'locale'        => 'locale',
97         'log'           => 'log',
98         'plugins'       => array(),
99         'template'      => 'template',
100         'template_c'    => 'tmp',
101         'tmp'           => 'tmp',
102         'view'          => 'app/view',
103         'www'           => 'www',
104         'test'          => 'app/test',
105     );
106
107     /**
108      *  @var    array       database access definition.
109      */
110     var $db = array(
111         ''              => DB_TYPE_RW,
112     );
113
114     /**
115      *  @var    array       extention(.php, etc) configuration.
116      */
117     var $ext = array(
118         'php'           => 'php',
119         'tpl'           => 'tpl',
120     );
121
122     /**
123      *  @var    array   class definition.
124      */
125     var $class = array(
126         /*
127          *  TODO: When you override Configuration class, Logger class,
128          *        SQL class, don't forget to change definition as follows!
129          */
130         'class'         => 'Ethna_ClassFactory',
131         'backend'       => 'Ethna_Backend',
132         'config'        => 'Ethna_Config',
133         'db'            => 'Ethna_DB_PEAR',
134         'error'         => 'Ethna_ActionError',
135         'form'          => '{$project_id}_ActionForm',
136         'i18n'          => 'Ethna_I18N',
137         'logger'        => 'Ethna_Logger',
138         'plugin'        => 'Ethna_Plugin',
139         'session'       => 'Ethna_Session',
140         'sql'           => 'Ethna_AppSQL',
141         'view'          => '{$project_id}_ViewClass',
142         'renderer'      => 'Ethna_Renderer_Smarty',
143         'url_handler'   => '{$project_id}_UrlHandler',
144     );
145
146     /**
147      *  @var    array       list of application id where Ethna searches plugin.
148      */
149     var $plugin_search_appids = array(
150         /*
151          *  write list of application id where Ethna searches plugin.
152          *
153          *  Example:
154          *  When there are plugins whose name are like "Common_Plugin_Foo_Bar" in
155          *  application plugin directory, Ethna searches them in the following order.
156          *
157          *  1. Common_Plugin_Foo_Bar,
158          *  2. {$project_id}_Plugin_Foo_Bar
159          *  3. Ethna_Plugin_Foo_Bar
160          *
161          *  'Common', '{$project_id}', 'Ethna',
162          */
163         '{$project_id}', 'Ethna',
164     );
165
166     /**
167      *  @var    array       filter definition.
168      */
169     var $filter = array(
170         /*
171          *  TODO: when you use filter, write filter plugin name here.
172          *  (If you specify class name, Ethna reads filter class in 
173          *   filter directory)
174          *
175          *  Example:
176          *
177          *  'ExecutionTime',
178          */
179     );
180
181     /**
182      *  @var    array   smarty modifier definition.
183      */
184     var $smarty_modifier_plugin = array(
185         /*
186          *  TODO: write user defined smarty modifier here.
187          *
188          *  Example:
189          *
190          *  'smarty_modifier_foo_bar',
191          */
192     );
193
194     /**
195      *  @var    array   smarty function definition.
196      */
197     var $smarty_function_plugin = array(
198         /*
199          *  TODO: write user defined smarty function here.
200          *
201          *  Example:
202          *
203          *  'smarty_function_foo_bar',
204          */
205     );
206
207     /**
208      *  @var    array   smarty block definition.
209      */
210     var $smarty_block_plugin = array(
211         /*
212          *  TODO: write user defined smarty block here.
213          *
214          *  Example:
215          * 
216          *  'smarty_block_foo_bar',
217          */
218     );
219
220     /**
221      *  @var    array   smarty prefilter definition.
222      */
223     var $smarty_prefilter_plugin = array(
224         /*
225          *  TODO: write user defined smarty prefilter here.
226          *
227          *  Example:
228          *
229          *  'smarty_prefilter_foo_bar',
230          */
231     );
232
233     /**
234      *  @var    array   smarty postfilter definition.
235      */
236     var $smarty_postfilter_plugin = array(
237         /*
238          *  TODO: write user defined smarty postfilter here.
239          *
240          *  Example:
241          *
242          *  'smarty_postfilter_foo_bar',
243          */
244     );
245
246     /**
247      *  @var    array   smarty outputfilter definition.
248      */
249     var $smarty_outputfilter_plugin = array(
250         /*
251          *  TODO: write user defined smarty outputfilter here.
252          *
253          *  Example:
254          *
255          *  'smarty_outputfilter_foo_bar',
256          */
257     );
258
259     /**#@-*/
260
261     /**
262      *  Get Default language and locale setting.
263      *  If you want to change Ethna's output encoding, override this method.
264      *
265      *  @access protected
266      *  @return array   locale name(e.x ja_JP, en_US .etc),
267      *                  system encoding name,
268      *                  client encoding name(= template encoding)
269      *                  (locale name is "ll_cc" format. ll = language code. cc = country code.)
270      */
271     function _getDefaultLanguage()
272     {
273         return array('{$locale}', 'UTF-8', '{$client_enc}');
274     }
275 }
276
277 ?>