public function vehicle_advertisement_detail_view($id) { $vehicle_advertisments_service = new Vehicle_advertisments_service(); $vehicle_images_service = new Vehicle_images_service(); $searched_vehicles_model = new Searched_vehicles_model(); $searched_vehicles_service = new Searched_vehicles_service(); $vehicle_reviews_service = new Vehicle_reviews_service(); $vehicle_equipment_service = new Vehicle_equipment_service(); $equipment_service = new Equipment_service(); $user_service = new User_service(); $website_advertisement_service = new Website_advertisements_service(); $vehicle_id = $this->uri->segment(3); $data['equipments'] = $equipment_service->get_all_active_equipment(); $data['vehicle_detail'] = $vehicle_advertisments_service->get_advertisement_by_id($id); $data['seller_add'] = $user_service->get_user($data['vehicle_detail']->added_by); $data['images'] = $vehicle_images_service->get_images_for_advertisement($id); $data['vehicle_reviews'] = $vehicle_reviews_service->get_all_vehicle_reviews($vehicle_id); $data['review_looks_count'] = count($searched_vehicles_service->get_view_count_for_advertisement($id)); $data['suggestions'] = $vehicle_advertisments_service->similar_suggestions($data['vehicle_detail']->manufacture_id, $data['vehicle_detail']->model_id); //Ashani $vehicle_equipments = $vehicle_equipment_service->get_equipments_by_vehicle_id($id); $equipment_array = array(); foreach ($vehicle_equipments as $value) { $equipment_array[] = $value->equipment_id; } $data['vehicle_equipments'] = $equipment_array; $data['latest_vehicles'] = $vehicle_advertisments_service->get_new_arrival(2); $data['commercial_images'] = $website_advertisement_service->get_advertisement_image(); $parials = array('content' => 'vehicle_adds/vehicle_detail_view', 'new_arrivals' => 'vehicle_adds/new_arrivals'); $this->template->load('template/main_template', $parials, $data); }
function edit_review() { $vehicle_reviews_service = new Vehicle_reviews_service(); $vehicle_reviews_model = new Vehicle_reviews_model(); $vehicle_reviews_model->set_id($this->input->post('review_id', TRUE)); $vehicle_reviews_model->set_description($this->input->post('description', TRUE)); $vehicle_reviews_model->set_updated_by($this->session->userdata('USER_ID')); $vehicle_reviews_model->set_updated_date(date("Y-m-d H:i:s")); $vehicle_reviews_service->update_reviews($vehicle_reviews_model); $vehicle_reviews = $vehicle_reviews_service->get_all_vehicle_reviews($this->input->post('vehicle_id', TRUE)); foreach ($vehicle_reviews as $value) { ?> <article class="review"> <figure class="author"> <?php if ($value->profile_pic == '') { ?> <img class="img-responsive " src="<?php echo base_url() . 'uploads/user_avatars/avatar.png'; ?> "/> <?php } else { ?> <img class="img-responsive " src="<?php echo base_url() . 'uploads/user_avatars/' . $value->profile_pic; ?> "/> <?php } ?> <div class="date"><?php echo date('Y.m.d', strtotime($value->added_date)); ?> </div> </figure> <!-- /.author--> <div class="wrapper"> <?php if ($value->added_by_user != '') { ?> <h5><?php echo ucfirst($value->added_by_user); ?> </h5> <?php } ?> <p> <?php echo $value->description; ?> </p> <?php if ($value->review_user == $this->session->userdata('USER_ID')) { ?> <div class="item list admin-view"> <div class="description"> <ul class="list-unstyled actions"> <li> <a style="cursor: pointer" onclick="display_edit_review_pop_up(<?php echo $value->id; ?> )"><i class="fa fa-pencil " title="Update"></i></a> </li> <li> <a style="cursor: pointer" onclick="delete_comment(<?php echo $value->id; ?> )"><i class="fa fa-trash-o " title="Remove" style="color: red;"></i></a> </li> </ul> </div> </div> <?php } ?> </div> <!-- /.wrapper--> </article> <?php } }