disable FilterComponent as it doesn't actually do anything. Add Groups join when needed

This commit is contained in:
Isaac Connor 2017-12-09 14:03:42 -05:00
parent 3b5e70c51a
commit ef1af9cc15
4 changed files with 14 additions and 14 deletions

View File

@ -21,7 +21,7 @@ class FilterComponent extends Component {
$query = array($attribute => $array);
array_push($conditions, $query);
} else {
array_push($conditions, array($attribute => $value));
$conditions[$attribute] = $value;
}
}

View File

@ -41,8 +41,9 @@ class EventsController extends AppController {
}
if ($this->request->params['named']) {
$this->FilterComponent = $this->Components->load('Filter');
$conditions = $this->FilterComponent->buildFilter($this->request->params['named']);
//$this->FilterComponent = $this->Components->load('Filter');
//$conditions = $this->FilterComponent->buildFilter($this->request->params['named']);
$conditions = $this->request->params['named'];
} else {
$conditions = array();
}
@ -60,7 +61,7 @@ class EventsController extends AppController {
'order' => array('StartTime'),
'paramType' => 'querystring',
);
//if ( $this->request->params['GroupId'] ) {
if ( isset( $conditions['GroupId'] ) ) {
$settings['joins'] = array(
array(
'table' => 'Groups_Monitors',
@ -71,7 +72,7 @@ class EventsController extends AppController {
),
);
$settings['contain'] = array('Group');
//}
}
$settings['conditions'] = array($conditions, $mon_options);
// How many events to return

View File

@ -34,7 +34,8 @@ class MonitorsController extends AppController {
if ($this->request->params['named']) {
$this->FilterComponent = $this->Components->load('Filter');
$conditions = $this->FilterComponent->buildFilter($this->request->params['named']);
//$conditions = $this->FilterComponent->buildFilter($this->request->params['named']);
$conditions = $this->request->params['named'];
} else {
$conditions = array();
}
@ -45,7 +46,7 @@ class MonitorsController extends AppController {
}
$find_array = array('conditions'=>$conditions,'contain'=>array('Group'));
//if ( $this->request->params['GroupId'] ) {
if ( isset( $conditions['GroupId'] ) ) {
$find_array['joins'] = array(
array(
'table' => 'Groups_Monitors',
@ -63,7 +64,7 @@ class MonitorsController extends AppController {
//),
//)
);
//}
}
$monitors = $this->Monitor->find('all',$find_array);
$this->set(array(
'monitors' => $monitors,
@ -84,12 +85,9 @@ class MonitorsController extends AppController {
throw new NotFoundException(__('Invalid monitor'));
}
$allowedMonitors=preg_split ('@,@', $this->Session->Read('allowedMonitors'),NULL, PREG_SPLIT_NO_EMPTY);
if (!empty($allowedMonitors))
{
if (!empty($allowedMonitors)) {
$restricted = array('Monitor.' . $this->Monitor->primaryKey => $allowedMonitors);
}
else
{
} else {
$restricted = '';
}

View File

@ -2,6 +2,7 @@
vertical-align: top;
margin: 10px auto 0;
width: 500px;
min-height: 20px;
}
.ptzControls input.ptzTextBtn {
@ -75,7 +76,7 @@
width: 100px;
}
.ptzControls .controlsPanel .pantiltPanel .pantiltControls .pantiltButtons {
.pantiltButtons {
margin: 5px auto;
border: 1px solid #006699;
text-align: center;