<?php require_once('../Connections/oprmConn.php'); 

//include('check-admin-session.php'); 



$maxRows_getannouncelist = 1000000;

$pageNum_getannouncelist = 0;

if (isset($_GET['pageNum_getannouncelist'])) {

  $pageNum_getannouncelist = $_GET['pageNum_getannouncelist'];

}

$startRow_getannouncelist = $pageNum_getannouncelist * $maxRows_getannouncelist;



$maxRows_getannouncelist = 10;

	$pageNum_getannouncelist = 0;

	if (isset($_GET['pageNum_getannouncelist'])) {

	  $pageNum_getannouncelist = $_GET['pageNum_getannouncelist'];

	}

	$startRow_getannouncelist = $pageNum_getannouncelist * $maxRows_getannouncelist;



//select configuration data

mysql_select_db($database_oprmConn, $oprmConn);

$query_getannouncelist = "SELECT * FROM weby_announcement WHERE status = 'A'";

$getannouncelist = mysql_query($query_getannouncelist, $oprmConn) or die(mysql_error());

$row_getannouncelist = mysql_fetch_assoc($getannouncelist);

$totalRows_getannouncelist = mysql_num_rows($getannouncelist);



if (isset($_GET['totalRows_getannouncelist'])) {

	  $totalRows_getannouncelist = $_GET['totalRows_getannouncelist'];

	} else {

	  $all_getannouncelist = mysql_query($query_getannouncelist);

	  $totalRows_getannouncelist = mysql_num_rows($all_getannouncelist);

	}

	$totalPages_getannouncelist = ceil($totalRows_getannouncelist/$maxRows_getannouncelist)-1;



$queryString_getannouncelist = "";

if (!empty($_SERVER['QUERY_STRING'])) {

  $params = explode("&", $_SERVER['QUERY_STRING']);

  $newParams = array();

  foreach ($params as $param) {

    if (stristr($param, "pageNum_getannouncelist") == false && 

        stristr($param, "totalRows_getannouncelist") == false) {

      array_push($newParams, $param);

    }

  }

}









if (!function_exists("GetSQLValueString")) {

function GetSQLValueString($theValue, $theType, $theDefinedValue = "", $theNotDefinedValue = "") 

{

  $theValue = get_magic_quotes_gpc() ? stripslashes($theValue) : $theValue;



  $theValue = function_exists("mysql_real_escape_string") ? mysql_real_escape_string($theValue) : mysql_escape_string($theValue);



  switch ($theType) {

    case "text":

      $theValue = ($theValue != "") ? "'" . $theValue . "'" : "NULL";

      break;    

    case "long":

    case "int":

      $theValue = ($theValue != "") ? intval($theValue) : "NULL";

      break;

    case "double":

      $theValue = ($theValue != "") ? "'" . doubleval($theValue) . "'" : "NULL";

      break;

    case "date":

      $theValue = ($theValue != "") ? "'" . $theValue . "'" : "NULL";

      break;

    case "defined":

      $theValue = ($theValue != "") ? $theDefinedValue : $theNotDefinedValue;

      break;

  }

  return $theValue;

}

}



$maxRows_getTimeSheet = 10;

$pageNum_getTimeSheet = 0;

if (isset($_GET['pageNum_getTimeSheet'])) {

  $pageNum_getTimeSheet = $_GET['pageNum_getTimeSheet'];

}

$startRow_getTimeSheet = $pageNum_getTimeSheet * $maxRows_getTimeSheet;



mysql_select_db($database_oprmConn, $oprmConn);

$query_getTimeSheet = "SELECT weby_timesheets.timesheet_id, weby_timesheets.user_id, weby_timesheets.total_hrs, weby_timesheets.hr_rate, weby_timesheets.total_amount, weby_profiles.full_name, weby_projects.project_name, weby_timesheets.created_date, weby_timesheetstatus.status_label FROM weby_timesheets, weby_profiles, weby_projects, weby_timesheetstatus WHERE weby_timesheets.created_by = weby_profiles.user_id  AND weby_projects.projetc_id = weby_timesheets.project_id AND weby_timesheetstatus.status = 'A'  AND weby_timesheetstatus.status_key = weby_timesheets.status AND weby_timesheetstatus.status_label!= 'Deleted' order by weby_timesheets.updated_date desc";

$query_limit_getTimeSheet = sprintf("%s LIMIT %d, %d", $query_getTimeSheet, $startRow_getTimeSheet, $maxRows_getTimeSheet);

$getTimeSheet = mysql_query($query_limit_getTimeSheet, $oprmConn) or die(mysql_error());

$row_getTimeSheet = mysql_fetch_assoc($getTimeSheet);



if (isset($_GET['totalRows_getTimeSheet'])) {

  $totalRows_getTimeSheet = $_GET['totalRows_getTimeSheet'];

} else {

  $all_getTimeSheet = mysql_query($query_getTimeSheet);

  $totalRows_getTimeSheet = mysql_num_rows($all_getTimeSheet);

}

$totalPages_getTimeSheet = ceil($totalRows_getTimeSheet/$maxRows_getTimeSheet)-1;



$maxRows_getRes = 2;

$pageNum_getRes = 0;

if (isset($_GET['pageNum_getRes'])) {

  $pageNum_getRes = $_GET['pageNum_getRes'];

}

$startRow_getRes = $pageNum_getRes * $maxRows_getRes;



mysql_select_db($database_oprmConn, $oprmConn);

$query_getRes = "SELECT weby_users.user_id, weby_users.email_address, weby_users.caeated_date, weby_profiles.profile_id, weby_profiles.full_name, weby_profiles.job_title, weby_profiles.skill_set, weby_profiles.profile_pic FROM weby_users, weby_profiles WHERE weby_users.status = 'P' AND weby_profiles.user_id = weby_users.user_id";

$query_limit_getRes = sprintf("%s LIMIT %d, %d", $query_getRes, $startRow_getRes, $maxRows_getRes);

$getRes = mysql_query($query_limit_getRes, $oprmConn) or die(mysql_error());

$row_getRes = mysql_fetch_assoc($getRes);



if (isset($_GET['totalRows_getRes'])) {

  $totalRows_getRes = $_GET['totalRows_getRes'];

} else {

  $all_getRes = mysql_query($query_getRes);

  $totalRows_getRes = mysql_num_rows($all_getRes);

}

$totalPages_getRes = ceil($totalRows_getRes/$maxRows_getRes)-1;



$maxRows_getRes1 = 2;

$pageNum_getRes1 = 0;

if (isset($_GET['pageNum_getRes1'])) {

  $pageNum_getRes1 = $_GET['pageNum_getRes1'];

}

$startRow_getRes1 = $pageNum_getRes1 * $maxRows_getRes1;



mysql_select_db($database_oprmConn, $oprmConn);

$query_getRes1 = "SELECT weby_users.user_id, weby_users.email_address, weby_users.caeated_date, weby_profiles.profile_id, weby_profiles.full_name, weby_profiles.job_title, weby_profiles.skill_set, weby_profiles.profile_pic FROM weby_users, weby_profiles WHERE weby_profiles.status = 'A' AND weby_users.status = 'A' AND weby_users.user_role <> 1 AND weby_profiles.user_id = weby_users.user_id order by weby_profiles.profile_id desc";

$query_limit_getRes1 = sprintf("%s LIMIT %d, %d", $query_getRes1, $startRow_getRes1, $maxRows_getRes1);

$getRes1 = mysql_query($query_limit_getRes1, $oprmConn) or die(mysql_error());

$row_getRes1 = mysql_fetch_assoc($getRes1);



if (isset($_GET['totalRows_getRes1'])) {

  $totalRows_getRes1 = $_GET['totalRows_getRes1'];

} else {

  $all_getRes1 = mysql_query($query_getRes1);

  $totalRows_getRes1 = mysql_num_rows($all_getRes1);

}

$totalPages_getRes1 = ceil($totalRows_getRes1/$maxRows_getRes1)-1;





?>



<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">



<html xmlns="http://www.w3.org/1999/xhtml">

<head>

<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />

<title>SS WEB TECHNOLOGIES - Announcement List</title>

<link rel="stylesheet" href="../css/style.css" type="text/css">

<link rel="stylesheet" type="text/css" href="../css/colorbox.css"> 

<!-- IE Fix for HTML5 Tags -->



<!--[if IE]> <script src="http://html5shiv.googlecode.com/svn/trunk/html5.js"></script> 







	<![endif]-->



<script type='text/javascript'>







function redirect(){















var uid = document.getElementById('uid').options[document.getElementById('uid').selectedIndex].value;















window.location = "leave-list.php?uid="+uid+"";















}















