Subversion Repositories SmartDukaan

Rev

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

Rev 16614 Rev 16755
Line 108... Line 108...
108
 * @return void
108
 * @return void
109
 */
109
 */
110
	public function admin_index() {
110
	public function admin_index() {
111
		$type = $this->request->query('type');
111
		$type = $this->request->query('type');
112
		$search = $this->request->query('search');	
112
		$search = $this->request->query('search');	
113
		$conditions = array();
113
		$conditions = array('offer_active'=>1);
-
 
114
		$offer_active = $this->request->query('offer_active');		
-
 
115
		if(strlen($offer_active)>0){
-
 
116
			print_r($offer_active);
-
 
117
			$conditions = array('offer_active'=>$offer_active);		
-
 
118
		}
114
		if(!empty($type) && !empty($search)){
119
		if(!empty($type) && !empty($search)){
115
			$conditions = array($type=>$search);
120
			$conditions[] = array($type .' LIKE ' => "%$search%");
116
			$options['conditions'] = array($type.' LIKE ' =>"%$search%");			
121
			// $options['conditions'][] = array($type.' LIKE ' =>"%$search%");			
117
			$this->Paginator->settings = $options;
122
			// $this->Paginator->settings = $options;
118
		}
123
		}
-
 
124
		print_r($conditions);
-
 
125
		$options['conditions'] = $conditions;
-
 
126
		$this->Paginator->settings = $options;	
119
		$this->AppOffer->recursive = 0;
127
		$this->AppOffer->recursive = 0;
120
		$this->set('appOffers', $this->Paginator->paginate());
128
		$this->set('appOffers', $this->Paginator->paginate());
121
	}
129
	}
122
 
130
 
123
/**
131
/**
Line 178... Line 186...
178
			$affiliate_ids = $this->AppOffer->AppAffiliate->find('list');
186
			$affiliate_ids = $this->AppOffer->AppAffiliate->find('list');
179
			$this->set(compact('affiliate_ids'));
187
			$this->set(compact('affiliate_ids'));
180
		}
188
		}
181
	}
189
	}
182
 
190
 
-
 
191
	public function admin_update($appmasterid = null) {		
-
 
192
		if ($this->request->is(array('post', 'put'))) {
-
 
193
			if ($this->AppOffer->save($this->request->data)) {
-
 
194
				$this->Session->setFlash(__('The app offer has been saved.'));
-
 
195
				return $this->redirect(array('action' => 'index'));
-
 
196
			} else {
-
 
197
				$this->Session->setFlash(__('The app offer could not be saved. Please, try again.'));
-
 
198
			}
-
 
199
		} else {
-
 
200
			$options = array('conditions' => array('AppOffer.appmaster_id' => $appmasterid,'AppOffer.offer_active'=>1));
-
 
201
			$this->request->data = $this->AppOffer->find('first', $options);
-
 
202
			$affiliate_ids = $this->AppOffer->AppAffiliate->find('list');
-
 
203
			$this->set(compact('affiliate_ids'));
-
 
204
			$this->render('admin_edit');
-
 
205
		}
-
 
206
	}
-
 
207
 
183
/**
208
/**
184
 * admin_delete method
209
 * admin_delete method
185
 *
210
 *
186
 * @throws NotFoundException
211
 * @throws NotFoundException
187
 * @param string $id
212
 * @param string $id