Fix to the filters

pull/306/merge
iglocska 2014-10-21 10:27:55 +02:00
parent e6e72e7f29
commit 2ed9c18068
1 changed files with 5 additions and 4 deletions

View File

@ -105,15 +105,15 @@ class EventsController extends AppController {
switch ($searchTerm) {
case 'published' :
if ($v == 2) continue 2;
$this->paginate['conditions'][] = array('Event.' . substr($k, 6) . ' =' => $v);
$this->paginate['conditions']['AND'][] = array('Event.' . substr($k, 6) . ' =' => $v);
break;
case 'Datefrom' :
if ($v == "") continue 2;
$this->paginate['conditions'][] = array('Event.date >=' => $v);
$this->paginate['conditions']['AND'][] = array('Event.date >=' => $v);
break;
case 'Dateuntil' :
if ($v == "") continue 2;
$this->paginate['conditions'][] = array('Event.date <=' => $v);
$this->paginate['conditions']['AND'][] = array('Event.date <=' => $v);
break;
case 'org' :
if ($v == "") continue 2;
@ -172,7 +172,7 @@ class EventsController extends AppController {
'recursive' => -1,
));
foreach ($allow as $a) {
$this->paginate['conditions']['OR'][] = array('Event.id' => $a['EventTag']['event_id']);
$this->paginate['conditions']['AND']['OR'][] = array('Event.id' => $a['EventTag']['event_id']);
}
$tagName = $this->Event->EventTag->Tag->find('first', array(
'conditions' => array('id' => $piece),
@ -235,6 +235,7 @@ class EventsController extends AppController {
'ThreatLevel.name'))
),
));
debug($this->paginate);
// for rest, don't use the pagination. With this, we'll escape the limit of events shown on the index.
if ($this->_isRest()) {
$rules = array();