mirror of
https://github.com/RaspbianFrance/raspisms.git
synced 2025-04-20 16:37:48 +02:00
add setting to hide menus for users
This commit is contained in:
parent
ca9b7c7c6e
commit
17d91873d4
4 changed files with 90 additions and 24 deletions
|
@ -40,6 +40,7 @@ namespace controllers\publics;
|
|||
* @param string $setting_name : Name of the setting to modify
|
||||
* @param $csrf : CSRF token
|
||||
* @param string $_POST['setting_value'] : Setting's new value
|
||||
* @param bool $_POST['allow_no_value'] : Default false, if true then allow $_POST['setting_value'] to dont exists, and treat it as empty string
|
||||
*
|
||||
* @return boolean;
|
||||
*/
|
||||
|
@ -53,6 +54,13 @@ namespace controllers\publics;
|
|||
}
|
||||
|
||||
$setting_value = $_POST['setting_value'] ?? false;
|
||||
$allow_no_value = $_POST['allow_no_value'] ?? false;
|
||||
|
||||
//if no value allowed and no value fund, default to ''
|
||||
if ($allow_no_value && ($setting_value === false))
|
||||
{
|
||||
$setting_value = '';
|
||||
}
|
||||
|
||||
if (false === $setting_value)
|
||||
{
|
||||
|
@ -61,6 +69,12 @@ namespace controllers\publics;
|
|||
return $this->redirect(\descartes\Router::url('Setting', 'show'));
|
||||
}
|
||||
|
||||
//If setting is an array, join with comas
|
||||
if (is_array($setting_value))
|
||||
{
|
||||
$setting_value = json_encode($setting_value);
|
||||
}
|
||||
|
||||
$update_setting_result = $this->internal_setting->update_for_user($_SESSION['user']['id'], $setting_name, $setting_value);
|
||||
if (false === $update_setting_result)
|
||||
{
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue