Subversion Repositories SmartDukaan

Rev

Rev 14928 | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 14928 Rev 15523
Line 13... Line 13...
13
 *
13
 *
14
 * @var array
14
 * @var array
15
 */
15
 */
16
	public $components = array('Paginator');
16
	public $components = array('Paginator');
17
 
17
 
-
 
18
	public function beforeFilter() {
-
 
19
		parent::beforeFilter();
-
 
20
		$this->Auth->allow('add');
-
 
21
	}
-
 
22
 
18
/**
23
/**
19
 * index method
24
 * index method
20
 *
25
 *
21
 * @return void
26
 * @return void
22
 */
27
 */
Line 45... Line 50...
45
 *
50
 *
46
 * @return void
51
 * @return void
47
 */
52
 */
48
	public function add() {
53
	public function add() {
49
		if ($this->request->is('post')) {
54
		if ($this->request->is('post')) {
-
 
55
			$this->log(print_r($this->request->data,1),'notificationrules');
50
			$this->NotificationRule->create();
56
			$this->NotificationRule->create();
51
			if ($this->NotificationRule->save($this->request->data)) {
57
			if ($this->NotificationRule->save($this->request->data)) {
-
 
58
				$result = array('success'=>true,'message'=>'The notification rule has been saved.');
52
				$this->Session->setFlash(__('The notification rule has been saved.'));
59
				// $this->Session->setFlash(__('The notification rule has been saved.'));
53
				return $this->redirect(array('action' => 'index'));
60
				// return $this->redirect(array('action' => 'index'));
54
			} else {
61
			} else {
-
 
62
				$result = array('success'=>true,'message'=>$this->NotificationRule->validationErrors);
55
				$this->Session->setFlash(__('The notification rule could not be saved. Please, try again.'));
63
				// $this->Session->setFlash(__('The notification rule could not be saved. Please, try again.'));
56
			}
64
			}
-
 
65
			$this->layout = "ajax";
-
 
66
	        $this->response->type('json');
-
 
67
	        $this->set(array(
-
 
68
	            'result' => $result,
-
 
69
	            '_serialize' => array('result')
-
 
70
	        ));
-
 
71
	        $this->render('/Elements/json');
57
		}		
72
		}		
58
	}
73
	}
59
 
74
 
60
/**
75
/**
61
 * edit method
76
 * edit method
Line 191... Line 206...
191
			$this->Session->setFlash(__('The notification rule has been deleted.'));
206
			$this->Session->setFlash(__('The notification rule has been deleted.'));
192
		} else {
207
		} else {
193
			$this->Session->setFlash(__('The notification rule could not be deleted. Please, try again.'));
208
			$this->Session->setFlash(__('The notification rule could not be deleted. Please, try again.'));
194
		}
209
		}
195
		return $this->redirect(array('action' => 'index'));
210
		return $this->redirect(array('action' => 'index'));
196
	}}
211
	}
-
 
212
}