<?php
session_start();
class employeectrl{
    public function salessignupdetails($emailid){
        include_once('../Model/employee.php');
        $dbobj=new employeedb();
        $result=$dbobj->sales_signupdetails($emailid);
        return $result;
    }
    public function salesemployeename($emailid){
        include_once('../Model/employee.php');
        $dbobj=new employeedb();
        $result=$dbobj->sales_employee_name($emailid);
        foreach($result as $row){
            $employeename=$row['employeename'];
        }
        return $employeename;
    }
    public function salesemployeeactionstream($emailid){
        include_once('../Model/employee.php');
        $dbobj=new employeedb();
        $result=$dbobj->sales_employee_action_stream($emailid);
        return $result;
    }
    public function salesselectemployee(){
        session_start();
        $companyname=$_SESSION['companyname'];
        $adminemailid=$_SESSION['companymailid'];
        $createby=$_SESSION['emailid'];
        $createtype=$_SESSION['employeetype'];
        include_once('../Model/employee.php');
        $dbobj=new employeedb();
        $result=$dbobj->sales_select_employee($companyname);
        return $result;
    }
}
?>

<?php
if(isset($_POST['updateemployee'])){
    $companyname=$_SESSION['companyname'];
    $adminemailid=$_SESSION['companymailid'];
    $createby=$_SESSION['emailid'];
    $createtype=$_SESSION['employeetype'];
    include_once('../Model/employee.php');
    $dbobj=new employeedb();
    date_default_timezone_set("Asia/Kolkata");
    $DateandTime=date("Y-m-d H:i:s");
    $employeeid=$_POST['updateemployee'];
    $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_employee_contact($contid, $employeeid, $createby, $createtype, $DateandTime);  
    }
    
    return $result1;
}
?>