Sindbad~EG File Manager

Current Path : /home/numerotech/www/livemt2023.aios-scientificcommittee.org/app/controllers/
Upload File :
Current File : //home/numerotech/www/livemt2023.aios-scientificcommittee.org/app/controllers/ARCLDPController.php

<?php

class ARCLDPController extends BaseController {


    //IF id is null then create empty fp and redeirect to edit fp page
    //if id is not null then fp can edit 
    public function getARCLDP(){ 
        
        $membership = CustomClass::GetMembership();  
        $user_id  = CustomClass::getUserId();
        
        if($membership->user_type_id == 3 || $membership->user_type_id == 2)
        {
            if($this->is_closed())
            {
                return Redirect::to('dashboard');
            }         
            else
            {
                if($this->is_need_update_profile())
                {
                    return View::make('arcldp.info_profile');
                }
                else
                {
                    return View::make('arcldp.arcldp')
                        // ->with('arcldp',$arcldp) 
                        ->with('membership',$membership);
                }
            }
           
        }
        else
        {
            return Redirect::to('dashboard');
        }

                    
    }

    //if ARC LDP count = count 1 then close 
    public function is_closed()
    {
        $arcs = ARCLDP::where('user_id',CustomClass::getUserId())->get();
        if(!(CustomClass::$ARCLDP_Count > count($arcs)))
        {
            return true;
        }  
        else
        {
            return false;
        } 
    }
    
    
    public function is_need_update_profile()
    {
        
        $user = User::find(CustomClass::getUserId());
        if(isset($user->dob) && isset($user->email) && isset($user->mobile))
        {
            return false;
        }  
        else
        {
            return true;
        } 
    }
    
    
    
     //ARC LDP Store
    public function store()
    {
        try {

            //for Response
            $arr = [];
            $code = 0;
            $msg = "";
            $data = "";
            
            $user_id    =  CustomClass::getUserId();
            // $is_next    = intval(Input::get('hdnIsNext'));
            $is_next    = 1;
            $step       = intval(Input::get("hdnStep"));


            
            
            $arcldp = ARCLDP::where('user_id',$user_id)->first(); 
        
            
            if($is_next == 1)
            {
                                   
               if($step == 1)
               {
                    if(isset($arcldp))
                    {
                        $code   = 0;
                        $msg    = AppMessage::$ARCLDP_ALREADY_SUBMIT ." <a href=". url('/dashboard'). " >Please, check the status in Dashboard</a>";    
                        $data   = "";

                    }
                    else
                    {
                        
                        $arcldp = new ARCLDP(); 
                        $arcldp->user_id = $user_id;
                        $arcldp->travel_your_own_cost = intval(Input::get('rbtn1'));
                        $arcldp->participate_ldp_and_meetings = intval(Input::get('rbtn2'));
                        $arcldp->potential_represent_aios_internationally = intval(Input::get('rbtn3'));
                        $arcldp->would_able_higher_responsibility = intval(Input::get('rbtn4'));
                        $arcldp->save();
                    }
                          
                    $user = Auth::User();  
                    $this->arcldp_mail($user,$arcldp);

                    $code = 1;
                    $data = View::make('arcldp.success')->with('arcldp',$arcldp)->render();
                }
           
            }
            
        } catch (Exception $e) {
            Log::error('ARCLDPController - store :'.$e->getMessage());          
            $msg =AppMessage::$GENERAL_ERROR;
        }

        $arr = ['data' => $data, 'code' => $code, 'msg' => $msg];
        return Response::json($arr); 
    }
    
    //ARC LDP Mail Send 
    public function arcldp_mail($user,$arcldp)
    {
        if(empty($user->email))
        {
            return;
        }
        if(CustomClass::$IsEmailEnabled)
        {
             $isMailSend  =  Mail::send('emails.arcldp.chiefauthor', array('user' => $user,'arcldp' =>$arcldp), function($message) use ($arcldp,$user)
                                {       
                                    $message->subject(Subject::$arcldp); 
                                    $message->from('support@aios-online.com', 'Dr. Chitra Ramamurthy, Chairperson - ARC, AIOS');
                                    if(CustomClass::$IsEmailTest)
                                    {
                                        $message->to(CustomClass::$TestMailId);   
                                    }
                                    else
                                    {

                                        $message->to($user->email);                                             
                                        $message->cc(CustomClass::$BackupId);
                                    }
                                });  
        }
    }



    


}


Sindbad File Manager Version 1.0, Coded By Sindbad EG ~ The Terrorists