<?php
if(@$_GET['user_group_id']!=null)
{
         $link   =   Yii::app()->createUrl('site/products',array('user_group_id'=>$_GET['user_group_id']));
	 $title  =   "<a href='".$link."'>".UserGroup::model()->findByPK($_GET['user_group_id'])->group_name.'</a>';
}
if(@$_GET['id']!=null)
{
        $link   =   Yii::app()->createUrl('site/productgroup',array('user_group_id'=>$_GET['user_group_id'],'id'=>$_GET['id']));
	$title   .=   " ><a href='".$link."'>".ProductGroup::model()->findByPK($_GET['id'])->product_group_name.'</a>';
}
if(@$_GET['product_category_id']!=null)
{
        $link   =   Yii::app()->createUrl('site/products',array('user_group_id'=>$_GET['user_group_id'],'id'=>$_GET['id'],'product_category_id'=>$_GET['product_category_id']));
	$title   .=   " ><a href='".$link."'>".ProductCategory::model()->findByPK($_GET['product_category_id'])->category_name.'</a>';
}
if(@$_GET['product_type_id']!=null)
{
        $link   =   Yii::app()->createUrl('site/products',array('user_group_id'=>$_GET['user_group_id'],'id'=>$_GET['id'],'product_category_id'=>$_GET['product_category_id'],'product_type_id'=>$_GET['product_type_id']));
	$title   .=   " ><a href='".$link."'>".ProductType::model()->findByPK($_GET['product_type_id'])->type_name.'</a>';
}
	
?>
<div class="main_content">

<div class="innercontent_outerbox">
  <div class="innerpage_main_contentbox">
    <div class="innerpage_content_box">
      <div class="innerpage_content_box"> <br />
        <div class="sider_shadow_top" > </div>
        <div class="compare"> <span style="margin-left:25px"><?php echo ucfirst($title); ?></span></div>
      </div>
    </div>
    <div class="innerpage_main_contentbox">
      <div class="innerpage_content_box">
        <div class="product_matter_outer">
          <div>
            <?php if(count($model)==0) echo "No products available in this user group"; ?>
            <?php foreach($model as $eachProduct): ?>
            <?php
			if (file_exists('media/product_images/'.$eachProduct->product_image)) 
			{
				$thumb=Yii::app()->phpThumb->create('media/product_images/'.$eachProduct->product_image);
				$thumb->resize(198,110);
				$thumb->save('media/product_images/thumbs/198_110'.$eachProduct->product_image);
			}
		 ?>
            <div class="compare_matter_outer">
              <div class="product_image"><img src="<?php echo Yii::app()->baseUrl; ?>/media/product_images/thumbs/198_110<?php echo $eachProduct->product_image; ?>" /></div>
              <div class="product_image_matter">
                <h2><a href="<?php echo Yii::app()->createUrl('site/productdetails',array('id'=>$eachProduct->id,'name'=>
            preg_replace('/[^a-z0-9_]/','',strtolower( str_replace(" ", "_", $eachProduct->product_name))))); ?>"><?php echo ($eachProduct->product_generic_name!='')?$eachProduct->product_generic_name:$eachProduct->product_name; ?><br />
                </h2>
                <?php echo $eachProduct->product_name; ?><br />
                <?php echo substr(strip_tags($eachProduct->description),0,200).'...'; ?><br />
                <br />
              </div>
              <div class="product_compare_box"> <a href="<?php echo Yii::app()->createUrl('site/productdetails',array('id'=>$eachProduct->id,'name'=>
            preg_replace('/[^a-z0-9_]/','',strtolower( str_replace(" ", "_", $eachProduct->product_name))))); ?>">
                <div class="find"> Find out more </div>
                </a> <br />
                <br />
                <br />
              </div>
            </div>
            <?php endforeach; ?>
          </div>
        </div>
      </div>
    </div>
  </div>
</div>
<?php echo $this->renderPartial('_bottom_common_user_product_group'); ?> 