@@ -18,8 +18,8 @@ discard block |
||
| 18 | 18 | api_protect_admin_script(true); |
| 19 | 19 | |
| 20 | 20 | // setting breadcrumbs |
| 21 | -$interbreadcrumb[]= array('url' => 'index.php','name' => get_lang('PlatformAdmin')); |
|
| 22 | -$interbreadcrumb[]= array('url' => 'usergroups.php','name' => get_lang('Classes')); |
|
| 21 | +$interbreadcrumb[] = array('url' => 'index.php', 'name' => get_lang('PlatformAdmin')); |
|
| 22 | +$interbreadcrumb[] = array('url' => 'usergroups.php', 'name' => get_lang('Classes')); |
|
| 23 | 23 | |
| 24 | 24 | // Database Table Definitions |
| 25 | 25 | |
@@ -91,14 +91,14 @@ discard block |
||
| 91 | 91 | |
| 92 | 92 | </script>'; |
| 93 | 93 | |
| 94 | -$form_sent = 0; |
|
| 94 | +$form_sent = 0; |
|
| 95 | 95 | |
| 96 | 96 | $extra_field_list = UserManager::get_extra_fields(); |
| 97 | 97 | $new_field_list = array(); |
| 98 | 98 | if (is_array($extra_field_list)) { |
| 99 | 99 | foreach ($extra_field_list as $extra_field) { |
| 100 | 100 | //if is enabled to filter and is a "<select>" field type |
| 101 | - if ($extra_field[8]==1 && $extra_field[2]==4 ) { |
|
| 101 | + if ($extra_field[8] == 1 && $extra_field[2] == 4) { |
|
| 102 | 102 | $new_field_list[] = array( |
| 103 | 103 | 'name'=> $extra_field[3], |
| 104 | 104 | 'variable' => $extra_field[1], 'data'=> $extra_field[9] |
@@ -146,7 +146,7 @@ discard block |
||
| 146 | 146 | foreach ($users as $user) { |
| 147 | 147 | $data[] = array($user['username'], $groupInfo['name']); |
| 148 | 148 | } |
| 149 | - $filename = 'export_user_class_' . api_get_local_time(); |
|
| 149 | + $filename = 'export_user_class_'.api_get_local_time(); |
|
| 150 | 150 | Export::arrayToCsv($data, $filename); |
| 151 | 151 | exit; |
| 152 | 152 | } |
@@ -156,11 +156,11 @@ discard block |
||
| 156 | 156 | // Filter by Extra Fields |
| 157 | 157 | $use_extra_fields = false; |
| 158 | 158 | if (is_array($extra_field_list)) { |
| 159 | - if (is_array($new_field_list) && count($new_field_list)>0 ) { |
|
| 159 | + if (is_array($new_field_list) && count($new_field_list) > 0) { |
|
| 160 | 160 | foreach ($new_field_list as $new_field) { |
| 161 | 161 | $varname = 'field_'.$new_field['variable']; |
| 162 | 162 | if (UserManager::is_extra_field_available($new_field['variable'])) { |
| 163 | - if (isset($_POST[$varname]) && $_POST[$varname]!='0') { |
|
| 163 | + if (isset($_POST[$varname]) && $_POST[$varname] != '0') { |
|
| 164 | 164 | $use_extra_fields = true; |
| 165 | 165 | $extra_field_result[] = UserManager::get_extra_user_data_by_value( |
| 166 | 166 | $new_field['variable'], |
@@ -174,10 +174,10 @@ discard block |
||
| 174 | 174 | |
| 175 | 175 | if ($use_extra_fields) { |
| 176 | 176 | $final_result = array(); |
| 177 | - if (count($extra_field_result)>1) { |
|
| 178 | - for ($i=0; $i<count($extra_field_result)-1; $i++) { |
|
| 179 | - if (is_array($extra_field_result[$i+1])) { |
|
| 180 | - $final_result = array_intersect($extra_field_result[$i], $extra_field_result[$i+1]); |
|
| 177 | + if (count($extra_field_result) > 1) { |
|
| 178 | + for ($i = 0; $i < count($extra_field_result) - 1; $i++) { |
|
| 179 | + if (is_array($extra_field_result[$i + 1])) { |
|
| 180 | + $final_result = array_intersect($extra_field_result[$i], $extra_field_result[$i + 1]); |
|
| 181 | 181 | } |
| 182 | 182 | } |
| 183 | 183 | } else { |
@@ -196,7 +196,7 @@ discard block |
||
| 196 | 196 | |
| 197 | 197 | $searchForm = new FormValidator('search', 'get', api_get_self().'?id='.$id); |
| 198 | 198 | $searchForm->addHeader(get_lang('AdvancedSearch')); |
| 199 | -$renderer =& $searchForm->defaultRenderer(); |
|
| 199 | +$renderer = & $searchForm->defaultRenderer(); |
|
| 200 | 200 | |
| 201 | 201 | $searchForm->addElement('hidden', 'id', $id); |
| 202 | 202 | foreach ($filters as $param) { |
@@ -345,13 +345,13 @@ discard block |
||
| 345 | 345 | $searchForm->display(); |
| 346 | 346 | echo '</div>'; |
| 347 | 347 | ?> |
| 348 | -<form name="formulaire" method="post" action="<?php echo api_get_self(); ?>?id=<?php echo $id; if(!empty($_GET['add'])) echo '&add=true' ; ?>" style="margin:0px;"> |
|
| 348 | +<form name="formulaire" method="post" action="<?php echo api_get_self(); ?>?id=<?php echo $id; if (!empty($_GET['add'])) echo '&add=true'; ?>" style="margin:0px;"> |
|
| 349 | 349 | <?php |
| 350 | 350 | echo '<legend>'.$tool_name.': '.$data['name'].'</legend>'; |
| 351 | 351 | |
| 352 | 352 | |
| 353 | 353 | if (is_array($extra_field_list)) { |
| 354 | - if (is_array($new_field_list) && count($new_field_list)>0) { |
|
| 354 | + if (is_array($new_field_list) && count($new_field_list) > 0) { |
|
| 355 | 355 | echo '<h3>'.get_lang('FilterByUser').'</h3>'; |
| 356 | 356 | foreach ($new_field_list as $new_field) { |
| 357 | 357 | echo $new_field['name']; |
@@ -359,7 +359,7 @@ discard block |
||
| 359 | 359 | echo ' <select name="'.$varname.'">'; |
| 360 | 360 | echo '<option value="0">--'.get_lang('Select').'--</option>'; |
| 361 | 361 | foreach ($new_field['data'] as $option) { |
| 362 | - $checked=''; |
|
| 362 | + $checked = ''; |
|
| 363 | 363 | if (isset($_POST[$varname])) { |
| 364 | 364 | if ($_POST[$varname] == $option[1]) { |
| 365 | 365 | $checked = 'selected="true"'; |
@@ -386,15 +386,15 @@ discard block |
||
| 386 | 386 | <?php if ($data['group_type'] == UserGroup::SOCIAL_CLASS) { ?> |
| 387 | 387 | <select name="relation" id="relation"> |
| 388 | 388 | <option value=""><?php echo get_lang('SelectARelationType')?></option> |
| 389 | - <option value="<?php echo GROUP_USER_PERMISSION_ADMIN ?>" <?php echo ((isset($relation) && $relation == GROUP_USER_PERMISSION_ADMIN)?'selected=selected':'') ?> > |
|
| 389 | + <option value="<?php echo GROUP_USER_PERMISSION_ADMIN ?>" <?php echo ((isset($relation) && $relation == GROUP_USER_PERMISSION_ADMIN) ? 'selected=selected' : '') ?> > |
|
| 390 | 390 | <?php echo get_lang('Admin') ?></option> |
| 391 | - <option value="<?php echo GROUP_USER_PERMISSION_READER ?>" <?php echo ((isset($relation) && $relation == GROUP_USER_PERMISSION_READER)?'selected=selected':'') ?> > |
|
| 391 | + <option value="<?php echo GROUP_USER_PERMISSION_READER ?>" <?php echo ((isset($relation) && $relation == GROUP_USER_PERMISSION_READER) ? 'selected=selected' : '') ?> > |
|
| 392 | 392 | <?php echo get_lang('Reader') ?></option> |
| 393 | - <option value="<?php echo GROUP_USER_PERMISSION_PENDING_INVITATION ?>" <?php echo ((isset($relation) && $relation == GROUP_USER_PERMISSION_PENDING_INVITATION)?'selected=selected':'') ?> > |
|
| 393 | + <option value="<?php echo GROUP_USER_PERMISSION_PENDING_INVITATION ?>" <?php echo ((isset($relation) && $relation == GROUP_USER_PERMISSION_PENDING_INVITATION) ? 'selected=selected' : '') ?> > |
|
| 394 | 394 | <?php echo get_lang('PendingInvitation') ?></option> |
| 395 | - <option value="<?php echo GROUP_USER_PERMISSION_MODERATOR ?>" <?php echo ((isset($relation) && $relation == GROUP_USER_PERMISSION_MODERATOR)?'selected=selected':'') ?> > |
|
| 395 | + <option value="<?php echo GROUP_USER_PERMISSION_MODERATOR ?>" <?php echo ((isset($relation) && $relation == GROUP_USER_PERMISSION_MODERATOR) ? 'selected=selected' : '') ?> > |
|
| 396 | 396 | <?php echo get_lang('Moderator') ?></option> |
| 397 | - <option value="<?php echo GROUP_USER_PERMISSION_HRM ?>" <?php echo ((isset($relation) && $relation == GROUP_USER_PERMISSION_HRM)?'selected=selected':'') ?> > |
|
| 397 | + <option value="<?php echo GROUP_USER_PERMISSION_HRM ?>" <?php echo ((isset($relation) && $relation == GROUP_USER_PERMISSION_HRM) ? 'selected=selected' : '') ?> > |
|
| 398 | 398 | <?php echo get_lang('Drh') ?></option> |
| 399 | 399 | </select> |
| 400 | 400 | <?php } ?> |
@@ -414,13 +414,13 @@ discard block |
||
| 414 | 414 | 'elements_not_in_name', |
| 415 | 415 | $elements_not_in, |
| 416 | 416 | '', |
| 417 | - array('class'=>'col-md-7', 'multiple'=>'multiple','id'=>'elements_not_in','size'=>'15px'), |
|
| 417 | + array('class'=>'col-md-7', 'multiple'=>'multiple', 'id'=>'elements_not_in', 'size'=>'15px'), |
|
| 418 | 418 | false |
| 419 | 419 | ); |
| 420 | 420 | ?> |
| 421 | 421 | <br /> |
| 422 | 422 | <label class="control-label"> |
| 423 | - <input type="checkbox" <?php if ($user_with_any_group) echo 'checked="checked"';?> onchange="checked_in_no_group(this.checked);" name="user_with_any_group" id="user_with_any_group_id"> |
|
| 423 | + <input type="checkbox" <?php if ($user_with_any_group) echo 'checked="checked"'; ?> onchange="checked_in_no_group(this.checked);" name="user_with_any_group" id="user_with_any_group_id"> |
|
| 424 | 424 | <?php echo get_lang('UsersRegisteredInAnyGroup'); ?> |
| 425 | 425 | </label> |
| 426 | 426 | </div> |
@@ -444,7 +444,7 @@ discard block |
||
| 444 | 444 | 'elements_in_name[]', |
| 445 | 445 | $elements_in, |
| 446 | 446 | '', |
| 447 | - array('class'=>'col-md-7', 'multiple'=>'multiple','id'=>'elements_in','size'=>'15px'), |
|
| 447 | + array('class'=>'col-md-7', 'multiple'=>'multiple', 'id'=>'elements_in', 'size'=>'15px'), |
|
| 448 | 448 | false |
| 449 | 449 | ); |
| 450 | 450 | unset($sessionUsersList); |
@@ -1231,13 +1231,13 @@ discard block |
||
| 1231 | 1231 | } |
| 1232 | 1232 | |
| 1233 | 1233 | /** |
| 1234 | - * Get the users by ID |
|
| 1235 | - * @param array $ids student ids |
|
| 1236 | - * @param string $active |
|
| 1237 | - * @param string $order |
|
| 1238 | - * @param string $limit |
|
| 1239 | - * @return array $result student information |
|
| 1240 | - */ |
|
| 1234 | + * Get the users by ID |
|
| 1235 | + * @param array $ids student ids |
|
| 1236 | + * @param string $active |
|
| 1237 | + * @param string $order |
|
| 1238 | + * @param string $limit |
|
| 1239 | + * @return array $result student information |
|
| 1240 | + */ |
|
| 1241 | 1241 | public static function get_user_list_by_ids($ids = array(), $active = null, $order = null, $limit = null) |
| 1242 | 1242 | { |
| 1243 | 1243 | if (empty($ids)) { |
@@ -2275,7 +2275,7 @@ discard block |
||
| 2275 | 2275 | * |
| 2276 | 2276 | * @return array with extra data info of a user i.e array('field_variable'=>'value'); |
| 2277 | 2277 | */ |
| 2278 | - public static function get_extra_user_data_by_value($field_variable, $field_value, $all_visibility = true) |
|
| 2278 | + public static function get_extra_user_data_by_value($field_variable, $field_value, $all_visibility = true) |
|
| 2279 | 2279 | { |
| 2280 | 2280 | $extraField = new ExtraFieldValue('user'); |
| 2281 | 2281 | |
@@ -3352,12 +3352,12 @@ discard block |
||
| 3352 | 3352 | if ($tag_id == 0) { |
| 3353 | 3353 | //the tag doesn't exist |
| 3354 | 3354 | $sql = "INSERT INTO $table_user_tag (tag, field_id,count) VALUES ('$tag','$field_id', count + 1)"; |
| 3355 | - Database::query($sql); |
|
| 3355 | + Database::query($sql); |
|
| 3356 | 3356 | $last_insert_id = Database::insert_id(); |
| 3357 | 3357 | } else { |
| 3358 | 3358 | //the tag exists we update it |
| 3359 | 3359 | $sql = "UPDATE $table_user_tag SET count = count + 1 WHERE id = $tag_id"; |
| 3360 | - Database::query($sql); |
|
| 3360 | + Database::query($sql); |
|
| 3361 | 3361 | $last_insert_id = $tag_id; |
| 3362 | 3362 | } |
| 3363 | 3363 | |
@@ -3552,9 +3552,9 @@ discard block |
||
| 3552 | 3552 | } |
| 3553 | 3553 | |
| 3554 | 3554 | /** |
| 3555 | - * Get extra filtrable user fields (only type select) |
|
| 3556 | - * @return array |
|
| 3557 | - */ |
|
| 3555 | + * Get extra filtrable user fields (only type select) |
|
| 3556 | + * @return array |
|
| 3557 | + */ |
|
| 3558 | 3558 | public static function get_extra_filtrable_fields() |
| 3559 | 3559 | { |
| 3560 | 3560 | $extraFieldList = UserManager::get_extra_fields(); |
@@ -3579,9 +3579,9 @@ discard block |
||
| 3579 | 3579 | } |
| 3580 | 3580 | |
| 3581 | 3581 | /** |
| 3582 | - * Get extra where clauses for finding users based on extra filtrable user fields (type select) |
|
| 3583 | - * @return string With AND clauses based on user's ID which have the values to search in extra user fields |
|
| 3584 | - */ |
|
| 3582 | + * Get extra where clauses for finding users based on extra filtrable user fields (type select) |
|
| 3583 | + * @return string With AND clauses based on user's ID which have the values to search in extra user fields |
|
| 3584 | + */ |
|
| 3585 | 3585 | public static function get_search_form_where_extra_fields() |
| 3586 | 3586 | { |
| 3587 | 3587 | $useExtraFields = false; |
@@ -3900,23 +3900,23 @@ discard block |
||
| 3900 | 3900 | } |
| 3901 | 3901 | |
| 3902 | 3902 | /** |
| 3903 | - * Get users followed by human resource manager |
|
| 3904 | - * @param int $userId |
|
| 3905 | - * @param int $userStatus Filter users by status (STUDENT, COURSEMANAGER, etc) |
|
| 3906 | - * @param bool $getOnlyUserId |
|
| 3907 | - * @param bool $getSql |
|
| 3908 | - * @param bool $getCount |
|
| 3909 | - * @param int $from |
|
| 3910 | - * @param int $numberItems |
|
| 3911 | - * @param int $column |
|
| 3912 | - * @param string $direction |
|
| 3913 | - * @param int $active |
|
| 3914 | - * @param string $lastConnectionDate |
|
| 3915 | - * @param int $status the function is called by who? COURSEMANAGER, DRH? |
|
| 3916 | - * @param string $keyword |
|
| 3903 | + * Get users followed by human resource manager |
|
| 3904 | + * @param int $userId |
|
| 3905 | + * @param int $userStatus Filter users by status (STUDENT, COURSEMANAGER, etc) |
|
| 3906 | + * @param bool $getOnlyUserId |
|
| 3907 | + * @param bool $getSql |
|
| 3908 | + * @param bool $getCount |
|
| 3909 | + * @param int $from |
|
| 3910 | + * @param int $numberItems |
|
| 3911 | + * @param int $column |
|
| 3912 | + * @param string $direction |
|
| 3913 | + * @param int $active |
|
| 3914 | + * @param string $lastConnectionDate |
|
| 3915 | + * @param int $status the function is called by who? COURSEMANAGER, DRH? |
|
| 3916 | + * @param string $keyword |
|
| 3917 | 3917 | * |
| 3918 | - * @return array user list |
|
| 3919 | - */ |
|
| 3918 | + * @return array user list |
|
| 3919 | + */ |
|
| 3920 | 3920 | public static function getUsersFollowedByUser( |
| 3921 | 3921 | $userId, |
| 3922 | 3922 | $userStatus = null, |