Sindbad~EG File Manager

Current Path : /home/numerotech/public_html/livemt2023.aios-scientificcommittee.org/app/models/
Upload File :
Current File : //home/numerotech/public_html/livemt2023.aios-scientificcommittee.org/app/models/Abstracts.php

<?php


class Abstracts extends Eloquent {

	protected $primaryKey = 'abs_id';
	/**
	 * The database table used by the model.
	 *
	 * @var string
	 */
	protected $table = 'abstracts';

  /**
  * Sridhar On 9 Mar 2017  
  * 
  * IC,FP and VT get author search and abstract author
  * example : Abstracts::usp_get_authors('sridhar',null,null,null,null,null)
  */
	public Static function usp_get_authors($search_text,$abs_type,$role_id,$abs_id,$user_type_id,$res1_order_by)
    {
        try
        {          
           $search_text = !is_null($search_text) ? "'" . $search_text ."'": "null";
           $abs_type    = !is_null($abs_type) ? "'" . $abs_type ."'": "null";
           $role_id     = !is_null($role_id) ? "'" . $role_id ."'":"null";
           $abs_id      = !is_null($abs_id) ? "'" . $abs_id ."'": "null";
           $user_type_id = !is_null($user_type_id) ? "'" . $user_type_id ."'": "null";
           $res1_order_by = !is_null($res1_order_by) ? "'" . $res1_order_by ."'": "null";
           
        	
           //$result = DB::select("call usp_get_authors (".$search_text.",".$abs_type.",".$role_id.",".$abs_id.")");   
           $result = DB::select("call usp_get_authors($search_text,$abs_type,$role_id,$abs_id,$user_type_id,$res1_order_by)");   
           //$result = DB::select("call usp_get_authors ('arul','IC',33,null)");   
           return $result;

        } catch (Exception $e)
        {
            Log::error('Models: Abstracts  -> usp_get_authors '.$e->getMessage());
            return [];
        }
    }
    
     public Static function usp_get_authors_mod($search_text,$abs_type,$role_id,$abs_id,$user_type_id,$res1_order_by,$dob_from=null,$dob_to=null,$update_at_from=null,$update_at_to=null,$mem_no_from=null,$mem_no_to=null)
    {
        try
        {          
          $search_text = !is_null($search_text) ? "'" . $search_text ."'": "null";
          $abs_type    = !is_null($abs_type) ? "'" . $abs_type ."'": "null";
          $role_id     = !is_null($role_id) ? "'" . $role_id ."'":"null";
          $abs_id      = !is_null($abs_id) ? "'" . $abs_id ."'": "null";
          $user_type_id = !is_null($user_type_id) ? "'" . $user_type_id ."'": "null";
          $res1_order_by = !is_null($res1_order_by) ? "'" . $res1_order_by ."'": "null";
          $dob_from = !is_null($dob_from) ? "'" . $dob_from ."'": "null";
          $dob_to = !is_null($dob_to) ? "'" . $dob_to ."'": "null";
          $update_at_from = !is_null($update_at_from) ? "'" . $update_at_from ."'": "null";
          $update_at_to = !is_null($update_at_to) ? "'" . $update_at_to ."'": "null";
          $mem_no_from = !is_null($mem_no_from) ? "'" . $mem_no_from ."'": "null";
          $mem_no_to = !is_null($mem_no_to) ? "'" . $mem_no_to ."'": "null";
          
          
        	
          //$result = DB::select("call usp_get_authors (".$search_text.",".$abs_type.",".$role_id.",".$abs_id.")");   
          $result = DB::select("call usp_get_authors_mod($search_text,$abs_type,$role_id,$abs_id,$user_type_id,$res1_order_by,$dob_from,$dob_to,$update_at_from,$update_at_to,$mem_no_from,$mem_no_to)");   
          //$result = DB::select("call usp_get_authors ('arul','IC',33,null)");   
          return $result;

        } catch (Exception $e)
        {
            Log::error('Models: Abstracts  -> usp_get_authors '.$e->getMessage());
            return [];
        }
    }
   
    
    // /** Nandhini 07/april/2020 
    // find user model
    // */
    // public Static function usp_get_authors_mod($search_text,$abs_type,$role_id,$abs_id,$user_type_id,$res1_order_by,$dob_from,$dob_to,$update_at_from,$update_at_to,$mem_no_from,$mem_no_to)
    
