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/Mark.php

<?php


class Mark extends Eloquent {

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

	/**
	* Sridhar On 17 Apr 2017  2:11 PM
	* Get User is evaliation 
	*/
	public Static function getUserIsEvaluator($user_id,$abs_type)
    {
        try
        {  
        	$result =   Mark::join('abstracts','abstracts.abs_id','=','marks.abs_id')
			        			->where('abstracts.abs_type',$abs_type)
                                ->where('marks.user_id',$user_id)
			        			->count();

        	return $result>0?true:false;

        } catch (Exception $e)
        {
            Log::error('Models: Mark  ->  '.$e->getMessage());
            return false;
        }
    }

    /**
	* Sridhar On 17 Apr 2017  2:11 PM
	* Get User Evaluation setting with date   
    * Used to API Evaluation
	*/
	public Static function getUserEvaluationSetting($user_id)
    {
        try
        {  
        	$result =  DB::select("SELECT DISTINCT
									    a.abs_type,
									    m.user_id,
									    dt.start_date,
									    dt.end_date,
									    CASE
									        WHEN
									            dt.start_date  <= '". date('Y-m-d H:i:s') ."'  AND 
									            dt.end_date >= '". date('Y-m-d H:i:s') ."'
									        THEN
									            1
									        ELSE 0
									    END AS can_evaluate
									from
									    marks m
									        inner join
									    abstracts a ON a.abs_id = m.abs_id
									        inner join
									    date_config dt ON dt.abstract = CONCAT(a.abs_type, 'VAL')
									where
									    m.user_id =".$user_id);

        	return  $result;

        } catch (Exception $e)
        {
            Log::error('Models: Mark  ->  '.$e->getMessage());
            echo $e->getMessage();
            //return false;
        }
    }

	/**
	* Sridhar On 17 Apr 2017  2:11 PM
	* 
	* Get User Assignment  Evaluation  data
	* Used to API Evaluation
	*/
	public Static function getUserEvaluationAssignment($user_id)
    {
        try
        {  
        	//$result = Mark::where('user_id',$user_id)->get(array('mark_id','abs_id','evaluation_order_by'));
            //$result = Mark::join('tmp_sqlite_data as t','t.abs_id','=','marks.abs_id')
            //            ->select('marks.mark_id','marks.abs_id','marks.evaluation_order_by','t.*')
            //            ->where('marks.user_id',$user_id)->get();
              $result = DB::select('select t.*,m.mark_id,m.abs_id,m.evaluation_order_by,m.m1,m.m2,m.m3,m.m4,m.m5,m.marks_total,m.comments,m.sync_at,m.mark_update_count from marks m
                        inner join sqlite_evaluation t on t.abs_id =m.abs_id 
                        where can_evaluate = 1 and m.user_id ='.$user_id );



        	return  $result;

        } catch (Exception $e)
        {
            Log::error('Models: Mark  ->  '.$e->getMessage());
            echo $e->getMessage();
            //return false;
        }
    }

    /**
	* Sridhar On 20 Apr 2017  11:41 AM
	* Get evulators and evulators Abstracts
	*/
	public Static function usp_view_evaluators($user_id,$category_id,$abs_type)
    {
        try
        {
            $evaluators    = array();            
            $abstracts  = array();
            $engagedAbstracts = array();            
            $pdo = DB::connection()->getPdo();
            $pdo->setAttribute(PDO::ATTR_EMULATE_PREPARES, true);
            $stmt = $pdo->prepare("CALL usp_view_evaluators(:user_id,:category_id,:abs_type,:abs_no);");
            //$stmt = $pdo->prepare("CALL usp_search_products($storeId,$currencyId,null,null,null,null,null,null,$page,$pageSize );");
            $stmt->execute(array(':user_id' =>  $user_id ,':category_id' => $category_id ,':abs_type' => $abs_type));
            //var_dump($stmt);
            $i = 1;
            do
            {

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

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

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

            return array('evaluators' => $evaluators,'abstracts' => $abstracts);

        }catch (Exception $e)
        {
           Log::error('Models: Mark  -> usp_view_evaluators '.$e->getMessage());
           //echo $e->getMessage();
           return array('evaluators' => [],'abstracts' => []);
        }
    }

    /**
	* Sridhar On 9 Mar 2017  
	* Get Evaluators abstract for view marks 
	* example : Marks::usp_evaluation_status(4250,"IC")
	*/
	public Static function usp_evaluation_status($user_id,$abs_type)
    {
        try
        {          
           $user_id 	= !is_null($user_id) ? "'" . $user_id ."'": "null";
           $abs_type    = !is_null($abs_type) ? "'" . $abs_type ."'": "null";                   	
           
           $result = DB::select("call usp_evaluation_status($user_id,$abs_type)");   
           
           return $result;

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


    /**
    * Sridhar On 9 Mar 2017  
    * Get Evaluatore next previous marks abstrcts 
    * example : Marks::usp_prev_next_evaluation_abstract(4250,"IC",1,1)
    */
    public Static function usp_prev_next_evaluation_abstract($user_id,$abs_type,$order_no,$for_evaluation)
    {
        try
        {          
           $user_id     = !is_null($user_id) ? "'" . $user_id ."'": "null";
           $abs_type    = !is_null($abs_type) ? "'" . $abs_type ."'": "null";                       
           $order_no    = !is_null($order_no) ? "'" . $order_no ."'": "null";        
           $for_evaluation    = !is_null($for_evaluation) ? "'" . $for_evaluation ."'": "null";        
           
           $result = DB::select("call usp_prev_next_evaluation_abstract($user_id,$abs_type,$order_no,$for_evaluation)");   
           
           return $result;

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


    /**
    * Varshini On 16 Aug 2017
    * Assign evulators by participation and specialization category_id from users_profile table
    */
    public Static function usp_get_profile_update($speciality_cat_id,$specialization_cat_id,$participate_cat_id,$evaluation_cat_id,$user_name,$exp_from,$exp_to,$abs_type)
    {
        try
        {
            $evaluator_profile    = array();            
            $categories  = array();
            
            $pdo = DB::connection()->getPdo();
            $pdo->setAttribute(PDO::ATTR_EMULATE_PREPARES, true);
            $stmt = $pdo->prepare('CALL usp_get_profile_update(:speciality_cat_id,:specialization_cat_id,:participate_cat_id,:evaluation_cat_id,:user_name,:exp_from,:exp_to,:abs_type);');
            //$stmt = $pdo->prepare("CALL usp_search_products($storeId,$currencyId,null,null,null,null,null,null,$page,$pageSize );");
            $stmt->execute(array(':speciality_cat_id' =>  $speciality_cat_id,':specialization_cat_id' => $specialization_cat_id,
                ':participate_cat_id' =>  $participate_cat_id ,':evaluation_cat_id' => $evaluation_cat_id,
                ':user_name' =>  $user_name ,':exp_from' => $exp_from,':exp_to' => $exp_to,
                ':abs_type' => $abs_type));
            //var_dump($stmt);
            $i = 1;
            do
            {

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

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

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

            return array('evaluator_profile' => $evaluator_profile,'categories' => $categories);

        }catch (Exception $e)
        {
           Log::error('Models: Mark  -> usp_get_profile_update '.$e->getMessage());
           //echo $e->getMessage();
           return array('evaluator_profile' => [],'categories' => []);
        }
    }


	
}

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