<?php
$this->load->view("top");
//$total_records=0;
?>
<div class="page_breadcrumbs">
        <div class="container">
            <ul>
      <li><a href="<?=site_url();?>" title="Home">Home</a>
        </li>
        <li><a href="<?=base_url('my-account');?>" title="My Account">My Account</a>
        </li>
        <li>My Wishlist</li>
            </ul>
        </div>
    </div>
  <!----My Accounts---->
  <section class="my_account_page">
    <div class="container">
      <div class="row">

        <div class="col-md-9 col-md-push-3">
            <div class="right_side">
                <h1>My Reviews (<?php echo (!empty($reviews))?count($reviews):0; ?>)</h1>
                <?php validation_message();
          error_message();
            //echo "<pre>";print_r($reviews);
          if (is_array($reviews) && !empty($reviews)) { ?>
                <div class="wps_right my_reviews">
                    <!-- Start --->
                    <?php 
                        $starArray =$this->config->item('starArray');
                        krsort($starArray);
                    foreach ($reviews as $key => $val) {
              $prodets = $this->product_model->get_products('1', '0', array("productid" => $val['entity_id']));
              //echo "<pre>";print_r($prodets);
              ?>
                    <div class="reviews_item">
                        <div class="row">
                            <div class="col-lg-12 col-md-12 col-sm-12">
                                <div class="row">
                                    <div class="col-lg-2 col-md-2 col-sm-3">
                                        <a href="javascript:void()">
                                            <img src="<?php echo get_image('products', $prodets[0]['media'], '173', '105', 'R'); ?>" alt="<?php echo $prodets[0]['product_name']; ?>" title="<?php echo $prodets[0]['product_name']; ?>">
                                        </a>
                                    </div>
                                    <div class="col-lg-10 col-md-10 col-sm-9">
                                        <div class="reviews_info">
                                            <a href="<?php echo site_url($prodets[0]['friendly_url']); ?>" title="<?php echo $prodets[0]['product_name']; ?>"><?php echo $prodets[0]['product_name']; ?></a>
                                            <!-- <div class="rate_rating">
                                                <i class="fa fa-star checked"></i>
                                                <i class="fa fa-star checked"></i>
                                                <i class="fa fa-star checked"></i>
                                                <i class="fa fa-star checked"></i>
                                                <i class="fa fa-star checked"></i>
                                            </div> -->
                                            <div class="stars">  
                                                             <?php
                          $ads_rating = $val['ads_rating'];
                         for ($i=1;$i<6;$i++) {
                          ?>
                          <i class="fa fa-star <?php if($i<=$ads_rating){ echo 'checked';} ?>"></i>
                          <?php
                           # code...
                         }
                         ?>
                                           <?php echo form_error('ads_rating');?>
                                        </div>
                                            <p><?php echo $val['text']; ?></p>
                                            <div class="row">
                                                <div class="col-lg-6 col-md-6">
                                                    <?php //echo "<pre>";print_r($mres);?>
                                                    <ul>
                                                        <li><i class="fa fa-user"></i> <?php echo $mres['first_name'].' '.$mres['last_name'];?></li>
                                                        <li><i class="fa fa-check-circle"></i> Certified Buyer <?php echo date('d M Y H:i A', strtotime($val['review_date'])); ?></li>
                                                    </ul>
                                                </div>
                                                <div class="col-lg-6 col-md-6">
                                                    <ul class="right_links">
                                                        <li>
                                                           <!--  <a href="javascript:void()"><i class="fa fa-pencil-square-o "></i> Edit</a> -->
                                                           <a href="<?php echo site_url(); ?>members/edit_review/<?php echo $val['review_id']; ?>" title="Remove"><i class="fa fa-pencil-square-o"></i> Edit</a>
                                                        </li>
                                                        <li>
                                                            <!-- <a href="javascript:void()"><i class="fa fa-check-circle"></i> Delete</a> -->
                                                            <a class="remove" href="<?php echo site_url(); ?>members/remove_review/<?php echo $val['review_id']; ?>" title="Remove"><i class="fa fa-trash-o"></i> Delete</a>
                                                        </li>
                                                    </ul>
                                                </div>
                                            </div>

                                        </div>
                                    </div>
                                </div>
                            </div>
                        </div>
                    </div>
                   <?php } ?>
                </div>
                  <?php }else{ ?>
                      <div class="text-center mt10 thank-you">
                      <h4 class="mb-70 thankyou-text">Sorry, No Results Found!</h4>
                      <a href="<?=site_url('products');?>" class="btn btn-default checkout_btn" title="Continue Shopping">Continue Shopping</a>
                    </div>
                  <?php } ?>
            </div>
        </div>

        <div class="col-md-3 col-md-pull-9">
         <?php $this->load->view('members/left'); ?>
        </div>

      </div>
    </div>
  </section>



<?php $this->load->view("bottom"); ?>