Skip to content

Commit

Permalink
User edit add a Settings button
Browse files Browse the repository at this point in the history
  • Loading branch information
markjcrane authored Sep 12, 2024
1 parent f073dbe commit 8edc5d1
Show file tree
Hide file tree
Showing 4 changed files with 98 additions and 72 deletions.
55 changes: 55 additions & 0 deletions core/user_settings/app_languages.php
Original file line number Diff line number Diff line change
@@ -1,5 +1,60 @@
<?php

$text['title-user_settings']['en-us'] = "User Settings";
$text['title-user_settings']['en-gb'] = "User Settings";
$text['title-user_settings']['ar-eg'] = "إعدادات المستخدم";
$text['title-user_settings']['de-at'] = "Benutzereinstellungen";
$text['title-user_settings']['de-ch'] = "Benutzereinstellungen";
$text['title-user_settings']['de-de'] = "Benutzereinstellungen";
$text['title-user_settings']['el-gr'] = "Ρυθμίσεις χρήστη";
$text['title-user_settings']['el-gr'] = "Ρυθμίσεις χρήστη";
$text['title-user_settings']['es-cl'] = "Ajustes de usuario";
$text['title-user_settings']['es-mx'] = "Ajustes de usuario";
$text['title-user_settings']['fr-ca'] = "Paramètres Utilisateur";
$text['title-user_settings']['fr-fr'] = "Paramètres Utilisateur";
$text['title-user_settings']['he-il'] = "הגדרות משתמש";
$text['title-user_settings']['it-it'] = "Impostazioni utente";
$text['title-user_settings']['ka-ge'] = "მომხმარებლის პარამეტრები";
$text['title-user_settings']['nl-nl'] = "Gebruikersinstellingen";
$text['title-user_settings']['pl-pl'] = "Ustawienia Użytkownika";
$text['title-user_settings']['pt-br'] = "Configurações do Usuário";
$text['title-user_settings']['pt-pt'] = "Configurações do Usuário";
$text['title-user_settings']['ro-ro'] = "Setarile utilizatorului";
$text['title-user_settings']['ru-ru'] = "Пользовательские настройки";
$text['title-user_settings']['sv-se'] = "Användarinställningar";
$text['title-user_settings']['uk-ua'] = "Налаштування користувача";
$text['title-user_settings']['tr-tr'] = "Kullanıcı ayarları";
$text['title-user_settings']['zh-cn'] = "用户设置";
$text['title-user_settings']['ja-jp'] = "ユーザー設定";
$text['title-user_settings']['ko-kr'] = "사용자 설정";

