MMCT TEAM
Server IP : 192.185.129.71  /  Your IP : 3.16.147.87
Web Server : Apache
System : Linux bh-ht-3.webhostbox.net 4.19.286-203.ELK.el7.x86_64 #1 SMP Wed Jun 14 04:33:55 CDT 2023 x86_64
User : svymadmin ( 4072)
PHP Version : 7.4.33
Disable Function : NONE
MySQL : OFF  |  cURL : ON  |  WGET : ON  |  Perl : ON  |  Python : ON
Directory (0755) :  /home4/svymadmin/public_html/site/controllers/

[  Home  ][  C0mmand  ][  Upload File  ]

Current File : /home4/svymadmin/public_html/site/controllers/Volunteer_application.php
<?php if ( ! defined('BASEPATH')) exit('No direct script access allowed');

class Volunteer_application extends CI_Controller {

	function __construct() 
    { 
        parent::__construct();
        
        $this->load->library('session');
                
        $this->load->database();
       
        $this->output->set_header('Cache-Control: no-store, no-cache, must-revalidate, post-check=0, pre-check=0');
        $this->output->set_header('Pragma: no-cache');
        
    }


	public function index()
	{
		$this->load->helper('url');
		$this->load->view('volunteer_application_v');
	}


	public function apply(){
		
	$data["name"] = $this->input->post("v_name");

	$data["age"] = $this->input->post("v_age");
	$data["gender"] = $this->input->post("v_gender");
	$data["nationality"] = $this->input->post("v_nationality");
	$data["martial"] = $this->input->post("v_martial");
	$data["address"] = $this->input->post("v_paddress");
	$data["phone"] = $this->input->post("v_phone");
	$data["email"] = $this->input->post("v_mail");
	$data["education"] = $this->input->post("v_education");
	$data["specilization"] = $this->input->post("v_area");
	$data["occuption"] = $this->input->post("v_present");
	$data["passport"] = $this->input->post("v_pass");

	$data["issuedby"] = $this->input->post("v_issued");

	$data["validate"] = $this->input->post("v_valid");

	$data["visa_type"] = $this->input->post("v_visa_type");
	$data["visa_no"] = $this->input->post("v_visa_no");
	$data["visa_validity"] = $this->input->post("v_visa_validate");
	$data["visited"] = ucfirst($this->input->post("v_visited"));

	$data["know"] = $this->input->post("know");
	$data["sector"] = $this->input->post("sector");
	$data["activities"] = "";
	$data["time_come"] = $this->input->post("v_when_come");

	$data["stay_long"] = $this->input->post("v_long_stay");
	$data["skills"] = $this->input->post("v_skills");
	$data["come_spouse"] = $this->input->post("spous");
	$data["disability"] = $this->input->post("disability");
	$data["disability_detailes"] = (($this->input->post("v_disability_details"))!="")? $this->input->post("v_disability_details") : "";
	$data["vital_medical"] = (($this->input->post("v_disability_medicals"))!="")? $this->input->post("v_disability_medicals") : "";

	$data["expections"] =(($this->input->post("v_expetations"))!="")? $this->input->post("v_expetations") : "";

	$data["uploaded_date"]= date("Y-m-d"); 
	
	if($this->db->insert('volunteer_application', $data)){

	$v_id = $this->db->insert_id();

	$numberref = count($this->input->post('ref_name'));

	if($numberref>0){
	for($i=0; $i<$numberref; $i++) {

	$data_ref['volunteer_id']= $v_id;
	$data_ref['name']= $this->input->post('ref_name')[$i];
	$data_ref['address']= $this->input->post('ref_address')[$i];
	$data_ref['phone']= $this->input->post('ref_phone')[$i];
	$data_ref['email']= $this->input->post('ref_mail')[$i];
	if( $data_ref['name']!="" &&  $data_ref['address']!="" && $data_ref['phone']!="" && $data_ref['email']!="" ){
	$this->db->insert('volunteer_reference', $data_ref);
	}
	}

	}

	if($data["visited"]=="Yes"){
	$numbervisit = count($this->input->post('v_when'));
	if($numberref>0){
	for($i=0; $i<$numbervisit; $i++) {
	
	$data_visited['volunteer_id']= $v_id;
	$data_visited['when_visited']= $this->input->post('v_when')[$i];
	$data_visited['how_long']= $this->input->post('v_long')[$i];
	$data_visited['purpose']= $this->input->post('v_purpose')[$i];
	if($data_visited['when_visited']!="" && $data_visited['how_long']!="" && $data_visited['purpose']!=""){
	$this->db->insert('volunteer_visited', $data_visited);
	}
	}
	}
	}

	$numpref = count($this->input->post('v_organiztion'));

	if($numpref>0){
	for($i=0; $i<$numpref; $i++) {
	
	$data_pre['volunteer_id']= $v_id;
	$data_pre['organization']= $this->input->post('v_organiztion')[$i];
	$data_pre['country']= $this->input->post('v_country')[$i];
	$data_pre['work']= $this->input->post('v_work')[$i];
	$data_pre['paid']= $this->input->post('v_paid')[$i];
	
	if($data_pre['organization']!="" && $data_pre['country']!="" && $data_pre['work']!="" && $data_pre['paid']!=""){
	$this->db->insert('volunteer_previous', $data_pre);
	}
	
	}
	}


	$prev = count($this->input->post('p_name'));

	if($prev>0){
	for($i=0; $i<$prev; $i++) {
	
	$data_p['volunteer_id']= $v_id;
	$data_p['name']= $this->input->post('p_name')[$i];
	$data_p['association']= $this->input->post('p_associ')[$i];
	$data_p['address']= $this->input->post('p_address')[$i];
	$data_p['phone']= $this->input->post('p_phone')[$i];
	$data_p['email']= $this->input->post('p_email')[$i];
	
	if($data_p['name']!="" && $data_p['association']!="" && $data_p['address']!="" && $data_p['phone']!="" && $data_p['email']!=""){
	$this->db->insert('volunteer_professional_ref', $data_p);
	}

	}
	}


	

	$this->load->library('email');
	
        $fromemail="info@svym.org";
        $toemail = $data["email"];
        $subject = "Volunteer";
        
        $data['data']="Thank you very much for your interest in volunteering with us. Thank you for your application. We will process your application and get back to you soon.";
         $mesg = $this->load->view('templates/applied',$data,true);
        


        $config=array(
        'charset'=>'utf-8',
        'wordwrap'=> TRUE,
        'mailtype' => 'html'
        );

        $this->email->initialize($config);

        $this->email->to($toemail);
        $this->email->from($fromemail, "SVYM");
        $this->email->subject($subject);
        $this->email->message($mesg);
        $mail = $this->email->send();
        
        $fromemail="info@svym.org";
        $toemail = "rekhas@svym.org.in";
        $subject = "Volunteer";
        
        $data['data']="Hi, you have a new volunteer application.";
         $mesg = $this->load->view('templates/applied',$data,true);
        


        $config=array(
        'charset'=>'utf-8',
        'wordwrap'=> TRUE,
        'mailtype' => 'html'
        );

        $this->email->initialize($config);

        $this->email->to($toemail);
        $this->email->from($fromemail, "SVYM");
        $this->email->subject($subject);
        $this->email->message($mesg);
        $mail = $this->email->send();

	redirect(base_url() . 'volunteer_application/status/success', 'refresh');

	}else{

		redirect(base_url() . 'volunteer_application/status', 'refresh');
	}

	redirect(base_url() . 'volunteer_application', 'refresh');

	}


	function status($param=""){

		$pagedata['status']=$param;
		$this->load->view('application_success', $pagedata);
	}

}


MMCT - 2023