From 5c8dbc2f5155e5a3f8043a51d4779f6b3037d462 Mon Sep 17 00:00:00 2001 From: markusfluer Date: Thu, 12 Oct 2017 16:24:12 +0200 Subject: [PATCH] Dev: fixes to the general loading of js and small fixes to the personal settings --- application/controllers/admin/useraction.php | 20 ++++++++++--------- .../yiiwheels/widgets/select2/WhSelect2.php | 4 ++-- application/views/admin/super/footer.php | 4 +++- .../views/admin/user/personalsettings.php | 20 ++++++++++++------- 4 files changed, 29 insertions(+), 19 deletions(-) diff --git a/application/controllers/admin/useraction.php b/application/controllers/admin/useraction.php index b7f869c1a82..9b4bb9b1443 100644 --- a/application/controllers/admin/useraction.php +++ b/application/controllers/admin/useraction.php @@ -693,12 +693,12 @@ public function personalsettings() } } - $oUserModel->setAttributes($aData); + $oUserModel->setAttributes($aData,false); $uresult = $oUserModel->save(); if (Yii::app()->request->getPost('lang')=='auto') { - $sLanguage= getBrowserLanguage(); + $sLanguage = getBrowserLanguage(); } else { @@ -722,17 +722,19 @@ public function personalsettings() } // Get user lang - $user = User::model()->findByPk(Yii::app()->session['loginID']); + unset($oUser); + $oUser = User::model()->findByPk(Yii::app()->session['loginID']); + $aLanguageData=array('auto'=>gT("(Autodetect)")); foreach (getLanguageData(true, Yii::app()->session['adminlang']) as $langkey => $languagekind) { $aLanguageData[$langkey]=html_entity_decode($languagekind['nativedescription'].' - '.$languagekind['description'],ENT_COMPAT,'utf-8'); } $aData['aLanguageData'] = $aLanguageData; - $aData['sSavedLanguage'] = $user->lang; - $aData['sUsername'] = $user->users_name; - $aData['sFullname'] = $user->full_name; - $aData['sEmailAdress'] = $user->email; + $aData['sSavedLanguage'] = $oUser->lang; + $aData['sUsername'] = $oUser->users_name; + $aData['sFullname'] = $oUser->full_name; + $aData['sEmailAdress'] = $oUser->email; $aData['fullpagebar']['savebutton']['form'] = 'personalsettings'; $aData['fullpagebar']['saveandclosebutton']['form'] = 'personalsettings'; @@ -741,9 +743,9 @@ public function personalsettings() //Get data for personal menues $oSurveymenu = Surveymenu::model(); - $oSurveymenu->user_id = $user->uid; + $oSurveymenu->user_id = $oUser->uid; $oSurveymenuEntries = SurveymenuEntries::model(); - $oSurveymenuEntries->user_id = $user->uid; + $oSurveymenuEntries->user_id = $oUser->uid; $aData['surveymenu_data']['model'] = $oSurveymenu; $aData['surveymenuentry_data']['model'] = $oSurveymenuEntries; // Render personal settings view diff --git a/application/extensions/yiiwheels/widgets/select2/WhSelect2.php b/application/extensions/yiiwheels/widgets/select2/WhSelect2.php index f2f93980556..1fc99f6c414 100644 --- a/application/extensions/yiiwheels/widgets/select2/WhSelect2.php +++ b/application/extensions/yiiwheels/widgets/select2/WhSelect2.php @@ -104,7 +104,7 @@ public function registerClientScript() /* initialize plugin */ $selector = '#' . TbArray::getValue('id', $this->htmlOptions, $this->getId()); $this->pluginOptions['theme']='bootstrap'; - $this->getApi()->registerPlugin('select2', $selector, $this->pluginOptions, LSYii_ClientScript::POS_BEGIN); - $this->getApi()->registerEvents($selector, $this->events, LSYii_ClientScript::POS_BEGIN); + $this->getApi()->registerPlugin('select2', $selector, $this->pluginOptions, LSYii_ClientScript::POS_END); + $this->getApi()->registerEvents($selector, $this->events, LSYii_ClientScript::POS_END); } } diff --git a/application/views/admin/super/footer.php b/application/views/admin/super/footer.php index 2b5d410e8a8..5b3a382be38 100644 --- a/application/views/admin/super/footer.php +++ b/application/views/admin/super/footer.php @@ -30,7 +30,9 @@ - +
+ <###end###> +
" control-label")); ?> -
+
widget('yiiwheels.widgets.select2.WhSelect2', array( 'asDropDownList' => true, 'name' => 'lang', 'data' => $aLanguageData, 'pluginOptions' => array( + 'buttonWidth' => '100%', 'htmlOptions' => array( - 'id' => 'lang', - 'class'=> "form-control" - ) - ), - 'value' => $sSavedLanguage - )); + 'id' => 'lang', + 'style'=> "widht:100%;" + ) + ), + 'value' => $sSavedLanguage, + 'htmlOptions' => array( + 'class'=> "form-control", + 'style'=> "widht:100%;", + 'data-width' => '100%' + ) + )); ?>