Define app_name and app_uuid as constants (#7534)
* Set a constant on each class for app_name and app_uuid * Update the database class to use the app_uuid and app_name * Update the classes to use the database::new() * Remove the instances of 'new database'
This commit is contained in:
+34
-26
@@ -27,41 +27,49 @@
|
||||
|
||||
class tones {
|
||||
|
||||
//define variables
|
||||
private $tones;
|
||||
/**
|
||||
* declare private variables
|
||||
*/
|
||||
private $music_list;
|
||||
private $recordings_list;
|
||||
private $default_tone_label;
|
||||
|
||||
//class constructor
|
||||
/**
|
||||
* called when the object is created
|
||||
*/
|
||||
public function __construct() {
|
||||
//add multi-lingual support
|
||||
$language = new text;
|
||||
$text = $language->get();
|
||||
$language = new text;
|
||||
$text = $language->get();
|
||||
|
||||
//connect to the database
|
||||
if (empty($this->database)) {
|
||||
$this->database = database::new();
|
||||
}
|
||||
|
||||
//get the tones
|
||||
$sql = "select * from v_vars ";
|
||||
$sql .= "where var_category = 'Tones' ";
|
||||
$sql .= "order by var_name asc ";
|
||||
$database = new database;
|
||||
$tones = $database->select($sql, null, 'all');
|
||||
if (!empty($tones)) {
|
||||
foreach ($tones as $tone) {
|
||||
$tone = $tone['var_name'];
|
||||
if (isset($text['label-'.$tone])) {
|
||||
$label = $text['label-'.$tone];
|
||||
}
|
||||
else {
|
||||
$label = $tone;
|
||||
}
|
||||
$tone_list[$tone] = $label;
|
||||
}
|
||||
}
|
||||
$this->tones = $tone_list ?? '';
|
||||
unset($sql, $tones, $tone, $tone_list);
|
||||
}
|
||||
|
||||
public function tones_list() {
|
||||
return $this->tones;
|
||||
//get the tones
|
||||
$sql = "select * from v_vars ";
|
||||
$sql .= "where var_category = 'Tones' ";
|
||||
$sql .= "order by var_name asc ";
|
||||
$tones = $this->database->select($sql, null, 'all');
|
||||
if (!empty($tones)) {
|
||||
foreach ($tones as $tone) {
|
||||
$tone = $tone['var_name'];
|
||||
if (isset($text['label-'.$tone])) {
|
||||
$label = $text['label-'.$tone];
|
||||
}
|
||||
else {
|
||||
$label = $tone;
|
||||
}
|
||||
$tone_list[$tone] = $label;
|
||||
}
|
||||
}
|
||||
unset($sql, $tones, $tone);
|
||||
|
||||
//return the tones
|
||||
return $tone_list ?? '';
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user