Bug 333 - Fixed weekday handling problem in filters.

git-svn-id: http://svn.zoneminder.com/svn/zm/trunk@1981 e3e1d417-86f3-4887-817a-d78f3d33393f
This commit is contained in:
stan 2006-05-10 13:39:12 +00:00
parent 996fc712cd
commit 04f5aee7ce
2 changed files with 9 additions and 4 deletions

View File

@ -1256,9 +1256,6 @@ function parseFilter( $save_to_session=false, $term_sep='&' )
case 'Time': case 'Time':
$value = "extract( hour_second from '".strftime( STRF_FMT_DATETIME_DB, strtotime( $value ) )."' )"; $value = "extract( hour_second from '".strftime( STRF_FMT_DATETIME_DB, strtotime( $value ) )."' )";
break; break;
case 'Weekday':
$value = "weekday( '".strftime( STRF_FMT_DATETIME_DB, strtotime( $value ) )."' )";
break;
} }
$value_list[] = $value; $value_list[] = $value;
} }

View File

@ -119,6 +119,11 @@ $archive_types = array(
'0' => $zmSlangArchUnarchived, '0' => $zmSlangArchUnarchived,
'1' => $zmSlangArchArchived '1' => $zmSlangArchArchived
); );
$weekdays = array();
for ( $i = 0; $i < 7; $i++ )
{
$weekdays[$i] = strftime( "%A", mktime( 12, 0, 0, 1, $i+1, 2001 ) );
}
$sort_fields = array( $sort_fields = array(
'Id' => $zmSlangAttrId, 'Id' => $zmSlangAttrId,
'Name' => $zmSlangAttrName, 'Name' => $zmSlangAttrName,
@ -287,7 +292,7 @@ window.focus();
</tr> </tr>
<tr> <tr>
<td colspan="4"> <td colspan="4">
<table width="100%" border="0" cellspacing="0" cellpadding="0"> <table width="100%" border="0" cellspacing="1" cellpadding="0">
<?php <?php
for ( $i = 1; $i <= $trms; $i++ ) for ( $i = 1; $i <= $trms; $i++ )
{ {
@ -318,6 +323,9 @@ else
<?php if ( $$attr_name == "Archived" ) { ?> <?php if ( $$attr_name == "Archived" ) { ?>
<td class="text"><center><?= $zmSlangOpEq ?><input type="hidden" name="<?= $op_name ?>" value="="></center></td> <td class="text"><center><?= $zmSlangOpEq ?><input type="hidden" name="<?= $op_name ?>" value="="></center></td>
<td class="text"><?= buildSelect( $value_name, $archive_types ); ?></td> <td class="text"><?= buildSelect( $value_name, $archive_types ); ?></td>
<?php } elseif ( $$attr_name == "Weekday" ) { ?>
<td class="text"><?= buildSelect( $op_name, $op_types ); ?></td>
<td class="text"><?= buildSelect( $value_name, $weekdays ); ?></td>
<?php } elseif ( $$attr_name ) { ?> <?php } elseif ( $$attr_name ) { ?>
<td class="text"><?= buildSelect( $op_name, $op_types ); ?></td> <td class="text"><?= buildSelect( $op_name, $op_types ); ?></td>
<td class="text"><input name="<?= $value_name ?>" value="<?= $$value_name ?>" class="form" size="24"></td> <td class="text"><input name="<?= $value_name ?>" value="<?= $$value_name ?>" class="form" size="24"></td>