<?php 

class testimonials extends CI_Controller {

function testimonials()	 

{  

parent::__construct();	

$this->load->library('session');

$this->load->Model('functions', 'fun');  //function in model 

$this->load->library('pagination');

	 $this->load->library('form_validation');

 

} 







	public function details($name,$id,$lang='')

	{     $data['id']=$id;
    
	    if($lang=='ar')
	   {
	   $this->session->set_userdata('lang','ar');
	   }
	   if($lang=='en')
	   {
	   $this->session->set_userdata('lang','en');
	   }
 
	
	    if($this->session->userdata('lang')=='en')
	    {

                $this->load->view('header');
				$this->load->view('about_us',$data);
				$this->load->view('footer');
	   }else
	   {
	            $this->load->view('header_ar');
				$this->load->view('about_us_ar',$data);
				$this->load->view('footer_ar');


	   }
	

	}

	function send_about_msg()
	{
	    $name=$this->input->post('name'); 
	    
	    $kind=$this->input->post('kind');
$msg=$this->input->post('msg');
$email=$this->input->post('email');
	    $to= $this->fun->get_email();
	   // $sub="New Call Order from rama website visitor";
	    // $msg="Dear sir,<br>\r\n name: ".$fname." ".$lname." <br>\r\n phone: ".$phone. "<br>\r\n rama: ".$cat."<br>\r\n Sub: ".$cat2. "<br>\r\n Message: <b>".$msg. "<b><br>\r\nthanks" ;
	                    $this->form_validation->set_error_delimiters('<font color="#ff0000">', '</font>');
						$this->form_validation->set_rules('name', 'Name ', 'trim|required|xss_clean');
						$this->form_validation->set_rules('msg', 'Name ', 'trim|required|xss_clean');

						$this->form_validation->set_rules('email', 'email ', 'trim|required|valid_email|xss_clean');
        if ($this->form_validation->run() == FALSE)
		 {
		       if($this->session->userdata('lang')=='en')
	            {
	            }
	            else
	            {

		 		 echo "<div style='text-align:right'><font color=red>كل الحقول مطلوبه</font></div>";
		 		 }
		         //$this->index("l",$result);
		 }
		 		 else
		 {
		       if($this->session->userdata('lang')=='en'){$lang='en';}else{$lang='ar';}
         $data=array('name'=>$name,'email'=>$email,'kind'=>$kind,'msg'=>$msg,'lang'=>$lang);
         $send=$this->fun->add('about_us',$data);


            if($send)
            {  
                if($this->session->userdata('lang')=='en')
	            {
	            }
	            else
	            {
 
                echo "<div style='text-align:right'><font color=red>تم الارسال .. انتظر تفعيل الاداره</font><div>";
                }
                //$this->index("l",$result);
            }
            else
            {
                if($this->session->userdata('lang')=='en')
	            {
	            }
	            else
	            {

                echo  "<div style='text-align:right'><font color=red>خطأ في الارسال ..حاول مره اخري</font></div>";
                //$this->index("l",$result);
                }
            }
 	       // echo "<script type=\"text/javascript\"> alert(\" Successfuly sent \") ;window.location.href= \"".base_url()."index.php/contact/form\";</script>";
		}
	}
	
	
}















/* End of file welcome.php */







/* Location: ./application/controllers/welcome.php */