mirror of
https://github.com/RaspbianFrance/raspisms.git
synced 2025-04-20 16:37:48 +02:00
Add page and api for stats about phone sended sms
This commit is contained in:
parent
064d6fd941
commit
4f717ef849
11 changed files with 530 additions and 0 deletions
|
@ -225,6 +225,22 @@ use Exception;
|
|||
return $this->get_model()->get_last_for_destination_and_user($id_user, $destination);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get number of sended SMS by day and status between two dates, possibly by sending phone.
|
||||
*
|
||||
* @param int $id_user : user id
|
||||
* @param \DateTime $start_date : Date since which we want the messages
|
||||
* @param \DateTime $end_date : Date until which we want the messages
|
||||
* @param ?int $id_phone : Id of the phone to search sended for, null by default get all phones
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public function get_sended_status_stats ($id_user, $start_date, $end_date, ?int $id_phone = null)
|
||||
{
|
||||
return $this->get_model()->get_sended_status_stats($id_user, $start_date, $end_date, $id_phone);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Send a SMS message.
|
||||
*
|
||||
|
|
|
@ -168,6 +168,26 @@ use BenMorel\GsmCharsetConverter\Converter;
|
|||
return $logo;
|
||||
}
|
||||
|
||||
/**
|
||||
* Check if a string is a valid PHP date
|
||||
*
|
||||
* @param string $date : Datestring to validate
|
||||
*
|
||||
* @return bool : True if a valid date, false else
|
||||
*/
|
||||
public static function is_valid_date($date)
|
||||
{
|
||||
try
|
||||
{
|
||||
new \DateTime($date);
|
||||
return true;
|
||||
}
|
||||
catch (\Exception $e)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Cette fonction vérifie une date.
|
||||
*
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue