progetto201 API
Functions | Variables
date.php File Reference

Functions

 valid_times ($t_conn_res)
 Checks if the request timestamps are valid. More...
 
 set_times ($t_conn_res, $mintime, $maxtime)
 Sets the timestamp's range in the options table. More...
 

Variables

 $response = array('errors' => array())
 Prepare default response array with no errors. More...
 

Function Documentation

◆ set_times()

set_times (   $t_conn_res,
  $mintime,
  $maxtime 
)

Sets the timestamp's range in the options table.

The function prepares the UPDATE query with two integers: $mintime e $maxtime.

If the query executing throws an error or it doesn't affect any row then the error is collected in the $action_res array.

If there where no errors, the 'data' of the $action_res array has the values sent by the request.

Since
01_01
Parameters
array$t_conn_resarray with the connection object
int$mintimeminimum timestamp
int$maxtimemaximum timestamp
Returns
array $action_res array with color data or errors

◆ valid_times()

valid_times (   $t_conn_res)

Checks if the request timestamps are valid.

The function collect the mintime and maxtime timestamps, checks if they are numbers.

If they are numbers their values must be equal to zero or the mintime value has to be lower than the maxtime value.

In these cases, the set_times() function is called to set the time in the DB.

Otherwise an error is collected in the $action_res array

Since
01_01
Parameters
array$t_conn_resarray with the connection object
Returns
array $action_res array with color data or errors

Variable Documentation

◆ $response

$response = array('errors' => array())

Prepare default response array with no errors.