id = $int_ID;
$this->ste_id = $int_STE_ID;
$this->name = $str_Name;
$this->analyst = $str_Analyst;
}
/**
* Getter function for ID
*
* @return integer
*/
public function get_ID()
{
return $this->id;
}
/**
* Setter function for ID
*
* @param integer $id_in
*/
public function set_ID($id_in)
{
$this->id = $id_in;
}
/**
* Getter function for STE ID
*
* @return integer
*/
public function get_STE_ID()
{
return $this->ste_id;
}
/**
* Getter function for name
*
* @return string
*/
public function get_Name()
{
return $this->name;
}
/**
* Getter function for analyst
*
* @return string
*/
public function get_Analyst()
{
return $this->analyst;
}
/**
* Getter function for the expected scan source array
*
* @return array:source
*/
public function get_Sources()
{
return $this->sources;
}
/**
* Getter function to return array of source IDs
*
* @return array:integer
*/
public function getSourceIDs()
{
$ret = [];
if (is_array($this->sources) && count($this->sources)) {
foreach ($this->sources as $s) {
$ret[] = $s->get_ID();
}
}
return $ret;
}
/**
* Function to add an expected scan source to the category
* @param source $src
*/
public function add_Source($src)
{
if (is_array($src) && count($src) && isset($src[0]) && is_a($src[0], 'source')) {
$this->sources[$src[0]->get_ID()] = $src[0];
}
elseif (is_a($src, 'source')) {
$this->sources[$src->get_ID()] = $src;
}
}
/**
* Function to remove an expected scan source from the category
*
* @param source $src
*/
public function remove_Source($src)
{
unset($this->sources[$src->get_ID()]);
}
/**
* Getter function for preformated option tag
*
* @return string
*/
public function get_Option()
{
return "";
}
/**
* Getter function for preformated table row
*
* @param integer$intCount
* @param mixed$status_count
*
* @return string
*/
public function get_Table_Row($intCount = 0, $status_count = null)
{
$nf = 0;
$open = 0;
$na = 0;
if (!is_null($status_count)) {
if (isset($status_count['nf'])) {
$nf = $status_count['nf'];
}
if (isset($status_count['na'])) {
$na = $status_count['na'];
}
if (isset($status_count['open'])) {
$open = $status_count['open'];
}
}
$cat_sources = array();
if (is_array($this->sources) && count($this->sources)) {
foreach ($this->sources as $src) {
$cat_sources[] = $src->get_ID();
}
}
$sources = json_encode($cat_sources);
$link = ($this->name != 'Unassigned' ? "{$this->name}" : $this->name);
$analyst = ($this->analyst ? " ({$this->analyst})" : "");
$export = ($this->name != 'Unassigned' ?
"" .
"
" .
"" :
"
"
);
$vert_menu = ($this->name != 'Unassigned' ? $this->get_Vert_Option_Menu() : '');
return <<
{$nf}
{$open}
{$na}
{$link} ({$intCount}){$analyst}
$export
$vert_menu
EOC;
}
/**
* Getter function for preformated table row
*
* @param mixed $status_count
*
* @return string
*/
public function getSTECatRow($status_count = null)
{
$nf = "0%";
$nr = "0%";
$na = "0%";
$open = "0%";
if (!is_null($status_count)) {
if (isset($status_count['nf'])) {
$nf = number_format(($status_count['nf'] / $this->total) * 100, 0) . "%";
}
if (isset($status_count['na'])) {
$na = number_format(($status_count['na'] / $this->total) * 100, 0) . "%";
}
if (isset($status_count['open'])) {
$open = number_format(($status_count['open'] / $this->total) * 100, 0) . "%";
}
if (isset($status_count['nr'])) {
$nr = number_format(($status_count['nr'] / $this->total) * 100, 0) . "%";
}
}
else {
if ($this->total - $this->nr > 0) {
$nf = ($this->total ? number_format(($this->nf / ($this->total - $this->nr)) * 100, 0) . "%" : "0%");
$na = ($this->total ? number_format(($this->na / ($this->total - $this->nr)) * 100, 0) . "%" : "0%");
$open = ($this->total ? number_format(($this->open / ($this->total - $this->nr) * 100), 0) . "%" : "0%");
}
$nr = ($this->total ? number_format(($this->nr / $this->total) * 100, 0) . "%" : "0%");
}
$cat_sources = [];
if (is_array($this->sources) && count($this->sources)) {
foreach ($this->sources as $src) {
$cat_sources[] = $src->get_ID();
}
}
$sources = json_encode($cat_sources);
$link = ($this->name != 'Unassigned' ? "{$this->name}" : $this->name);
$analyst = ($this->analyst ? " ({$this->analyst})" : "");
$export = ($this->name != 'Unassigned' ?
"" .
"
" .
"" :
"
"
);
$vert_menu = ($this->name != 'Unassigned' ? $this->get_Vert_Option_Menu() : '');
return <<
{$open}
{$nf}
{$na}
{$nr}
$link ({$this->tgt_count})$analyst
{$export}
$vert_menu
EOC;
}
/**
* Function to create vertical menu
*
* @return string
*/
public function get_Vert_Option_Menu()
{
return <<