<?php
defined('BASEPATH') OR exit('No direct script access allowed');

class Front_setting extends Admin_Core_Controller {

	public function __construct()
    {
        parent::__construct();
        $this->load->model('Front_model', 'FrontendModel');
    }

	function edit_slider($id)
    {
        $data['app_setting'] = $this->setting_model->get_all_app_setting();
        $data['slider']=$this->FrontendModel->get_slider_by_id($id); 
        $this->load->view('admin/include/header',$data);  
        $this->load->view('admin/front_setting/edit_slider',$data);  
        $this->load->view('admin/include/footer');  
    }

    function update_slider($id)
    {
        if ($this->FrontendModel->update_slider($id)) {
          $this->session->set_userdata('success', "Slider Successfully Updated");
          redirect($this->agent->referrer());
        } 
        else 
        {
            $this->session->set_userdata('error', "Slider Updated Faild");
            redirect($this->agent->referrer());
        }    
    }

    function short_about_us()
    {
        $data['app_setting'] = $this->setting_model->get_all_app_setting();
        $data['service_heading'] = $this->FrontendModel->get_our_service_image();
        $data['all_service'] = $this->FrontendModel->get_all_our_service();
        $this->load->view('admin/include/header',$data); 
        $this->load->view('admin/front_setting/our_service');
        $this->load->view('admin/include/footer');
    }

    function update_our_service_image_section()
    {
        if ($this->FrontendModel->update_our_service_image_section()) {
            $this->session->set_userdata('success', "Data Section Successfully Updated");
            redirect(base_url().'admin/front_setting/short_about_us');
        } 
        else 
        {
            $this->session->set_userdata('error', "Data Section Update Faild");
            redirect($this->agent->referrer());
        }
    }

    function add_new_service()
    {
        if ($this->FrontendModel->add_new_service()) {
            $this->session->set_userdata('success', "Data Successfully Added");
            redirect(base_url().'admin/front_setting/short_about_us');
        } 
        else 
        {
            $this->session->set_userdata('error', "Data Added Faild");
            redirect($this->agent->referrer());
        }
    }

    function edit_our_service($id)
    {
        $data['app_setting'] = $this->setting_model->get_all_app_setting();
        $data['service'] = $this->FrontendModel->get_our_service_by_id($id);
        $this->load->view('admin/include/header',$data); 
        $this->load->view('admin/front_setting/edit_our_service');
        $this->load->view('admin/include/footer');
    }

    function update_our_service_section($id)
    {
        if ($this->FrontendModel->update_our_service_section($id)) {
            $this->session->set_userdata('success', "Data Successfully Updated");
            redirect(base_url().'admin/front_setting/short_about_us');
        } 
        else 
        {
            $this->session->set_userdata('error', "Data Updated Faild");
            redirect($this->agent->referrer());
        }
    }

    function delete_our_service($id)
    {
        if ($this->FrontendModel->delete_our_service($id)) {
            $this->session->set_userdata('success', "Data Successfully Deleted");
            redirect(base_url().'admin/front_setting/short_about_us');
        } 
        else 
        {
            $this->session->set_userdata('error', "Data Deleted Faild");
            redirect($this->agent->referrer());
        }
    }

    function banner_details()
    {
        $data['app_setting'] = $this->setting_model->get_all_app_setting();
        $data['heading'] = $this->FrontendModel->get_all_banner_heading();
        $this->load->view('admin/include/header',$data);  
        $this->load->view('admin/front_setting/banner_details');  
        $this->load->view('admin/include/footer');  
    }

    function update_banner_heading()
    {
        if ($this->FrontendModel->update_banner_heading()) {
            $this->session->set_userdata('success', "Data Successfully Updated");
            redirect(base_url().'admin/front_setting/banner_details');
        } 
        else 
        {
            $this->session->set_userdata('error', "Data Updated Faild");
            redirect($this->agent->referrer());
        }
    }

    /// About Us Page Start

    public function add_about_us_section_1()
    {
        if ($this->FrontendModel->add_about_us_section_1()) {
            $this->session->set_userdata('success', "Section 1 Successfully Updated");
            redirect($this->agent->referrer());
        } else {
            $this->session->set_userdata('error', "Section Updated Faild");
            redirect($this->agent->referrer());
        }
    }