    // {
    //     try
    //     {          
    //       $search_text = !is_null($search_text) ? "'" . $search_text ."'": "null";
    //       $abs_type    = !is_null($abs_type) ? "'" . $abs_type ."'": "null";
    //       $role_id     = !is_null($role_id) ? "'" . $role_id ."'":"null";
    //       $abs_id      = !is_null($abs_id) ? "'" . $abs_id ."'": "null";
    //       $user_type_id = !is_null($user_type_id) ? "'" . $user_type_id ."'": "null";
    //       $res1_order_by = !is_null($res1_order_by) ? "'" . $res1_order_by ."'": "null";
    //       $dob_from = !is_null($dob_from) ? "'" . $dob_from ."'": "null";
    //       $dob_to = !is_null($dob_to) ? "'" . $dob_to ."'": "null";
    //       $update_at_from = !is_null($update_at_from) ? "'" . $update_at_from ."'": "null";
    //       $update_at_to = !is_null($update_at_to) ? "'" . $update_at_to ."'": "null";
    //       $mem_no_from = !is_null($mem_no_from) ? "'" . $mem_no_from ."'": "null";
    //       $mem_no_to = !is_null($mem_no_to) ? "'" . $mem_no_to ."'": "null";
           
          
    //       //$result = DB::select("call usp_get_authors (".$search_text.",".$abs_type.",".$role_id.",".$abs_id.")");   
    //       $result = DB::select("call usp_get_authors_mod($search_text,$abs_type,$role_id,$abs_id,$user_type_id,$res1_order_by,$dob_from,$dob_to,$update_at_from,$update_at_to,$mem_no_from,$mem_no_to)");   
    //       //$result = DB::select("call usp_get_authors ('arul','IC',33,null)");   
    //       return $result;

    //     } catch (Exception $e)
    //     {
    //         Log::error('Models: Abstracts  -> usp_get_authors_mod '.$e->getMessage());
    //         return [];
    //     }
    // }
    
    /**
    * Sridhar On 9 Mar 2017  
    * 
    * IC,FP and VT Generate abstract Number
    */
    public Static function usp_generate_abs_no($abs_type,$abs_id)
    {
        try
        {          
           
          $abs_type    = !is_null($abs_type) ? "'" . $abs_type ."'": "null";           
          $abs_id      = !is_null($abs_id) ? "'" . $abs_id ."'": "null";
            
          //$result = DB::select("call usp_get_authors (".$search_text.",".$abs_type.",".$role_id.",".$abs_id.")");   
          $result = DB::select("call usp_generate_abs_no($abs_type,$abs_id)");   
          //$result = DB::select("call usp_get_authors ('arul','IC',33,null)");   
          return $result;

        } catch (Exception $e)
        {
            Log::error('Models: Abstracts  -> usp_generate_abs_no '.$e->getMessage());
            return [];
        }
    }


    /**
    * Sridhar On 10 Mar 2017  10:17 AM
    * 
    * Get all abstract and with filters 
    */
   
    
    public Static function usp_get_abstracts($role_id=null,$category_id=null,$abs_type=null,$abs_no=null,$abs_id=null,$selection_type_id=null,$status_id=null,$user_id=null,$ignore_columns=null,$res1_order_by=null,$res2_order_by=null,$res3_order_by=null,$presentation_type=null)
    {
        try
        {
   
            $abstracts  = array();
            $authors    = array();            
            $engagedAbstracts = array(); 
           
            $pdo = DB::connection()->getPdo();
            $pdo->setAttribute(PDO::ATTR_EMULATE_PREPARES, true);
            $stmt = $pdo->prepare("CALL usp_get_abstracts(:role_id,:category_id,:abs_type,:abs_no,:abs_id,:selection_type_id,:status_id,:user_id,:ignore_columns,:res1_order_by,:res2_order_by,:res3_order_by,:presentation_type);");
            //$stmt = $pdo->prepare("CALL usp_search_products($storeId,$currencyId,null,null,null,null,null,null,$page,$pageSize );");
            $stmt->execute(array(':role_id' =>  $role_id ,':category_id' => $category_id ,':abs_type' => $abs_type,':abs_no' => $abs_no,':abs_id' => $abs_id,':selection_type_id' => $selection_type_id,':status_id' => $status_id,':user_id' => $user_id,':ignore_columns' => $ignore_columns,':res1_order_by' => $res1_order_by,':res2_order_by' => $res2_order_by,':res3_order_by' => $res3_order_by,'presentation_type'=>$presentation_type));
            //var_dump($stmt);
 
            $i = 1;
            do
            {

                if($i == 1)
                {
                    while ($row = $stmt->fetch())
                    {
                        array_push($abstracts, (object)$row);                        
                    }

                }
 
                elseif($i == 2)
                {
                    while ($row = $stmt->fetch())
                    {
                        array_push($authors,(object)$row);

                    }
                }   
          
                elseif($i == 3)
                {
                    while ($row = $stmt->fetch())
                    {
                        array_push($engagedAbstracts,(object)$row);
                    }
                }
   
                $i++;
            } while ($stmt->nextRowset());

            return array('abstracts' => $abstracts,'authors' => $authors,'engaged'=>$engagedAbstracts);

        }catch (Exception $e)
        {
           Log::error('abstracts->usp_get_abstracts '.$e->getMessage());
           //echo $e->getMessage();
           return array('abstracts' => [],'authors' => [],'engaged' =>[]);
        }
    }

