pictcode / app / Controller / TopController.php @ 995bd018
履歴 | 表示 | アノテート | ダウンロード (2.705 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 | 
      function beforeFilter(){  | 
  
| 44 | 
      $this->Auth->allow();  | 
  
| 45 | 
      }  | 
  
| 46 | 
      /**
     | 
  
| 47 | 
       * index
     | 
  
| 48 | 
       */
     | 
  
| 49 | 
      public function index() {  | 
  
| 50 | 
      }  | 
  
| 51 | 
      /**
     | 
  
| 52 | 
       * privacy_policy
     | 
  
| 53 | 
       */
     | 
  
| 54 | 
      public function privacy_policy() {  | 
  
| 55 | 
      }  | 
  
| 56 | 
      /**
     | 
  
| 57 | 
       * kiyaku
     | 
  
| 58 | 
       */
     | 
  
| 59 | 
      public function kiyaku() {  | 
  
| 60 | 
      }  | 
  
| 61 | 
      /**
     | 
  
| 62 | 
       * about
     | 
  
| 63 | 
       */
     | 
  
| 64 | 
      public function about() {  | 
  
| 65 | 
      }  | 
  
| 66 | 
      /**
     | 
  
| 67 | 
       * company
     | 
  
| 68 | 
       */
     | 
  
| 69 | 
      public function company() {  | 
  
| 70 | 
      }  | 
  
| 71 | 
      /**
     | 
  
| 72 | 
       * contact
     | 
  
| 73 | 
       */
     | 
  
| 74 | 
      public function contact() {  | 
  
| 75 | 
      if($this->request->is('post') || $this->request->is('put')){  | 
  
| 76 | 
      $this->ContactValidate->set($this->request->data);  | 
  
| 77 | 
      if($this->ContactValidate->validates()){  | 
  
| 78 | 
      $this->Session->write('contact',$this->request->data);  | 
  
| 79 | 
      $this->redirect(array('action'=>'contact_confirm'));  | 
  
| 80 | 
                              }else{
     | 
  
| 81 | 
      }  | 
  
| 82 | 
      }  | 
  
| 83 | 
      }  | 
  
| 84 | 
      /**
     | 
  
| 85 | 
       * contact_confirm
     | 
  
| 86 | 
       */
     | 
  
| 87 | 
      public function contact_confirm() {  | 
  
| 88 | 
      if($this->Session->read('contact')){  | 
  
| 89 | 
      $this->set('contact',$this->Session->read('contact'));  | 
  
| 90 | 
                      }else{
     | 
  
| 91 | 
      $this->redirect(array('action'=>'contact'));  | 
  
| 92 | 
      }  | 
  
| 93 | 
      }  | 
  
| 94 | 
      /**
     | 
  
| 95 | 
       * contact_complete
     | 
  
| 96 | 
       */
     | 
  
| 97 | 
      public function contact_complete() {  | 
  
| 98 | 
      $this->set('contact',$this->Session->read('contact'));  | 
  
| 99 | 
      $name = $this->Session->read('contact.ContactValidate.name');  | 
  
| 100 | 
      $mail = $this->Session->read('contact.ContactValidate.mail');  | 
  
| 101 | 
      $comment = $this->Session->read('contact.ContactValidate.comment');  | 
  
| 102 | 
      $Email = new CakeEmail();  | 
  
| 103 | 
      $Email->charset('ISO-2022-JP');  | 
  
| 104 | 
      $Email->emailFormat('text');  | 
  
| 105 | 
      $Email->template('user_contact');  | 
  
| 106 | 
      $Email->viewVars(array('name'=>$name,'comment'=>$comment));  | 
  
| 107 | 
      $Email->from($mail);  | 
  
| 108 | 
      $Email->to('yano@i-hearts.jp');  | 
  
| 109 | 
      $Email->subject('[PICT CODE]問い合わせ');  | 
  
| 110 | 
                      $Email->send();
     | 
  
| 111 | 
      }  | 
  
| 112 | 
      }  |