<?php 
/*
##################################################################
#                       PHP 4&5 MySQL 4&5                        #
##################################################################
#           Copyright (c) 2004-2008 Armia Systems Inc            #
##################################################################
#               This file is part of Cybermatch site             #
##################################################################
#    Developed By: simi (simi@armia.com)                         #

##################################################################
#               Developed On:   03-04-2008                       #
##################################################################
#               Modified By:                                     #
##################################################################
#               Modified On:                                     #
##################################################################
# This script may not be distributed, sold, given away for free  #
# to third party, or used as a part of any internet services 	 #
# such as webdesign etc.                                         #
##################################################################
*/

require_once ("config.inc.php");
require_once ("includes/userlogincheck.inc.php");
require_once ("includes/mysql.inc.php");
require_once ("includes/arrays.inc.php");
require_once ("classes/userside.class.php");
require_once ("classes/misc.class.php");
require_once ("includes/Pager/Pager.php");

$message	= "";
$pages		= "";
$count		= 0;
$page		= isset($_REQUEST['page'])	?	trim($_REQUEST['page'])	:	"1";
$data		= array();

if (!$objDB) {
	$message	= "Unable to Locate Database Server.";
} else {
	$objC		= new check();
	$objU		= new userside($objDB);
	$objM		= new misc($objDB);
	$count		= $objM->get_testimonial_count2();
	$params 	= array(
		'mode'      => 'Sliding',
		'perPage'   => PAGESIZE,
		'urlVar'    => 'page',
		'extraVars' => array(),
		'totalItems' => $count,
		'delta'		=> 7
	);
	$objP 		= & Pager::factory($params);
	if ($count > 0) {
		$data  		= $objM->get_testimonial_page2(($page-1)*PAGESIZE, PAGESIZE);
		$pages		= $objP->links;
	} else
		$message	= "No testimonial(s) found.<br>";		
	$script		= $objU->get_script($message);
	$message	= $objU->remove_script($message);
}
include_once ("title.inc.php");
include_once ("tophtml.inc.php");
?>

<div class="row">
	<div class="eight columns">
		<div class="search-rslts">
			<div class="row"><div class="inenr-hd"><h2>Testimonials</h2></div></div>
			<div class="row">
				<h2 class="headings2"></h2>
			</div>
			<div class="row">
				<div class="full_row" align="right">
					<a href="add_testimonial.php" class="add-story01">Add Testimonials</a>
				</div>
				<div class="newdesignforinput maintext1">
					<?php if(isset($message) && trim($message)!='')
					{ ?>
					<div class="full_row">
						<div class="maintext1 warning"><?php echo $message;?></div>
					</div>
					<?php }//end if
					      if(isset($_GET['msg']) && trim($_GET['msg'])!='')
					      {
					?>
					<div class="full_row">
						<div class="maintext1 warning"><?php echo $_GET['msg'];?></div>
					</div>
					
					<?php }//end if
					      if (!empty($data)) 
						  { 
						foreach ($data as $key => $value) 
						{ 
					?>
                      <?php switch($value['nUser_Id'])
							{
								case "0":
									$postedBy='Admin';
								break;

								default:
									$postedBy=$_SESSION['user_login'];
								break;
							}//end switch
						?>
					
					<div class="border-bottom-new">
						<div class="full_row">
							<div class="twelve columns" align="right">Posted by <strong><?php echo $postedBy; ?></strong> on <?php echo date('m/d/Y',strtotime($value['dDay']))?></div>
						</div>
						<div class="full_row">
							<div class="twelve columns"><?php echo nl2br((stripslashes($value['tContent'])))?></div>
						</div>			
								
						<div class="full_row">
							<!--<td align="left" class="maintext1"><b>Posted By</b> <?php echo $postedBy;?></td>-->
							  <?php if(isset($_SESSION['user_id']) && $_SESSION['user_id']!='')
									  {
									  ?>
									  
									  <div class="twelve columns">
											<?php
											if($value['nUser_Id']==$_SESSION['user_id'])
											{
							?>
							
								<?php echo '<a href="add_testimonial.php?id='.$value['nTestimonial_Id'].'&mode=edit">Edit</a> | <a href="add_testimonial.php?id='.$value['nTestimonial_Id'].'&mode=delete">Delete</a>';?>
								 <?php 			}//end if
										else
										{
											echo '<div class="twelve columns" align="right" class="maintext1">&nbsp;</div>';
										}//end else
								}//end first if
								?>
							</div>
						</div>
						
					</div>
					
					<?php 
							}//end foreach
					  }//end if
					?>
				</div>
				
				<?php if ($pages <> "") 
				{
				?>
				
				<div class="full_row">
					<div class="twelve row pagenation"><?php echo $pages?></div>
				</div>
				 <?php } ?>

			</div>
		</div>
	</div>
	<div class="four columns right search_result_R">
		<?php include_once ("left.inc.php");?>
	</div>
</div>


<?php include_once('bottomhtml.inc.php');?>