    public function add_about_us_section_2_i()
    {
        if ($this->FrontendModel->add_about_us_section_2_i()) {
            $this->session->set_userdata('success', "Section 2 Successfully Updated");
            redirect($this->agent->referrer().'#head_2');
        } else {
            $this->session->set_userdata('error', "Section Updated Faild");
            redirect($this->agent->referrer());
        }
    }

    public function add_about_us_section_2_ii()
    {
        if ($this->FrontendModel->add_about_us_section_2_ii()) {
            $this->session->set_userdata('success', "Section 2 Content Successfully Added");
            redirect($this->agent->referrer().'#head_2_c');
        } else {
            $this->session->set_userdata('error', "Section Updated Faild");
            redirect($this->agent->referrer());
        }
    }

    public function delete_section_2_content($id)
    {
        if ($this->FrontendModel->delete_section_2_content($id)) {
            $this->session->set_userdata('success', "Section 2 Content Successfully Delete");
            redirect($this->agent->referrer().'#head_2_c');
        } else {
            $this->session->set_userdata('error', "Section Updated Faild");
            redirect($this->agent->referrer());
        }
    }

    public function update_about_us_section_2_ii()
    {
        if ($this->FrontendModel->update_about_us_section_2_ii()) {
            $this->session->set_userdata('success', "Section 2 Content Successfully Updated");
            redirect($this->agent->referrer().'#head_2_c');
        } else {
            $this->session->set_userdata('error', "Section Updated Faild");
            redirect($this->agent->referrer());
        }
    }

    public function add_about_us_section_3()
    {
        if ($this->FrontendModel->add_about_us_section_3()) {
            $this->session->set_userdata('success', "Section 3 Content Successfully Updated");
            redirect($this->agent->referrer().'#head_3');
        } else {
            $this->session->set_userdata('error', "Section Updated Faild");
            redirect($this->agent->referrer());
        }
    }

    public function add_about_us_section_4_i()
    {
        if ($this->FrontendModel->add_about_us_section_4_i()) {
            $this->session->set_userdata('success', "Section 4 Successfully Updated");
            redirect($this->agent->referrer().'#head_4_c');
        } else {
            $this->session->set_userdata('error', "Section Updated Faild");
            redirect($this->agent->referrer());
        }
    }

    public function add_about_us_section_4_ii()
    {
        if ($this->FrontendModel->add_about_us_section_4_ii()) {
            $this->session->set_userdata('success', "Section 4 Content Successfully Added");
            redirect($this->agent->referrer().'#head_4_c');
        } else {
            $this->session->set_userdata('error', "Section Updated Faild");
            redirect($this->agent->referrer());
        }
    }

    public function delete_section_4_content($id)
    {
        if ($this->FrontendModel->delete_section_4_content($id)) {
            $this->session->set_userdata('success', "Section 4 Content Successfully Deleted");
            redirect($this->agent->referrer().'#head_4_c');
        } else {
            $this->session->set_userdata('error', "Section Updated Faild");
            redirect($this->agent->referrer());
        }
    }

    public function update_about_us_section_4_ii()
    {
        if ($this->FrontendModel->update_about_us_section_4_ii()) {
            $this->session->set_userdata('success', "Section 4 Content Successfully Updated");
            redirect($this->agent->referrer().'#head_4_c');
        } else {
            $this->session->set_userdata('error', "Section Updated Faild");
            redirect($this->agent->referrer());
        }
    }

    public function add_about_us_section_5()
    {
        if ($this->FrontendModel->add_about_us_section_5()) {
            $this->session->set_userdata('success', "Section 5 Content Successfully Added");
            redirect($this->agent->referrer().'#head_5');
        } else {
            $this->session->set_userdata('error', "Section Updated Faild");
            redirect($this->agent->referrer());
        }
    }

    public function delete_section_5_content($id)
    {
        if ($this->FrontendModel->delete_section_5_content($id)) {
            $this->session->set_userdata('success', "Section 5 Content Successfully Deleted");
            redirect($this->agent->referrer().'#head_5');
        } else {
            $this->session->set_userdata('error', "Section Updated Faild");
            redirect($this->agent->referrer());
        }
    }

    public function update_about_us_section_5()
    {
        if ($this->FrontendModel->update_about_us_section_5()) {
            $this->session->set_userdata('success', "Section 5 Content Successfully Updated");
            redirect($this->agent->referrer().'#head_5');
        } else {
            $this->session->set_userdata('error', "Section Updated Faild");
            redirect($this->agent->referrer());
        }
    }

