<?php
session_start();
//include '../Control/sales.php';
class leadsourcectrl{
public $companyname;
public $adminemailid;
public $createby;
public $createtype;
     function __construct() {
     }
    public function salesselectleadsource(){
        session_start();
        $companyname=$_SESSION['companyname'];
        $companytype=$_SESSION['companytype'];
        $companymailid=$_SESSION['companymailid'];
        $adminemailid=$_SESSION['emailid'];
        $responsible=$_SESSION['responsible_employee'];
        $createby=$_SESSION['emailid'];
        $createtype=$_SESSION['employeetype'];
        require_once ('../Model/leadsource.php');
        $dbobj=new leadsourcedb();
        $result1=$dbobj->sales_select_leadsource($companyname, $companymailid);  
        return $result1;
    }

}
?>

<?php
if(isset($_POST['updateleadsource'])){
        $companyname=$_SESSION['companyname'];
        $companytype=$_SESSION['companytype'];
        $companymailid=$_SESSION['companymailid'];
        $adminemailid=$_SESSION['emailid'];
        $responsible=$_SESSION['responsible_employee'];
    $createby=$_SESSION['emailid'];
    $createtype=$_SESSION['employeetype'];
    require_once ('../Model/leadsource.php');
    $dbobj=new leadsourcedb();
    date_default_timezone_set("Asia/Kolkata");
    $DateandTime=date("Y-m-d H:i:s");
    $leadsourceid=$_POST['updateleadsource'];
    $cont=$_POST['cont'];
    $cont_array=array();
    $cont_array=explode("@#", $cont);
    for($i=0;$i<count($cont_array);$i++){
        $contid=$cont_array[$i];
        $result1=$dbobj->sales_update_leadsource_contact($contid, $leadsourceid, $createby, $createtype, $DateandTime);  
    }
    return $result1;
}
?>