From 7f0f5bf4c596204dd2484cc11c348fafad50c3f3 Mon Sep 17 00:00:00 2001 From: Julio Date: Mon, 27 Nov 2017 08:17:15 +0100 Subject: [PATCH] Minor - format code --- main/admin/user_edit.php | 9 +++++++-- main/admin/user_information.php | 2 +- main/auth/inscription.php | 2 +- main/exercise/question.class.php | 1 - main/inc/lib/usermanager.lib.php | 11 +++++------ main/inc/lib/userportal.lib.php | 1 - 6 files changed, 14 insertions(+), 12 deletions(-) diff --git a/main/admin/user_edit.php b/main/admin/user_edit.php index d5c636354f..67efc49b3d 100755 --- a/main/admin/user_edit.php +++ b/main/admin/user_edit.php @@ -285,7 +285,12 @@ if (!$user_data['platform_admin']) { $form->addElement('radio', 'radio_expiration_date', get_lang('ExpirationDate'), get_lang('NeverExpires'), 0); $group = array(); $group[] = $form->createElement('radio', 'radio_expiration_date', null, get_lang('Enabled'), 1); - $group[] = $form->createElement('DateTimePicker', 'expiration_date', null, array('onchange' => 'javascript: enable_expiration_date();')); + $group[] = $form->createElement( + 'DateTimePicker', + 'expiration_date', + null, + array('onchange' => 'javascript: enable_expiration_date();') + ); $form->addGroup($group, 'max_member_group', null, null, false); // Active account or inactive account @@ -305,7 +310,7 @@ if ($studentBoss) { } } -if ($studentBossList) { +if (!empty($studentBossList)) { $studentBossList = array_column($studentBossList, 'boss_id'); } diff --git a/main/admin/user_information.php b/main/admin/user_information.php index 4b139d6cfb..df0c6fd243 100755 --- a/main/admin/user_information.php +++ b/main/admin/user_information.php @@ -125,7 +125,7 @@ if (api_is_platform_admin()) { $studentBossList = UserManager::getStudentBossList($userId); $studentBossListToString = ''; -if ($studentBossList) { +if (!empty($studentBossList)) { $table = new HTML_Table(array('class' => 'data_table')); $table->setHeaderContents(0, 0, get_lang('User')); $csvContent[] = [get_lang('StudentBoss')]; diff --git a/main/auth/inscription.php b/main/auth/inscription.php index b93df7c7df..056792e028 100755 --- a/main/auth/inscription.php +++ b/main/auth/inscription.php @@ -827,7 +827,7 @@ if ($form->validate()) { ); $bossList = UserManager::getStudentBossList($user_id); - if ($bossList) { + if (!empty($bossList)) { $bossList = array_column($bossList, 'boss_id'); $currentUserInfo = api_get_user_info($user_id); foreach ($bossList as $bossId) { diff --git a/main/exercise/question.class.php b/main/exercise/question.class.php index 2061a3a406..d66f97a175 100755 --- a/main/exercise/question.class.php +++ b/main/exercise/question.class.php @@ -1010,7 +1010,6 @@ abstract class Question if ($exercise->questionFeedbackEnabled) { $params['feedback'] = $this->feedback; } - $this->id = Database::insert($TBL_QUESTIONS, $params); if ($this->id) { diff --git a/main/inc/lib/usermanager.lib.php b/main/inc/lib/usermanager.lib.php index 52f9ad40b5..f3c7083458 100755 --- a/main/inc/lib/usermanager.lib.php +++ b/main/inc/lib/usermanager.lib.php @@ -5393,11 +5393,11 @@ class UserManager /** * Get the boss user ID from a followed user id * @param $userId - * @return bool + * @return array */ public static function getStudentBossList($userId) { - $userId = intval($userId); + $userId = (int) $userId; if ($userId > 0) { $userRelTable = Database::get_main_table(TABLE_MAIN_USER_REL_USER); $result = Database::select( @@ -5410,14 +5410,13 @@ class UserManager USER_RELATION_TYPE_BOSS, ) ) - ), - 'all' + ) ); return $result; } - return false; + return []; } /** @@ -5430,7 +5429,7 @@ class UserManager { $result = false; $bossList = self::getStudentBossList($studentId); - if ($bossList) { + if (!empty($bossList)) { $bossList = array_column($bossList, 'boss_id'); if (in_array($bossId, $bossList)) { $result = true; diff --git a/main/inc/lib/userportal.lib.php b/main/inc/lib/userportal.lib.php index 9637c261c5..0b2403df7c 100755 --- a/main/inc/lib/userportal.lib.php +++ b/main/inc/lib/userportal.lib.php @@ -1013,7 +1013,6 @@ class IndexManager // Main navigation section. // Tabs that are deactivated are added here. if (!empty($this->tpl->menu_navigation)) { - //$content = '