Subversion Repositories SmartDukaan

Rev

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

Rev 14781 Rev 14783
Line 50... Line 50...
50
 * @return void
50
 * @return void
51
 */
51
 */
52
	public function add() {
52
	public function add() {
53
		if ($this->request->is('post')) {
53
		if ($this->request->is('post')) {
54
			$this->log(print_r($this->request->data,1),'pushnotifications');
54
			$this->log(print_r($this->request->data,1),'pushnotifications');
-
 
55
			$data = $this->request->data;
-
 
56
			$data['type'] = $data['result'];
-
 
57
			$data['status'] = 1;
-
 
58
			$data['notification_campaign_id'] = $data['cid'];
-
 
59
			unset($data['result']);
-
 
60
			unset($data['cid']);
55
			$this->Pushnotification->create();
61
			$this->Pushnotification->create();
56
			if ($this->Pushnotification->save($this->request->data)) {
62
			if ($this->Pushnotification->save($data)) {
57
				$this->Session->setFlash(__('The pushnotification has been saved.'));
63
				// $this->Session->setFlash(__('The pushnotification has been saved.'));
58
				return $this->redirect(array('action' => 'index'));
64
				// return $this->redirect(array('action' => 'index'));
-
 
65
				$result = array('success' => true,'message'=>'The pushnotification has been saved.');
59
			} else {
66
			} else {
-
 
67
				$result = array('success' => false,'message'=>'The pushnotification could not be saved. Please, try again.');
60
				$this->Session->setFlash(__('The pushnotification could not be saved. Please, try again.'));
68
				// $this->Session->setFlash(__('The pushnotification could not be saved. Please, try again.'));
61
			}
69
			}
62
		}
70
		}
-
 
71
		$this->set(array(
-
 
72
		    'result' => $result,
63
		// $users = $this->Pushnotification->User->find('list');
73
		    '_serialize' => array('result')
-
 
74
		));
64
		// $this->set(compact('users'));
75
		$this->render('/Elements/json');
65
	}
76
	}
66
 
77
 
67
/**
78
/**
68
 * edit method
79
 * edit method
69
 *
80
 *