whitespace and add a test for ->Triggers being an array

This commit is contained in:
Isaac Connor 2017-03-31 12:01:37 -04:00
parent d1a60dedc8
commit 514c83d3e9
1 changed files with 14 additions and 14 deletions

View File

@ -768,22 +768,22 @@ switch ( $tab )
<tr><td><?php echo translate('Triggers') ?></td><td> <tr><td><?php echo translate('Triggers') ?></td><td>
<?php <?php
$optTriggers = getSetValues( 'Monitors', 'Triggers' ); $optTriggers = getSetValues( 'Monitors', 'Triggers' );
$breakCount = (int)(ceil(count($optTriggers))); $breakCount = (int)(ceil(count($optTriggers)));
$breakCount = min( 3, $breakCount ); $breakCount = min( 3, $breakCount );
$optCount = 0; $optCount = 0;
foreach( $optTriggers as $optTrigger ) foreach( $optTriggers as $optTrigger ) {
{ if ( ( ! ZM_OPT_X10 ) && ( $optTrigger == 'X10' ) )
if ( !ZM_OPT_X10 && $optTrigger == 'X10' ) continue;
continue; if ( $optCount && ($optCount%$breakCount == 0) )
if ( $optCount && ($optCount%$breakCount == 0) ) echo '</br>';
echo "</br>"; echo '<input type="checkbox" name="newMonitor[Triggers][]" value="'. $optTrigger .'"';
?> if ( isset($monitor->Triggers) && is_array( $monitor->Triggers ) and in_array( $optTrigger, $monitor->Triggers ) ) {
<input type="checkbox" name="newMonitor[Triggers][]" value="<?php echo $optTrigger ?>"<?php if ( isset($monitor->Triggers) && in_array( $optTrigger, $monitor->Triggers ) ) { ?> checked="checked"<?php } ?>/>&nbsp;<?php echo $optTrigger ?> echo ' checked="checked"';
<?php }
echo '/>&nbsp;'. $optTrigger ;
$optCount ++; $optCount ++;
} }
if ( !$optCount ) if ( !$optCount ) {
{
?> ?>
<em><?php echo translate('NoneAvailable') ?></em> <em><?php echo translate('NoneAvailable') ?></em>
<?php <?php