Subversion Repositories SmartDukaan

Rev

Rev 13745 | Rev 14490 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 13745 Rev 14484
Line 4... Line 4...
4
 * Feedbacks Controller
4
 * Feedbacks Controller
5
 *
5
 *
6
 * @property Feedback $Feedback
6
 * @property Feedback $Feedback
7
 * @property PaginatorComponent $Paginator
7
 * @property PaginatorComponent $Paginator
8
 */
8
 */
-
 
9
App::uses('CakeEmail', 'Network/Email');
-
 
10
 
9
class FeedbacksController extends AppController {
11
class FeedbacksController extends AppController {
10
 
12
 
11
/**
13
/**
12
 * Components
14
 * Components
13
 *
15
 *
Line 53... Line 55...
53
	public function add() {
55
	public function add() {
54
		$this->log(print_r($this->request->data,1),'feedbacks');
56
		$this->log(print_r($this->request->data,1),'feedbacks');
55
		if ($this->request->is('post')) {
57
		if ($this->request->is('post')) {
56
			$this->Feedback->create();
58
			$this->Feedback->create();
57
			if ($this->Feedback->save($this->request->data)) {
59
			if ($this->Feedback->save($this->request->data)) {
-
 
60
				$emailConf = Configure::read('emails');
-
 
61
				$Email = new CakeEmail();
-
 
62
				$Email->from($emailConf['from']);
-
 
63
				$Email->to($emailConf['from']);
-
 
64
				$Email->cc($emailConf['cc']);
-
 
65
				$Email->subject('New Contact Us message');
-
 
66
				$message = "<ul style='list-style:none;'><li style='padding:10px 0;'>User Id : ".$this->request->data['Feedback']['user_id']."<li>";
-
 
67
				$message .= "<li>Email : ".$this->request->data['Feedback']['email']."<li>";
-
 
68
				$message .= "<li>Subject : ".$this->request->data['Feedback']['subject']."<li>";
-
 
69
				$message .= "<li>Message : ".$this->request->data['Feedback']['message']."<li></ul>";
-
 
70
				$Email->send($message);
58
				$result = array('success'=>true,'message'=>__('The feedback has been saved.'));
71
				$result = array('success'=>true,'message'=>__('The feedback has been saved.'));
59
			} else {
72
			} else {
60
				$result = array('success'=>false,'message'=>__('The feedback could not be saved. Please, try again.'));
73
				$result = array('success'=>false,'message'=>__('The feedback could not be saved. Please, try again.'));
61
			}
74
			}
62
			$this->response->type('json');
75
			$this->response->type('json');