<?php

/*
 *	  CLASS:  SearchResultsTable
 *
*/

class SearchResultsTable {

  private $header;
  private $results;
  private $pager;
  private $selected;

  private $inited = False;
  private $type;

  public function __construct($type) {
    $this->header = array();
    $this->results = array();
    $this->pager = '';
    $this->selected = array();

    if ( ($type == 'DR') || ($type == 'ENG') ||
         ($type == 'SD') || ($type == 'SL')  ||
         ($type == 'TC') || ($type == 'QTG') ||
         ($type == 'VE')) {
      $this->type = $type;
    }
  }

  public function setType($type) {
    if ( ($type == 'DR') || ($type == 'ENG') ||
         ($type == 'SD') || ($type == 'SL')  ||
         ($type == 'TC') || ($type == 'QTG') ||
         ($type == 'VE')) {
      $this->type = $type;
    }
  }

  public function getType() {
    return $this->type;
  }

  public function hasHeader() {
    return (count($this->header) > 0);
  }

  public function setHeader($hdr) {
    $this->header = $hdr;
  }

  public function getHeader() {
    return $this->header;
  }

  public function setPager($pgr) {
    $this->pager = $pgr;
  }

  public function getPager() {
    return $this->pager;
  }

  public function setResults($results) {
    $this->results = $results;
  }

  public function getResults() {
    return $this->results;
  }

  public function getResultIds() {
    return array_keys($this->results);
  }

  public function clearResults() {
    $this->results = array();
  }

  public function setSelected($selected) {
    $this->selected = $selected;
  }

  public function getSelected() {
    return $this->selected;
  }

  public function getSelectedCount() {
    return count($this->selected);
  }

  public function resultsIsEmpty() {
    return ( count($this->results) == 0 );
  }

} // end - class SearchResultsTable
