<?php

class Delete extends CI_Controller
{
    function __construct()
    {
        parent::__construct();
        $this->load->model('Delete_data');
        $this->load->model('Common_model');
    }
 
    public function del_images($a_id)
    {
         $image = $this->Common_model->select_by_id('a_id',$a_id, 'add_image');
         foreach($image as $row);
         $p_id = $row->p_id;
         
         $this->Delete_data->del_image($a_id);
         $this->session->set_flashdata('delete_product','Data  deleted successfully..');        
         redirect('index.php/App/add_image/'.$p_id, 'location');
    }
    public function del_productvideo($v_id)
    {
         $video = $this->Common_model->select_by_id('v_id',$v_id, 'add_video');
         foreach($video as $row);
         $p_id = $row->p_id;
         
         $this->Common_model->deleteall('v_id', $v_id, 'add_video');
         $this->session->set_flashdata('delete','Data  deleted successfully..');       
         redirect('index.php/App/add_video/'.$p_id, 'location');
    }
    public function del_article($a_id)
    {
        $this->Delete_data->delarticle($a_id);
         $this->session->set_flashdata('delete_product','Blogs  deleted successfully..');
        redirect('index.php/App/article', 'location');
    }

    public function del_slider($s_id)
    {
        $this->Delete_data->delslider($s_id);
        $this->session->set_flashdata('delete_slider','Slider deleted successfully..');
        redirect('index.php/App/slider','location');
    }

    public function del_gallery($g_id)
   {
    $this->Delete_data->delgallery($g_id);
    $this->session->set_flashdata('delete_gallery','Gallery deleted successfully..');
    redirect('index.php/App/gallery','location');
   }
   public function del_gtype($gt_id)
   {
    $this->Delete_data->del_gtype($gt_id);
    $this->session->set_flashdata('delete_gallerytype','Gallery Type deleted successfully..');
    redirect('index.php/App/gallery_type','location');
   }
   public function del_video($v_id)
   {
    $this->Delete_data->del_video($v_id);
    $this->session->set_flashdata('delete_video','Video link deleted successfully..');
    redirect('index.php/App/video','location');
   }
    public function del_test($t_id)
   {
    $this->Delete_data->del_test($t_id);
    $this->session->set_flashdata('delete_test','Testmonial deleted successfully..');
    redirect('index.php/App/testmonial','location');
   }
   
    public function del_client($c_id)
   {
    $this->Delete_data->delclient($c_id);
    $this->session->set_flashdata('delete_pcategory','Product deleted successfully..');
    redirect('App/client','location');
   }
   
   public function del_infra($id)
   {
    $this->Common_model->deleteall('id', $id, 'infrastructure');
    $this->session->set_flashdata('delete','Data deleted successfully..');
    redirect('App/infra','location');
   }
   
     public function del_products($p_id)
    {
        $this->Delete_data->delproduct($p_id);
         $this->session->set_flashdata('delete_product','Product  deleted successfully..');
        redirect('index.php/App/products', 'location');
    }
    public function del_project($p_id)
    {
        $this->Common_model->deleteall('p_id', $p_id, 'projects');
         $this->session->set_flashdata('delete_product','Project  deleted successfully..');
        redirect('index.php/App/project', 'location');
    }
    
     public function del_projectimage($a_id)
    {
        $images =$this->Common_model->select_by_id('a_id', $a_id, 'project_images');
        foreach($images as $row);
        $p_id = $row->p_id;
        $this->Common_model->deleteall('a_id', $a_id, 'project_images');
        $this->session->set_flashdata('delete','Images  deleted successfully..');
        redirect('index.php/App/project_image/'.$p_id, 'location');
    }

  public function del_pdf($p_id)
  {
    $this->Delete_data->del_pdf($p_id);
    redirect('app/pdf','location');

  }

  public function del_news($n_id)
  {
    $this->Delete_data->del_news($n_id);
    redirect('app/news','location');

  }
}
