Ejemplo n.º 1
0
    $found = $result->getFoundSetCount();
    //Setup sort by type
    $fileType = $records[0]->getField('Source_Type');
    if ($fileType != "Video") {
        $fileType = "Images";
    }
    echo '<div class="recordSeparator">' . $fileType . '</div>';
    foreach ($records as $record) {
        //searchResultDisplay($record,$fileType);
        if ($record->getField('Source_Type') == "Video") {
            displayVideoPreview($record);
        } else {
            if ($fileType != "Images") {
                echo '<p>&nbsp;</p><div class="recordSeparator">Images</div>';
            }
            displayImgPreview($record);
            $fileType = "Images";
        }
    }
    include 'includes/pagination.php';
}
?>

<?php 
include 'footer.php';
?>




function fmDisplaySearchResults($result, $whetherToPaginate)
{
    global $skip, $paginate_number, $max, $page, $querystring;
    // If an error is found, return a message and exit.
    if (FileMaker::isError($result)) {
        echo "Error: " . $result->getMessage() . "<br>";
        //exit;
    } else {
        // Get records from found set
        $records = $result->getRecords();
        $found = $result->getFoundSetCount();
        //Setup sort by type
        $fileType = $records[0]->getField('Source_Type');
        if ($fileType != "Video") {
            $fileType = "Images";
        }
        echo '<div class="recordSeparator">' . $fileType . '</div>';
        foreach ($records as $record) {
            //searchResultDisplay($record,$fileType);
            if ($record->getField('Source_Type') == "Video") {
                displayVideoPreview($record);
            } else {
                if ($fileType != "Images") {
                    echo '<p>&nbsp;</p><div class="recordSeparator">Images</div>';
                }
                displayImgPreview($record);
                $fileType = "Images";
            }
        }
        if ($whetherToPaginate) {
            // adds pagination if specified. Disabled for "recent additions" mode.
            ?>

			<div style="clear: both; padding-top: 20px; text-align: right;"><!--pagination div-->
			<?php 
            //pagination
            $displayed = count($records);
            $pagenum = ceil($skip / $max + 1);
            $pagetotal = ceil($found / $max);
            if ($skip + $max > $found) {
                $next = $skip;
            }
            echo "Displaying <b>{$displayed}</b> of <b>{$found}</b> results<br /><br />";
            paginate($querystring, $page, $pagetotal);
            ?>
			</div>
			<?php 
        }
    }
}