<?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.                                                       |
// +----------------------------------------------------------------------+
?>
<?
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);
}


/*$pattern = strpos($_SERVER['REQUEST_URI'],'.php');

$seller_name = substr($_SERVER['REQUEST_URI'],$pattern+5,strlen($_SERVER['REQUEST_URI'])-$pattern);


$select_artist_id = "SELECT artist_id FROM ".$tableprefix."artists WHERE artist_name = '".$seller_name."'";
$result_artist_id = mysql_query($select_artist_id) or die(mysql_error());  

$artist_id_row = mysql_fetch_assoc($result_artist_id);

$artistid = $artist_id_row['artist_id'];*/

if (isset($_GET["artistid"]) and $_GET["artistid"] != "") {
    $artistid = $_GET["artistid"];
} else if (isset($_POST["artistid"]) and $_POST["artistid"] != "") {
    $artistid = $_POST["artistid"];
}


/*----------Multicart 2.0 Upgradation Starts------------*/


$select_artist_id = "SELECT artist_id,artist_name FROM ".$tableprefix."artists WHERE artist_name = ".GetSQLValueString($artistid,"text");

$result_artist_id = mysql_query($select_artist_id) or die(mysql_error());

if(mysql_num_rows($result_artist_id) > 0)
{

	$artist_row = mysql_fetch_assoc($result_artist_id);
	$artistid = $artist_row['artist_id'];
	$artist_name = $artist_row['artist_name'];


}


/*----------Multicart 2.0 Upgradation Ends------------*/



$portfoliodir = SITE_URL."/portfolios/";

$sql = "SELECT ap.*, a.artist_name,a.first_name,a.last_name,a.state, a.country FROM ".$tableprefix."artists a LEFT JOIN ".$tableprefix."artist_portfolios ap ON a.artist_id = ap.artist_id  WHERE a.artist_id = '".addslashes($artistid)."' ";

$res = mysql_query($sql);
if(mysql_num_rows($res) > 0 ){
	$row= mysql_fetch_array($res);
	$portfolioid = $row["artist_portfolio_id"];
	$txtArtistDescription = $row["artist_description"];
	$txtArtistPhoto= $row["artist_photo"];
	$arrSamples = array();
	$txtArtistSampleWork1= $row["artist_sample_work_1"];
	$txtArtistSampleWork2= $row["artist_sample_work_2"];
	$txtArtistSampleWork3= $row["artist_sample_work_3"];
	$txtArtistSampleWork4= $row["artist_sample_work_4"];
	$txtArtistSampleWork5= $row["artist_sample_work_5"];
	$txtArtistSampleWork6= $row["artist_sample_work_6"];

	if($txtArtistSampleWork1!=""){
		array_push($arrSamples, $txtArtistSampleWork1);
	}
	if($txtArtistSampleWork2!=""){
		array_push($arrSamples, $txtArtistSampleWork2);
	}
	if($txtArtistSampleWork3!=""){
		array_push($arrSamples, $txtArtistSampleWork3);
	}
	if($txtArtistSampleWork4!=""){
		array_push($arrSamples, $txtArtistSampleWork4);
	}
	if($txtArtistSampleWork5!=""){
		array_push($arrSamples, $txtArtistSampleWork5);
	}
	if($txtArtistSampleWork6!=""){
		array_push($arrSamples, $txtArtistSampleWork6);
	}

	$txtArtistName = $row["artist_name"];
	$txtArtistFirstName = $row["first_name"];
	$txtArtistLastName = $row["last_name"];
	$txtArtistFullName = $txtArtistFirstName;
	if($txtArtistLastName!=""){
		$txtArtistFullName .= " ". $txtArtistLastName;
	}
	$txtArtistState = $row["state"];
	$txtArtistCountry = $row["country"];
	
	if($txtArtistPhoto == ""){
		$imageurl = "<img src='".$portfoliodir . "noimage.jpg' width='100' height='100' border='0' >";
	}else{
		if(!function_exists('gd_info')){
			$imageurl = "<img src='".$portfoliodir.$txtArtistPhoto."' border='0' width='100' height='100' >";
		}else{
			$imageurl = "<img src='getimagethumbnailnew.php?imagename=".$txtArtistPhoto."' border='0' >";
		}
	}
}

