This commit is contained in:
Isaac Connor 2018-04-20 13:10:38 -04:00
parent c9e18fa24f
commit 970830aee3
2 changed files with 539 additions and 496 deletions

View File

@ -1,494 +1,538 @@
<?php
function getDateScale( $scales, $range, $minLines, $maxLines ) {
foreach ( $scales as $scale ) {
$align = isset($scale['align'])?$scale['align']:1;
$scaleRange = (int)($range/($scale['factor']*$align));
//echo "S:".$scale['name'].", A:$align, SR:$scaleRange<br>";
if ( $scaleRange >= $minLines ) {
$scale['range'] = $scaleRange;
break;
}
}
if ( !isset($scale['range']) ) {
$scale['range'] = (int)($range/($scale['factor']*$align));
}
$scale['divisor'] = 1;
while ( ($scale['range']/$scale['divisor']) > $maxLines ) {
$scale['divisor']++;
}
$scale['lines'] = (int)($scale['range']/$scale['divisor']);
return( $scale );
foreach ( $scales as $scale ) {
$align = isset($scale['align'])?$scale['align']:1;
$scaleRange = (int)($range/($scale['factor']*$align));
//echo "S:".$scale['name'].", A:$align, SR:$scaleRange<br>";
if ( $scaleRange >= $minLines ) {
$scale['range'] = $scaleRange;
break;
}
}
if ( !isset($scale['range']) ) {
$scale['range'] = (int)($range/($scale['factor']*$align));
}
$scale['divisor'] = 1;
while ( ($scale['range']/$scale['divisor']) > $maxLines ) {
$scale['divisor']++;
}
$scale['lines'] = (int)($scale['range']/$scale['divisor']);
return( $scale );
}
function getYScale( $range, $minLines, $maxLines ) {
$scale['range'] = $range;
$scale['divisor'] = 1;
while ( $scale['range']/$scale['divisor'] > $maxLines ) {
$scale['divisor']++;
}
$scale['lines'] = (int)(($scale['range']-1)/$scale['divisor'])+1;
$scale['range'] = $range;
$scale['divisor'] = 1;
while ( $scale['range']/$scale['divisor'] > $maxLines ) {
$scale['divisor']++;
}
$scale['lines'] = (int)(($scale['range']-1)/$scale['divisor'])+1;
return( $scale );
return( $scale );
}
function getSlotFrame( $slot ) {
$slotFrame = isset($slot['frame'])?$slot['frame']['FrameId']:1;
if ( false && $slotFrame ) {
$slotFrame -= $monitor['PreEventCount'];
if ( $slotFrame < 1 )
$slotFrame = 1;
}
return( $slotFrame );
$slotFrame = isset($slot['frame'])?$slot['frame']['FrameId']:1;
if ( false && $slotFrame ) {
$slotFrame -= $monitor['PreEventCount'];
if ( $slotFrame < 1 )
$slotFrame = 1;
}
return( $slotFrame );
}
function parseFilterToTree( $filter ) {
if ( count($filter['terms']) > 0 ) {
$postfixExpr = array();
$postfixStack = array();
if ( count($filter['terms']) <= 0 ) {
return false;
}
$terms = $filter['terms'];
$priorities = array(
'<' => 1,
'<=' => 1,
'>' => 1,
'>=' => 1,
'=' => 2,
'!=' => 2,
'=~' => 2,
'!~' => 2,
'=[]' => 2,
'![]' => 2,
'and' => 3,
'or' => 4,
);
$StorageArea = NULL;
for ( $i = 0; $i <= count($filter['terms']); $i++ ) {
if ( !empty($filter['terms'][$i]['cnj']) ) {
while( true ) {
if ( !count($postfixStack) ) {
$postfixStack[] = array( 'type'=>"cnj", 'value'=>$filter['terms'][$i]['cnj'], 'sqlValue'=>$filter['terms'][$i]['cnj']);
break;
} elseif ( $postfixStack[count($postfixStack)-1]['type'] == 'obr' ) {
$postfixStack[] = array( 'type'=>"cnj", 'value'=>$filter['terms'][$i]['cnj'], 'sqlValue'=>$filter['terms'][$i]['cnj']);
break;
} elseif ( $priorities[$filter['terms'][$i]['cnj']] < $priorities[$postfixStack[count($postfixStack)-1]['value']] ) {
$postfixStack[] = array( 'type'=>"cnj", 'value'=>$filter['terms'][$i]['cnj'], 'sqlValue'=>$filter['terms'][$i]['cnj']);
break;
} else {
$postfixExpr[] = array_pop( $postfixStack );
}
}
}
if ( !empty($filter['terms'][$i]['obr']) )
{
for ( $j = 0; $j < $filter['terms'][$i]['obr']; $j++ )
{
$postfixStack[] = array( 'type'=>"obr", 'value'=>$filter['terms'][$i]['obr']);
}
}
if ( !empty($filter['terms'][$i]['attr']) )
{
$dtAttr = false;
switch ( $filter['terms'][$i]['attr'])
{
case 'MonitorName':
$sqlValue = 'M.'.preg_replace( '/^Monitor/', '', $filter['terms'][$i]['attr']);
break;
case 'Name':
$sqlValue = "E.Name";
break;
case 'Cause':
$sqlValue = "E.Cause";
break;
case 'DateTime':
$sqlValue = "E.StartTime";
$dtAttr = true;
break;
case 'StartDateTime':
$sqlValue = "E.StartTime";
$dtAttr = true;
break;
case 'Date':
$sqlValue = "to_days( E.StartTime )";
$dtAttr = true;
break;
case 'Time':
$sqlValue = "extract( hour_second from E.StartTime )";
break;
case 'Weekday':
$sqlValue = "weekday( E.StartTime )";
break;
case 'Id':
case 'Name':
case 'MonitorId':
case 'Length':
case 'Frames':
case 'AlarmFrames':
case 'TotScore':
case 'AvgScore':
case 'MaxScore':
case 'Archived':
$sqlValue = "E.".$filter['terms'][$i]['attr'];
break;
case 'DiskPercent':
$sqlValue = getDiskPercent();
break;
case 'DiskBlocks':
$sqlValue = getDiskBlocks();
break;
default :
$sqlValue = $filter['terms'][$i]['attr'];
break;
}
if ( $dtAttr ) {
$postfixExpr[] = array( 'type'=>"attr", 'value'=>$filter['terms'][$i]['attr'], 'sqlValue'=>$sqlValue, 'dtAttr'=>true );
} else {
$postfixExpr[] = array( 'type'=>"attr", 'value'=>$filter['terms'][$i]['attr'], 'sqlValue'=>$sqlValue );
}
}
if ( isset($filter['terms'][$i]['op']) ) {
if ( empty($filter['terms'][$i]['op']) ) {
$filter['terms'][$i]['op' ]= '=';
}
switch ( $filter['terms'][$i]['op' ]) {
case '=' :
case '!=' :
case '>=' :
case '>' :
case '<' :
case '<=' :
$sqlValue = $filter['terms'][$i]['op'];
break;
case '=~' :
$sqlValue = "regexp";
break;
case '!~' :
$sqlValue = "not regexp";
break;
case '=[]' :
$sqlValue = 'in (';
break;
case '![]' :
$sqlValue = 'not in (';
break;
}
while( true ) {
if ( !count($postfixStack) ) {
$postfixStack[] = array( 'type'=>"op", 'value'=>$filter['terms'][$i]['op'], 'sqlValue'=>$sqlValue );
break;
} elseif ( $postfixStack[count($postfixStack)-1]['type'] == 'obr' ) {
$postfixStack[] = array( 'type'=>"op", 'value'=>$filter['terms'][$i]['op'], 'sqlValue'=>$sqlValue );
break;
} elseif ( $priorities[$filter['terms'][$i]['op']] < $priorities[$postfixStack[count($postfixStack)-1]['value']] ) {
$postfixStack[] = array( 'type'=>"op", 'value'=>$filter['terms'][$i]['op'], 'sqlValue'=>$sqlValue );
break;
} else {
$postfixExpr[] = array_pop( $postfixStack );
}
}
}
if ( isset($filter['terms'][$i]['val']) ) {
$valueList = array();
foreach ( preg_split( '/["\'\s]*?,["\'\s]*?/', preg_replace( '/^["\']+?(.+)["\']+?$/', '$1', $filter['terms'][$i]['val' ]) ) as $value ) {
switch ( $filter['terms'][$i]['attr']) {
case 'MonitorName':
case 'Name':
case 'Cause':
case 'Notes':
$value = "'$value'";
break;
case 'DateTime':
$value = "'".strftime( STRF_FMT_DATETIME_DB, strtotime( $value ) )."'";
break;
case 'StartDateTime':
$value = "'".strftime( STRF_FMT_DATETIME_DB, strtotime( $value ) )."'";
break;
case 'Date':
$value = "to_days( '".strftime( STRF_FMT_DATETIME_DB, strtotime( $value ) )."' )";
break;
case 'Time':
$value = "extract( hour_second from '".strftime( STRF_FMT_DATETIME_DB, strtotime( $value ) )."' )";
break;
case 'Weekday':
$value = "weekday( '".strftime( STRF_FMT_DATETIME_DB, strtotime( $value ) )."' )";
break;
}
$valueList[] = $value;
}
$postfixExpr[] = array( 'type'=>"val", 'value'=>$filter['terms'][$i]['val'], 'sqlValue'=>join( ',', $valueList ) );
}
if ( !empty($filter['terms'][$i]['cbr']) )
{
for ( $j = 0; $j < $filter['terms'][$i]['cbr']; $j++ )
{
while ( count($postfixStack) )
{
$element = array_pop( $postfixStack );
if ( $element['type'] == "obr" )
{
$postfixExpr[count($postfixExpr)-1]['bracket'] = true;
break;
}
$postfixExpr[] = $element;
}
}
}
}
while ( count($postfixStack) )
{
$postfixExpr[] = array_pop( $postfixStack );
}
$postfixExpr = array();
$postfixStack = array();
$exprStack = array();
//foreach ( $postfixExpr as $element )
//{
//echo $element['value']." ";
//}
//echo "<br>";
foreach ( $postfixExpr as $element )
{
if ( $element['type'] == 'attr' || $element['type'] == 'val' )
{
$node = array( 'data'=>$element, 'count'=>0 );
$exprStack[] = $node;
}
elseif ( $element['type'] == 'op' || $element['type'] == 'cnj' )
{
$right = array_pop( $exprStack );
$left = array_pop( $exprStack );
$node = array( 'data'=>$element, 'count'=>2+$left['count']+$right['count'], 'right'=>$right, 'left'=>$left );
$exprStack[] = $node;
}
else
{
Fatal( "Unexpected element type '".$element['type']."', value '".$element['value']."'" );
}
}
if ( count($exprStack) != 1 )
{
Fatal( "Expression stack has ".count($exprStack)." elements" );
}
$exprTree = array_pop( $exprStack );
return( $exprTree );
}
return( false );
$priorities = array(
'<' => 1,
'<=' => 1,
'>' => 1,
'>=' => 1,
'=' => 2,
'!=' => 2,
'=~' => 2,
'!~' => 2,
'=[]' => 2,
'![]' => 2,
'and' => 3,
'or' => 4,
);
for ( $i = 0; $i <= count($terms); $i++ ) {
if ( !empty($terms[$i]['cnj']) ) {
while( true ) {
if ( !count($postfixStack) ) {
$postfixStack[] = array('type'=>'cnj', 'value'=>$terms[$i]['cnj'], 'sqlValue'=>$terms[$i]['cnj']);
break;
} elseif ( $postfixStack[count($postfixStack)-1]['type'] == 'obr' ) {
$postfixStack[] = array('type'=>'cnj', 'value'=>$terms[$i]['cnj'], 'sqlValue'=>$terms[$i]['cnj']);
break;
} elseif ( $priorities[$terms[$i]['cnj']] < $priorities[$postfixStack[count($postfixStack)-1]['value']] ) {
$postfixStack[] = array('type'=>'cnj', 'value'=>$terms[$i]['cnj'], 'sqlValue'=>$terms[$i]['cnj']);
break;
} else {
$postfixExpr[] = array_pop($postfixStack);
}
}
}
if ( !empty($terms[$i]['obr']) ) {
for ( $j = 0; $j < $terms[$i]['obr']; $j++ ) {
$postfixStack[] = array('type'=>'obr', 'value'=>$terms[$i]['obr']);
}
}
if ( !empty($terms[$i]['attr']) ) {
$dtAttr = false;
switch ( $terms[$i]['attr']) {
case 'MonitorName':
$sqlValue = 'M.'.preg_replace( '/^Monitor/', '', $terms[$i]['attr']);
break;
case 'ServerId':
$sqlValue .= 'M.ServerId';
break;
case 'DateTime':
case 'StartDateTime':
$sqlValue = "E.StartTime";
$dtAttr = true;
break;
case 'Date':
case 'StartDate':
$sqlValue = "to_days( E.StartTime )";
$dtAttr = true;
break;
case 'Time':
case 'StartTime':
$sqlValue = "extract( hour_second from E.StartTime )";
break;
case 'Weekday':
case 'StartWeekday':
$sqlValue = "weekday( E.StartTime )";
break;
case 'EndDateTime':
$sqlValue = "E.EndTime";
$dtAttr = true;
break;
case 'EndDate':
$sqlValue = "to_days( E.EndTime )";
$dtAttr = true;
break;
case 'EndTime':
$sqlValue = "extract( hour_second from E.EndTime )";
break;
case 'EndWeekday':
$sqlValue = "weekday( E.EndTime )";
break;
case 'Id':
case 'Name':
case 'MonitorId':
case 'StorageId':
case 'Length':
case 'Frames':
case 'AlarmFrames':
case 'TotScore':
case 'AvgScore':
case 'MaxScore':
case 'Cause':
case 'Notes':
case 'StateId':
case 'Archived':
$sqlValue = "E.".$terms[$i]['attr'];
break;
case 'DiskPercent':
// Need to specify a storage area, so need to look through other terms looking for a storage area, else we default to ZM_EVENTS_PATH
if ( ! $StorageArea ) {
for ( $j = 0; $j < count($terms); $j++ ) {
if ( isset($terms[$j]['attr']) and $terms[$j]['attr'] == 'StorageId' and isset($terms[$j]['val']) ) {
$StorageArea = new Storage($terms[$j]['val']);
break;
}
} // end foreach remaining term
if ( ! $StorageArea ) $StorageArea = new Storage();
} // end no StorageArea found yet
$sqlValue = getDiskPercent($StorageArea);
break;
case 'DiskBlocks':
// Need to specify a storage area, so need to look through other terms looking for a storage area, else we default to ZM_EVENTS_PATH
if ( ! $StorageArea ) {
for ( $j = 0; $j < count($terms); $j++ ) {
if ( isset($terms[$j]['attr']) and $terms[$j]['attr'] == 'StorageId' and isset($terms[$j]['val']) ) {
$StorageArea = new Storage($terms[$j]['val']);
break;
}
} // end foreach remaining term
if ( ! $StorageArea ) $StorageArea = new Storage();
} // end no StorageArea found yet
$sqlValue = getDiskBlocks($StorageArea);
break;
default :
$sqlValue = $terms[$i]['attr'];
break;
}
if ( $dtAttr ) {
$postfixExpr[] = array('type'=>'attr', 'value'=>$terms[$i]['attr'], 'sqlValue'=>$sqlValue, 'dtAttr'=>true);
} else {
$postfixExpr[] = array('type'=>'attr', 'value'=>$terms[$i]['attr'], 'sqlValue'=>$sqlValue);
}
} # end if attr
if ( isset($terms[$i]['op']) ) {
if ( empty($terms[$i]['op']) ) {
$terms[$i]['op'] = '=';
}
switch ( $terms[$i]['op']) {
case '=' :
case '!=' :
case '>=' :
case '>' :
case '<' :
case '<=' :
$sqlValue = $terms[$i]['op'];
break;
case '=~' :
$sqlValue = 'regexp';
break;
case '!~' :
$sqlValue = 'not regexp';
break;
case '=[]' :
$sqlValue = 'in (';
break;
case '![]' :
$sqlValue = 'not in (';
break;
default :
Error('Unknown operator in filter '. $terms[$i]['op']);
}
while( true ) {
if ( !count($postfixStack) ) {
$postfixStack[] = array('type'=>'op', 'value'=>$terms[$i]['op'], 'sqlValue'=>$sqlValue);
break;
} elseif ( $postfixStack[count($postfixStack)-1]['type'] == 'obr' ) {
$postfixStack[] = array('type'=>'op', 'value'=>$terms[$i]['op'], 'sqlValue'=>$sqlValue);
break;
} elseif ( $priorities[$terms[$i]['op']] < $priorities[$postfixStack[count($postfixStack)-1]['value']] ) {
$postfixStack[] = array('type'=>'op', 'value'=>$terms[$i]['op'], 'sqlValue'=>$sqlValue );
break;
} else {
$postfixExpr[] = array_pop($postfixStack);
}
} // end while
} // end if operator
if ( isset($terms[$i]['val']) ) {
$valueList = array();
foreach ( preg_split('/["\'\s]*?,["\'\s]*?/', preg_replace('/^["\']+?(.+)["\']+?$/', '$1', $terms[$i]['val'])) as $value ) {
switch ( $terms[$i]['attr'] ) {
case 'MonitorName':
case 'Name':
case 'Cause':
case 'Notes':
$value = "'$value'";
break;
case 'ServerId':
if ( $value == 'ZM_SERVER_ID' ) {
$value = ZM_SERVER_ID;
} else if ( $value == 'NULL' ) {
} else {
$value = dbEscape($value);
}
break;
case 'StorageId':
$StorageArea = new Storage($value);
if ( $value != 'NULL' )
$value = dbEscape($value);
break;
case 'DateTime':
case 'EndDateTime':
case 'StartDateTime':
$value = "'".strftime(STRF_FMT_DATETIME_DB, strtotime($value))."'";
break;
case 'Date':
case 'EndDate':
case 'StartDate':
$value = "to_days('".strftime(STRF_FMT_DATETIME_DB, strtotime($value))."' )";
break;
case 'Time':
case 'EndTime':
case 'StartTime':
$value = "extract( hour_second from '".strftime(STRF_FMT_DATETIME_DB, strtotime($value))."' )";
break;
case 'Weekday':
case 'EndWeekday':
case 'StartWeekday':
$value = "weekday( '".strftime(STRF_FMT_DATETIME_DB, strtotime($value))."' )";
break;
default :
if ( $value != 'NULL' )
$value = dbEscape($value);
} // end switch attribute
$valueList[] = $value;
} // end foreach value
$postfixExpr[] = array('type'=>'val', 'value'=>$terms[$i]['val'], 'sqlValue'=>join(',', $valueList));
} // end if has val
if ( !empty($terms[$i]['cbr']) ) {
for ( $j = 0; $j < $terms[$i]['cbr']; $j++ ) {
while ( count($postfixStack) ) {
$element = array_pop($postfixStack);
if ( $element['type'] == 'obr' ) {
$postfixExpr[count($postfixExpr)-1]['bracket'] = true;
break;
}
$postfixExpr[] = $element;
}
}
}
}
while ( count($postfixStack) ) {
$postfixExpr[] = array_pop($postfixStack);
}
$exprStack = array();
//foreach ( $postfixExpr as $element )
//{
//echo $element['value'].' ';
//}
//echo "<br>";
foreach ( $postfixExpr as $element ) {
if ( $element['type'] == 'attr' || $element['type'] == 'val' ) {
$node = array('data'=>$element, 'count'=>0);
$exprStack[] = $node;
} elseif ( $element['type'] == 'op' || $element['type'] == 'cnj' ) {
$right = array_pop($exprStack);
$left = array_pop($exprStack);
$node = array('data'=>$element, 'count'=>2+$left['count']+$right['count'], 'right'=>$right, 'left'=>$left);
$exprStack[] = $node;
} else {
Fatal("Unexpected element type '".$element['type']."', value '".$element['value']."'");
}
}
if ( count($exprStack) != 1 ) {
Fatal('Expression stack has '.count($exprStack).' elements');
}
return array_pop($exprStack);
}
function _parseTreeToInfix( $node )
{
$expression = '';
if ( isset($node) )
{
if ( isset($node['left']) )
{
if ( !empty($node['data']['bracket']) )
$expression .= '( ';
$expression .= _parseTreeToInfix( $node['left'] );
}
$expression .= $node['data']['value']." ";
if ( isset($node['right']) )
{
$expression .= _parseTreeToInfix( $node['right'] );
if ( !empty($node['data']['bracket']) )
$expression .= ') ';
}
}
return( $expression );
function _parseTreeToInfix($node) {
$expression = '';
if ( isset($node) ) {
if ( isset($node['left']) ) {
if ( !empty($node['data']['bracket']) )
$expression .= '( ';
$expression .= _parseTreeToInfix($node['left']);
}
$expression .= $node['data']['value'].' ';
if ( isset($node['right']) ) {
$expression .= _parseTreeToInfix($node['right']);
if ( !empty($node['data']['bracket']) )
$expression .= ') ';
}
}
return $expression;
}
function parseTreeToInfix( $tree )
{
return( _parseTreeToInfix( $tree ) );
function parseTreeToInfix($tree) {
return _parseTreeToInfix($tree);
}
function _parseTreeToSQL( $node, $cbr=false )
{
$expression = '';
if ( $node )
{
if ( isset($node['left']) )
{
if ( !empty($node['data']['bracket']) )
$expression .= '( ';
$expression .= _parseTreeToSQL( $node['left'] );
}
$inExpr = $node['data']['type'] == 'op' && ($node['data']['value'] == '=[]' || $node['data']['value'] == '![]');
$expression .= $node['data']['sqlValue'];
if ( !$inExpr )
$expression .= ' ';
if ( $cbr )
$expression .= ') ';
if ( isset($node['right']) )
{
$expression .= _parseTreeToSQL( $node['right'], $inExpr );
if ( !empty($node['data']['bracket']) )
$expression .= ') ';
}
}
return( $expression );
$expression = '';
if ( $node )
{
if ( isset($node['left']) )
{
if ( !empty($node['data']['bracket']) )
$expression .= '( ';
$expression .= _parseTreeToSQL( $node['left'] );
}
$inExpr = $node['data']['type'] == 'op' && ($node['data']['value'] == '=[]' || $node['data']['value'] == '![]');
$expression .= $node['data']['sqlValue'];
if ( !$inExpr )
$expression .= ' ';
if ( $cbr )
$expression .= ') ';
if ( isset($node['right']) )
{
$expression .= _parseTreeToSQL( $node['right'], $inExpr );
if ( !empty($node['data']['bracket']) )
$expression .= ') ';
}
}
return( $expression );
}
function parseTreeToSQL( $tree )
{
return( _parseTreeToSQL( $tree ) );
return( _parseTreeToSQL( $tree ) );
}
function _parseTreeToFilter( $node, &$terms, &$level )
{
$elements = array();
if ( $node )
{
if ( isset($node['left']) )
{
if ( !empty($node['data']['bracket']) )
$terms[$level]['obr'] = 1;
_parseTreeToFilter( $node['left'], $terms, $level );
}
if ( $node['data']['type'] == 'cnj' )
{
$level++;
}
$terms[$level][$node['data']['type']] = $node['data']['value'];
if ( isset($node['right']) )
{
_parseTreeToFilter( $node['right'], $terms, $level );
if ( !empty($node['data']['bracket']) )
$terms[$level]['cbr'] = 1;
}
}
$elements = array();
if ( $node )
{
if ( isset($node['left']) )
{
if ( !empty($node['data']['bracket']) )
$terms[$level]['obr'] = 1;
_parseTreeToFilter( $node['left'], $terms, $level );
}
if ( $node['data']['type'] == 'cnj' )
{
$level++;
}
$terms[$level][$node['data']['type']] = $node['data']['value'];
if ( isset($node['right']) )
{
_parseTreeToFilter( $node['right'], $terms, $level );
if ( !empty($node['data']['bracket']) )
$terms[$level]['cbr'] = 1;
}
}
}
function parseTreeToFilter( $tree )
{
$terms = array();
if ( isset($tree) )
{
$level = 0;
_parseTreeToFilter( $tree, $terms, $level );
}
return( array( 'Query' => array( 'terms' => $terms ) ) );
$terms = array();
if ( isset($tree) )
{
$level = 0;
_parseTreeToFilter( $tree, $terms, $level );
}
return( array( 'Query' => array( 'terms' => $terms ) ) );
}
function parseTreeToQuery( $tree )
{
$filter = parseTreeToFilter( $tree );
parseFilter( $filter, false, '&' );
return( $filter['query'] );
$filter = parseTreeToFilter( $tree );
parseFilter( $filter, false, '&' );
return( $filter['query'] );
}
function _drawTree( $node, $level )
{
if ( isset($node['left']) )
{
_drawTree( $node['left'], $level+1 );
}
echo str_repeat( ".", $level*2 ).$node['data']['value']."<br>";
if ( isset($node['right']) )
{
_drawTree( $node['right'], $level+1 );
}
if ( isset($node['left']) )
{
_drawTree( $node['left'], $level+1 );
}
echo str_repeat( ".", $level*2 ).$node['data']['value']."<br>";
if ( isset($node['right']) )
{
_drawTree( $node['right'], $level+1 );
}
}
function drawTree( $tree )
{
_drawTree( $tree, 0 );
_drawTree( $tree, 0 );
}
function _extractDatetimeRange( &$node, &$minTime, &$maxTime, &$expandable, $subOr )
{
$pruned = $leftPruned = $rightPruned = false;
if ( $node )
{
if ( isset($node['left']) && isset($node['right']) )
{
if ( $node['data']['type'] == 'cnj' && $node['data']['value'] == 'or' )
{
$subOr = true;
}
elseif ( !empty($node['left']['data']['dtAttr']) )
{
if ( $subOr )
{
$expandable = false;
}
elseif ( $node['data']['type'] == 'op' )
{
if ( $node['data']['value'] == '>' || $node['data']['value'] == '>=' )
{
if ( !$minTime || $minTime > $node['right']['data']['sqlValue'] )
{
$minTime = $node['right']['data']['value'];
return( true );
}
}
if ( $node['data']['value'] == '<' || $node['data']['value'] == '<=' )
{
if ( !$maxTime || $maxTime < $node['right']['data']['sqlValue'] )
{
$maxTime = $node['right']['data']['value'];
return( true );
}
}
}
else
{
Fatal( "Unexpected node type '".$node['data']['type']."'" );
}
return( false );
}
$pruned = $leftPruned = $rightPruned = false;
if ( $node )
{
if ( isset($node['left']) && isset($node['right']) )
{
if ( $node['data']['type'] == 'cnj' && $node['data']['value'] == 'or' )
{
$subOr = true;
}
elseif ( !empty($node['left']['data']['dtAttr']) )
{
if ( $subOr )
{
$expandable = false;
}
elseif ( $node['data']['type'] == 'op' )
{
if ( $node['data']['value'] == '>' || $node['data']['value'] == '>=' )
{
if ( !$minTime || $minTime > $node['right']['data']['sqlValue'] )
{
$minTime = $node['right']['data']['value'];
return( true );
}
}
if ( $node['data']['value'] == '<' || $node['data']['value'] == '<=' )
{
if ( !$maxTime || $maxTime < $node['right']['data']['sqlValue'] )
{
$maxTime = $node['right']['data']['value'];
return( true );
}
}
}
else
{
Fatal( "Unexpected node type '".$node['data']['type']."'" );
}
return( false );
}
$leftPruned = _extractDatetimeRange( $node['left'], $minTime, $maxTime, $expandable, $subOr );
$rightPruned = _extractDatetimeRange( $node['right'], $minTime, $maxTime, $expandable, $subOr );
$leftPruned = _extractDatetimeRange( $node['left'], $minTime, $maxTime, $expandable, $subOr );
$rightPruned = _extractDatetimeRange( $node['right'], $minTime, $maxTime, $expandable, $subOr );
if ( $leftPruned && $rightPruned )
{
$pruned = true;
}
elseif ( $leftPruned )
{
$node = $node['right'];
}
elseif ( $rightPruned )
{
$node = $node['left'];
}
}
}
return( $pruned );
if ( $leftPruned && $rightPruned )
{
$pruned = true;
}
elseif ( $leftPruned )
{
$node = $node['right'];
}
elseif ( $rightPruned )
{
$node = $node['left'];
}
}
}
return( $pruned );
}
function extractDatetimeRange( &$tree, &$minTime, &$maxTime, &$expandable )
{
$minTime = "";
$maxTime = "";
$expandable = true;
$minTime = "";
$maxTime = "";
$expandable = true;
_extractDateTimeRange( $tree, $minTime, $maxTime, $expandable, false );
_extractDateTimeRange( $tree, $minTime, $maxTime, $expandable, false );
}
function appendDatetimeRange( &$tree, $minTime, $maxTime=false )
{
$attrNode = array( 'data'=>array( 'type'=>'attr', 'value'=>'StartDateTime', 'sqlValue'=>'E.StartTime', 'dtAttr'=>true ), 'count'=>0 );
$valNode = array( 'data'=>array( 'type'=>'val', 'value'=>$minTime, 'sqlValue'=>$minTime ), 'count'=>0 );
$opNode = array( 'data'=>array( 'type'=>'op', 'value'=>'>=', 'sqlValue'=>'>=' ), 'count'=>2, 'left'=>$attrNode, 'right'=>$valNode );
if ( isset($tree) )
{
$cnjNode = array( 'data'=>array( 'type'=>'cnj', 'value'=>'and', 'sqlValue'=>'and' ), 'count'=>2+$tree['count']+$opNode['count'], 'left'=>$tree, 'right'=>$opNode );
$tree = $cnjNode;
}
else
{
$tree = $opNode;
}
$attrNode = array( 'data'=>array( 'type'=>'attr', 'value'=>'StartDateTime', 'sqlValue'=>'E.StartTime', 'dtAttr'=>true ), 'count'=>0 );
$valNode = array( 'data'=>array( 'type'=>'val', 'value'=>$minTime, 'sqlValue'=>$minTime ), 'count'=>0 );
$opNode = array( 'data'=>array( 'type'=>'op', 'value'=>'>=', 'sqlValue'=>'>=' ), 'count'=>2, 'left'=>$attrNode, 'right'=>$valNode );
if ( isset($tree) )
{
$cnjNode = array( 'data'=>array( 'type'=>'cnj', 'value'=>'and', 'sqlValue'=>'and' ), 'count'=>2+$tree['count']+$opNode['count'], 'left'=>$tree, 'right'=>$opNode );
$tree = $cnjNode;
}
else
{
$tree = $opNode;
}
if ( $maxTime )
{
$attrNode = array( 'data'=>array( 'type'=>'attr', 'value'=>'StartDateTime', 'sqlValue'=>'E.StartTime', 'dtAttr'=>true ), 'count'=>0 );
$valNode = array( 'data'=>array( 'type'=>'val', 'value'=>$maxTime, 'sqlValue'=>$maxTime ), 'count'=>0 );
$opNode = array( 'data'=>array( 'type'=>'op', 'value'=>'<=', 'sqlValue'=>'<=' ), 'count'=>2, 'left'=>$attrNode, 'right'=>$valNode );
$cnjNode = array( 'data'=>array( 'type'=>'cnj', 'value'=>'and', 'sqlValue'=>'and' ), 'count'=>2+$tree['count']+$opNode['count'], 'left'=>$tree, 'right'=>$opNode );
$tree = $cnjNode;
}
if ( $maxTime )
{
$attrNode = array( 'data'=>array( 'type'=>'attr', 'value'=>'StartDateTime', 'sqlValue'=>'E.StartTime', 'dtAttr'=>true ), 'count'=>0 );
$valNode = array( 'data'=>array( 'type'=>'val', 'value'=>$maxTime, 'sqlValue'=>$maxTime ), 'count'=>0 );
$opNode = array( 'data'=>array( 'type'=>'op', 'value'=>'<=', 'sqlValue'=>'<=' ), 'count'=>2, 'left'=>$attrNode, 'right'=>$valNode );
$cnjNode = array( 'data'=>array( 'type'=>'cnj', 'value'=>'and', 'sqlValue'=>'and' ), 'count'=>2+$tree['count']+$opNode['count'], 'left'=>$tree, 'right'=>$opNode );
$tree = $cnjNode;
}
}
?>

View File

@ -142,7 +142,8 @@ foreach( dbFetchAll( $monitorsSql ) as $row ) {
# The as E, and joining with Monitors is required for the filterSQL filters.
$rangeSql = 'SELECT min(E.StartTime) AS MinTime, max(E.EndTime) AS MaxTime FROM Events AS E INNER JOIN Monitors AS M ON (E.MonitorId = M.Id) WHERE NOT isnull(E.StartTime) AND NOT isnull(E.EndTime)';
$eventsSql = 'SELECT * FROM Events AS E WHERE NOT isnull(StartTime)';
$eventsSql = 'SELECT * FROM Events AS E INNER JOIN Monitors AS M ON (E.MonitorId = M.Id) WHERE NOT isnull(StartTime)';
$eventsValues = array();
if ( !empty($user['MonitorIds']) ) {
$monFilterSql = ' AND MonitorId IN ('.$user['MonitorIds'].')';
@ -152,7 +153,7 @@ if ( !empty($user['MonitorIds']) ) {
}
if ( isset($_REQUEST['filter']) )
$tree = parseFilterToTree( $_REQUEST['filter']['Query'] );
$tree = parseFilterToTree($_REQUEST['filter']['Query']);
else
$tree = false;
@ -200,27 +201,27 @@ if ( isset($range) ) {
if ( isset($minTime) && isset($maxTime) ) {
$tempMinTime = $tempMaxTime = $tempExpandable = false;
extractDatetimeRange( $tree, $tempMinTime, $tempMaxTime, $tempExpandable );
$filterSql = parseTreeToSQL( $tree );
extractDatetimeRange($tree, $tempMinTime, $tempMaxTime, $tempExpandable);
$filterSql = parseTreeToSQL($tree);
if ( $filterSql ) {
$filterSql = " and $filterSql";
$filterSql = " AND $filterSql";
$eventsSql .= $filterSql;
}
} else {
$filterSql = parseTreeToSQL( $tree );
$filterSql = parseTreeToSQL($tree);
$tempMinTime = $tempMaxTime = $tempExpandable = false;
extractDatetimeRange( $tree, $tempMinTime, $tempMaxTime, $tempExpandable );
extractDatetimeRange($tree, $tempMinTime, $tempMaxTime, $tempExpandable);
if ( $filterSql ) {
$filterSql = " and $filterSql";
$filterSql = " AND $filterSql";
$rangeSql .= $filterSql;
$eventsSql .= $filterSql;
}
if ( !isset($minTime) || !isset($maxTime) ) {
// Dynamically determine range
$row = dbFetchOne( $rangeSql );
$row = dbFetchOne($rangeSql);
if ( !isset($minTime) )
$minTime = $row['MinTime'];
@ -233,7 +234,7 @@ if ( isset($minTime) && isset($maxTime) ) {
if ( empty($maxTime) )
$maxTime = $tempMaxTime;
if ( empty($maxTime) )
$maxTime = "now";
$maxTime = 'now';
$minTimeT = strtotime($minTime);
$maxTimeT = strtotime($maxTime);
@ -253,16 +254,16 @@ if ( $tree ) {
}
$scales = array(
array( 'name'=>"year", 'factor'=>60*60*24*365, 'align'=>1, 'zoomout'=>2, 'label'=>STRF_TL_AXIS_LABEL_YEAR ),
array( 'name'=>"month", 'factor'=>60*60*24*30, 'align'=>1, 'zoomout'=>12, 'label'=>STRF_TL_AXIS_LABEL_MONTH ),
array( 'name'=>"week", 'factor'=>60*60*24*7, 'align'=>1, 'zoomout'=>4.25, 'label'=>STRF_TL_AXIS_LABEL_WEEK, 'labelCheck'=>"%W" ),
array( 'name'=>"day", 'factor'=>60*60*24, 'align'=>1, 'zoomout'=>7, 'label'=>STRF_TL_AXIS_LABEL_DAY ),
array( 'name'=>'year', 'factor'=>60*60*24*365, 'align'=>1, 'zoomout'=>2, 'label'=>STRF_TL_AXIS_LABEL_YEAR ),
array( 'name'=>'month', 'factor'=>60*60*24*30, 'align'=>1, 'zoomout'=>12, 'label'=>STRF_TL_AXIS_LABEL_MONTH ),
array( 'name'=>'week', 'factor'=>60*60*24*7, 'align'=>1, 'zoomout'=>4.25, 'label'=>STRF_TL_AXIS_LABEL_WEEK, 'labelCheck'=>"%W" ),
array( 'name'=>'day', 'factor'=>60*60*24, 'align'=>1, 'zoomout'=>7, 'label'=>STRF_TL_AXIS_LABEL_DAY ),
array( 'name'=>"hour4", 'factor'=>60*60, 'align'=>4, 'zoomout'=>6, 'label'=>STRF_TL_AXIS_LABEL_4HOUR, 'labelCheck'=>"%H" ),
array( 'name'=>"hour", 'factor'=>60*60, 'align'=>1, 'zoomout'=>4, 'label'=>STRF_TL_AXIS_LABEL_HOUR, 'labelCheck'=>"%H" ),
array( 'name'=>'hour', 'factor'=>60*60, 'align'=>1, 'zoomout'=>4, 'label'=>STRF_TL_AXIS_LABEL_HOUR, 'labelCheck'=>"%H" ),
array( 'name'=>"minute10", 'factor'=>60, 'align'=>10, 'zoomout'=>6, 'label'=>STRF_TL_AXIS_LABEL_10MINUTE, 'labelCheck'=>"%M" ),
array( 'name'=>"minute", 'factor'=>60, 'align'=>1, 'zoomout'=>10, 'label'=>STRF_TL_AXIS_LABEL_MINUTE, 'labelCheck'=>"%M" ),
array( 'name'=>'minute', 'factor'=>60, 'align'=>1, 'zoomout'=>10, 'label'=>STRF_TL_AXIS_LABEL_MINUTE, 'labelCheck'=>"%M" ),
array( 'name'=>"second10", 'factor'=>1, 'align'=>10, 'zoomout'=>6, 'label'=>STRF_TL_AXIS_LABEL_10SECOND ),
array( 'name'=>"second", 'factor'=>1, 'align'=>1, 'zoomout'=>10, 'label'=>STRF_TL_AXIS_LABEL_SECOND ),
array( 'name'=>'second', 'factor'=>1, 'align'=>1, 'zoomout'=>10, 'label'=>STRF_TL_AXIS_LABEL_SECOND ),
);
$majXScale = getDateScale( $scales, $range, $chart['grid']['x']['major']['min'], $chart['grid']['x']['major']['max'] );
@ -288,10 +289,10 @@ $midTime = strftime( STRF_FMT_DATETIME_DB, $midTimeT );
//echo "MxTt:$maxTimeT<br>";
if ( isset($minTime) && isset($maxTime) ) {
$eventsSql .= " and EndTime >= '$minTime' and StartTime <= '$maxTime'";
$eventsSql .= " AND EndTime >= '$minTime' AND StartTime <= '$maxTime'";
}
$eventsSql .= ' order by Id asc';
$eventsSql .= ' ORDER BY E.Id ASC';
//echo "ESQL: $eventsSql<br>";
$chart['data'] = array(
@ -361,14 +362,13 @@ if ( $event ) {
}
if ( $event['MaxScore'] > 0 ) {
Warning("Has max Scoer");
if ( $startIndex == $endIndex ) {
$framesSql = 'SELECT FrameId,Score FROM Frames WHERE EventId = ? AND Score > 0 ORDER BY Score DESC LIMIT 1';
$frame = dbFetchOne( $framesSql, NULL, array($event['Id']) );
$frame = dbFetchOne($framesSql, NULL, array($event['Id']));
$i = $startIndex;
if ( !isset($currFrameSlots[$i]) ) {
$currFrameSlots[$i] = array( 'count'=>1, 'value'=>$event['MaxScore'], 'event'=>$event, 'frame'=>$frame );
$currFrameSlots[$i] = array('count'=>1, 'value'=>$event['MaxScore'], 'event'=>$event, 'frame'=>$frame);
} else {
$currFrameSlots[$i]['count']++;
if ( $event['MaxScore'] > $currFrameSlots[$i]['value'] ) {
@ -382,8 +382,8 @@ if ( $event ) {
}
} else {
$framesSql = 'SELECT FrameId,Delta,unix_timestamp(TimeStamp) AS TimeT,Score FROM Frames WHERE EventId = ? AND Score > 0';
$result = dbQuery( $framesSql, array( $event['Id'] ) );
while( $frame = dbFetchNext( $result ) ) {
$result = dbQuery($framesSql, array($event['Id']));
while( $frame = dbFetchNext($result) ) {
if ( $frame['Score'] == 0 )
continue;
$frameTimeT = $frame['TimeT'];
@ -395,7 +395,7 @@ if ( $event ) {
continue;
if ( !isset($currFrameSlots[$frameIndex]) ) {
$currFrameSlots[$frameIndex] = array( 'count'=>1, 'value'=>$frame['Score'], 'event'=>$event, 'frame'=>$frame );
$currFrameSlots[$frameIndex] = array('count'=>1, 'value'=>$frame['Score'], 'event'=>$event, 'frame'=>$frame);
} else {
$currFrameSlots[$frameIndex]['count']++;
if ( $frame['Score'] > $currFrameSlots[$frameIndex]['value'] ) {
@ -426,7 +426,7 @@ if ( false ) {
for ( $i = 0; $i < $chart['graph']['width']; $i++ ) {
if ( isset($currFrameSlots[$i]) ) {
if ( !isset($currFrameSlots[$i]['frame']) ) {
$framesSql = "select FrameId,Score from Frames where EventId = ? and Score > 0 order by FrameId limit 1";
$framesSql = "SELECT FrameId,Score FROM Frames WHERE EventId = ? AND Score > 0 ORDER BY FrameId LIMIT 1";
$currFrameSlots[$i]['frame'] = dbFetchOne( $framesSql, NULL, array( $currFrameSlots[$i]['event']['Id'] ) );
}
}
@ -488,7 +488,7 @@ $frameSlots = array();
$frameMonitorIds = array_keys($monFrameSlots);
for ( $i = 0; $i < $chart['graph']['width']; $i++ ) {
foreach ( $frameMonitorIds as $frameMonitorId ) {
unset( $currFrameSlots );
unset($currFrameSlots);
$currFrameSlots = &$monFrameSlots[$frameMonitorId];
if ( isset($currFrameSlots[$i]) ) {
if ( !isset($frameSlots[$i]) ) {
@ -595,7 +595,7 @@ function drawXGrid( $chart, $scale, $labelClass, $tickClass, $gridClass, $zoomCl
unset( $lastLabel );
$labelCheck = isset($scale['labelCheck'])?$scale['labelCheck']:$scale['label'];
?>
<div id="xScale">
<div id='xScale'>
<?php
for ( $i = 0; $i < $chart['graph']['width']; $i++ ) {
$x = $i - 1;
@ -655,7 +655,7 @@ function drawXGrid( $chart, $scale, $labelClass, $tickClass, $gridClass, $zoomCl
function drawYGrid( $chart, $scale, $labelClass, $tickClass, $gridClass ) {
ob_start();
?>
<div id="yScale">
<div id='yScale'>
<?php
for ( $i = 0; $i < $scale['lines']; $i++ ) {
$label = (int)($i * $scale['divisor']);
@ -699,30 +699,30 @@ $focusWindow = true;
xhtmlHeaders(__FILE__, translate('Timeline') );
?>
<body>
<div id="page">
<div id='page'>
<?php echo getNavBarHTML() ?>
<div id="header">
<div id="info">
<div id='header'>
<div id='info'>
<h2><?php echo translate('Timeline') ?></h2>
<a id="refreshLink" href="#" onclick="location.reload(true);"><?php echo translate('Refresh') ?></a>
<a id='refreshLink' href="#" onclick="location.reload(true);"><?php echo translate('Refresh') ?></a>
</div>
<div id="headerButtons">
<div id='headerButtons'>
<a href="#" onclick="window.history.back();"><?php echo translate('Back') ?></a>
<a href="?view=events&amp;page=1<?php echo htmlspecialchars($filterQuery) ?>"><?php echo translate('List') ?></a>
</div>
</div>
<div id="content" class="chartSize">
<div id="topPanel" class="graphWidth">
<div id="imagePanel">
<div id="image" class="imageHeight">
<img id="imageSrc" class="imageWidth" src="graphics/transparent.png" alt="<?php echo translate('ViewEvent') ?>" title="<?php echo translate('ViewEvent') ?>"/>
<div id='content' class='chartSize'>
<div id='topPanel' class='graphWidth'>
<div id='imagePanel'>
<div id='image' class='imageHeight'>
<img id='imageSrc' class='imageWidth' src="graphics/transparent.png" alt="<?php echo translate('ViewEvent') ?>" title="<?php echo translate('ViewEvent') ?>"/>
<?php
if ( 0 ) {
//due to chrome bug, has to enable https://code.google.com/p/chromium/issues/detail?id=472300
//crossorigin has to be added below to make caption work in chrome
?>
<!--
<video id="preview" width="100%" controls crossorigin="anonymous">
<video id='preview' width="100%" controls crossorigin='anonymous'>
<source src="<?php echo getEventDefaultVideoPath($first_event); ?>" type="video/mp4">
Your browser does not support the video tag.
</video>
@ -731,26 +731,26 @@ o-->
</div>
</div>
<div id="dataPanel">
<div id="textPanel">
<div id="instruction">
<div id='dataPanel'>
<div id='textPanel'>
<div id='instruction'>
<p><?php echo translate('TimelineTip1') ?></p>
<p><?php echo translate('TimelineTip2') ?></p>
<p><?php echo translate('TimelineTip3') ?></p>
<p><?php echo translate('TimelineTip4') ?></p>
</div>
<div id="eventData">
<div id='eventData'>
</div>
</div>
<div id="navPanel">
<input type="button" title="<?php echo translate('PanLeft') ?>" value="&lt;&lt;" onclick="tlPan( '<?php echo $minTime ?>', '<?php echo $range ?>' )"/>
<input type="button" title="<?php echo translate('ZoomOut') ?>" value="&ndash;" onclick="tlZoomRange( '<?php echo $midTime ?>', '<?php echo (int)($range*$majXScale['zoomout']) ?>' )"/>
<input type="button" title="<?php echo translate('PanRight') ?>" value="&gt;&gt;" onclick="tlPan( '<?php echo $maxTime ?>', '<?php echo $range ?>' )"/>
<div id='navPanel'>
<input type='button' title="<?php echo translate('PanLeft') ?>" value="&lt;&lt;" onclick="tlPan( '<?php echo $minTime ?>', '<?php echo $range ?>' )"/>
<input type='button' title="<?php echo translate('ZoomOut') ?>" value="&ndash;" onclick="tlZoomRange( '<?php echo $midTime ?>', '<?php echo (int)($range*$majXScale['zoomout']) ?>' )"/>
<input type='button' title="<?php echo translate('PanRight') ?>" value="&gt;&gt;" onclick="tlPan( '<?php echo $maxTime ?>', '<?php echo $range ?>' )"/>
</div>
</div>
</div>
<div id="chartPanel">
<div id="chart" class="graphSize">
<div id='chartPanel'>
<div id='chart' class='graphSize'>
<?php
if ( $mode == 'overlay' ) {
echo drawYGrid( $chart, $majYScale, 'majLabelY', 'majTickY', 'majGridY graphWidth' );
@ -759,7 +759,7 @@ echo drawXGrid( $chart, $majXScale, 'majLabelX', 'majTickX', 'majGridX graphHeig
Warning("Mode: $mode");
if ( $mode == 'overlay' ) {
?>
<div id="activity" class="activitySize">
<div id='activity' class='activitySize'>
<?php
foreach ( $frameSlots as $index=>$slots ) {
foreach ( $slots as $slot ) {
@ -770,16 +770,16 @@ if ( $mode == 'overlay' ) {
if ( $mouseover ) {
$behaviours = array(
'onclick="'.getSlotShowEventBehaviour( $slot ).'"',
'onmouseover="'.getSlotPreviewEventBehaviour( $slot ).'"'
'onclick="'.getSlotShowEventBehaviour($slot).'"',
'onmouseover="'.getSlotPreviewEventBehaviour($slot).'"'
);
} else {
$behaviours = array(
'onclick="'.getSlotPreviewEventBehaviour( $slot ).'"'
'onclick="'.getSlotPreviewEventBehaviour($slot).'"'
);
}
?>
<div class="activity monitorColour<?php echo $slot['event']['MonitorId'] ?>" style="left: <?php echo $index ?>px; height: <?php echo $slotHeight ?>px;" <?php echo join( " ", $behaviours ) ?>></div>
<div class="activity monitorColour<?php echo $slot['event']['MonitorId'] ?>" style="left: <?php echo $index ?>px; height: <?php echo $slotHeight ?>px;" <?php echo join( ' ', $behaviours ) ?>></div>
<?php
}
}
@ -791,7 +791,7 @@ if ( $mode == 'overlay' ) {
?>
<div id="activity<?php echo $monitorId ?>">
<?php
unset( $currFrameSlots );
unset($currFrameSlots);
$currFrameSlots = &$monFrameSlots[$monitorId];
foreach ( $currFrameSlots as $index=>$slot ) {
$slotHeight = (int)($slot['value']/$chart['data']['y']['density']);
@ -801,16 +801,16 @@ if ( $mode == 'overlay' ) {
if ( $mouseover ) {
$behaviours = array(
'onclick="'.getSlotShowEventBehaviour( $slot ).'"',
'onmouseover="'.getSlotPreviewEventBehaviour( $slot ).'"'
'onclick="'.getSlotShowEventBehaviour($slot).'"',
'onmouseover="'.getSlotPreviewEventBehaviour($slot).'"'
);
} else {
$behaviours = array(
'onclick="'.getSlotPreviewEventBehaviour( $slot ).'"'
'onclick="'.getSlotPreviewEventBehaviour($slot).'"'
);
}
?>
<div class="activity activity<?php echo $slot['event']['MonitorId'] ?>" style="left: <?php echo $index ?>px; height: <?php echo $slotHeight ?>px;" <?php echo join( " ", $behaviours ) ?>></div>
<div class="activity activity<?php echo $slot['event']['MonitorId'] ?>" style="left: <?php echo $index ?>px; height: <?php echo $slotHeight ?>px;" <?php echo join( ' ', $behaviours ) ?>></div>
<?php
} # end foreach $currFrameSlots
?>
@ -831,16 +831,16 @@ foreach( array_keys($monEventSlots) as $monitorId ) {
if ( $mouseover ) {
$behaviours = array(
'onclick="'.getSlotShowEventBehaviour( $slot ).'"',
'onmouseover="'.getSlotPreviewEventBehaviour( $slot ).'"'
'onclick="'.getSlotShowEventBehaviour($slot).'"',
'onmouseover="'.getSlotPreviewEventBehaviour($slot).'"'
);
} else {
$behaviours = array(
'onclick="'.getSlotPreviewEventBehaviour( $slot ).'"'
'onclick="'.getSlotPreviewEventBehaviour($slot).'"'
);
}
?>
<div class="event eventsHeight monitorColour<?php echo $monitorId ?>" style="left: <?php echo $i ?>px; width: <?php echo $slot['width'] ?>px;" <?php echo join( " ", $behaviours ) ?>></div>
<div class="event eventsHeight monitorColour<?php echo $monitorId ?>" style="left: <?php echo $i ?>px; width: <?php echo $slot['width'] ?>px;" <?php echo join( ' ', $behaviours ) ?>></div>
<?php
} # end if isset($currEventSlots[$i])
} # end foreach width segment
@ -851,22 +851,21 @@ foreach( array_keys($monEventSlots) as $monitorId ) {
?>
</div>
</div>
<div id="chartLabels" class="graphWidth">
<div id="key">
<div id='chartLabels' class='graphWidth'>
<div id='key'>
<?php
foreach( array_keys($monEventSlots) as $monitorId ) {
?>
<span class="keyEntry"><?php echo $monitors[$monitorId]['Name'] ?>
<span class='keyEntry'><?php echo $monitors[$monitorId]['Name'] ?>
<img id="keyBox<?php echo $monitorId ?>" class="keyBox monitorColour<?php echo $monitorId ?>" src="graphics/transparent.png" alt="<?php echo $monitors[$monitorId]['Name'] ?>"/>
</span>
<?php
}
?>
</div>
<div id="range"><?php echo $title ?></div>
<div id='range'><?php echo $title ?></div>
</div>
</div>
</div>
<script src="skins/<?php echo $skin ?>/js/moment.min.js"></script>
</body>
</html>