mirror of
https://github.com/ZoneMinder/zoneminder.git
synced 2026-07-09 04:36:04 -04:00
add Filtering to monitors index
This commit is contained in:
@@ -34,17 +34,13 @@ public function beforeFilter() {
|
||||
public function index() {
|
||||
$this->Event->recursive = -1;
|
||||
|
||||
$allowedMonitors=preg_split ('@,@', $this->Session->Read('allowedMonitors'),NULL, PREG_SPLIT_NO_EMPTY);
|
||||
|
||||
if (!empty($allowedMonitors))
|
||||
{
|
||||
$mon_options = array('Event.MonitorId' => $allowedMonitors);
|
||||
}
|
||||
else
|
||||
{
|
||||
$mon_options='';
|
||||
}
|
||||
$allowedMonitors=preg_split ('@,@', $this->Session->Read('allowedMonitors'),NULL, PREG_SPLIT_NO_EMPTY);
|
||||
|
||||
if (!empty($allowedMonitors)) {
|
||||
$mon_options = array('Event.MonitorId' => $allowedMonitors);
|
||||
} else {
|
||||
$mon_options='';
|
||||
}
|
||||
|
||||
if ($this->request->params['named']) {
|
||||
$this->FilterComponent = $this->Components->load('Filter');
|
||||
@@ -81,7 +77,6 @@ public function beforeFilter() {
|
||||
//$thumbData = $this->createThumbnail($value['Event']['Id']);
|
||||
$thumbData = "";
|
||||
$events[$key]['thumbData'] = $thumbData;
|
||||
|
||||
}
|
||||
|
||||
$this->set(compact('events'));
|
||||
|
||||
@@ -35,22 +35,24 @@ public function beforeFilter() {
|
||||
* @return void
|
||||
*/
|
||||
public function index() {
|
||||
$this->Monitor->recursive = 0;
|
||||
$allowedMonitors=preg_split ('@,@', $this->Session->Read('allowedMonitors'),NULL, PREG_SPLIT_NO_EMPTY);
|
||||
$this->Monitor->recursive = 0;
|
||||
|
||||
if (!empty($allowedMonitors))
|
||||
{
|
||||
$options = array('conditions'=>array('Monitor.Id'=> $allowedMonitors));
|
||||
if ($this->request->params['named']) {
|
||||
$this->FilterComponent = $this->Components->load('Filter');
|
||||
$conditions = $this->FilterComponent->buildFilter($this->request->params['named']);
|
||||
} else {
|
||||
$conditions = array();
|
||||
}
|
||||
else
|
||||
{
|
||||
$options='';
|
||||
|
||||
$allowedMonitors=preg_split ('@,@', $this->Session->Read('allowedMonitors'),NULL, PREG_SPLIT_NO_EMPTY);
|
||||
if (!empty($allowedMonitors)) {
|
||||
$conditions['Monitor.Id' ] = $allowedMonitors;
|
||||
}
|
||||
$monitors = $this->Monitor->find('all',$options);
|
||||
$this->set(array(
|
||||
'monitors' => $monitors,
|
||||
'_serialize' => array('monitors')
|
||||
));
|
||||
$monitors = $this->Monitor->find('all',array('conditions'=>$conditions));
|
||||
$this->set(array(
|
||||
'monitors' => $monitors,
|
||||
'_serialize' => array('monitors')
|
||||
));
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
Reference in New Issue
Block a user