/*display the active template*/

$active_template = displayTemplate();


include "includes/htmltop.php";

/* Top File Name */

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

?>

<script>
function clickSearch()
{
	document.frmCatalog.submit();
}
</script>
<div align="left" class="main_body">
			
			<!--mainbody area start -->
			
			<div align="left" id="body_left_area">
				<!--body left area start -->
		
				
				
			<!--categories area start -->
			
<?php

	include_once("includes/categorylist.php");

?>			
			
			<!--categories area end -->	
			
			<!--body left area end -->
				</div>


		<!--center content area start-->		

		<div align="left" id="item_details">
				<!--items display area start -->
				
		<div align="left" id="items_top_area">
				<img src="<?php echo $imagefolder?>/top_title_left.gif" alt="" class="items_top_area_img" />
				<div align="left" id="items_top_area_ttl"><?php echo ucwords($txtArtistFirstName)?>'s Portfolio</div>
				<img src="<?php echo $imagefolder?>/top_title_right.gif" alt="" class="items_top_area_img" />
		</div>

		<div align="center" id="items_display_area">
				<div align="center" id="portfilo_top_links"><a href="<?php echo SITE_URL?>/portfolio/<?php echo $artist_name?>">Home</a>  &nbsp;|&nbsp;  <a href="<?php echo SITE_URL?>/showportfolio.php?artistid=<?php echo $artistid?>&mode=catlog">Catalogue</a>  &nbsp;|&nbsp;  <a href="<?php echo SITE_URL?>/showportfolio.php?artistid=<?php echo $artistid?>&mode=feedback">Feedback</a></div>
				
				<div align="left" id="seller_info_container">
				<!--Seller Info Area start -->
						<div align="left" id="seller_info_left">
								<table width="100%" border="0" cellpadding="0" cellspacing="0" class="seller_info_table">
									  <tr>
										<td width="32%" align="right" valign="middle">Full Name </td>
										<td width="8%" align="center" valign="middle">:</td>
										<td width="60%" align="left" valign="middle"><?php echo $txtArtistFullName;?></td>
									  </tr>
									  <tr>
										<td align="right" valign="middle">State/ Privince </td>
										<td align="center" valign="middle">:</td>
										<td align="left" valign="middle"><?php echo $txtArtistState;?></td>
									  </tr>
									  <tr>
										<td align="right" valign="middle">Country</td>
										<td align="center" valign="middle">:</td>
										<td align="left" valign="middle"><?php echo  $txtArtistCountry;?></td>
									  </tr>
						  </table>

						</div>
						<div align="left" id="seller_info_right">
								<?php echo $imageurl;?>
						</div>
						<div align="left" class="float_clear1"><img src="images/clear1.gif" alt="" /></div>
				<!--Seller Info Area end -->
				</div>
				
<?php
if (isset($_GET["mode"]) and $_GET["mode"] != "") {
$mode = $_GET["mode"];
} else if (isset($_POST["mode"]) and $_POST["mode"] != "") {
					$mode = $_POST["mode"];
}

if( $mode=="")
{
?>				
				
				<div align="left" id="seller_discription">
				<!--seller discription area start -->
				<?php echo nl2br(htmlentities($txtArtistDescription));?>		
				<!--seller discription area end -->
				</div>
				
<?php 

}

 ?>				
 
 
 	<!--<div align="left" id="sample_work_title">Sample Works </div>-->
								
	<div align="left">
	
	<!--sample photo container start-->
	
 <?php

	if(count($arrSamples) > 0 and $mode=="")
	{
	
?>		
				
			
<?php			

	if(count($arrSamples) > 0 )
	{
		while($row = array_pop($arrSamples))
		{
			if($arrSamples == "")
			{
				$imageurl = "<img src='".$prodimagedir . "noimage.jpg' width='50' height='50' border='0' >";
			}
			else
			{
				if(!function_exists('gd_info'))
				{
					$imageurl = "<img src='".$portfoliodir.urlencode($row)."' border='0' width='100' height='100' >";
				}
				else
				{
					$imageurl = "<img src='getimagethumbnailnew.php?imagename=".urlencode($row)."' border='0' >";
				}
			}
		
			/*if(strlen($row["product_name"])>30)
				$productname=substr($row["product_name"],0,30)."...";
			else
				$productname =$row["product_name"];*/
				
?>				
			
			
			
			<div align="left" class=""><?php echo $imageurl?></div>
					
<?php

			}
		
		}
	
	}		

