エントリーフォーム ENTRY FORM

必須応募職種
必須お名前
必須フリガナ
必須お電話番号(携帯可)
必須メールアドレス
必須性別
必須年齢
任意居住地
任意その他

Debug Information (Developer Only) by Application::shutdownHandler()

Error File: /usr/home/mw2puddjr1/www/htdocs/recruit/code/application/Entry.php
Error Line: 77
Error Message: Creation of dynamic property Entry::$_lh is deprecated
1: <?php // code/application/Entry.php
2:
3: /**
4: * お問い合わせフォームサンプルクラス
5: * Contact form sample class
6: *
7: * _validatePostedData()
8: * 入力検証
9: * Validate input data
10: *
11: * index()
12: * 入力画面
13: * Input window
14: *
15: * confirm()
16: * 確認画面
17: * Confirm window
18: *
19: * error()
20: * エラー画面
21: * Error window
22: *
23: * post()
24: * メール送信
25: * 送信完了はresult.htmlにリダイレクト
26: * Send Email
27: * After that, redirect to result.html
28: *
29: * result()
30: * 送信完了画面
31: * Result window
32: */
33:
34: class Entry extends MyApplication
35: {
36: private $_common;
37: private $_config = array();
38:
39: /**
40: * コンストラクタ
41: * Constructor
42: */
43: public function __construct()
44: {
45: parent::__construct();
46:
47: $this->page['contact_common'] =
48: require(FEGG_CODE_DIR.'/config/entry/common.php');
49: $this->contact_config =
50: require(FEGG_CODE_DIR.'/config/entry/contact_config.php');
51: }
52:
53:
54: /**
55: * イニシャライズ
56: * Initialize progress
57: *
58: * 省略可。定義されているときは __construct() の後で呼び出される。
59: * __construct() との違いは自身のインスタンスが生成されているので
60: * $thisにより、Applicationクラスのメソッドが使用できる。
61: *
62: * This method run after making self instance.
63: * So, it can use Application class method, for example "$this->in()".
64: * It is the difference between __init and construct.
65: * If this method is nothing, initializing progress is omitted.
66: */
67: public function __init()
68: {
69: parent::__init();
70:
71: $this->loadConfig('site_info');
72: foreach($this->config['site_info'] as $key => $val) {
73: $this->setSiteInfo($key, $val);
74: }
75:
76: // LH用汎用クラスを読込
77: $this->_lh = $this->getClass('LH_FW');
78: }
79:
80:
81: /**
82: * エラーチェック
83: * Validate input data
84: *
85: * @return mixed $errorMessage
86: */
87: private function _validatePostedData()
88: {
89: $validation = $this->getClass('Validation');
90:
91: $name = '応募職種';
92: $id = 'applicants';
93: $validation->required($id, $this->in($id), array('@required', $name));
94:
95: $id = 'name';
96: $name = 'お名前';
97: $validation->required($id, $this->in($id), array('@required', $name));
98:
99: $id = 'phonetic';
100: $name = 'フリガナ';
101: $validation->required($id, $this->in($id), array('@required', $name));
102:
103: $id = 'phone';
104: $name = 'お電話番号(携帯可)';
105: $validation->required($id, $this->in($id), array('@required', $name));
106:
107: $name = 'メールアドレス';
108: $id = 'email';
109: $validation->required($id, $this->in($id), array('@required', $name));
110: $validation->email( $id, $this->in($id), array('@email', $name));
111:
112: $id = 'gender';
113: $name = '性別';
114: $validation->required($id, $this->in($id), array('@required', $name));
115:
116: $id = 'age';
117: $name = '年齢';
118: $validation->required($id, $this->in($id), array('@required', $name));
119:
120: // 正当性確認
121: // Return validate result
122: return $validation->getErrorMessage();
123: }
124:
125:
126: /**
127: * 入力画面
128: * Input window
129: */
130: public function index()
131: {
132: if($this->getSession($this->contact_config['session_key_form'])) {
133: $this->page['data'] = $this->getSession($this->contact_config['session_key_form']);
134: $this->unsetSession($this->contact_config['session_key_form']);
135: } else {
136: $this->page['data'] = array(
137: 'applicants' => $this->in('name', 'get')
138: );
139: }
140:
141: $this->displayPage($this->contact_config['template'].'/input');
142: }
143:
144:
145: /**
146: * 確認画面
147: * Confirm window
148: */
149: public function confirm()
150: {
151: $this->page['data'] = $this->in();
152: $this->setSession($this->contact_config['session_key_form'], $this->page['data']);
153:
154: // エラーチェック
155: // Check validation
156: $errorMessage = $this->_validatePostedData();
157:
158: if(! $errorMessage) {
159: $this->setTicket($this->contact_config['session_key_ticket']);
160:
161: $this->displayPage($this->contact_config['template'].'/confirm');
162: } else {
163: // エラーメッセージ設定
164: // Setting Error message
165: $this->setSession($this->contact_config['session_key_error'], $errorMessage);
166: $this->redirect($this->contact_config['error_url']);
167: }
168:
169: }
170:
171:
172: /**
173: * エラー画面
174: * Error window
175: */
176: public function error()
177: {
178:
179: if(! $this->getSession($this->contact_config['session_key_form'])) {
180: $this->redirect($this->contact_config['input_url']);
181: }
182:
183: $this->page['data'] = $this->getSession($this->contact_config['session_key_form']);
184: $this->unsetSession($this->contact_config['session_key_form']);
185: $this->page['error'] = $this->getSession($this->contact_config['session_key_error']);
186: $this->unsetSession($this->contact_config['session_key_error']);
187:
188: $this->displayPage($this->contact_config['template'].'/input');
189: }
190:
191:
192: /**
193: * メール送信
194: * Send Email
195: */
196: public function post()
197: {
198: if(
199: ! $this->useTicket($this->contact_config['session_key_ticket']) ||
200: ! $this->getSession($this->contact_config['session_key_form'])
201: ) {
202: $this->setSession($this->contact_config['session_key_error'], array('不明のエラー'));
203: $this->redirect($this->contact_config['error_url']);
204: }
205:
206: // 入力データをセッションから取得
207: // Get input data from Session
208: $this->page['data'] = $this->getSession($this->contact_config['session_key_form']);
209:
210: // 返信先設定
211: // Setting reply to
212: $cli_address = array();
213: foreach(explode(',', $this->page['data'][$this->contact_config['client_mail']]) as $address) {
214: $cli_address[] = $address;
215: }
216: $cli_name = array();
217: foreach(explode(',', $this->page['data'][$this->contact_config['client_name']]) as $name) {
218: $cli_name[] = $name;
219: }
220: $cli_name = implode(' ', $cli_name);
221:
222: // メールクラス
223: // Get Mail class
224: $this->getClass('Tool/Mail');
225:
226: /**
227: * 自動返信メール
228: * For client mail
229: */
230: $cli_subject = $this->contact_config['to_client_subject'];
231: $cli_body = $this->fetchPage('/'.$this->contact_config['template'].'/mail/to_client');
232: $cli_mail = new Mail($cli_subject, $cli_body);
233: $cli_mail->setDebugFlag(
234: $this->contact_config['send_debug'],
235: FEGG_CODE_DIR.'/data/log/'.$this->contact_config['template'].'_client.log'
236: );
237:
238: /**
239: * 管理者向けメール
240: * For Administrator mail
241: */
242: $adm_subject = $this->contact_config['to_admin_subject'];
243: $adm_body = $this->fetchPage('/'.$this->contact_config['template'].'/mail/to_admin');
244: $adm_mail = new Mail($adm_subject, $adm_body);
245: $adm_mail->setDebugFlag(
246: $this->contact_config['send_debug'],
247: FEGG_CODE_DIR.'/data/log/'.$this->contact_config['template'].'_admin.log'
248: );
249:
250: $_FLAG = true;
251: foreach($cli_address as $address) {
252: $_FLAG =
253: $_FLAG &&
254: $cli_mail->send(
255: $address,
256: $this->contact_config['admin_name'],
257: $this->contact_config['admin_from']
258: );
259: }
260:
261: if(
262: $_FLAG &&
263: $adm_mail->send(
264: $this->contact_config['admin_mail'],
265: $this->contact_config['admin_name'],
266: $this->contact_config['admin_from']
267: )
268: ) {
269: // 送信成功
270: // Succeed
271: $this->unsetSession($this->contact_config['session_key_form']);
272: // result.htmlにリダイレクト
273: // Redirect to result.html
274: $this->redirect($this->contact_config['result_url']);
275: } else {
276: // 送信失敗
277: // Failed
278: $this->setSession(
279: $this->contact_config['session_key_error'],
280: array('メールの送信に失敗しました')
281: );
282: $this->redirect($this->contact_config['error_url']);
283: }
284:
285: }
286:
287: /**
288: * 送信完了画面
289: * Result window
290: */
291: public function result()
292: {
293: $this->displayPage($this->contact_config['template'].'/result');
294: }
295:
296: }
297: /* End Of File: code/application/Entry.php */
298: