Subversion Repositories SmartDukaan

Rev

Rev 13591 | Rev 14662 | Go to most recent revision | Details | Compare with Previous | Last modification | View Log | RSS feed

Rev Author Line No. Line
13591 anikendra 1
<?php
2
App::uses('AppController', 'Controller');
3
/**
4
 * Mobileappsettings Controller
5
 *
6
 * @property Mobileappsetting $Mobileappsetting
7
 * @property PaginatorComponent $Paginator
8
 */
9
class MobileappsettingsController extends AppController {
10
 
11
/**
12
 * Components
13
 *
14
 * @var array
15
 */
16
	public $components = array('Paginator');
17
 
13593 anikendra 18
	public function index() {	
19
		$this->layout = 'ajax';
20
		$settings = $this->Mobileappsetting->find('all');
21
		$result = array('settings' => $settings);
22
		$this->set(array(
23
		    'result' => $result,
24
		    '_serialize' => array('result')
25
		));
26
		$this->render('/Elements/json');
27
	}
13591 anikendra 28
/**
29
 * admin_index method
30
 *
31
 * @return void
32
 */
33
	public function admin_index() {
34
		$this->Mobileappsetting->recursive = 0;
35
		$this->set('mobileappsettings', $this->Paginator->paginate());
36
	}
37
 
38
/**
39
 * admin_view method
40
 *
41
 * @throws NotFoundException
42
 * @param string $id
43
 * @return void
44
 */
45
	public function admin_view($id = null) {
46
		if (!$this->Mobileappsetting->exists($id)) {
47
			throw new NotFoundException(__('Invalid mobileappsetting'));
48
		}
49
		$options = array('conditions' => array('Mobileappsetting.' . $this->Mobileappsetting->primaryKey => $id));
50
		$this->set('mobileappsetting', $this->Mobileappsetting->find('first', $options));
51
	}
52
 
53
/**
54
 * admin_add method
55
 *
56
 * @return void
57
 */
58
	public function admin_add() {
59
		if ($this->request->is('post')) {
60
			$this->Mobileappsetting->create();
61
			if ($this->Mobileappsetting->save($this->request->data)) {
62
				$this->Session->setFlash(__('The mobileappsetting has been saved.'));
63
				return $this->redirect(array('action' => 'index'));
64
			} else {
65
				$this->Session->setFlash(__('The mobileappsetting could not be saved. Please, try again.'));
66
			}
67
		}
68
	}
69
 
70
/**
71
 * admin_edit method
72
 *
73
 * @throws NotFoundException
74
 * @param string $id
75
 * @return void
76
 */
77
	public function admin_edit($id = null) {
78
		if (!$this->Mobileappsetting->exists($id)) {
79
			throw new NotFoundException(__('Invalid mobileappsetting'));
80
		}
81
		if ($this->request->is(array('post', 'put'))) {
82
			if ($this->Mobileappsetting->save($this->request->data)) {
83
				$this->Session->setFlash(__('The mobileappsetting has been saved.'));
84
				return $this->redirect(array('action' => 'index'));
85
			} else {
86
				$this->Session->setFlash(__('The mobileappsetting could not be saved. Please, try again.'));
87
			}
88
		} else {
89
			$options = array('conditions' => array('Mobileappsetting.' . $this->Mobileappsetting->primaryKey => $id));
90
			$this->request->data = $this->Mobileappsetting->find('first', $options);
91
		}
92
	}
93
 
94
/**
95
 * admin_delete method
96
 *
97
 * @throws NotFoundException
98
 * @param string $id
99
 * @return void
100
 */
101
	public function admin_delete($id = null) {
102
		$this->Mobileappsetting->id = $id;
103
		if (!$this->Mobileappsetting->exists()) {
104
			throw new NotFoundException(__('Invalid mobileappsetting'));
105
		}
106
		$this->request->onlyAllow('post', 'delete');
107
		if ($this->Mobileappsetting->delete()) {
108
			$this->Session->setFlash(__('The mobileappsetting has been deleted.'));
109
		} else {
110
			$this->Session->setFlash(__('The mobileappsetting could not be deleted. Please, try again.'));
111
		}
112
		return $this->redirect(array('action' => 'index'));
113
	}}