pictcode / app / Controller / TopController.php @ 33ddd711
履歴 | 表示 | アノテート | ダウンロード (2.653 KB)
1 |
<?php
|
---|---|
2 |
/**
|
3 |
* Static content controller.
|
4 |
*
|
5 |
* This file will render views from views/pages/
|
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 app.Controller
|
17 |
* @since CakePHP(tm) v 0.2.9
|
18 |
* @license http://www.opensource.org/licenses/mit-license.php MIT License
|
19 |
*/
|
20 |
|
21 |
App::uses('AppController', 'Controller'); |
22 |
App::uses('CakeEmail', 'Network/Email'); |
23 |
|
24 |
/**
|
25 |
* Static content controller
|
26 |
*
|
27 |
* Override this controller by placing a copy in controllers directory of an application
|
28 |
*
|
29 |
* @package app.Controller
|
30 |
* @link http://book.cakephp.org/2.0/en/controllers/pages-controller.html
|
31 |
*/
|
32 |
class TopController extends AppController { |
33 |
|
34 |
/**
|
35 |
* This controller does not use a model
|
36 |
*
|
37 |
* @var array
|
38 |
*/
|
39 |
var $name = 'top'; |
40 |
public $uses = array('ContactValidate'); |
41 |
public $layout = 'top'; |
42 |
|
43 |
/**
|
44 |
* index
|
45 |
*/
|
46 |
public function index() { |
47 |
} |
48 |
/**
|
49 |
* privacy_policy
|
50 |
*/
|
51 |
public function privacy_policy() { |
52 |
} |
53 |
/**
|
54 |
* kiyaku
|
55 |
*/
|
56 |
public function kiyaku() { |
57 |
} |
58 |
/**
|
59 |
* about
|
60 |
*/
|
61 |
public function about() { |
62 |
} |
63 |
/**
|
64 |
* company
|
65 |
*/
|
66 |
public function company() { |
67 |
} |
68 |
/**
|
69 |
* contact
|
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();
|
108 |
} |
109 |
} |