    /*Navaneeth - 06-jan-2018*/
    /*Print program sheet*/
     public Static function usp_get_abstracts_print($role_id=null,$category_id=null,$abs_type=null,$abs_no=null,$abs_id=null,$selection_type_id=null,$status_id=null,$user_id=null,$ignore_columns=null,$res1_order_by=null,$res2_order_by=null,$res3_order_by=null,$presentation_type=null,$hall_id=null,$starts_by=null,$start_time=null,$name_in_grid_id = null,$is_semi_final = null,$is_final = null,$is_winner = null)
    {
        try
        {
   
            $abstracts  = array();
            $authors    = array();            
            $engagedAbstracts = array(); 
           
            $pdo = DB::connection()->getPdo();
            $pdo->setAttribute(PDO::ATTR_EMULATE_PREPARES, true);
            $stmt = $pdo->prepare("CALL usp_get_abstracts_print(:role_id,:category_id,:abs_type,:abs_no,:abs_id,:selection_type_id,:status_id,:user_id,:ignore_columns,:res1_order_by,:res2_order_by,:res3_order_by,:presentation_type,:hall_id,:starts_by,:start_time,:name_in_grid_id,:is_semi_final,:is_final,:is_winner);");
            //$stmt = $pdo->prepare("CALL usp_search_products($storeId,$currencyId,null,null,null,null,null,null,$page,$pageSize );");
            $stmt->execute(array(':role_id' =>  $role_id ,':category_id' => $category_id ,':abs_type' => $abs_type,':abs_no' => $abs_no,':abs_id' => $abs_id,':selection_type_id' => $selection_type_id,':status_id' => $status_id,':user_id' => $user_id,':ignore_columns' => $ignore_columns,':res1_order_by' => $res1_order_by,':res2_order_by' => $res2_order_by,':res3_order_by' => $res3_order_by,':presentation_type'=>$presentation_type,':hall_id'=>$hall_id,':starts_by'=>$starts_by,':start_time'=>$start_time,':name_in_grid_id'=>$name_in_grid_id,':is_semi_final'=>$is_semi_final,':is_final'=>$is_final,':is_winner'=>$is_winner));
            //var_dump($stmt);
 
            $i = 1;
            do
            {

                if($i == 1)
                {
                    while ($row = $stmt->fetch())
                    {
                        array_push($abstracts, (object)$row);                        
                    }

                }
 
                elseif($i == 2)
                {
                    while ($row = $stmt->fetch())
                    {
                        array_push($authors,(object)$row);

                    }
                }   
          
                elseif($i == 3)
                {
                    while ($row = $stmt->fetch())
                    {
                        array_push($engagedAbstracts,(object)$row);
                    }
                }
   
                $i++;
            } while ($stmt->nextRowset());

            return array('abstracts' => $abstracts,'authors' => $authors,'engaged'=>$engagedAbstracts);

        }catch (Exception $e)
        {
           Log::error('abstracts->usp_get_abstracts_print '.$e->getMessage());
           //echo $e->getMessage();
           return array('abstracts' => [],'authors' => [],'engaged' =>[]);
        }
    }



     
    /*Varshini - 16.06.2017*/
    /*Selection Matrix*/
    public Static function usp_selection_matrix($category_id=null,$abs_type=null)
    {
        try
        {          
           
          // $abs_type    = !is_null($abs_type) ? "'" . $abs_type ."'": "null";           
          // $category_id = !is_null($category_id) ? "'" . $category_id ."'": "null";
          $abstracts  = array();
          $evaluators = array();
          $matrix     = array();

          
          $pdo = DB::connection()->getPdo();
          $pdo->setAttribute(PDO::ATTR_EMULATE_PREPARES, true);
          $stmt = $pdo->prepare('call usp_selection_matrix(:category_id,:abs_type)');
          $stmt->bindParam(':category_id',$category_id, PDO::PARAM_INT);
          $stmt->bindParam(':abs_type',$abs_type, PDO::PARAM_STR);
          $stmt->execute();

          // while ($row = $stmnt->fetch())
          // {
          //     array_push($matrix, (object)$row);
          // }
          // $stmnt->closeCursor();
          $i = 1;
          do
          {

              if($i == 1)
              {
                  while ($row = $stmt->fetch())
                  {
                      array_push($abstracts, (object)$row);                        
                  }

              }
              elseif($i == 2)
              {
                  while ($row = $stmt->fetch())
                  {
                      array_push($evaluators,(object)$row);

                  }
              }             
              elseif($i == 3)
              {
                  while ($row = $stmt->fetch())
                  {
                      array_push($matrix,(object)$row);
                  }
              }   
              $i++;
          } while ($stmt->nextRowset());

          //$result = DB::select("call usp_get_authors (".$search_text.",".$abs_type.",".$role_id.",".$abs_id.")");   
          // $matrix = DB::select("call usp_selection_matrix($category_id,$abs_type)");   
          //$result = DB::select("call usp_get_authors ('arul','IC',33,null)");   
          return array('abstracts' => $abstracts,'evaluators' => $evaluators,'matrix' => $matrix);
        } 
        catch (Exception $e)
        {
          Log::error('Models: Abstracts  -> usp_selection_matrix '.$e->getMessage());
          return [];
        }
    }

 
     /*Varshini - 28.06.2017*/
    /*Selection Form*/
    public Static function usp_get_abstracts_for_selection($category_id=null,$abs_type=null,$abs_id=null,$order_by=null,$status_id=null,$hall=null,$attendance_from=null,$attendance_to=null,$presentation_type = null)
    {
        try
        {
            $abstracts  = array();
            $authors    = array();            
            $categories = array(); 
            $speakers   = array();
            $duplicates = array();
            $user_count = array(); /*presenting author more than 2 submission for pp*/
            $additional = array(); /*additional submissions and selection abstracts*/

            $pdo = DB::connection()->getPdo();
            $pdo->setAttribute(PDO::ATTR_EMULATE_PREPARES, true);
            $stmt = $pdo->prepare("CALL usp_get_abstracts_for_selection(:category_id,:abs_type,:abs_id,:order_by,:status_id,:hall,:attendance_from,:attendance_to,:presentation_type);");
            //$stmt = $pdo->prepare("CALL usp_search_products($storeId,$currencyId,null,null,null,null,null,null,$page,$pageSize );");
            $stmt->execute(array(':category_id' => $category_id,':abs_type' => $abs_type,':abs_id' => $abs_id,':order_by' => $order_by,':status_id' => $status_id,
                              ':hall' => $hall,':attendance_from' => $attendance_from,':attendance_to' => $attendance_to,':presentation_type' => $presentation_type));
            //var_dump($stmt);
            $i = 1;
            do
            {

                if($i == 1)
                {
                    while ($row = $stmt->fetch())
                    {
                        array_push($abstracts, (object)$row);                        
                    }

                }
                elseif($i == 2)
                {
                    while ($row = $stmt->fetch())
                    {
                        array_push($authors,(object)$row);

                    }
                }             
                elseif($i == 3)
                {
                    while ($row = $stmt->fetch())
                    {
                        array_push($categories,(object)$row);
                    }
                }   
                elseif($i == 4)
                {
                    while ($row = $stmt->fetch())
                    {
                        array_push($speakers,(object)$row);
                    }
                } 
                elseif($i == 5)
                {
                    while ($row = $stmt->fetch())
                    {
                        array_push($duplicates,(object)$row);
                    }
                } 
                elseif($i == 6)
                {
                    while ($row = $stmt->fetch())
                    {
                        array_push($user_count,(object)$row);
                    }
                } 
                elseif($i == 7)
                {
                    while ($row = $stmt->fetch())
                    {
                        array_push($additional,(object)$row);
                    }
                } 
                $i++;
            } while ($stmt->nextRowset());

            return array('abstracts' => $abstracts,'authors' => $authors,'categories'=>$categories,
                         'speakers' => $speakers,'duplicates' => $duplicates,'user_count' => $user_count,'additional' => $additional);

        }catch (Exception $e)
        {
           Log::error('abstracts->usp_get_abstracts_for_selection '.$e->getMessage());
           //echo $e->getMessage();
           return array('abstracts' => [],'authors' => [],'categories' =>[],'speakers' => [],'duplicates' => [],'user_count' => [],'additional' => []);
        }
    }
	 /**
    * Sridhar On 29 aug 2017  
    * 
    * User upload full text and eposter
    */
    public Static function isCanUploadFP($user_id)
    {
        try
        {          
           
       $result = Abstracts::where('user_id', '=', $user_id)
                                             ->where('abs_type','FP')
                                             ->where('status_id','>',0)                                              
                                             ->whereIn('selection_type_id',array(2))
                                             ->count();                                                
                                             
           return $result>0? true:false;

        } catch (Exception $e)
        {
            Log::error('Models: Abstracts  -> usp_generate_abs_no '.$e->getMessage());
            return [];
        }
    }


