Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public function search() {
- $this->Outlet->set($this->data);
- // define a custom validation for this form, we don't want to use the same validation rules as we do when we save outlet
- $validate = array(
- 'postcode' => array(
- 'rule' => array(
- 'postal', null, 'uk'
- ),
- 'allowEmpty' => true
- )
- );
- $this->Outlet->validate = $validate;
- // validation message div display flag
- $show_validation_msg = false;
- // flag to toggle form display
- $display_form = true;
- if ($this->Outlet->validates()) {
- $this->Prg->commonProcess();
- // set flag
- if(!empty($this->passedArgs)){
- $display_form = false;
- }
- $this->paginate = array(
- 'conditions' => $this->Outlet->parseCriteria($this->passedArgs),
- 'limit' => 5
- ); // max number of results to display per page
- }else{
- $show_validation_msg = true;
- }
- $this->set('show_validation_msg', $show_validation_msg);
- $this->set('outlets', $this->paginate());
- $this->set('display_form', $display_form);
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement