$SLANG['ChooseFilter'] ); foreach ( dbFetchAll( "select * from Filters order by Name" ) as $row ) { $filterNames[$row['Name']] = $row['Name']; if ( $row['Background'] ) $filterNames[$row['Name']] .= "*"; if ( !empty($_REQUEST['reload']) && isset($_REQUEST['filterName']) && $_REQUEST['filterName'] == $row['Name'] ) $dbFilter = $row; } $backgroundStr = ""; if ( isset($dbFilter) ) { if ( $dbFilter['Background'] ) $backgroundStr = '['.strtolower($SLANG['Background']).']'; $_REQUEST['filter'] = jsonDecode( $dbFilter['Query'] ); $_REQUEST['sort_field'] = isset($_REQUEST['filter']['sort_field'])?$_REQUEST['filter']['sort_field']:"DateTime"; $_REQUEST['sort_asc'] = isset($_REQUEST['filter']['sort_asc'])?$_REQUEST['filter']['sort_asc']:"1"; $_REQUEST['limit'] = isset($_REQUEST['filter']['limit'])?$_REQUEST['filter']['limit']:""; unset( $_REQUEST['filter']['sort_field'] ); unset( $_REQUEST['filter']['sort_asc'] ); unset( $_REQUEST['filter']['limit'] ); } $conjunctionTypes = array( 'and' => $SLANG['ConjAnd'], 'or' => $SLANG['ConjOr'] ); $obracketTypes = array(); $cbracketTypes = array(); if ( isset($_REQUEST['filter']['terms']) ) { for ( $i = 0; $i <= count($_REQUEST['filter']['terms'])-2; $i++ ) { $obracketTypes[$i] = str_repeat( "(", $i ); $cbracketTypes[$i] = str_repeat( ")", $i ); } } $attrTypes = array( 'MonitorId' => $SLANG['AttrMonitorId'], 'MonitorName' => $SLANG['AttrMonitorName'], 'Id' => $SLANG['AttrId'], 'Name' => $SLANG['AttrName'], 'Cause' => $SLANG['AttrCause'], 'Notes' => $SLANG['AttrNotes'], 'DateTime' => $SLANG['AttrDateTime'], 'Date' => $SLANG['AttrDate'], 'Time' => $SLANG['AttrTime'], 'Weekday' => $SLANG['AttrWeekday'], 'Length' => $SLANG['AttrDuration'], 'Frames' => $SLANG['AttrFrames'], 'AlarmFrames' => $SLANG['AttrAlarmFrames'], 'TotScore' => $SLANG['AttrTotalScore'], 'AvgScore' => $SLANG['AttrAvgScore'], 'MaxScore' => $SLANG['AttrMaxScore'], 'Archived' => $SLANG['AttrArchiveStatus'], 'DiskPercent' => $SLANG['AttrDiskPercent'], 'DiskBlocks' => $SLANG['AttrDiskBlocks'], 'SystemLoad' => $SLANG['AttrSystemLoad'], ); $opTypes = array( '=' => $SLANG['OpEq'], '!=' => $SLANG['OpNe'], '>=' => $SLANG['OpGtEq'], '>' => $SLANG['OpGt'], '<' => $SLANG['OpLt'], '<=' => $SLANG['OpLtEq'], '=~' => $SLANG['OpMatches'], '!~' => $SLANG['OpNotMatches'], '=[]' => $SLANG['OpIn'], '![]' => $SLANG['OpNotIn'], ); $archiveTypes = array( '0' => $SLANG['ArchUnarchived'], '1' => $SLANG['ArchArchived'] ); $weekdays = array(); for ( $i = 0; $i < 7; $i++ ) { $weekdays[$i] = strftime( "%A", mktime( 12, 0, 0, 1, $i+1, 2001 ) ); } $sort_fields = array( 'Id' => $SLANG['AttrId'], 'Name' => $SLANG['AttrName'], 'Cause' => $SLANG['AttrCause'], 'Notes' => $SLANG['AttrNotes'], 'MonitorName' => $SLANG['AttrMonitorName'], 'DateTime' => $SLANG['AttrDateTime'], 'Length' => $SLANG['AttrDuration'], 'Frames' => $SLANG['AttrFrames'], 'AlarmFrames' => $SLANG['AttrAlarmFrames'], 'TotScore' => $SLANG['AttrTotalScore'], 'AvgScore' => $SLANG['AttrAvgScore'], 'MaxScore' => $SLANG['AttrMaxScore'], ); $sort_dirns = array( '1' => $SLANG['SortAsc'], '0' => $SLANG['SortDesc'] ); if ( empty($_REQUEST['sort_field']) ) { $_REQUEST['sort_field'] = ZM_WEB_EVENT_SORT_FIELD; $_REQUEST['sort_asc'] = (ZM_WEB_EVENT_SORT_ORDER == "asc"); } $hasCal = file_exists( 'tools/jscalendar/calendar.js' ); $focusWindow = true; xhtmlHeaders(__FILE__, $SLANG['EventFilter'] ); ?>