      /**
    * Sridhar On 3 oct 2017  
    * 
    * User upload full text and eposter
    */
    public Static function isCanUploadEP($user_id)
    {
        try
        {          
           
       $result = Abstracts::where('user_id', '=', $user_id)
                                             ->where('abs_type','FP')
                                             ->where('status_id','>',0)                                              
                                             ->whereIn('selection_type_id',array(3,9))
                                             ->count();                                                
                                             
           return $result>0? true:false;

        } catch (Exception $e)
        {
            Log::error('Models: Abstracts  -> usp_generate_abs_no '.$e->getMessage());
            return [];
        }
    }

    /**
    * Sridhar On 04 jan 2018  
    * 
    * User upload PP ppt
    */
    public Static function isCanUploadPP($user_id)
    {
        try
        {          
           
       $result = Abstracts::where('user_id', '=', $user_id)
                                             ->where('abs_type','FP')
                                             ->where('status_id','=',2)                                              
                                             ->whereIn('selection_type_id',array(4))
                                             ->count();                                                
                                             
           return $result>0? true:false;

        } catch (Exception $e)
        {
            Log::error('Models: Abstracts  -> isCanUploadPP '.$e->getMessage());
            return [];
        }
    }


     /**
    * Sridhar On 13 Nov 2018  
    * 
    * User upload PPP ppt
    */
    public Static function isCanUploadPPP($user_id)
    {
        try
        {          
           
       $result = Abstracts::where('user_id', '=', $user_id)
                                             ->where('abs_type','FP')
                                             ->where('status_id','=',2)                                              
                                             ->whereIn('selection_type_id',array(11))
                                             ->count();                                                
                                             
           return $result>0? true:false;

        } catch (Exception $e)
        {
            Log::error('Models: Abstracts  -> isCanUploadPPP '.$e->getMessage());
            return [];
        }
    }


