Add settings to enable/disable phone priority and phone limits

This commit is contained in:
osaajani 2023-02-20 15:48:47 +01:00
parent 4ea624b0d9
commit b825bd6d6e
7 changed files with 461 additions and 324 deletions

View File

@ -669,12 +669,24 @@ use Monolog\Logger;
$phones_subset = $mms_only ?: $phones_subset;
}
// Keep only phones with remaining volume and available status
// Keep only available phones
$remaining_volume_phones = array_filter($phones_subset, function ($phone) {
return $phone['remaining_volume'] > 0 && $phone['status'] == \models\Phone::STATUS_AVAILABLE;
return $phone['status'] == \models\Phone::STATUS_AVAILABLE;
});
$phones_subset = $remaining_volume_phones ?: $phones_subset;
// Keep only phones with remaining volume
if ((int) ($users_settings[$id_user]['phone_limit'] ?? false))
{
$remaining_volume_phones = array_filter($phones_subset, function ($phone) {
return $phone['remaining_volume'] > 0;
});
$phones_subset = $remaining_volume_phones ?: $phones_subset;
}
if ((int) ($users_settings[$id_user]['phone_priority'] ?? false))
{
$max_priority_phones = [];
$max_priority = PHP_INT_MIN;
foreach ($phones_subset as $phone)
@ -695,6 +707,8 @@ use Monolog\Logger;
}
$phones_subset = $max_priority_phones;
}
if ($phones_subset)
{
$random_phone = $phones_subset[array_rand($phones_subset)];

View File

@ -255,6 +255,9 @@ use Exception;
'error_message' => null,
];
$internal_setting = new Setting();
$user_settings = $internal_setting->gets_for_user($id_user);
$at = (new \DateTime())->format('Y-m-d H:i:s');
$media_uris = [];
foreach ($medias as $media)
@ -295,7 +298,9 @@ use Exception;
throw new Exception('Invalid phone status : ' . $phone['status']);
}
//If we reached limit for this phone, do not send the message
//If we reached limit for this phone and phone limits are enabled, do not send the message
if ((int) ($users_settings['phone_limit'] ?? false))
{
$limits = $internal_phone->get_limits($id_phone);
$remaining_volume = PHP_INT_MAX;
@ -310,6 +315,7 @@ use Exception;
{
throw new Exception('Phone send limit have been reached.');
}
}
$response = $adapter->send($destination, $text, $flash, $mms, $media_uris);

View File

@ -83,6 +83,8 @@
'alert_quota_limit_close' => 0.9,
'hide_menus' => '',
'force_gsm_alphabet' => 0,
'phone_limit' => 0,
'phone_priority' => 0,
],
];

View File

@ -47,6 +47,8 @@
<input required="required" name="name" class="form-control" placeholder="Nom du téléphone" value="<?php $this->s($_SESSION['previous_http_post']['name'] ?? '') ?>">
</div>
</div>
<?php if ($_SESSION['user']['settings']['phone_priority']) { ?>
<div class="form-group">
<label>Priorité d'utilisation du téléphone</label>
<p class="italic small help">
@ -56,6 +58,8 @@
<input required="required" name="priority" class="form-control" type="number" min="0" placeholder="Priorité d'utilisation" value="<?php $this->s($_SESSION['previous_http_post']['priority'] ?? 0) ?>">
</div>
</div>
<?php } ?>
<div class="form-group">
<label>Type de téléphone</label>
<p class="italic small help" id="description-adapter-general">
@ -87,6 +91,8 @@
<div id="adapter-data-fields"></div>
</div>
</div>
<?php if ($_SESSION['user']['settings']['phone_limit']) { ?>
<div class="form-group">
<label>Limites des volumes d'envoi du téléphone</label>
<p class="italic small help">
@ -96,6 +102,8 @@
<div class="text-center"><div class="add-phone-limit-button fa fa-plus-circle"></div></div>
</div>
</div>
<?php } ?>
<a class="btn btn-danger" href="<?php echo \descartes\Router::url('Phone', 'list'); ?>">Annuler</a>
<input type="submit" class="btn btn-success" value="Enregistrer le téléphone" />
</form>

View File

@ -40,6 +40,7 @@
<form action="<?php echo \descartes\Router::url('Phone', 'update', ['csrf' => $_SESSION['csrf']]);?>" method="POST">
<?php foreach ($phones as $phone) { ?>
<div class="entry-container" data-entry-id="<?php $this->s($phone['id']); ?>">
<div class="form-group">
<label>Nom du téléphone</label>
<p class="italic small help">
@ -49,6 +50,8 @@
<input required="required" name="phones[<?php $this->s($phone['id']); ?>][name]" class="form-control" placeholder="Nom du téléphone" value="<?php $this->s($phone['name']); ?>">
</div>
</div>
<?php if ($_SESSION['user']['settings']['phone_priority']) { ?>
<div class="form-group">
<label>Priorité d'utilisation du téléphone</label>
<p class="italic small help">
@ -58,6 +61,8 @@
<input required="required" name="phones[<?php $this->s($phone['id']); ?>][priority]" class="form-control" type="number" min="0" placeholder="Priorité d'utilisation" value="<?php $this->s($phone['priority']) ?>">
</div>
</div>
<?php } ?>
<div class="form-group">
<label>Type de téléphone</label>
<p class="italic small help description-adapter-general">
@ -94,6 +99,8 @@
<div class="adapter-data-fields"></div>
</div>
</div>
<?php if ($_SESSION['user']['settings']['phone_limit']) { ?>
<div class="form-group">
<label>Limites des volumes d'envoi du téléphone</label>
<p class="italic small help">
@ -132,6 +139,8 @@
<div class="text-center"><div class="add-phone-limit-button fa fa-plus-circle"></div></div>
</div>
</div>
<?php } ?>
</div>
<hr/>
<?php } ?>

View File

@ -41,10 +41,14 @@
<tr>
<th>ID</th>
<th>Nom</th>
<?php if ($_SESSION['user']['settings']['phone_priority']) { ?>
<th>Priorité</th>
<?php } ?>
<th>Type de téléphone</th>
<th>Callbacks</th>
<?php if ($_SESSION['user']['settings']['phone_limit']) { ?>
<th>Limites</th>
<?php } ?>
<th class="checkcolumn"><input type="checkbox" id="check-all"/></th>
</tr>
</thead>
@ -113,7 +117,9 @@ jQuery(document).ready(function ()
return html
},
},
<?php if ($_SESSION['user']['settings']['phone_priority']) { ?>
{data: 'priority', render: jQuery.fn.dataTable.render.text()},
<?php } ?>
{data: 'adapter', render: jQuery.fn.dataTable.render.text()},
{
data: '_',
@ -149,6 +155,7 @@ jQuery(document).ready(function ()
return html;
},
},
<?php if ($_SESSION['user']['settings']['phone_limit']) { ?>
{
data: 'limits',
render: function (limits) {
@ -204,6 +211,7 @@ jQuery(document).ready(function ()
return html;
},
},
<?php } ?>
{
data: 'id',
render: function (data, type, row, meta) {

View File

@ -37,16 +37,13 @@
<div class="col-xs-12 col-md-6">
<div class="panel panel-default">
<div class="panel-heading">
<h4 class="panel-title"><i class="fa fa-share fa-fw"></i> Transfert des SMS par e-mail</h4>
<h4 class="panel-title"><i class="fa fa-phone fa-fw"></i> Pays par défaut numéros internationaux</h4>
</div>
<div class="panel-body">
<form action="<?php echo \descartes\Router::url('Setting', 'update', ['setting_name' => 'transfer', 'csrf' => $_SESSION['csrf']]); ?>" method="POST">
<form action="<?php echo \descartes\Router::url('Setting', 'update', ['setting_name' => 'default_phone_country', 'csrf' => $_SESSION['csrf']]); ?>" method="POST">
<div class="form-group">
<label>Transfert activé : </label>
<select name="setting_value" class="form-control">
<option value="0">Non</option>
<option value="1" <?php echo $_SESSION['user']['settings']['transfer'] ? 'selected' : ''; ?>>Oui</option>
</select>
<label>Code du pays (norme ISO 3166-1 alpha-2) : </label>
<input name="setting_value" class="form-control" value="<?php $this->s($_SESSION['user']['settings']['default_phone_country']); ?>" />
</div>
<div class="text-center">
<button class="btn btn-success">Mettre à jour les données</button>
@ -54,6 +51,47 @@
</form>
</div>
</div>
</div>
<div class="col-xs-12 col-md-6">
<div class="panel panel-default">
<div class="panel-heading">
<h4 class="panel-title"><i class="fa fa-phone fa-fw"></i> Pays préférés numéros internationaux</h4>
</div>
<div class="panel-body">
<form action="<?php echo \descartes\Router::url('Setting', 'update', ['setting_name' => 'preferred_phone_country', 'csrf' => $_SESSION['csrf']]); ?>" method="POST">
<div class="form-group">
<label>Code des pays (norme ISO 3166-1 alpha-2) séparés par des virgules : </label>
<input name="setting_value" class="form-control" value="<?php $this->s($_SESSION['user']['settings']['preferred_phone_country']); ?>" />
</div>
<div class="text-center">
<button class="btn btn-success">Mettre à jour les données</button>
</div>
</form>
</div>
</div>
</div>
<div class="col-xs-12 col-md-6">
<div class="panel panel-default">
<div class="panel-heading">
<h4 class="panel-title"><i class="fa fa-flag fa-fw"></i> Pays autorisés pour l'envoi</h4>
</div>
<div class="panel-body">
<form action="<?php echo \descartes\Router::url('Setting', 'update', ['setting_name' => 'authorized_phone_country', 'csrf' => $_SESSION['csrf']]); ?>" method="POST">
<div class="form-group">
<label>Code des pays (norme ISO 3166-1 alpha-2) séparés par des virgules (laissez vide pour tout autoriser) : </label>
<input name="setting_value" class="form-control" value="<?php $this->s($_SESSION['user']['settings']['authorized_phone_country']); ?>" />
</div>
<div class="text-center">
<button class="btn btn-success">Mettre à jour les données</button>
</div>
</form>
</div>
</div>
</div>
<div class="col-xs-12 col-md-6">
<div class="panel panel-default">
<div class="panel-heading">
<h4 class="panel-title"><i class="fa fa-font fa-fw"></i> Alphabet SMS optimisé</h4>
@ -73,6 +111,9 @@
</form>
</div>
</div>
</div>
<div class="col-xs-12 col-md-6">
<div class="panel panel-default">
<div class="panel-heading">
<h4 class="panel-title"><i class="fa fa-picture-o fa-fw"></i> Support des MMS</h4>
@ -92,106 +133,20 @@
</form>
</div>
</div>
</div>
<div class="col-xs-12 col-md-6">
<div class="panel panel-default">
<div class="panel-heading">
<h4 class="panel-title"><i class="fa fa-link fa-fw"></i> Détection des URL dans les discussions</h4>
<h4 class="panel-title"><i class="fa fa-flash fa-fw"></i> Support des SMS Flash</h4>
</div>
<div class="panel-body">
<form action="<?php echo \descartes\Router::url('Setting', 'update', ['setting_name' => 'detect_url', 'csrf' => $_SESSION['csrf']]); ?>" method="POST">
<form action="<?php echo \descartes\Router::url('Setting', 'update', ['setting_name' => 'sms_flash', 'csrf' => $_SESSION['csrf']]); ?>" method="POST">
<div class="form-group">
<label>Détection activé : </label>
<label>SMS Flash activé : </label>
<select name="setting_value" class="form-control">
<option value="0">Non</option>
<option value="1" <?php echo $_SESSION['user']['settings']['detect_url'] ? 'selected' : ''; ?>>Oui</option>
</select>
</div>
<div class="text-center">
<button class="btn btn-success">Mettre à jour les données</button>
</div>
</form>
</div>
</div>
<div class="panel panel-default">
<div class="panel-heading">
<h4 class="panel-title"><i class="fa fa-phone fa-fw"></i> Pays préférés numéros internationaux</h4>
</div>
<div class="panel-body">
<form action="<?php echo \descartes\Router::url('Setting', 'update', ['setting_name' => 'preferred_phone_country', 'csrf' => $_SESSION['csrf']]); ?>" method="POST">
<div class="form-group">
<label>Code des pays (norme ISO 3166-1 alpha-2) séparés par des virgules : </label>
<input name="setting_value" class="form-control" value="<?php $this->s($_SESSION['user']['settings']['preferred_phone_country']); ?>" />
</div>
<div class="text-center">
<button class="btn btn-success">Mettre à jour les données</button>
</div>
</form>
</div>
</div>
<div class="panel panel-default">
<div class="panel-heading">
<h4 class="panel-title"><i class="fa fa-flag fa-fw"></i> Pays autorisés pour l'envoi</h4>
</div>
<div class="panel-body">
<form action="<?php echo \descartes\Router::url('Setting', 'update', ['setting_name' => 'authorized_phone_country', 'csrf' => $_SESSION['csrf']]); ?>" method="POST">
<div class="form-group">
<label>Code des pays (norme ISO 3166-1 alpha-2) séparés par des virgules (laissez vide pour tout autoriser) : </label>
<input name="setting_value" class="form-control" value="<?php $this->s($_SESSION['user']['settings']['authorized_phone_country']); ?>" />
</div>
<div class="text-center">
<button class="btn btn-success">Mettre à jour les données</button>
</div>
</form>
</div>
</div>
<div class="panel panel-default">
<div class="panel-heading">
<h4 class="panel-title"><i class="fa fa-music fa-fw"></i> Son sur reception d'un SMS</h4>
</div>
<div class="panel-body">
<form action="<?php echo \descartes\Router::url('Setting', 'update', ['setting_name' => 'sms_reception_sound', 'csrf' => $_SESSION['csrf']]); ?>" method="POST">
<div class="form-group">
<label>Jouer un son quand vous recevez un SMS : </label>
<select name="setting_value" class="form-control">
<option value="0">Non</option>
<option value="1" <?php echo $_SESSION['user']['settings']['sms_reception_sound'] ? 'selected' : ''; ?>>Oui</option>
</select>
</div>
<div class="text-center">
<button class="btn btn-success">Mettre à jour les données</button>
</div>
</form>
</div>
</div>
<div class="panel panel-default">
<div class="panel-heading">
<h4 class="panel-title"><i class="fa fa-exclamation-triangle fa-fw"></i> Alerte limite de SMS atteinte</h4>
</div>
<div class="panel-body">
<form action="<?php echo \descartes\Router::url('Setting', 'update', ['setting_name' => 'alert_quota_limit_reached', 'csrf' => $_SESSION['csrf']]); ?>" method="POST">
<div class="form-group">
<label>Recevoir un e-mail quand la limite de SMS est atteinte :</label>
<select name="setting_value" class="form-control">
<option value="0">Non</option>
<option value="1" <?php echo $_SESSION['user']['settings']['alert_quota_limit_reached'] == 1 ? 'selected' : ''; ?>>Oui</option>
</select>
</div>
<div class="text-center">
<button class="btn btn-success">Mettre à jour les données</button>
</div>
</form>
</div>
</div>
<div class="panel panel-default">
<div class="panel-heading">
<h4 class="panel-title"><i class="fa fa-question-circle fa-fw"></i> Affichage de l'aide</h4>
</div>
<div class="panel-body">
<form action="<?php echo \descartes\Router::url('Setting', 'update', ['setting_name' => 'display_help', 'csrf' => $_SESSION['csrf']]); ?>" method="POST">
<div class="form-group">
<label>Afficher l'aide : </label>
<select name="setting_value" class="form-control">
<option value="0">Non</option>
<option value="1" <?php echo $_SESSION['user']['settings']['display_help'] ? 'selected' : ''; ?>>Oui</option>
<option value="1" <?php echo $_SESSION['user']['settings']['sms_flash'] ? 'selected' : ''; ?>>Oui</option>
</select>
</div>
<div class="text-center">
@ -201,6 +156,7 @@
</div>
</div>
</div>
<div class="col-xs-12 col-md-6">
<div class="panel panel-default">
<div class="panel-heading">
@ -221,79 +177,9 @@
</form>
</div>
</div>
<div class="panel panel-default">
<div class="panel-heading">
<h4 class="panel-title"><i class="fa fa-plug fa-fw"></i> Activation de Webhooks</h4>
</div>
<div class="panel-body">
<form action="<?php echo \descartes\Router::url('Setting', 'update', ['setting_name' => 'webhook', 'csrf' => $_SESSION['csrf']]); ?>" method="POST">
<div class="form-group">
<label>Webhooks activé : </label>
<select name="setting_value" class="form-control">
<option value="0">Non</option>
<option value="1" <?php echo $_SESSION['user']['settings']['webhook'] ? 'selected' : ''; ?>>Oui</option>
</select>
</div>
<div class="text-center">
<button class="btn btn-success">Mettre à jour les données</button>
</div>
</form>
</div>
</div>
<div class="panel panel-default">
<div class="panel-heading">
<h4 class="panel-title"><i class="fa fa-phone fa-fw"></i> Pays par défaut numéros internationaux</h4>
</div>
<div class="panel-body">
<form action="<?php echo \descartes\Router::url('Setting', 'update', ['setting_name' => 'default_phone_country', 'csrf' => $_SESSION['csrf']]); ?>" method="POST">
<div class="form-group">
<label>Code du pays (norme ISO 3166-1 alpha-2) : </label>
<input name="setting_value" class="form-control" value="<?php $this->s($_SESSION['user']['settings']['default_phone_country']); ?>" />
</div>
<div class="text-center">
<button class="btn btn-success">Mettre à jour les données</button>
</div>
</form>
</div>
</div>
<div class="panel panel-default">
<div class="panel-heading">
<h4 class="panel-title"><i class="fa fa-flash fa-fw"></i> Support des SMS Flash</h4>
</div>
<div class="panel-body">
<form action="<?php echo \descartes\Router::url('Setting', 'update', ['setting_name' => 'sms_flash', 'csrf' => $_SESSION['csrf']]); ?>" method="POST">
<div class="form-group">
<label>SMS Flash activé : </label>
<select name="setting_value" class="form-control">
<option value="0">Non</option>
<option value="1" <?php echo $_SESSION['user']['settings']['sms_flash'] ? 'selected' : ''; ?>>Oui</option>
</select>
</div>
<div class="text-center">
<button class="btn btn-success">Mettre à jour les données</button>
</div>
</form>
</div>
</div>
<div class="panel panel-default">
<div class="panel-heading">
<h4 class="panel-title"><i class="fa fa-bullseye fa-fw"></i> Support des groupes conditionnels</h4>
</div>
<div class="panel-body">
<form action="<?php echo \descartes\Router::url('Setting', 'update', ['setting_name' => 'conditional_group', 'csrf' => $_SESSION['csrf']]); ?>" method="POST">
<div class="form-group">
<label>Groupes conditionnels activés : </label>
<select name="setting_value" class="form-control">
<option value="0">Non</option>
<option value="1" <?php echo $_SESSION['user']['settings']['conditional_group'] ? 'selected' : ''; ?>>Oui</option>
</select>
</div>
<div class="text-center">
<button class="btn btn-success">Mettre à jour les données</button>
</div>
</form>
</div>
</div>
<div class="col-xs-12 col-md-6">
<div class="panel panel-default">
<div class="panel-heading">
<h4 class="panel-title"><i class="fa fa-code fa-fw"></i> Support du templating</h4>
@ -313,6 +199,141 @@
</form>
</div>
</div>
</div>
<div class="col-xs-12 col-md-6">
<div class="panel panel-default">
<div class="panel-heading">
<h4 class="panel-title"><i class="fa fa-bullseye fa-fw"></i> Support des groupes conditionnels</h4>
</div>
<div class="panel-body">
<form action="<?php echo \descartes\Router::url('Setting', 'update', ['setting_name' => 'conditional_group', 'csrf' => $_SESSION['csrf']]); ?>" method="POST">
<div class="form-group">
<label>Groupes conditionnels activés : </label>
<select name="setting_value" class="form-control">
<option value="0">Non</option>
<option value="1" <?php echo $_SESSION['user']['settings']['conditional_group'] ? 'selected' : ''; ?>>Oui</option>
</select>
</div>
<div class="text-center">
<button class="btn btn-success">Mettre à jour les données</button>
</div>
</form>
</div>
</div>
</div>
<div class="col-xs-12 col-md-6">
<div class="panel panel-default">
<div class="panel-heading">
<h4 class="panel-title"><i class="fa fa-thermometer-3 fa-fw"></i> Support des limites d'envoi par téléphones</h4>
</div>
<div class="panel-body">
<form action="<?php echo \descartes\Router::url('Setting', 'update', ['setting_name' => 'phone_limit', 'csrf' => $_SESSION['csrf']]); ?>" method="POST">
<div class="form-group">
<label>Limites d'envoi par téléphones activées : </label>
<select name="setting_value" class="form-control">
<option value="0">Non</option>
<option value="1" <?php echo $_SESSION['user']['settings']['phone_limit'] ? 'selected' : ''; ?>>Oui</option>
</select>
</div>
<div class="text-center">
<button class="btn btn-success">Mettre à jour les données</button>
</div>
</form>
</div>
</div>
</div>
<div class="col-xs-12 col-md-6">
<div class="panel panel-default">
<div class="panel-heading">
<h4 class="panel-title"><i class="fa fa-sort-numeric-desc fa-fw"></i> Support des téléphones prioritaires</h4>
</div>
<div class="panel-body">
<form action="<?php echo \descartes\Router::url('Setting', 'update', ['setting_name' => 'phone_priority', 'csrf' => $_SESSION['csrf']]); ?>" method="POST">
<div class="form-group">
<label>Téléphones prioritaires activés : </label>
<select name="setting_value" class="form-control">
<option value="0">Non</option>
<option value="1" <?php echo $_SESSION['user']['settings']['phone_priority'] ? 'selected' : ''; ?>>Oui</option>
</select>
</div>
<div class="text-center">
<button class="btn btn-success">Mettre à jour les données</button>
</div>
</form>
</div>
</div>
</div>
<div class="col-xs-12 col-md-6">
<div class="panel panel-default">
<div class="panel-heading">
<h4 class="panel-title"><i class="fa fa-plug fa-fw"></i> Activation de Webhooks</h4>
</div>
<div class="panel-body">
<form action="<?php echo \descartes\Router::url('Setting', 'update', ['setting_name' => 'webhook', 'csrf' => $_SESSION['csrf']]); ?>" method="POST">
<div class="form-group">
<label>Webhooks activé : </label>
<select name="setting_value" class="form-control">
<option value="0">Non</option>
<option value="1" <?php echo $_SESSION['user']['settings']['webhook'] ? 'selected' : ''; ?>>Oui</option>
</select>
</div>
<div class="text-center">
<button class="btn btn-success">Mettre à jour les données</button>
</div>
</form>
</div>
</div>
</div>
<div class="col-xs-12 col-md-6">
<div class="panel panel-default">
<div class="panel-heading">
<h4 class="panel-title"><i class="fa fa-share fa-fw"></i> Transfert des SMS par e-mail</h4>
</div>
<div class="panel-body">
<form action="<?php echo \descartes\Router::url('Setting', 'update', ['setting_name' => 'transfer', 'csrf' => $_SESSION['csrf']]); ?>" method="POST">
<div class="form-group">
<label>Transfert activé : </label>
<select name="setting_value" class="form-control">
<option value="0">Non</option>
<option value="1" <?php echo $_SESSION['user']['settings']['transfer'] ? 'selected' : ''; ?>>Oui</option>
</select>
</div>
<div class="text-center">
<button class="btn btn-success">Mettre à jour les données</button>
</div>
</form>
</div>
</div>
</div>
<div class="col-xs-12 col-md-6">
<div class="panel panel-default">
<div class="panel-heading">
<h4 class="panel-title"><i class="fa fa-exclamation-triangle fa-fw"></i> Alerte limite de SMS atteinte</h4>
</div>
<div class="panel-body">
<form action="<?php echo \descartes\Router::url('Setting', 'update', ['setting_name' => 'alert_quota_limit_reached', 'csrf' => $_SESSION['csrf']]); ?>" method="POST">
<div class="form-group">
<label>Recevoir un e-mail quand la limite de SMS est atteinte :</label>
<select name="setting_value" class="form-control">
<option value="0">Non</option>
<option value="1" <?php echo $_SESSION['user']['settings']['alert_quota_limit_reached'] == 1 ? 'selected' : ''; ?>>Oui</option>
</select>
</div>
<div class="text-center">
<button class="btn btn-success">Mettre à jour les données</button>
</div>
</form>
</div>
</div>
</div>
<div class="col-xs-12 col-md-6">
<div class="panel panel-default">
<div class="panel-heading">
<h4 class="panel-title"><i class="fa fa-exclamation fa-fw"></i> Alerte limite de SMS proche</h4>
@ -337,6 +358,75 @@
</form>
</div>
</div>
</div>
<div class="col-xs-12 col-md-6">
<div class="panel panel-default">
<div class="panel-heading">
<h4 class="panel-title"><i class="fa fa-music fa-fw"></i> Son sur reception d'un SMS</h4>
</div>
<div class="panel-body">
<form action="<?php echo \descartes\Router::url('Setting', 'update', ['setting_name' => 'sms_reception_sound', 'csrf' => $_SESSION['csrf']]); ?>" method="POST">
<div class="form-group">
<label>Jouer un son quand vous recevez un SMS : </label>
<select name="setting_value" class="form-control">
<option value="0">Non</option>
<option value="1" <?php echo $_SESSION['user']['settings']['sms_reception_sound'] ? 'selected' : ''; ?>>Oui</option>
</select>
</div>
<div class="text-center">
<button class="btn btn-success">Mettre à jour les données</button>
</div>
</form>
</div>
</div>
</div>
<div class="col-xs-12 col-md-6">
<div class="panel panel-default">
<div class="panel-heading">
<h4 class="panel-title"><i class="fa fa-link fa-fw"></i> Détection des URL dans les discussions</h4>
</div>
<div class="panel-body">
<form action="<?php echo \descartes\Router::url('Setting', 'update', ['setting_name' => 'detect_url', 'csrf' => $_SESSION['csrf']]); ?>" method="POST">
<div class="form-group">
<label>Détection activé : </label>
<select name="setting_value" class="form-control">
<option value="0">Non</option>
<option value="1" <?php echo $_SESSION['user']['settings']['detect_url'] ? 'selected' : ''; ?>>Oui</option>
</select>
</div>
<div class="text-center">
<button class="btn btn-success">Mettre à jour les données</button>
</div>
</form>
</div>
</div>
</div>
<div class="col-xs-12 col-md-6">
<div class="panel panel-default">
<div class="panel-heading">
<h4 class="panel-title"><i class="fa fa-question-circle fa-fw"></i> Affichage de l'aide</h4>
</div>
<div class="panel-body">
<form action="<?php echo \descartes\Router::url('Setting', 'update', ['setting_name' => 'display_help', 'csrf' => $_SESSION['csrf']]); ?>" method="POST">
<div class="form-group">
<label>Afficher l'aide : </label>
<select name="setting_value" class="form-control">
<option value="0">Non</option>
<option value="1" <?php echo $_SESSION['user']['settings']['display_help'] ? 'selected' : ''; ?>>Oui</option>
</select>
</div>
<div class="text-center">
<button class="btn btn-success">Mettre à jour les données</button>
</div>
</form>
</div>
</div>
</div>
<div class="col-xs-12 col-md-6">
<div class="panel panel-default">
<div class="panel-heading">
<h4 class="panel-title"><i class="fa fa-eye-slash fa-fw"></i> Cacher des menus</h4>
@ -346,7 +436,7 @@
<input type="hidden" name="allow_no_value" value="1" />
<div class="form-group">
<label>Cacher certains menus à l'utilisateur (ces menus restent accessibles par l'URL) : </label>
<input name="setting_value[]" class="add-hide-menus form-control" type="text" placeholder="Menus à cacher" autofocus value="<?php $this->s($_SESSION['user']['settings']['hide_menus']); ?>">
<input name="setting_value[]" class="add-hide-menus form-control" type="text" placeholder="Menus à cacher" value="<?php $this->s($_SESSION['user']['settings']['hide_menus']); ?>">
</div>
<div class="text-center">
<button class="btn btn-success">Mettre à jour les données</button>