?>					
					
					
					
			<!--sample photo container end-->
			
			
<?php


	if($mode=="catlog")
	{
		if (isset($_GET["catid"]) and $_GET["catid"] != "")
		{
			$catid = $_GET["catid"];
		}
		else if (isset($_POST["catid"]) and $_POST["catid"] != "")
		{
			$catid = $_POST["catid"];
		}





	?>			
			
			
			<!--category area starts-->
			
			<div>&nbsp;</div>
			
			<div align="left" id="items_top_area">
				<img src="<?php echo $imagefolder?>/top_title_left.gif" alt="" class="items_top_area_img" />
				<div align="left" id="items_top_area_ttl">Category</div>
				<img src="<?php echo $imagefolder?>/top_title_right.gif" alt="" class="items_top_area_img" />
			</div>
			
			<div>&nbsp;</div>
			
			<form name="frmCatalog" action="<?php echo $_SERVER["PHP_SELF"]?>" method="POST" enctype="multipart/form-data">
			<input type="hidden" name="catid" value="<?php echo htmlentities($catid);?>" >
			<input type="hidden" name="artistid" value="<?php echo htmlentities($artistid);?>" >
			<input type="hidden" name="mode" value="<?php echo htmlentities($mode);?>" >
			
<?
			if(!isset($catid) || $catid =="")
			{
				$catid = 0;
			}
			
			$showproducts=false;
			
			$artistid=addslashes($artistid);
			$qry = "select  p.product_artist_id,p.product_category,count(product_category) as cnt ,
					c.category_name,c.category_id from ".$tableprefix."products
					p left join ".$tableprefix."categories  c on  p.product_category= c.category_id
					where product_artist_id='".$artistid."' group by product_category";



			$result = mysql_query($qry) or die(mysql_error());

			if(mysql_num_rows($result)!= 0)
			{
				while($row = mysql_fetch_array($result))
				{
					$displayctegory="".getCategory("",$row["category_id"])."";			

?>			
			
			<div class="item_block1" align="center">
			
<?php		

			echo "<a href=\"".$PHP_SELF."?artistid=$artistid&mode=catlog&catid=" . $row["category_id"] . "\">" . $displayctegory ."</a>&nbsp;(" . $row["cnt"] . ")";
				
			
?>			
			</div>
			
			
			
			
			
			
			
			
			
			
			
<?php

			}// end while
		
		}// end if	

	}

?>			
			
			
			</form>
			
			<!--category area ends-->
			
			
			<!--artist product area starts-->
			
			<div>&nbsp;</div>
			
			<div align="left" id="items_top_area_1">
				<img src="<?php echo $imagefolder?>/top_title_left.gif" alt="" class="items_top_area_img" />
				<div align="left" id="items_top_area_ttl_2">Products</div>
				<img src="<?php echo $imagefolder?>/top_title_right.gif" alt="" class="items_top_area_img" />
			</div>
			
			<div>&nbsp;</div>
			
			<div class="item_block1" align="center">sfsd</div>
<?php

			//require("./includes/artistproductlist.php");
			
?>						
			
			
			<!--artist product area ends-->
	
			
			</div>
				<div align="left" class="float_clear1"></div>
			</div>
			
			
						
			
		  <!--items display area end -->
		  </div>
		  
		 		
		  
		  
			<div align="left" class="clear"></div>	
		<!--mainbody area end -->
        </div>
		<div align="left" class="clear"></div>
		
		
		
		
<?php
	include "includes/".$active_template[2];	/* Bottom File Name */
?>