    public function add_about_us_section_6_i()
    {
        if ($this->FrontendModel->add_about_us_section_6_i()) {
            $this->session->set_userdata('success', "Section 6 Content Successfully Updated");
            redirect($this->agent->referrer().'#head_6');
        } else {
            $this->session->set_userdata('error', "Section Updated Faild");
            redirect($this->agent->referrer());
        }
    }

    public function add_about_us_section_6_ii()
    {
        if ($this->FrontendModel->add_about_us_section_6_ii()) {
            $this->session->set_userdata('success', "Section 6 Content Successfully Added");
            redirect($this->agent->referrer().'#head_6');
        } else {
            $this->session->set_userdata('error', "Section Updated Faild");
            redirect($this->agent->referrer());
        }
    }

    public function delete_section_6_ii_content($id)
    {
        if ($this->FrontendModel->delete_section_6_ii_content($id)) {
            $this->session->set_userdata('success', "Section 6 Content Successfully Deleted");
            redirect($this->agent->referrer().'#head_6');
        } else {
            $this->session->set_userdata('error', "Section Updated Faild");
            redirect($this->agent->referrer());
        }
    }

    public function update_about_us_section_6_ii()
    {
        if ($this->FrontendModel->update_about_us_section_6_ii()) {
            $this->session->set_userdata('success', "Section 6 Content Successfully Updated");
            redirect($this->agent->referrer().'#head_6');
        } else {
            $this->session->set_userdata('error', "Section Updated Faild");
            redirect($this->agent->referrer());
        }
    }


    public function add_about_us_section_timeline()
    {
        if ($this->FrontendModel->add_about_us_section_timeline()) {
            $this->session->set_userdata('success', "Timeline Content Successfully Added");
            redirect($this->agent->referrer().'#head_7');
        } else {
            $this->session->set_userdata('error', "Timeline Updated Faild");
            redirect($this->agent->referrer());
        }
    }

    public function delete_section_timeline_content($id)
    {
        if ($this->FrontendModel->delete_section_timeline_content($id)) {
            $this->session->set_userdata('success', "Timeline Content Successfully Deleted");
            redirect($this->agent->referrer().'#head_7');
        } else {
            $this->session->set_userdata('error', "Timeline Updated Faild");
            redirect($this->agent->referrer());
        }
    }

    public function update_about_us_section_timeline($id)
    {
        if ($this->FrontendModel->update_about_us_section_timeline($id)) {
            $this->session->set_userdata('success', "Timeline Content Successfully Updated");
            redirect($this->agent->referrer().'#head_7');
        } else {
            $this->session->set_userdata('error', "Timeline Updated Faild");
            redirect($this->agent->referrer());
        }
    }
    
    function update_brain_behind()
    {
        if ($this->FrontendModel->update_brain_behind()) {
            $this->session->set_userdata('success', "Content Successfully Updated");
            redirect($this->agent->referrer().'#head_8');
        } else {
            $this->session->set_userdata('error', "Content Updated Faild");
            redirect($this->agent->referrer());
        }
    }

    public function add_about_us_section_award()
    {
        if ($this->FrontendModel->add_about_us_section_award()) {
            $this->session->set_userdata('success', "Award Content Successfully Added");
            redirect($this->agent->referrer().'#head_9');
        } else {
            $this->session->set_userdata('error', "Award Updated Faild");
            redirect($this->agent->referrer());
        }
    }

    public function delete_section_award_content($id)
    {
        if ($this->FrontendModel->delete_section_award_content($id)) {
            $this->session->set_userdata('success', "Award Content Successfully Deleted");
            redirect($this->agent->referrer().'#head_9');
        } else {
            $this->session->set_userdata('error', "Award Updated Faild");
            redirect($this->agent->referrer());
        }
    }

    public function update_about_us_section_award($id)
    {
        if ($this->FrontendModel->update_about_us_section_award($id)) {
            $this->session->set_userdata('success', "Award Content Successfully Updated");
            redirect($this->agent->referrer().'#head_9');
        } else {
            $this->session->set_userdata('error', "Award Updated Faild");
            redirect($this->agent->referrer());
        }
    }
    


    