   /*Varshini - 01.08.2017*/
    /*Abstract Conversion*/
    public Static function usp_copy_abstracts($abs_no = null,$to_abs_type = null,$from_abs_type = null)
    {
        try
        {          
          $new_abs_id = array();
          $new_abs_no = array();
         
          
          $pdo = DB::connection()->getPdo();
          $pdo->setAttribute(PDO::ATTR_EMULATE_PREPARES, true);
          $stmt = $pdo->prepare('call usp_copy_abstracts(:abs_no,:to_abs_type,:from_abs_type)');
          $stmt->execute(array(':abs_no' => $abs_no,':to_abs_type' => $to_abs_type,':from_abs_type' => $from_abs_type));

          // while ($row = $stmt->fetch())
          // {
          //     array_push($abstract, (object)$row);
          // }
          // $stmt->closeCursor();
          $i = 1;
          do
          {

              if($i == 1)
              {
                  while ($row = $stmt->fetch())
                  {
                      array_push($new_abs_id, (object)$row);                        
                  }

              }
              elseif($i == 2)
              {
                  while ($row = $stmt->fetch())
                  {
                      array_push($new_abs_no,(object)$row);

                  }
              }             
             $i++;
          } while ($stmt->nextRowset());
       
          // return $abstract;

          return array('new_abs_id' => $new_abs_id,'new_abs_no' => $new_abs_no);
        } 
        catch (Exception $e)
        {
          Log::error('Models: Abstracts  -> usp_copy_abstracts '.$e->getMessage());
           return array('new_abs_id' => [],'new_abs_no' => []);
        }
    }


}

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