You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
72 lines
1.7 KiB
PHP
72 lines
1.7 KiB
PHP
<?php
|
|
|
|
namespace App\ClassLib;
|
|
|
|
class MiscLib
|
|
{
|
|
public static function getDateTime()
|
|
{
|
|
return date('Y-m-d H:i:s');
|
|
}
|
|
|
|
public static function adminLTETableTemplate()
|
|
{
|
|
$template = [
|
|
'table_open' => '<table class="table table-head-fixed table-hover text-nowrap">'
|
|
];
|
|
|
|
return $template;
|
|
}
|
|
|
|
public static function adminLTEDataTable1Template($tableID)
|
|
{
|
|
$template = [
|
|
'table_open' => '<table id="'.$tableID.'" class="table table-bordered table-hover">'
|
|
];
|
|
|
|
return $template;
|
|
}
|
|
|
|
public static function adminLTEDataTableTemplate($tableID)
|
|
{
|
|
$template = [
|
|
'table_open' => '<table id="'.$tableID.'" class="table table-bordered table-striped">'
|
|
];
|
|
|
|
return $template;
|
|
}
|
|
|
|
public static function searchFromAsocArray($column, $value, $data)
|
|
{
|
|
$key = array_search($value, array_column($data, $column));
|
|
|
|
return ($key !== false) ? $data[$key] : null;
|
|
}
|
|
|
|
public static function searchFromAsocArrayByKey($key, $data)
|
|
{
|
|
if(array_key_exists($key, $data))
|
|
return $data[$key];
|
|
else
|
|
return false;
|
|
}
|
|
|
|
public static function getAttFileInfo($name)
|
|
{
|
|
$fileInfo = [];
|
|
|
|
$name = strtolower($name);
|
|
|
|
if(str_contains($name, 'agl'))
|
|
$fileInfo = ['code'=>'AGL',
|
|
'skipcount'=>2];
|
|
else if(str_contains($name, 'attlog'))
|
|
$fileInfo = ['code'=>'ATTLOG',
|
|
'skipcount'=>1];
|
|
else
|
|
$fileInfo = ['code'=>'ATTLOG',
|
|
'skipcount'=>1];
|
|
|
|
return $fileInfo;
|
|
}
|
|
} |