    public function about_us_page()
    {
        $data['title'] = 'About Us';
        $data['app_setting'] = $this->setting_model->get_all_app_setting();
        $data['content_1'] = $this->FrontendModel->get_all_about_us_content_1();
        $data['content_2'] = $this->FrontendModel->get_all_about_us_content_2_i();
        $data['content_2_i'] = $this->FrontendModel->get_all_about_us_content_2_ii();
        $data['content_3'] = $this->FrontendModel->get_all_about_us_content_3();
        $data['content_4'] = $this->FrontendModel->get_all_about_us_content_4_i();
        $data['content_4_i'] = $this->FrontendModel->get_all_about_us_content_4_ii();
        $data['content_5'] = $this->FrontendModel->get_all_about_us_content_5();
        $data['content_6_i'] = $this->FrontendModel->get_all_about_us_content_6_i();
        $data['content_6_ii'] = $this->FrontendModel->get_all_about_us_content_6_ii();
        $data['all_timeline'] = $this->FrontendModel->get_all_about_us_content_timeline();
        $data['brain'] = $this->FrontendModel->get_brain_behiend();
        $data['get_all_award'] = $this->FrontendModel->get_all_about_us_content_award();
        $this->load->view('admin/include/header', $data);
        $this->load->view('admin/front_setting/about_us', $data);
        $this->load->view('admin/include/footer', $data);
    }
    
    // About Us Page end

    function slider_block()
    {
        $data['app_setting'] = $this->setting_model->get_all_app_setting();
        $data['slider']=$this->FrontendModel->get_all_slider_block(); 
        $this->load->view('admin/include/header',$data);  
        $this->load->view('admin/front_setting/slider_block',$data);  
        $this->load->view('admin/include/footer');  
    }

    function update_slider_block()
    {
        if ($this->FrontendModel->update_slider_block()) {
          $this->session->set_userdata('success', "Block Successfully Updated");
          redirect($this->agent->referrer());
        } 
        else 
        {
            $this->session->set_userdata('error', "Block Updated Faild");
            redirect($this->agent->referrer());
        }    
    }

    function testimonial()
    {
        $data['app_setting'] = $this->setting_model->get_all_app_setting();
        $data['all_testimonial'] = $this->FrontendModel->get_all_testimonial();
        // $data['testimonials_bg'] = $this->FrontendModel->get_testimonials_bg_image();
        $this->load->view('admin/include/header',$data); 
        $this->load->view('admin/front_setting/all_testimonial', $data);
        $this->load->view('admin/include/footer', $data);
    }

    function add_testimonial()
    {
        $data['app_setting'] = $this->setting_model->get_all_app_setting();
        $this->load->view('admin/include/header',$data); 
        $this->load->view('admin/front_setting/add_testimonial');
        $this->load->view('admin/include/footer');
    }

    function add_new_testimonials()
    {
    
      if ($this->FrontendModel->add_new_testimonials()) {
        $this->session->set_userdata('success', "Testimonial Successfully Added");
        redirect(base_url().'admin/front_setting/testimonial');
      } 
      else 
      {
          $this->session->set_userdata('error', "Testimonial Added Faild");
          redirect($this->agent->referrer());
      }
    }

    function delete_testmonials($id)
    {
          if ($this->FrontendModel->delete_testmonials()) {
            $this->session->set_userdata('success', "Testimonial Successfully Deleted");
            redirect(base_url().'admin/front_setting/testimonial');
          } 
          else 
          {
              $this->session->set_userdata('error', "Testimonial Deleted Faild");
              redirect($this->agent->referrer());
          }
    }

    function edit_testmonials($id)
    {
        $data['app_setting'] = $this->setting_model->get_all_app_setting();
        $data['testimonial'] = $this->FrontendModel->get_testimonials_details_by_id($id);
        $this->load->view('admin/include/header',$data); 
        $this->load->view('admin/front_setting/edit_testmonials', $data);
        $this->load->view('admin/include/footer', $data);
    }

    function update_testimonials($id)
    {
          if ($this->FrontendModel->update_testimonials($id)) {
            $this->session->set_userdata('success', "Testimonial Successfully Updated");
             redirect(base_url().'admin/front_setting/testimonial');
          } 
          else 
          {
              $this->session->set_userdata('error', "Testimonial Update Faild");
              redirect($this->agent->referrer());
          }
    }

