no result to display if the list is empty

master
Y 2016-01-26 19:55:42 +01:00
parent c66afedb17
commit 18866c3157
1 changed files with 16 additions and 10 deletions

View File

@ -62,30 +62,36 @@ if (array_key_exists('doDownload', $_REQUEST)) {
$json = @$_REQUEST['queryDone']; $json = @$_REQUEST['queryDone'];
} }
if ($json) { if ($json) {
$current = (array_key_exists('doThumbnails', $_REQUEST) ? $_REQUEST['doThumbnails'] : @$_REQUEST['currentDoc']); if ($json == '[]') {
?>
<p>No result.</p>
<?php
} else {
$current = (array_key_exists('doThumbnails', $_REQUEST) ? $_REQUEST['doThumbnails'] : @$_REQUEST['currentDoc']);
?> ?>
<h2>Documents found</h2> <h2>Documents found</h2>
<input type="hidden" name="queryDone" value="<?php echo htmlentities($json); ?>"/> <input type="hidden" name="queryDone" value="<?php echo htmlentities($json); ?>"/>
<?php <?php
foreach (json_decode($json, true) as $doc) { foreach (json_decode($json, true) as $doc) {
$docId = $doc['folder'].'|'.$doc['type']; $docId = $doc['folder'].'|'.$doc['type'];
?> ?>
<button type="submit" name="doThumbnails" value="<?php echo htmlentities($docId); ?>"<?php <button type="submit" name="doThumbnails" value="<?php echo htmlentities($docId); ?>"<?php
if ($docId == $current) { if ($docId == $current) {
echo ' disabled="disabled"'; echo ' disabled="disabled"';
} }
?>> ?>>
<h3><?php echo preg_replace('/^(....)(..)(..).*$/', '$1-$2-$3', $doc['folder']); ?></h3> <h3><?php echo preg_replace('/^(....)(..)(..).*$/', '$1-$2-$3', $doc['folder']); ?></h3>
<p><?php echo $doc['count']; ?> pages (<?php echo ($doc['type']=='pdf'?'PDF':'images'); ?>)</p> <p><?php echo $doc['count']; ?> pages (<?php echo ($doc['type']=='pdf'?'PDF':'images'); ?>)</p>
<?php if (count($doc['labels'])) { ?> <?php if (count($doc['labels'])) { ?>
<ul> <ul>
<?php foreach ($doc['labels'] as $lab) { ?> <?php foreach ($doc['labels'] as $lab) { ?>
<li><?php echo htmlentities($lab); ?></li> <li><?php echo htmlentities($lab); ?></li>
<?php } ?> <?php } ?>
</ul> </ul>
<?php } ?> <?php } ?>
</button> </button>
<?php <?php
}
} }
} }
?> ?>