</script>



<script src="//code.jquery.com/jquery-1.9.1.js"></script>

<script src="../js/jquery.colorbox.js"></script> 

<script type="text/javascript">

		// Can also be used with $(document).ready()

	

		$(function(){

			$(".view_annonce").colorbox({iframe:true, fastIframe:false, width:"650px", height:"250px", transition:"fade", scrolling   : true});

  		});

   

 

  </script>  

<style>

.act_announcement  { 

background: #373938;

  color: #fff;}

  .timesheet_table .x-item_wide{

	  width:170px;

	  display:inline-table;

  }

  .timesheet_table .x-big_wide{

	  width:270px;

	  display:inline-table;

  }

.timesheet_table .item_wide:last-child{

	float:right;

}

.timesheet_table .column_title {

	color:#fff;

}



</style>

</head>



<body>



<!-- Wrapper Starts -->



<div class="wrapper">



  <?php  require_once('../includes/header.php'); ?>

  <?php  require_once('../includes/tools-menu.php'); ?>

  <!-- Content Goes here --> 

  

  <!-- Content Goes here -->

  

  <article class="inside_wrapper clear_fix"> 

    

    <!-- Main Content Goes here -->

    

    <section class="main_content">

      <h1>Current Announcements</h1>

     <!-- <div class="add_announce"><a href="add-announcements">Add Announcement</a></div>-->

     <?php if(isset($_GET['msgcrtannonce'])) { $msgcrtannonce = "Annoncement created successfully"; ?>

	<script>alert("<?php echo $msgcrtannonce; ?>");</script>

	<?php } ?>

	<?php if(isset($_GET['msgdelannonce'])) { $msgdelannonce = "Annoncement deleted successfully"; ?>

	<script>alert("<?php echo $msgdelannonce; ?>");</script>

	<?php } ?>

   

      

      

      

      <div class="timesheet_table clear_fix">

        <div class="column_title"> <span class="x-item_wide">Subject </span><span class="x-big_wide">Message</span><span class="item_wide"></span><!--<span class="item_small">Rate(£)</span><span class="item_small">Total</span>--> 

          

        </div>

        <?php if($totalRows_getannouncelist > 0) { do { ?>

          <div class="row <?php if($n==0) { echo "yellow"; $n=1; } else $n=0; ?>"> <span class="x-item_wide"><?php echo substr($row_getannouncelist['subject'], 0,10); ?>..</span><span class="x-big_wide"><?php echo substr($row_getannouncelist['message'], 0,40); ?>..</span><span class="item_wide"><?php /*?><form action="view-announcements.php" method="post" class="view_annonce"> <input type="hidden" name="aid" id="aid" value="<?php echo $row_getannouncelist['aid']; ?>"><input type="submit" value="View" /></form><?php */?> <a class="view_annonce" href="view-announcements.php?aid=<?php echo $row_getannouncelist['aid']; ?>">View</a>
              <!--
              <form class="delete_annonce" action="delete-announcements.php" method="post"><input type="hidden" name="aid" id="aid" value="<//?php echo $row_getannouncelist['aid']; ?>"> <input type="hidden" name="aid" id="aid" value="<?php echo $row_getannouncelist['aid']; ?>"><input type="submit" value="Delete" name="delete" id="delete" class="exit" onclick="return confirm('Are you sure you want to delete Announcement?')"/></form>

--></span> </div>

          <?php } while ($row_getannouncelist = mysql_fetch_assoc($getannouncelist)); ?>

        <div class="nav-right">

<table border="0" align="center" cellpadding="2" style="clear:both">

<tr><td colspan="4" align="center"><?php echo ($startRow_getannouncelist + 1) ?> to <?php echo min($startRow_getannouncelist + $maxRows_getannouncelist, $totalRows_getannouncelist) ?> of <?php echo $totalRows_getannouncelist ?></td></tr>



<tr><td align="center"><?php if ($pageNum_getannouncelist > 0) { // Show if not first page ?><a href="<?php printf("%s?pageNum_getannouncelist=%d%s", $currentPage, 0, $queryString_getannouncelist); ?>">&lt;&lt; START</a><?php } // Show if not first page ?></td>



<td align="center"><?php if ($pageNum_getannouncelist > 0) { // Show if not first page ?>

<a href="<?php printf("%s?pageNum_getannouncelist=%d%s", $currentPage, max(0, $pageNum_getannouncelist - 1), $queryString_getannouncelist); ?>">&lt; PREVIOUS</a>

<?php } // Show if not first page ?></td>



<td align="center"><?php if ($pageNum_getannouncelist < $totalPages_getannouncelist) { // Show if not last page ?><a href="<?php printf("%s?pageNum_getannouncelist=%d%s", $currentPage, min($totalPages_getannouncelist, $pageNum_getannouncelist + 1), $queryString_getannouncelist); ?>">NEXT &gt;</a><?php } // Show if not last page ?></td>



<td align="center"><?php if ($pageNum_getannouncelist < $totalPages_getannouncelist) { // Show if not last page ?><a href="<?php printf("%s?pageNum_getannouncelist=%d%s", $currentPage, $totalPages_getannouncelist, $queryString_getannouncelist); ?>">LAST &gt;&gt;</a>

<?php } // Show if not last page ?></td>

	</tr>

</table>

</div>

        <?php } else echo "<div class='no-rows'>No announcement found</div>";?>

      </div>

      

      

      

     

      

    </section>

    

    <!-- Sidebar Goes here -->

    

    <!--<aside class="sidebar">

      <?php /*?><div class="featured">

        <h2 class="white_txt">PENDING RESOURCES</h2>

        <?php if($totalRows_getRes>0) { do { ?>

        <div class="profile_box"> <a href="resources-view.php?user_id=<?php echo $row_getRes['user_id']; ?>"><img src="/RM/images/<?php if(!empty($row_getRes['profile_pic'])) echo $row_getRes['profile_pic']; else echo "black-img.jpg";?>" width="68" /></a>

          <p class="profile_title"><a href="resources-view.php?user_id=<?php echo $row_getRes['user_id']; ?>"><?php echo $row_getRes['full_name']; ?></a><span class="desig"><br />

            <?php echo $row_getRes['job_title']; ?></span></p>

          <p class="profile_desc"><?php echo $row_getRes['skill_set']; ?></p>

          <div class="clear-fix">&nbsp;</div>

        </div>

        <?php } while ($row_getRes = mysql_fetch_assoc($getRes)); } else { echo "<div class='no-rows'>No Pending Resources</div>";}?>

      </div><?php */?>

      <h2>ACTIVE RESOURCES</h2>

      <form action="resources-list.php" method="post" id="act_resource_search">

        <input name="search" class="search" type="text" size="30" />

        <input name="submit" type="submit" class="search-sub" value="Search" />

      </form>

      <?php if($totalRows_getRes1>0) { do { ?>

      <div class="profile_box"> <a href="resources-view.php?user_id=<?php echo $row_getRes1['user_id']; ?>"><img src="/RM/images/<?php if(!empty($row_getRes1['profile_pic'])) echo $row_getRes1['profile_pic']; else echo "black-img.jpg";?>" width="68" /></a>

        <p class="profile_title"><a href="resources-view.php?user_id=<?php echo $row_getRes1['user_id']; ?>"><?php echo $row_getRes1['full_name']; ?></a><span class="desig"><br />

          <?php echo $row_getRes1['job_title']; ?></span></p>

        <p class="profile_desc"><?php echo $row_getRes1['skill_set']; ?></p>

        <div class="clear-fix">&nbsp;</div>

      </div>

      <?php } while ($row_getRes1 = mysql_fetch_assoc($getRes1)); } else { echo "<div>No Active Resources</div>";} ?>

      

      <!-- <div class="profile_box"> <a href="resources-view.php?user_id=1234"><img src="/RM/images/black-img.jpg" /></a>







                    <p class="profile_title"><a href="resources-view.php?user_id=1234">David Masciana</a><span class="desig"><br />







				  IT Business Analyst</span></p>







                    <p class="profile_desc">Cisco IP knowledge is preferred to Cisco CCNA/Juniper JNCIA and similar level 		







                    ....</p>







                <div class="clear-fix">&nbsp;</div>







          </div>

      

      <p><a href="resources-list.php">View all >></a></p>

    </aside>-->

    <div class="clear-fix">&nbsp;</div>

  </article>

  <div class="clear-fix">&nbsp;</div>

  

  <!-- Footer Goes here -->

  

  <?php  require_once('../includes/footer.php'); ?>

</div>

</body>

</html>

