Properties

$host

$host : string

Database Hostname / IP Address

Type

string

$port

$port : integer

Database Port

Type

integer

$user

$user : string

Database User

Type

string

$password

$password : string

Database User Password

Type

string

$dbname

$dbname : string

Database name

Type

string

$persistent

$persistent : boolean

Use persistent connections when connecting to the database

Type

boolean

$connection

$connection : 

Database connection object

Type

Methods

__construct()

__construct(string  $dbname = 'arsf_status', string  $host = 'pgsql', integer  $port = 5432, string  $user = 'rsguser', string|null  $password = 'd0G8er?t', boolean  $persistent = true) 

Database constructor

Parameters

string $dbname

Database name

string $host

Database Host

integer $port

Database Port

string $user

Database User

string|null $password

Database Password

boolean $persistent

Persistent Connections

__destruct()

__destruct() 

Closes the database connection if its still open.

connect()

connect() 

Connects to the database.

close()

close() 

Closes database connection.

getAllPIs()

getAllPIs() : array

Gets all the PIs from the database

Returns

array —

An array of [id, pi_name, address, email]

getAllSensors()

getAllSensors() : array

Gets all sensor names from the database

Returns

array —

An array of sensor names

getAllDisplayedSensors()

getAllDisplayedSensors() : array

Gets all sensors that should be displayed on the status page

Returns

array —

An array of sensor names

getAllStatuses()

getAllStatuses() : array

Gets the progress values from the database

Returns

array —

An array of [progress_name, description]

getAllProjects()

getAllProjects() : array

Gets all project codes from the database

Returns

array —

A list of project codes.

getAllPriorities()

getAllPriorities() : array

Gets the available priorities from the database.

Returns

array —

An array of [priority_name, value, description]

getAllProgress()

getAllProgress() : array

Gets all the progress values from the database.

Returns

array —

An array of [progress_name, value, description]

getStatusPage()

getStatusPage() : array

Gets the results from the status page view

Returns

array —

An array of many fields which can vary. ;)

getStatusOrderPage()

getStatusOrderPage() : array

Gets the results from the status order page view

Returns

array —

An array of many fields which can vary. ;)

getStatusPageSorted()

getStatusPageSorted(array  $variables) : array

Gets the results from the status page view

Parameters

array $variables

Variables to filter view

Returns

array —

An array of many fields which can vary. ;)

getStatusOrderPageSorted()

getStatusOrderPageSorted(array  $variables) : array

Gets the results from the status page view

Parameters

array $variables

Variables to filter view

Returns

array —

An array of many fields which can vary. ;)

getOrderPage()

getOrderPage() : array

Gets data from the 3 tables for the order page

Returns

array —

An array from 3 views.

getYearRange()

getYearRange() : array

Gets the range of years that covers all flights.

Returns

array —

The first item is the lowest year, and the 2nd item is the max year.

getFlight()

getFlight(integer  $flight_id) : array

Gets flight info from the flight table.

Parameters

integer $flight_id

Flight ID

Returns

array —

A result resource.

getProgressPageFlight()

getProgressPageFlight(integer  $flight_id) : array

Gets flight info for progress page from the flight table.

Parameters

integer $flight_id

Flight ID

Returns

array —

A result resource.

getProgressPageSensorDetails()

getProgressPageSensorDetails(integer  $sensor_id) : array

Get Details for the progress page

Parameters

integer $sensor_id

Sensor ID

Returns

array —

A result resource.

getFlightSensor()

getFlightSensor(integer  $sensor_id) : array

Gets a flight sensor from the database

Parameters

integer $sensor_id

Flight Sensor ID

Returns

array —

A result resource

getProject()

getProject(integer  $flight_id) : array

Gets projects from database

Parameters

integer $flight_id

Flight ID

Returns

array —

An array of data ;)

getPI()

getPI(integer  $flight_id) : array

Gets PIs and their respective project code from the database.

Parameters

integer $flight_id

Flight ID

Returns

array —

An array of [project_code, pi.*]

getPIFromProject()

getPIFromProject(integer  $project_code) : array

Gets PIs and their respective project code from the database.

Parameters

integer $project_code

Project Code

Returns

array —

An array of [pi.*]