    function placement_logo()
    {
        $data['app_setting'] = $this->setting_model->get_all_app_setting();
        $data['all_logo']=$this->FrontendModel->get_all_placement_logo(); 
        $this->load->view('admin/include/header',$data);  
        $this->load->view('admin/front_setting/all_placement_logo',$data);  
        $this->load->view('admin/include/footer');  
           
    }

    function add_placement_logo()
    {
        $data['app_setting'] = $this->setting_model->get_all_app_setting();
        $this->load->view('admin/include/header',$data);  
        $this->load->view('admin/front_setting/add_placement_logo',$data);  
        $this->load->view('admin/include/footer');  
    }

    function add_new_placement_logo()
    {
        if ($this->FrontendModel->add_new_placement_logo()) {
          $this->session->set_userdata('success', "Logo Successfully Added");
          redirect(base_url().'admin/front_setting/placement_logo');
        } 
        else 
        {
            $this->session->set_userdata('error', "Logo Added Faild");
            redirect($this->agent->referrer());
        }
            
    }

    function edit_placement_logo($id)
    {
        $data['app_setting'] = $this->setting_model->get_all_app_setting();
        $data['logo']=$this->FrontendModel->get_placement_logo_by_id($id); 
        $this->load->view('admin/include/header',$data);  
        $this->load->view('admin/front_setting/edit_placement_logo');  
        $this->load->view('admin/include/footer');  
    }

    function update_new_placement_logo($id)
    {
        if ($this->FrontendModel->update_new_placement_logo($id)) {
            $this->session->set_userdata('success', "Logo Successfully Updated");
            redirect(base_url().'admin/front_setting/placement_logo');
        } 
        else 
        {
            $this->session->set_userdata('error', "Logo Updated Faild");
            redirect($this->agent->referrer());
        }
    }

    function delete_placement_logo($id)
    {
        if ($this->FrontendModel->delete_placement_logo($id)) {
            $this->session->set_userdata('success', "Logo Successfully Deleted");
            redirect(base_url().'admin/front_setting/placement_logo');
        } 
        else 
        {
            $this->session->set_userdata('error', "Logo Deleted Faild");
            redirect($this->agent->referrer());
        }
            
    }

    public function view_all_page()
    {
        $data['title'] = 'Page Setting';
        $data['app_setting'] = $this->setting_model->get_all_app_setting(); 
        $data['get_all_page'] = $this->FrontendModel->get_all_page();  
        $this->load->view('admin/include/header', $data);
        $this->load->view('admin/front_setting/all_page', $data);
        $this->load->view('admin/include/footer', $data);
    }

    function add_new_page()
    {
        $data['title'] = 'Add New Page';
        $data['app_setting'] = $this->setting_model->get_all_app_setting(); 
        $this->load->view('admin/include/header', $data);
        $this->load->view('admin/front_setting/add_new_page', $data);
        $this->load->view('admin/include/footer', $data);
    }

    function page_add()
    {
        if ($this->FrontendModel->page_add()) {
            $this->session->set_userdata('success', "Page Successfully Added");
            redirect(base_url().'admin/front_setting/view_all_page');
        } else {
            $this->session->set_userdata('error', "Page Added Faild");
            redirect($this->agent->referrer());
        }
    }

    public function update_page($id)
    {
        $data['title'] = 'Update Page';
        $data['app_setting'] = $this->setting_model->get_all_app_setting(); 
        $data['page'] = $this->FrontendModel->get_page_by_id($id); 
        $this->load->view('admin/include/header', $data);
        $this->load->view('admin/front_setting/update_page', $data);
        $this->load->view('admin/include/footer', $data);
    }

    public function page_update()
    {
        if ($this->FrontendModel->update_page()) {
            $this->session->set_userdata('success', "Page Successfully Updated");
            redirect(base_url().'admin/front_setting/view_all_page');
        } else {
            $this->session->set_userdata('error', "Page Update Faild");
            redirect($this->agent->referrer());
        }
    }

    
    function delete_page($id)
    {
        if ($this->FrontendModel->delete_page($id)) {
            $this->session->set_userdata('success', "Page Successfully Deleted");
            redirect(base_url().'admin/front_setting/view_all_page');
        } else {
            $this->session->set_userdata('error', "Page Deleted Faild");
            redirect($this->agent->referrer());
        }
    }

