public function browse() { $this->Paginator->settings = array(); $this->Paginator->settings['MediaFile'] = array("limit" => 50, "order" => array("MediaFile.modified" => "DESC"), "contain" => array("Website")); if (isset($this->request->params['named']['MediaFile.name'])) { $this->request->data['MediaFile']['name'] = urldecode($this->request->params['named']['MediaFile.name']); $this->Paginator->settings['MediaFile']['conditions']['MediaFile.name LIKE'] = "%" . str_replace(" ", "%", urldecode($this->request->params['named']['MediaFile.name'])); } if (isset($this->request->params['named']['MediaFile.media_type'])) { $this->request->data['MediaFile']['media_type'] = urldecode($this->request->params['named']['MediaFile.media_type']); $this->Paginator->settings['MediaFile']['conditions']['MediaFile.media_type'] = urldecode($this->request->params['named']['MediaFile.media_type']); } if (isset($this->request->params['named']['MediaFile.website_id'])) { $this->Paginator->settings['MediaFile']['conditions']['MediaFile.website_id'] = $this->request->data['MediaFile']['website_id'] = $this->request->params['named']['MediaFile.website_id']; } else { //default it at the berrics //$this->request->data['MediaFile']['website_id'] = //$this->Paginator->settings['MediaFile']['conditions']['MediaFile.website_id'] = 1; } $websites = $this->MediaFile->Website->dropdown(); $mediaTypes = MediaFile::mediaFileTypes(); $files = $this->paginate("MediaFile"); $this->set(compact("files", "websites", "mediaTypes")); }