<?php
// file: public/partials/cemetery-sexton-results.php
/**
 * Provide a public-facing view for the plugin
 *
 * This file is used to markup the public-facing aspects of the plugin.
 *
 * @link       https://orbicular.media
 * @since      1.1.0
 *
 * @package    Cemetery_Sexton
 * @subpackage Cemetery_Sexton/public/partials
 */
?>
<div id="cemetery-sexton-results">
    <div class="group">
        <div class="left-align">
        	<?php // Results x to xx of xxx
        	echo $thisPagination->displayResultInfo();
        	?>
        </div>
        <div class="right-align">
        	<?php // Show 25 50 75 100 Results
        	echo $thisPagination->renderResultsByPage($pagi['orderby'],$pagi['sorttype'],$pagi['pagename'],$pagi['recpage'],$pagi['pageparams']);
        	?>
        </div>
    </div>
    <table class="cemetery-sexton-results-list">
    	<thead>
    		<tr>
    			<th class="title" id="header-name"><?php echo $thisPagination->renderTableHeader('Name','name',$pagi['orderby'],$pagi['newsorttype'],$pagi['pagename'],$pagi['recpage'],$pagi['pageparams']); ?></th>
    			<th class="title" id="header-dob"><?php echo $thisPagination->renderTableHeader('Date of Birth','DateBirth',$pagi['orderby'],$pagi['newsorttype'],$pagi['pagename'],$pagi['recpage'],$pagi['pageparams']); ?></th>
    			<th class="title" id="header-dod"><?php echo $thisPagination->renderTableHeader('Date of Death','DateDeath',$pagi['orderby'],$pagi['newsorttype'],$pagi['pagename'],$pagi['recpage'],$pagi['pageparams']); ?></th>
    		</tr>
    	</thead>
    	<tbody>
    	<?php
    	foreach ($interRow as $rsInter){
    		//$link = '?pagename=interment&InterID='. $rsInter['InterID'];
    		//$redirect = get_site_url(null, $link);
    	    $redirect = esc_html( add_query_arg( 'InterID', $rsInter['InterID'], get_permalink(get_option('cemetery-sexton')['page_interment']) ) );
    		?>
    		<tr>
    			<td class="result-name"><a href="<?php echo $redirect; ?>"><?php echo $rsInter['FirstName'].' '.$rsInter['MidName'].' '.$rsInter['LastName'].' '.$rsInter['Suffix']; ?></a></td>
    			<td class="result-date"><a href="<?php echo $redirect; ?>"><?php echo $tools->tools_dateFormat($rsInter['DateBirth']); ?></a></td>
    			<td class="result-date"><a href="<?php echo $redirect; ?>"><?php echo $tools->tools_dateFormat($rsInter['DateDeath']); ?></a></td>
    		</tr>
    		<?php } ?>
    	</tbody>
    </table>
    <div class="group">
        <div class="left-align">
            <?php // Show 25 50 75 100 Results
        	echo $thisPagination->displayPageInfo();
        	?>
        </div>
        <div class="right-align">
        	<?php // Results x to xx of xxx
            echo $thisPagination->renderNavigation($pagi['orderby'],$pagi['sorttype'],$pagi['pagename'],$pagi['recpage'],$pagi['pageparams']);
            ?>
        </div>
    </div>
</div>