<?php
/* vim: set expandtab tabstop=4 shiftwidth=4 softtabstop=4: */
// +----------------------------------------------------------------------+
// | PHP version 4/5                                                      |
// +----------------------------------------------------------------------+
// | This source file is a part of iScripts Multicart                     |
// +----------------------------------------------------------------------+
// | Authors: Programmer<programmer@armia.com>        		              |
// +----------------------------------------------------------------------+
// | Copyrights Armia Systems, Inc and iScripts.com  2005                |
// | All rights reserved                                                  |
// +----------------------------------------------------------------------+
// | 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.                                                       |
// +----------------------------------------------------------------------+
?>
<?php
include "includes/config.php";
include "includes/session.php";
include "includes/functions.php";

if (get_magic_quotes_gpc()) {
    $_POST = array_map('stripslashes_deep', $_POST);
    $_GET = array_map('stripslashes_deep', $_GET);
    $_COOKIE = array_map('stripslashes_deep', $_COOKIE);
}
if(isset( $_GET["artistid"]) && $_GET["artistid"]!=""){
	$artistid = $_GET["artistid"];
}else if(isset( $_POST["artistid"]) && $_POST["artistid"]!=""){
	$artistid = $_POST["artistid"];
}
if(isset( $_GET["productid"]) && $_GET["productid"]!=""){
	$productid = $_GET["productid"];
}else if(isset( $_POST["productid"]) && $_POST["productid"]!=""){
	$productid = $_POST["productid"];
}

/*if(isset( $_SESSION["sess_userid"]) && $_SESSION["sess_userid"]!=""){
	$userid = $_SESSION["sess_userid"];
}else{
	header("Location:login.php?action=artistfeedbacks&artistid=$artistid&productid=$productid");
	exit();
}*/

if($artistid==''){
	header("Location:categorydetail.php");
	exit();
}

if($begin == ""){
        $begin=0;
        $num=1;
        $numBegin=1;
}




if(isset($_GET["msg"]) and $_GET["msg"]!=""){
	$msg = $_GET["msg"];
	switch($msg){
		case "deleted": $message = FEEDBACK_DELETE_SUCCESS_TEXT;break;
		default:
			;
	} // switch

}
 $sql=" SELECT f.*, u.user_name,u.first_name,u.last_name FROM ".$tableprefix."artist_feedbacks f
	INNER JOIN ".$tableprefix."users u ON f.user_id = u.user_id
	WHERE f.artist_id = '".addslashes($artistid)."' AND f.published='Y' order by date_added DESC   ";
$sess_back= $_SERVER["PHP_SELF"] . "?begin=" . $begin . "&num=" . $num . "&numBegin=" . $numBegin . "&cmbSearchType=" . $cmbSearchType . "&txtSearch=" . $txtSearch;
$_SESSION["gbackurl"] = $sess_back;

$totalrows = mysql_num_rows(mysql_query($sql));

$navigate = pageBrowser($totalrows,10,10,"&artistid=".addslashes($artistid)."&productid=".addslashes($productid)."&cmbSearchType=$cmbSearchType&txtSearch=$txtSearch",$_GET[numBegin],$_GET[start],$_GET[begin],$_GET[num]);
$sql = $sql.$navigate[0];
$rs = mysql_query($sql);

/*display the active template*/

$active_template = displayTemplate();


include "includes/htmltop.php";

/* Top File Name */

include_once ("includes/".$active_template[0]);

?>
<script language="JavaScript" type="text/JavaScript">
function clickSearch()
{
	document.frmFeedbacks.submit();
}

</script>

<div align="left" class="main_body">
			
			<!--mainbody area start -->
			
		<!--center content area start-->		
		
		<form action="<?php echo $_SERVER["PHP_SELF"]?>" method="post" name="frmFeedbacks">
			<input type="hidden" name="artistid" value="<?php echo $artistid;?>" >
			<input type="hidden" name="productid" value="<?php echo $productid;?>" >
			
			
		<div align="left" id="item_details">
	
	
		<!--items display area start -->
	
		<div align="left" id="items_top_area">
				<div align="left" id="items_top_area_ttl"><?php echo SELLER_FEEDBACK_TEXT;?></div>
		</div>
		
		<div class="text_information" align="center"><?php echo $message?></div>
		
		<div class="prodetails_topsection">				
																				
																										
			<table width="98%"  border="0" cellpadding="0" cellspacing="0"  align="center">
				<tr>
					<td >
						<table width="98%" cellpadding="2" cellspacing="2" border=0>
							<tr><td>&nbsp;</td><td colspan="2" align="center"></td></tr>
							<?php
							$i=1;
							while($row  = mysql_fetch_array($rs))
							{
								echo "<tr>
								          <td width='5%' valign='top' class='message'><b>#".$i."</b></td>
								          <td align='left' colspan=2>
											  <div align='left' class='innertext' >
												  <p>".nl2br(stripslashes($row["feedback_content"]))."</p>
											  </div>
										  </td>
									  </tr>";
								echo "<tr class='prdetails_productprice' ><td width='5%' height='15' valign='top'>&nbsp;</td>
								           <td align='left' colspan=2 >".BY_TEXT." <b>".$row["first_name"]." &nbsp;" .$row["last_name"]."</b>&nbsp;&nbsp;&nbsp;&nbsp;
										   ";
							?>
					
									<div class="ratings"> <div class="rating_<?php echo GetSellerRatingStar($row['artist_feedback_id'])?>"></div></div>

										   </td>
									 </tr>
						<?php			 
								echo "<tr><td colspan=3>&nbsp;</td></tr>";
	
								$i++;
							}
							?>
							<tr><td colspan=3 align='center'>&nbsp;</td></tr>
							<tr><td colspan=3 align='center'><?php echo($navigate[2]); ?></td></tr>
					  </table>
					</td>
				</tr>
				
				<tr>
					<td align="center"><input type="button" class="button" value="<?php echo BACK_TO_PRODUCT_DETAILS_BUTTON;?>" onClick="window.location.href='productdetails.php?productid=<?php echo $productid;?>';" ></td>
				</tr>
			</table>
						
			<div class="clear"></div>
		</div>	
	
	
		<div align="left" class="float_clear1"></div>
					
					
		 <!--items display area end -->
		  </div>
		
		</form>
		<!--center content area end-->	


		<!--mainbody area end -->
        </div>


<?php
include "includes/".$active_template[2];	/* Bottom File Name */
?>