getSensorStatuses()

getSensorStatuses(integer  $flight_sensor_id) : array

Gets statues for a specific flight sensor

Parameters

integer $flight_sensor_id

Flight Sensor ID

Returns

array —

An array of status details

insert_flight_sensor()

insert_flight_sensor(integer  $flight_id, string  $sensor_name, string  $priority, integer  $lines, string  $user) : boolean

Adds a new entry for a flight sensor and adds a status of not started.

Parameters

integer $flight_id

Flight ID

string $sensor_name

Sensor Name

string $priority

Sensor Priority

integer $lines

Number of flightlines

string $user

Username

Returns

boolean —

True if sucessfull, false otherwise.

insert_sensor_status()

insert_sensor_status(array  $variable_array) : resource

Adds an entry into sensor_status for a new status update.

Parameters

array $variable_array

Array of variables to be substituted into SQL

Returns

resource

insert_flight()

insert_flight(array  $flight_data, array  $project_data, array  $sensor_data) : resource

Adds entries into flight

Parameters

array $flight_data

Array of variables to be substituted into SQL

array $project_data

Array of variables to be substituted into SQL

array $sensor_data

Array of variables to be substituted into SQL

Returns

resource

insert_pi()

insert_pi(string  $pi_name, string  $pi_email, string  $pi_address) : integer

Adds a PI to the database

Parameters

string $pi_name

PI Name

string $pi_email

PI Email

string $pi_address

PI Address

Returns

integer —

of the PI's ID

insert_project()

insert_project(array  $project_args) : true

Adds a Project to the database

Parameters

array $project_args

Project details

Returns

true —

if insert was successful false otherwise.

insert_flight_project()

insert_flight_project(integer  $flight_id, string  $project_code) : boolean

Adds a Project to a flight in the database

Parameters

integer $flight_id

Flight ID

string $project_code

Project Code

Returns

boolean —

if insert was successful returns true, false otherwise.

update_flight()

update_flight(array  $variable_array) : resource

Updates the flight details

Parameters

array $variable_array

Array of flight details

Returns

resource —

Returns FALSE if not exectuted.

update_flight_project()

update_flight_project(array  $variable_array) : resource

Updates the flight project linkage

Parameters

array $variable_array

Array of project details

Returns

resource —

Returns FALSE if not exectuted.

update_project()

update_project(array  $variable_array) : resource

Updates the project details

Parameters

array $variable_array

Array of project details

Returns

resource —

Returns FALSE if not exectuted.

update_pi()

update_pi(array  $variable_array) : resource

Updates the pi details

Parameters

array $variable_array

Array of pi details

Returns

resource —

Returns FALSE if not exectuted.

update_flight_sensor()

update_flight_sensor(array  $variable_array) : resource

Updates the flight sensor details

Parameters

array $variable_array

Array of flight sensor details

Returns

resource —

Returns FALSE if not exectuted.

update_sensor_status()

update_sensor_status(  $variable_array) : resource

Updates a status

Parameters

$variable_array

Array of status details

Returns

resource —

Returns FALSE if not exectuted.

delete_flight_sensor()

delete_flight_sensor(integer  $flight_sensor_id) : resource

Deletes a flight sensor

Parameters

integer $flight_sensor_id

Flight Sensor ID

Returns

resource

delete_flight()

delete_flight(integer  $flight_id) : resource

Deletes a flight

Parameters

integer $flight_id

Flight ID

Returns

resource

delete_project()

delete_project(integer  $flight_id, string  $project_code) : boolean

Deletes a project

Parameters

integer $flight_id

Flight ID

string $project_code

Project Code

Returns

boolean —

true if delete is sucessful

delete_sensor_status()

delete_sensor_status(integer  $status_id) : resource

Deletes a status

Parameters

integer $status_id

Status ID

Returns

resource

query()

query(string  $sql) : resource

Performs an SQL query

Parameters

string $sql

SQL to be executed.

Returns

resource —

Result resource or FALSE

query_args()

query_args(string  $sql, array  $arguments) : resource

Performs an SQL query

Parameters

string $sql

SQL to be executed.

array $arguments

arguments to be substituted into the SQL.

Returns

resource —

Result resource or FALSE