
<?php
$pagination = new Pagination();
$pagination->setLink("screenshots?page=%s");
$pagination->setPage($page);
$pagination->setSize($size);
$pagination->setTotalRecords($total);
$screenshots = ScreenshotsData::getpagnated($pagination->getLimitSql());
?>
<div class="row">
	<div class="col-md-12">
		<div class="content-header">
		<div class="header-section">
			<h1>
				<i class="fa fa-image"></i><strong>Screenshot</strong> Center<br><small>Utilities | <?php echo SITE_NAME; ?> &copy; <?php echo date("Y"); ?></small>
			</h1>
		</div>
	</div>
	</div>
	
</div>
<ol class="breadcrumb breadcrumb-top">
  <li><a href="<?php echo SITE_URL; ?>/index.php"><i class="fa fa-home"></i></a></li>
  <li><a href="<?php echo SITE_URL; ?>/index.php/Screenshots">Screenshots</a></li>
</ol>

<div class="widget">
  <div class="widget-advanced widget-advanced-alt">
    <div class="widget-main">
		
    <center>
	<div class="widget">
        <div class="widget-advanced widget-advanced-alt">
    		<div class="widget-main">
    			<h3><strong>Screenshots</strong><br><small>The best, and only the best!</small><br><br><center>
			<a href="<?php if(PilotGroups::group_has_perm(Auth::$usergroups, ACCESS_ADMIN)) {echo url('screenshots/approval_list');?>" class="btn btn-md btn-primary"> Approval List</a> <?php } ?>
			<a href="<?php echo url('screenshots/upload');?>" class="btn btn-md btn-success animation pulseSlow"><i class="fa fa-cloud-upload"></i>&nbsp; Upload Mine</a>
			</center></h3>
    				<div class="gallery gallery-widget" data-toggle="lightbox-gallery">
        	<div class="row">
        		
        <?php
          if (!$screenshots) {echo '<div id="error">Oops! There are no screenshots yet! Wanna showcase yours? Click UPLOAD <br><br></div>'; }
          else {
          echo '<table class="profiletop">';
          $tiles=0;
          foreach($screenshots as $screenshot) {
          $comments = ScreenshotsData::get_comments($screenshot_id);
          $pilot = PilotData::getpilotdata($screenshot->pilot_id);
          if(!$screenshot->file_description)
          {$screenshot->file_description = 'Not Available';}
          if ($tiles == '0') { echo '<tr>'; } ?>
           
          <?php
          echo '
          
          <div class="col-xs-6 col-sm-3">
          <div class="gallery-image">
					<img src="'.SITE_URL.'/pics/'.$screenshot->file_name.'" alt="'.$screenshot->file_description.'" alt="By: '.$pilot->firstname.' '.$pilot->lastname.'">
					<div class="gallery-image-options">
					<a href="'.SITE_URL.'/index.php/Screenshots/large_screenshot?id='.$screenshot->id.'" class="btn btn-sm btn-alt btn-primary" data-toggle="tooltip" title="" data-original-title="Seen by"><i class="fa fa-eye"></i> '.$screenshot->views.' </a>
					<a href="'.SITE_URL.'/index.php/Screenshots/large_screenshot?id='.$screenshot->id.'" class="btn btn-sm btn-alt btn-primary" data-toggle="tooltip" title="" data-original-title="Rate this screenshot"><i class="fa fa-thumbs-up"></i> '.$screenshot->rating.'</a>
					<a href="'.SITE_URL.'/index.php/Screenshots/large_screenshot?id='.$screenshot->id.'" class="btn btn-sm btn-alt btn-primary" data-toggle="tooltip" title="" data-original-title="Comment on this screenshot"><i class="fa fa-comments-o"></i> '.count($comments).'</a><br><br>
					<a href="'.SITE_URL.'/pics/'.$screenshot->file_name.'" title="Uploaded by : '.$pilot->firstname.' '.$pilot->lastname.' - '.PilotData::getpilotcode($pilot->code, $pilot->pilotid).' <br> Description : '.$screenshot->file_description.'" class="gallery-link btn btn-md btn-primary">View</a>
					
					</div>
			</div></div>
          
        ';
        $tiles++;
        if ($tiles == '4') {  echo '</tr>'; $tiles=0; }
    }
    echo '</table>';
}

?>
<br><br>
<div class="col-md-12">
	<div class="pull-center">
		<?php $navigation = $pagination->create_links();
			echo $navigation; ?>
	</div>
</div>
    </div>
      </div>
    </div>
  </div>
</div></center>
		</div>
	</div>
</div>
<!--<td width="25%" valign="top"><br />
                    
                    <a href="'.SITE_URL.'/index.php/Screenshots/large_screenshot?id='.$screenshot->id.'">
                        <img src="'.SITE_URL.'/pics/'.$screenshot->file_name.'" border="0" width="200px" height="150px" alt="By: '.$pilot->firstname.' '.$pilot->lastname.'" /></a>
                            <br />
                    <u>Submited By:</u>  - '.PilotData::getpilotcode($pilot->code, $pilot->pilotid).'<br />
                    <u>Date:</u> '.date('m/d/Y', strtotime($screenshot->date_uploaded)).'<br />
                    <u>Description:</u> '.$screenshot->file_description.'<br /><br />
                </td>-->



