use backticks on table and column names. Use data-on-change-this in group dropdown
This commit is contained in:
parent
1103928ed7
commit
68052368f7
|
@ -118,13 +118,13 @@ class Group extends ZM_Object {
|
|||
if ( is_array($group_id) ) {
|
||||
$group_id_sql_part = ' IN ('.implode(',', array_map(function(){return '?';}, $group_id ) ).')';
|
||||
|
||||
$MonitorIds = dbFetchAll('SELECT MonitorId FROM Groups_Monitors WHERE GroupId'.$group_id_sql_part, 'MonitorId', $group_id);
|
||||
$MonitorIds = dbFetchAll('SELECT `MonitorId` FROM `Groups_Monitors` WHERE `GroupId`'.$group_id_sql_part, 'MonitorId', $group_id);
|
||||
|
||||
$MonitorIds = array_merge($MonitorIds, dbFetchAll('SELECT MonitorId FROM Groups_Monitors WHERE GroupId IN (SELECT Id FROM Groups WHERE ParentId'.$group_id_sql_part.')', 'MonitorId', $group_id));
|
||||
$MonitorIds = array_merge($MonitorIds, dbFetchAll('SELECT `MonitorId` FROM `Groups_Monitors` WHERE `GroupId` IN (SELECT `Id` FROM `Groups` WHERE `ParentId`'.$group_id_sql_part.')', 'MonitorId', $group_id));
|
||||
} else {
|
||||
$MonitorIds = dbFetchAll('SELECT MonitorId FROM Groups_Monitors WHERE GroupId=?', 'MonitorId', array($group_id));
|
||||
$MonitorIds = dbFetchAll('SELECT `MonitorId` FROM `Groups_Monitors` WHERE `GroupId`=?', 'MonitorId', array($group_id));
|
||||
|
||||
$MonitorIds = array_merge($MonitorIds, dbFetchAll('SELECT MonitorId FROM Groups_Monitors WHERE GroupId IN (SELECT Id FROM Groups WHERE ParentId = ?)', 'MonitorId', array($group_id)));
|
||||
$MonitorIds = array_merge($MonitorIds, dbFetchAll('SELECT `MonitorId` FROM `Groups_Monitors` WHERE `GroupId` IN (SELECT `Id` FROM `Groups` WHERE `ParentId` = ?)', 'MonitorId', array($group_id)));
|
||||
}
|
||||
$groupSql = " find_in_set( M.Id, '".implode(',', $MonitorIds)."' )";
|
||||
}
|
||||
|
@ -138,11 +138,11 @@ class Group extends ZM_Object {
|
|||
} else if ( isset($_COOKIE['zmMonitorId']) ) {
|
||||
$monitor_id = $_COOKIE['zmMonitorId'];
|
||||
}
|
||||
$sql = 'SELECT * FROM Monitors';
|
||||
$sql = 'SELECT `Id`,`Name` FROM `Monitors`';
|
||||
if ( $options ) {
|
||||
$sql .= ' WHERE '. implode(' AND ', array(
|
||||
( isset($options['groupSql']) ? $options['groupSql']:'')
|
||||
) ).' ORDER BY Sequence ASC';
|
||||
) ).' ORDER BY `Sequence` ASC';
|
||||
}
|
||||
$monitors_dropdown = array(''=>'All');
|
||||
|
||||
|
@ -153,7 +153,7 @@ class Group extends ZM_Object {
|
|||
$monitors_dropdown[$monitor['Id']] = $monitor['Name'];
|
||||
}
|
||||
|
||||
echo htmlSelect('monitor_id', $monitors_dropdown, $monitor_id, array('onchange'=>'changeMonitor(this);'));
|
||||
echo htmlSelect('monitor_id', $monitors_dropdown, $monitor_id, array('data-on-change-this'=>'changeMonitor'));
|
||||
return $monitor_id;
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue