リビジョン 33ddd711 app/Controller/TopController.php
app/Controller/TopController.php | ||
---|---|---|
19 | 19 |
*/ |
20 | 20 |
|
21 | 21 |
App::uses('AppController', 'Controller'); |
22 |
App::uses('CakeEmail', 'Network/Email'); |
|
22 | 23 |
|
23 | 24 |
/** |
24 | 25 |
* Static content controller |
... | ... | |
36 | 37 |
* @var array |
37 | 38 |
*/ |
38 | 39 |
var $name = 'top'; |
39 |
public $uses = array(); |
|
40 |
public $uses = array('ContactValidate');
|
|
40 | 41 |
public $layout = 'top'; |
41 | 42 |
|
42 | 43 |
/** |
... | ... | |
68 | 69 |
* contact |
69 | 70 |
*/ |
70 | 71 |
public function contact() { |
72 |
if($this->request->is('post') || $this->request->is('put')){ |
|
73 |
$this->ContactValidate->set($this->request->data); |
|
74 |
if($this->ContactValidate->validates()){ |
|
75 |
$this->Session->write('contact',$this->request->data); |
|
76 |
$this->redirect(array('action'=>'contact_confirm')); |
|
77 |
}else{ |
|
78 |
} |
|
79 |
} |
|
80 |
} |
|
81 |
/** |
|
82 |
* contact_confirm |
|
83 |
*/ |
|
84 |
public function contact_confirm() { |
|
85 |
if($this->Session->read('contact')){ |
|
86 |
$this->set('contact',$this->Session->read('contact')); |
|
87 |
}else{ |
|
88 |
$this->redirect(array('action'=>'contact')); |
|
89 |
} |
|
90 |
} |
|
91 |
/** |
|
92 |
* contact_complete |
|
93 |
*/ |
|
94 |
public function contact_complete() { |
|
95 |
$this->set('contact',$this->Session->read('contact')); |
|
96 |
$name = $this->Session->read('contact.ContactValidate.name'); |
|
97 |
$mail = $this->Session->read('contact.ContactValidate.mail'); |
|
98 |
$comment = $this->Session->read('contact.ContactValidate.comment'); |
|
99 |
$Email = new CakeEmail(); |
|
100 |
$Email->charset('ISO-2022-JP'); |
|
101 |
$Email->emailFormat('text'); |
|
102 |
$Email->template('user_contact'); |
|
103 |
$Email->viewVars(array('name'=>$name,'comment'=>$comment)); |
|
104 |
$Email->from($mail); |
|
105 |
$Email->to('yano@i-hearts.jp'); |
|
106 |
$Email->subject('[PICT CODE]問い合わせ'); |
|
107 |
$Email->send(); |
|
71 | 108 |
} |
72 | 109 |
} |
他の形式にエクスポート: Unified diff