    function notification()
    {
        $data['app_setting'] = $this->setting_model->get_all_app_setting();
        $data['notice'] = $this->FrontendModel->get_front_top_notification();
        $this->load->view('admin/include/header',$data); 
        $this->load->view('admin/front_setting/notification');
        $this->load->view('admin/include/footer');
    }

    function update_notification()
    {
        if ($this->FrontendModel->update_notification()) {
            $this->session->set_userdata('success', "Notice Successfully Updated");
            redirect(base_url().'admin/front_setting/notification');
        } 
        else 
        {
            $this->session->set_userdata('error', "Notice Update Faild");
            redirect($this->agent->referrer());
        }
    }

    function gallery()
    {
        $data['app_setting'] = $this->setting_model->get_all_app_setting();
        $data['all_category'] = $this->FrontendModel->get_all_gallery_category();
        $data['all_gallery'] = $this->FrontendModel->get_all_gellery_with_category();
        $this->load->view('admin/include/header',$data); 
        $this->load->view('admin/front_setting/gallery');
        $this->load->view('admin/include/footer');
    }

    function add_gallery_category()
    {
        if ($this->FrontendModel->add_gallery_category()) {
            $this->session->set_userdata('success', "Category Successfully Added");
            redirect($this->agent->referrer());
        } 
        else 
        {
            $this->session->set_userdata('error', "Category Added Faild");
            redirect($this->agent->referrer());
        }
    }

    public function update_gallery_category($id)
    {
        if ($this->FrontendModel->update_gallery_category($id)) 
        {
            $this->session->set_userdata('success', "Category Successfully Updated");
            redirect($this->agent->referrer());
        } 
        else 
        {
            $this->session->set_userdata('error', "Category Updated Faild");
            redirect($this->agent->referrer());
        }
    }

    public function delete_gallery_category($id)
    {
        if ($this->FrontendModel->delete_gallery_category($id)) 
        {
            $this->session->set_userdata('success', "Category Successfully Deleted");
            redirect($this->agent->referrer());
        } 
        else 
        {
            $this->session->set_userdata('error', "Category Deleted Faild");
            redirect($this->agent->referrer());
        }
    }

    public function add_gallery_image()
    {
        if ($this->FrontendModel->add_gallery_image()) 
        {
            $this->session->set_userdata('success', "Image Successfully Added");
            redirect($this->agent->referrer());
        } 
        else 
        {
            $this->session->set_userdata('error', "Image Added Faild");
            redirect($this->agent->referrer());
        }
    }

    function edit_gallery($id)
    {
        $data['app_setting'] = $this->setting_model->get_all_app_setting();
        $data['all_category'] = $this->FrontendModel->get_all_gallery_category();
        $data['gallery'] = $this->FrontendModel->get_gallery_by_id($id);
        $this->load->view('admin/include/header',$data); 
        $this->load->view('admin/front_setting/edit_gallery');
        $this->load->view('admin/include/footer');
    }

    public function update_gallery_image($id)
    {
        if ($this->FrontendModel->update_gallery($id)) 
        {
            $this->session->set_userdata('success', "Data Successfully Updated");
            redirect(base_url().'admin/front_setting/gallery');
        } 
        else 
        {
            $this->session->set_userdata('error', "Data Updated Faild");
            redirect($this->agent->referrer());
        }
    }

    public function delete_gallery($id)
    {
        if ($this->FrontendModel->delete_gallery($id)) 
        {
            $this->session->set_userdata('success', "Data Successfully Deleted");
            redirect($this->agent->referrer());
        } 
        else 
        {
            $this->session->set_userdata('error', "Data Deleted Faild");
            redirect($this->agent->referrer());
        }
    }

    public function ebook()
    {
        $data['app_setting'] = $this->setting_model->get_all_app_setting();
        $data['ebook'] = $this->FrontendModel->get_ebook_data();
        $this->load->view('admin/include/header',$data); 
        $this->load->view('admin/front_setting/ebook');
        $this->load->view('admin/include/footer');
    }

    public function update_ebook()
    {
        if ($this->FrontendModel->update_ebook()) 
        {
            $this->session->set_userdata('success', "Data Successfully Updated");
            redirect($this->agent->referrer());
        } 
        else 
        {
            $this->session->set_userdata('error', "Data Updated Faild");
            redirect($this->agent->referrer());
        }
    }
   
}