Subversion Repositories SmartDukaan

Rev

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

Rev 13698 Rev 15013
Line 52... Line 52...
52
	public function add() {
52
	public function add() {
53
		$this->layout = 'ajax';
53
		$this->layout = 'ajax';
54
		$this->response->type('json');
54
		$this->response->type('json');
55
		$this->log(print_r($this->request->data,1),'gcm');
55
		$this->log(print_r($this->request->data,1),'gcm');
56
		if ($this->request->is('post')) {
56
		if ($this->request->is('post')) {
-
 
57
			$data = $this->GcmUser->find('first',array('conditions'=>array('user_id'=>$this->request->data['user_id'],'gcm_regid'=>$this->request->data['gcm_regid'])));
-
 
58
			if($empty($data)){
-
 
59
				$this->request->data['id'] = $data['GcmUser']['id'];
-
 
60
			}else{
57
			$this->GcmUser->create();
61
				$this->GcmUser->create();
-
 
62
			}			
58
			if ($this->GcmUser->save($this->request->data)) {
63
			if ($this->GcmUser->save($this->request->data)) {
59
				$result = array('success'=>true);
64
				$result = array('success'=>true);
60
//				$this->Session->setFlash(__('The gcm user has been saved.'));
65
//				$this->Session->setFlash(__('The gcm user has been saved.'));
61
//				return $this->redirect(array('action' => 'index'));
66
//				return $this->redirect(array('action' => 'index'));
62
			} else {
67
			} else {