save( array( 'Name'=> $_REQUEST['newGroup']['Name'], 'ParentId'=>( $_REQUEST['newGroup']['ParentId'] == '' ? null : $_REQUEST['newGroup']['ParentId'] ), ) ); dbQuery('DELETE FROM `Groups_Monitors` WHERE `GroupId`=?', array($group_id)); $group_id = $group->Id(); if ( $group_id ) { foreach ( $_REQUEST['newGroup']['MonitorIds'] as $mid ) { dbQuery('INSERT INTO `Groups_Monitors` (`GroupId`,`MonitorId`) VALUES (?,?)', array($group_id, $mid)); } } $redirect = '?view=groups'; } ?>