
<?php include("php/session.php"); ?>
<?php include("header.php"); ?>
<style>
.loader { position: fixed; left: 0px; top: 0px; width: 100%; height: 100%; z-index: 9999; background: url('images/ajax.gif') 50% 50% no-repeat rgb(249,249,249); }    
</style>
	<script type="text/javascript">
		$(document).live( "pagecreate", function() {
		});
                
	</script>
	<center><h3><?php echo 'Alerts'; ?></h3></center>
	<div data-role="content">
	
		<div class="ui-body ui-body-d">
                 <div class="loader">
		<?php
					$user = $_SESSION['user_id'];
					$limit=10;
					$page=1;
					$query = "select alm.add_date, alm.alert_header, alm.alert_msg from alert_master alm join assests_master am on find_in_set(am.id,alm.assets_id) and am.status=1 where alm.user_id='$user' order by alm.add_date desc LIMIT $limit";

					/*$res=mysql_query($query) or die($query.mysql_error());
					$count = mysql_num_rows($res);
					if( $count > 0 ) {
							$total_pages = ceil($count/$limit);    
					} else {
							$total_pages = 0;
					}
					if ($page > $total_pages)  
							$page=$total_pages;
					$start = $limit*$page - $limit; 
					$start = ($start<0)?0:$start;
					$query .= " order by add_date desc LIMIT $start, $limit";*/

					$res=mysql_query($query) or die($query.mysql_error());
					if(mysql_num_rows($res)<1)
					{
						echo "<center><b>".$lang['No Data Found']."</b></center>";
					}else{
						//$row=mysql_fetch_array($res);
						echo '<div style="width: 100%; overflow: auto"><table data-role="table" id="table-custom-2" data-mode="columntoggle" class="ui-body-d ui-shadow table-stripe ui-responsive" data-column-btn-theme="b" data-column-btn-text="'.$lang['Columns to display...'].'" data-column-popup-theme="a"><thead><tr><th data-priority="1">'.$lang['DateTime'].' </th><th data-priority="1">'.$lang['Alert Header'] .' </th><th data-priority="1" >'.$lang['Message'] .' </th></tr></thead>';
						$footer="</tbody></table></div></div></div></div>";
					}
					//$res =mysql_query($query) or die($query.mysql_error());
					while($row=mysql_fetch_array($res))
					{
						echo '<tr><td>'.date("d.m.Y H:i:s",strtotime($row['add_date'])).'</td><td>'.$row['alert_header'].'</td><td>'.$row['alert_msg'].'</td></tr>';

					}
                                            echo $footer;

			?>
            </div>            
	</div>
</div>
<?php  include("footer.php"); ?>
<script type="text/javascript">
		
                $(window).load(function() { $(".loader").fadeOut("slow"); })
</script>
	

	
