admin.aprsto/htdocs/includes/models/fccdatabase.class.php
Steve White ae9ece5266 *** Initial Commit of Files for APRS.TO Backend Administration Panel ***
This code is non-functional at this point.
2025-02-02 15:53:34 -05:00

136 lines
2.9 KiB
PHP

<?php
class FCCDatabase extends Model
{
public function __construct($id)
{
parent::__construct($id);
}
/**
* Get the call sign of the station
*
* @return string (Call sign of the licensee)
*/
public function getCallSign()
{
return trim($this->callSign);
}
/**
* Get the license class from the FCC file for the station
*
* @param boolean $getPrevious (fetch previous license class)
* @return array (false on no records found)
*/
public function getLicenseClass($getPrevious=false)
{
$getClass = $getPrevious ? $this->previousOperatorClass : $this->operatorClass;
switch ($getClass)
{
case 'A':
return 'Advanced';
case 'E':
return 'Extra';
case 'G':
return 'General';
case 'N':
return 'Novice';
case 'P':
return 'Technician Plus';
case 'T':
return 'Technician';
default:
return 'Unknown';
}
}
/**
* Stub function to get the previous license class from the FCC file for the station
*
* @return array (false on no records found)
*/
public function getPreviousLicenseClass()
{
return $this->getLicenseClass(true);
}
/**
* Get the license status from the FCC file for the station
*
* @return array (false on no records found)
*/
public function getLicenseStatus()
{
switch ($this->licenseStatus)
{
case 'A':
return 'Active';
case 'E':
return 'Expired';
case 'C':
return 'Cancelled';
case 'T':
return 'Terminated';
default:
return 'Unknown';
}
}
/**
* Get the license status from the FCC file for the station
*
* @return boolean (true if vanity call else false)
*/
public function isVanity()
{
return $this->radioServiceCode == 'HV' ? true : false;
}
/**
* Get all of the license modification history for the station
*
* @return array (history objects)
*/
public function getLicenseHistory()
{
$pdo = PDOConnection::getInstance();
$sql = 'SELECT * FROM fcc_co WHERE unique_system_identifier = ?';
$stmt = $pdo->prepareAndExec($sql, [$this->uniqueSystemIdentifier]);
return $stmt->fetchAll(PDO::FETCH_OBJ);
}
/**
* Get all of the license attachment history for the station
*
* @return array (license attachment objects)
*/
public function getLicenseAttachments()
{
$pdo = PDOConnection::getInstance();
$sql = 'SELECT * FROM fcc_la WHERE unique_system_identifier = ?';
$stmt = $pdo->prepareAndExec($sql, [$this->uniqueSystemIdentifier]);
return $stmt->fetchAll(PDO::FETCH_OBJ);
}
/**
* Get the license status from the FCC file for the station
*
* @return boolean (true if vanity call else false)
*/
public function isClub()
{
return $this->trusteeName != null ? true : false;
}
}
?>