$text['title_description-user_settings']['en-us'] = "Settings for this user that should override those defined in Domain or Default Settings.";
$text['title_description-user_settings']['en-gb'] = "Settings for this user that should override those defined in Domain or Default Settings.";
$text['title_description-user_settings']['ar-eg'] = "يجب أن تتجاوز الإعدادات الخاصة بهذا المستخدم الإعدادات المحددة في النطاق أو الإعدادات الافتراضية.";
$text['title_description-user_settings']['de-at'] = "Einstellungen für diesen Benutzer, die die in den Domänen- oder Standardeinstellungen definierten überschreiben sollen.";
$text['title_description-user_settings']['de-ch'] = "Einstellungen für diesen Benutzer, die die in den Domänen- oder Standardeinstellungen definierten überschreiben sollen.";
$text['title_description-user_settings']['de-de'] = "Einstellungen für diesen Benutzer, die die in den Domänen- oder Standardeinstellungen definierten überschreiben sollen.";
$text['title_description-user_settings']['el-gr'] = "Ρυθμίσεις για αυτόν τον χρήστη που θα πρέπει να αντικαθιστούν αυτές που ορίζονται στις Ρυθμίσεις Τομέα ή Προεπιλεγμένες Ρυθμίσεις.";
$text['title_description-user_settings']['es-cl'] = "Configuración para este usuario que debe anular las definidas en Dominio o Configuración predeterminada.";
$text['title_description-user_settings']['es-mx'] = "Configuración para este usuario que debe anular las definidas en Dominio o Configuración predeterminada.";
$text['title_description-user_settings']['fr-ca'] = "Paramètres pour cet utilisateur qui doivent remplacer ceux définis dans le domaine ou les paramètres par défaut.";
$text['title_description-user_settings']['fr-fr'] = "Paramètres pour cet utilisateur qui doivent remplacer ceux définis dans le domaine ou les paramètres par défaut.";
$text['title_description-user_settings']['he-il'] = "הגדרות עבור משתמש זה שצריכות לעקוף את אלו שהוגדרו בהגדרות דומיין או ברירת מחדל.";
$text['title_description-user_settings']['it-it'] = "Impostazioni per questo utente che devono sovrascrivere quelle definite in Dominio o Impostazioni predefinite.";
$text['title_description-user_settings']['ka-ge'] = "ამ მომხმარებლის პარამეტრები, რომლებიც დომენის ან ნაგულისხმევ პარამეტრებში აღწერილ მნიშვნელობებს გადაფარავს.";
$text['title_description-user_settings']['nl-nl'] = "Instellingen voor deze gebruiker die de instellingen in Domein- of Standaardinstellingen moeten overschrijven.";
$text['title_description-user_settings']['pl-pl'] = "Ustawienia dla tego użytkownika, które powinny zastąpić te zdefiniowane w Domenie lub Ustawieniach Domyślnych.";
$text['title_description-user_settings']['pt-br'] = "Configurações para este usuário que devem substituir aquelas definidas em Domínio ou Configurações padrão.";
$text['title_description-user_settings']['pt-pt'] = "Configurações para este usuário que devem substituir aquelas definidas em Domínio ou Configurações padrão.";
$text['title_description-user_settings']['ro-ro'] = "Setări pentru acest utilizator care ar trebui să le înlocuiască pe cele definite în Domeniu sau Setări implicite.";
$text['title_description-user_settings']['ru-ru'] = "Настройки для этого пользователя, которые должны иметь приоритет над настройками, определенными в настройках домена или по умолчанию.";
$text['title_description-user_settings']['sv-se'] = "Inställningar för denna användare som ska åsidosätta de som definierats i Domän eller Standardinställningar.";
$text['title_description-user_settings']['uk-ua'] = "Налаштування для цього користувача, які мають замінити параметри, визначені в домені або налаштуваннях за замовчуванням.";
$text['title_description-user_settings']['tr-tr'] = "Bu kullanıcının Etki Alanı veya Varsayılan Ayarlar'da tanımlanan ayarları geçersiz kılması gereken ayarlar.";
$text['title_description-user_settings']['zh-cn'] = "此用户的设置应覆盖域或默认设置中定义的设置。";
$text['title_description-user_settings']['ja-jp'] = "ドメインまたはデフォルト設定で定義されているものを上書きするこのユーザーの設定。";
$text['title_description-user_settings']['ko-kr'] = "이 사용자에 대한 설정은 도메인 또는 기본 설정에서 정의된 것을 무시해야 합니다.";

$text['title-user_setting-edit']['en-us'] = "User Setting";
$text['title-user_setting-edit']['en-gb'] = "User Setting";
$text['title-user_setting-edit']['ar-eg'] = "مؤسسة مستعمل";
Expand Down
47 changes: 38 additions & 9 deletions core/user_settings/user_settings.php
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,20 @@
//connect to the database
$database = new database;

//add multi-lingual support
$language = new text;
$text = $language->get();

//action add or update
if (!empty($_REQUEST["id"]) && is_uuid($_REQUEST["id"])) {
$action = "update";
$user_uuid = $_REQUEST["id"];
$id = $_REQUEST["id"];
}
else {
$action = "add";
}

