Sindbad~EG File Manager
<?php
class PresType extends Eloquent {
protected $primaryKey = 'presentation_type_id';
/**
* The database table used by the model.
*
* @var string
*/
protected $table = 'presentation_type';
//Updated by Sridhar On 03-Sep-2022
//where condition MidYear default 1 for counts
public Static function getPresType($user_id)
{
try
{
$presentation_type_counts_db = DB::select('select presentation_type_id, count(*) as count from abstracts
where MidYear = 1 and abs_no >0 and abs_type = \''.CustomClass::$FP.'\' and user_id = '.$user_id.'
group by presentation_type_id
');
$pres_types_db = PresType::lists('type','presentation_type_id');
$pres_types = [];
$presentation_type_counts = [];
foreach ($presentation_type_counts_db as $key => $item) {
$presentation_type_counts[$item->presentation_type_id] = $item->count;
}
foreach ($pres_types_db as $key => $value) {
if(!(isset(CustomClass::$FP_PresType_Counts[$key]) && isset($presentation_type_counts[$key]) && $presentation_type_counts[$key] >= CustomClass::$FP_PresType_Counts[$key]))
$pres_types[$key] = $value;
}
if(!isset($pres_types[CustomClass::$Paper_only]))
{
if(isset($pres_types[CustomClass::$Paper_or_EPoster]))
unset($pres_types[CustomClass::$Paper_or_EPoster]);
if(isset($pres_types[CustomClass::$Paper_or_Physical_Poster]))
unset($pres_types[CustomClass::$Paper_or_Physical_Poster]);
}
if(!isset($pres_types[CustomClass::$EPoster_only]))
{
if(isset($pres_types[CustomClass::$Paper_or_EPoster]))
unset($pres_types[CustomClass::$Paper_or_EPoster]);
}
if(!isset($pres_types[CustomClass::$Physical_Poster]))
{
if(isset($pres_types[CustomClass::$Paper_or_Physical_Poster]))
unset($pres_types[CustomClass::$Paper_or_Physical_Poster]);
}
// if(!isset($pres_types[CustomClass::$Paper_or_EPoster]))
// {
// if(isset($pres_types[CustomClass::$Paper_only]))
// unset($pres_types[CustomClass::$Paper_only]);
// if(isset($pres_types[CustomClass::$EPoster_only]))
// unset($pres_types[CustomClass::$EPoster_only]);
// }
// if(!isset($pres_types[CustomClass::$Paper_or_Physical_Poster]))
// {
// if(isset($pres_types[CustomClass::$Paper_only]))
// unset($pres_types[CustomClass::$Paper_only]);
// if(isset($pres_types[CustomClass::$Physical_Poster]))
// unset($pres_types[CustomClass::$Physical_Poster]);
// }
return $pres_types;
}
catch (Exception $e)
{
Log::error('Models: PresType -> getPresType '.$e->getMessage());
return [];
}
}
}
Sindbad File Manager Version 1.0, Coded By Sindbad EG ~ The Terrorists