Sindbad~EG File Manager
<?php
class JudgeMark extends Eloquent {
protected $primaryKey = 'judges_mark_id';
/**
* The database table used by the model.
*
* @var string
*/
protected $table = 'judges_marks';
/**
* Sridhar On 17 Apr 2017 2:11 PM
* Get User is evaliation
*/
// public Static function getUserIsEvaluator($user_id,$abs_type)
public Static function getUserIsEvaluator($user_id)
{
try
{
$result = DB::select("SELECT a.abs_id FROM abstracts a
INNER JOIN authors au ON au.abs_id = a.abs_id
INNER JOIN roles r ON r.role_id = au.role_id
inner join selection_type st on st.selection_type_id = a.selection_type_id
WHERE au.role_id < 32 AND a.status_id = 2 AND a.abs_type NOT IN ('GP')
AND au.user_id=".$user_id." order by a.starts_by");
// $result = JudgeMark::join('abstracts','abstracts.abs_id','=','judges_marks.abs_id')
// ->where('judges_marks.user_id',$user_id)
// ->count();
if(isset($result))
{
return count($result)>0?true:false;
}
else
{
return false;
}
} catch (Exception $e)
{
Log::error('Models: JudgeMark -> '.$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 06 Jan 2018
* Get Evaluators abstract for view marks
* example : Marks::usp_evaluation_status(4250,"IC")
*/
public Static function usp_list_abstracts_fulltext_judges($user_id)
{
try
{
$user_id = !is_null($user_id) ? "'" . $user_id ."'": "null";
$result = DB::select("call usp_list_abstracts_fulltext_judges($user_id)");
return $result;
} catch (Exception $e)
{
Log::error('Models: Mark -> usp_list_abstracts_fulltext_judges '.$e->getMessage());
return [];
}
}
/**
* Nandhini On 10 Jun 2021
* Get Evaluators abstract for view marks
* example : Marks::usp_evaluation_status(4250,"IC")
*/
public Static function usp_get_sessions_for_judges($user_id)
{
try
{
$user_id = !is_null($user_id) ? "'" . $user_id ."'": "null";
$result = DB::select("call usp_get_sessions_for_judges($user_id)");
return $result;
} catch (Exception $e)
{
Log::error('Models: Mark -> usp_get_sessions_for_judges '.$e->getMessage());
return [];
}
}
/**
* Sridhar On 8 Jan 2018
* Get Evaluatore next previous marks abstrcts
* example : Marks::usp_prev_next_fulltext_judges_abstracts(4250,"IC",1,1)
*/
// public Static function usp_prev_next_fulltext_judges_abstracts($user_id,$abs_type,$abs_id,$for_evaluation)
// {
// try
// {
// $user_id = !is_null($user_id) ? "'" . $user_id ."'": "null";
// $abs_type = !is_null($abs_type) ? "'" . $abs_type ."'": "null";
// $abs_id = !is_null($abs_id) ? "'" . $abs_id ."'": "null";
// $for_evaluation = !is_null($for_evaluation) ? "'" . $for_evaluation ."'": "null";
// $result = DB::select("call usp_prev_next_fulltext_judges_abstracts($user_id,$abs_id)");
// return $result;
// } catch (Exception $e)
// {
// Log::error('Models: Mark -> usp_evaluation_status '.$e->getMessage());
// return [];
// }
// }
/**
* Nandhini On 15 Jun 2021
* Get Evaluatore next previous marks abstrcts
* example : Marks::usp_prev_next_fulltext_judges_abstracts(4250,"IC",1,1)
*/
// $result = JudgeMark::usp_prev_next_fulltext_judges_abstracts($evaluator_id,$abs_type,$abs_id,1);
// $result = JudgeMark::usp_prev_next_judges_abstracts($evaluator_id,$abs_id,$name_in_grid);
public Static function usp_prev_next_judges_abstracts($user_id,$abs_id,$name_in_grid_id)
{
try
{
$user_id = !is_null($user_id) ? "'" . $user_id ."'": "null";
// $abs_type = !is_null($abs_type) ? "'" . $abs_type ."'": "null";
$abs_id = !is_null($abs_id) ? "'" . $abs_id ."'": "null";
// $for_evaluation = !is_null($for_evaluation) ? "'" . $for_evaluation ."'": "null";
$name_in_grid_id = !is_null($name_in_grid_id) ? "'" . $name_in_grid_id ."'": "null";
$result = DB::select("call usp_prev_next_judges_abstracts($user_id,$abs_id,$name_in_grid_id)");
// var_dump($result);
// exit();
return $result;
} catch (Exception $e)
{
Log::error('Models: Mark -> usp_prev_next_judges_abstracts '.$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