//get the http post data
if (!empty($_POST['action'])) {
$action = $_POST['action'] ?? '';
Expand Down Expand Up @@ -146,8 +160,8 @@
$sql .= "from v_user_settings ";
$sql .= "where user_uuid = :user_uuid ";
$sql .= "and not ( ";
$sql .= "(user_setting_category = 'domain' and user_setting_subcategory = 'language') ";
$sql .= "or (user_setting_category = 'domain' and user_setting_subcategory = 'time_zone') ";
$sql .= " (user_setting_category = 'domain' and user_setting_subcategory = 'language') ";
$sql .= " or (user_setting_category = 'domain' and user_setting_subcategory = 'time_zone') ";
$sql .= ") ";
if (!empty($order_by)) {
$sql .= "order by user_setting_category, user_setting_subcategory, user_setting_order asc ";
Expand All @@ -164,10 +178,17 @@
$object = new token;
$token = $object->create('/core/user_settings/user_settings.php');

//include the header
$document['title'] = $text['title-user_settings'];
require_once "resources/header.php";

//show the content
echo "<div class='action_bar' id='action_bar_sub'>\n";
echo " <div class='heading'><b id='heading_sub'>".$text['header-user_settings']."</b></div>\n";
echo " <div class='heading'><b id='heading_sub'>".$text['title-user_settings']."</b></div>\n";
echo " <div class='actions'>\n";
if (permission_exists('user_add') || permission_exists('user_edit')) {
echo button::create(['type'=>'button','label'=>$text['button-back'],'icon'=>$_SESSION['theme']['button_icon_back'],'id'=>'btn_back','link'=>'/core/users/user_edit.php?id='.$user_uuid]);
}
echo button::create(['type'=>'button','id'=>'action_bar_sub_button_back','label'=>$text['button-back'],'icon'=>$button_icon_back,'style'=>'margin-right: 15px; display: none;','link'=>'users.php']);
if (permission_exists('user_setting_add')) {
echo button::create(['type'=>'button','label'=>$text['button-add'],'icon'=>$button_icon_add,'id'=>'btn_add','link'=>PROJECT_PATH.'/core/user_settings/user_setting_edit.php?user_uuid='.urlencode($_GET['id'])]);
Expand All @@ -189,15 +210,14 @@
echo modal::create(['id'=>'modal-delete','type'=>'delete','actions'=>button::create(['type'=>'button','label'=>$text['button-continue'],'icon'=>'check','id'=>'btn_delete','style'=>'float: right; margin-left: 15px;','collapse'=>'never','onclick'=>"modal_close(); list_action_set('delete'); list_form_submit('form_list');"])]);
}

echo $text['header_description-user_settings']."\n";
echo $text['title_description-user_settings']."\n";
echo "<br /><br />\n";

echo "<form id='form_list' method='post' action='/core/user_settings/user_settings.php'>\n";
echo "<input type='hidden' name='action' id='action' value=''>\n";
echo "<input type='hidden' name='user_uuid' value='".$user_uuid."'>\n";

echo "<div class='card'>\n";
echo "<table class='list'>\n";

if (!empty($user_settings)) {
$previous_user_setting_category = '';
$x = 0;
Expand All @@ -217,13 +237,16 @@
}

if ($previous_user_setting_category != $row['user_setting_category']) {
if ($previous_user_setting_category != '') {
echo "</table>\n";

echo "<br>\n";
if (!empty($previous_user_setting_category)) {
echo "</table>\n";
echo "</div>\n";
echo "</div>\n";
}
echo "<div class='category' id='category_".$user_setting_category."'>\n";
echo "<b>".escape($label_user_setting_category)."</b><br>\n";

echo "<div class='card'>\n";
echo "<table class='list'>\n";
echo "<tr class='list-header'>\n";
if (permission_exists('user_setting_add') || permission_exists('user_setting_edit') || permission_exists('user_setting_delete')) {
Expand Down Expand Up @@ -376,7 +399,10 @@

echo "</table>\n";
echo "</div>\n";
echo "</div>\n";
echo "<br />\n";


echo "<div align='center'>".$paging_controls."</div>\n";
echo "<input type='hidden' name='".$token['name']."' value='".$token['hash']."'>\n";
echo "</form>\n";
Expand All @@ -398,4 +424,7 @@

echo "</script>\n";

//include the footer
require_once "resources/footer.php";

?>
55 changes: 0 additions & 55 deletions core/users/app_languages.php
Original file line number Diff line number Diff line change
Expand Up @@ -2246,61 +2246,6 @@
$text['header-user_import']['ja-jp'] = "ユーザーのインポート";
$text['header-user_import']['ko-kr'] = "사용자 가져오기";

$text['header-user_settings']['en-us'] = "User Settings";
$text['header-user_settings']['en-gb'] = "User Settings";
$text['header-user_settings']['ar-eg'] = "إعدادات المستخدم";
$text['header-user_settings']['de-at'] = "Benutzereinstellungen";
$text['header-user_settings']['de-ch'] = "Benutzereinstellungen";
$text['header-user_settings']['de-de'] = "Benutzereinstellungen";
$text['header-user_settings']['el-gr'] = "Ρυθμίσεις χρήστη";
$text['header-user_settings']['el-gr'] = "Ρυθμίσεις χρήστη";
$text['header-user_settings']['es-cl'] = "Ajustes de usuario";
$text['header-user_settings']['es-mx'] = "Ajustes de usuario";
$text['header-user_settings']['fr-ca'] = "Paramètres Utilisateur";
$text['header-user_settings']['fr-fr'] = "Paramètres Utilisateur";
$text['header-user_settings']['he-il'] = "הגדרות משתמש";
$text['header-user_settings']['it-it'] = "Impostazioni utente";
$text['header-user_settings']['ka-ge'] = "მომხმარებლის პარამეტრები";
$text['header-user_settings']['nl-nl'] = "Gebruikersinstellingen";
$text['header-user_settings']['pl-pl'] = "Ustawienia Użytkownika";
$text['header-user_settings']['pt-br'] = "Configurações do Usuário";
$text['header-user_settings']['pt-pt'] = "Configurações do Usuário";
$text['header-user_settings']['ro-ro'] = "Setarile utilizatorului";
$text['header-user_settings']['ru-ru'] = "Пользовательские настройки";
$text['header-user_settings']['sv-se'] = "Användarinställningar";
$text['header-user_settings']['uk-ua'] = "Налаштування користувача";
$text['header-user_settings']['tr-tr'] = "Kullanıcı ayarları";
$text['header-user_settings']['zh-cn'] = "用户设置";
$text['header-user_settings']['ja-jp'] = "ユーザー設定";
$text['header-user_settings']['ko-kr'] = "사용자 설정";

$text['header_description-user_settings']['en-us'] = "Settings for this user that should override those defined in Domain or Default Settings.";
$text['header_description-user_settings']['en-gb'] = "Settings for this user that should override those defined in Domain or Default Settings.";
$text['header_description-user_settings']['ar-eg'] = "يجب أن تتجاوز الإعدادات الخاصة بهذا المستخدم الإعدادات المحددة في النطاق أو الإعدادات الافتراضية.";
$text['header_description-user_settings']['de-at'] = "Einstellungen für diesen Benutzer, die die in den Domänen- oder Standardeinstellungen definierten überschreiben sollen.";
$text['header_description-user_settings']['de-ch'] = "Einstellungen für diesen Benutzer, die die in den Domänen- oder Standardeinstellungen definierten überschreiben sollen.";
$text['header_description-user_settings']['de-de'] = "Einstellungen für diesen Benutzer, die die in den Domänen- oder Standardeinstellungen definierten überschreiben sollen.";
$text['header_description-user_settings']['el-gr'] = "Ρυθμίσεις για αυτόν τον χρήστη που θα πρέπει να αντικαθιστούν αυτές που ορίζονται στις Ρυθμίσεις Τομέα ή Προεπιλεγμένες Ρυθμίσεις.";
$text['header_description-user_settings']['es-cl'] = "Configuración para este usuario que debe anular las definidas en Dominio o Configuración predeterminada.";
$text['header_description-user_settings']['es-mx'] = "Configuración para este usuario que debe anular las definidas en Dominio o Configuración predeterminada.";
$text['header_description-user_settings']['fr-ca'] = "Paramètres pour cet utilisateur qui doivent remplacer ceux définis dans le domaine ou les paramètres par défaut.";
$text['header_description-user_settings']['fr-fr'] = "Paramètres pour cet utilisateur qui doivent remplacer ceux définis dans le domaine ou les paramètres par défaut.";
$text['header_description-user_settings']['he-il'] = "הגדרות עבור משתמש זה שצריכות לעקוף את אלו שהוגדרו בהגדרות דומיין או ברירת מחדל.";
$text['header_description-user_settings']['it-it'] = "Impostazioni per questo utente che devono sovrascrivere quelle definite in Dominio o Impostazioni predefinite.";
$text['header_description-user_settings']['ka-ge'] = "ამ მომხმარებლის პარამეტრები, რომლებიც დომენის ან ნაგულისხმევ პარამეტრებში აღწერილ მნიშვნელობებს გადაფარავს.";
$text['header_description-user_settings']['nl-nl'] = "Instellingen voor deze gebruiker die de instellingen in Domein- of Standaardinstellingen moeten overschrijven.";
$text['header_description-user_settings']['pl-pl'] = "Ustawienia dla tego użytkownika, które powinny zastąpić te zdefiniowane w Domenie lub Ustawieniach Domyślnych.";
$text['header_description-user_settings']['pt-br'] = "Configurações para este usuário que devem substituir aquelas definidas em Domínio ou Configurações padrão.";
$text['header_description-user_settings']['pt-pt'] = "Configurações para este usuário que devem substituir aquelas definidas em Domínio ou Configurações padrão.";
$text['header_description-user_settings']['ro-ro'] = "Setări pentru acest utilizator care ar trebui să le înlocuiască pe cele definite în Domeniu sau Setări implicite.";
$text['header_description-user_settings']['ru-ru'] = "Настройки для этого пользователя, которые должны иметь приоритет над настройками, определенными в настройках домена или по умолчанию.";
$text['header_description-user_settings']['sv-se'] = "Inställningar för denna användare som ska åsidosätta de som definierats i Domän eller Standardinställningar.";
$text['header_description-user_settings']['uk-ua'] = "Налаштування для цього користувача, які мають замінити параметри, визначені в домені або налаштуваннях за замовчуванням.";
$text['header_description-user_settings']['tr-tr'] = "Bu kullanıcının Etki Alanı veya Varsayılan Ayarlar'da tanımlanan ayarları geçersiz kılması gereken ayarlar.";
$text['header_description-user_settings']['zh-cn'] = "此用户的设置应覆盖域或默认设置中定义的设置。";
$text['header_description-user_settings']['ja-jp'] = "ドメインまたはデフォルト設定で定義されているものを上書きするこのユーザーの設定。";
$text['header_description-user_settings']['ko-kr'] = "이 사용자에 대한 설정은 도메인 또는 기본 설정에서 정의된 것을 무시해야 합니다.";

$text['description-user_manager']['en-us'] = "Add, edit, delete, and search users. ";
$text['description-user_manager']['en-gb'] = "Add, edit, delete, and search users. ";
$text['description-user_manager']['ar-eg'] = "إضافة، تحرير، حذف، ومستعملي البحث.";
Expand Down
Loading

0 comments on commit 8edc5d1

Please sign in to comment.