@@ -1025,91 +1025,77 @@ function active_filter($active, $urlParams, $row)
1025
1025
*/
1026
1026
function modify_filter ($ user_id , $ row , $ data )
1027
1027
{
1028
- $ canEditUsers = 'true ' == api_get_setting ('allow_user_course_subscription_by_course_admin ' ) || api_is_platform_admin ();
1029
-
1028
+ $ canEditUsers = 'true ' === api_get_setting ('allow_user_course_subscription_by_course_admin ' ) || api_is_platform_admin ();
1030
1029
$ is_allowed_to_track = api_is_allowed_to_edit (true , true );
1031
1030
$ user_id = $ data [0 ];
1032
1031
$ userInfo = api_get_user_info ($ user_id );
1033
- $ isInvitee = INVITEE == $ userInfo ['status ' ] ? true : false ;
1032
+ $ isInvitee = INVITEE == $ userInfo ['status ' ];
1034
1033
$ course_info = $ _course = api_get_course_info ();
1035
1034
$ current_user_id = api_get_user_id ();
1036
1035
$ sessionId = api_get_session_id ();
1037
1036
$ courseId = $ _course ['id ' ];
1038
1037
$ type = isset ($ _REQUEST ['type ' ]) ? intval ($ _REQUEST ['type ' ]) : STUDENT ;
1039
1038
1040
- $ result = '' ;
1039
+ $ result = '<div class="flex items-center justify-center gap-2 text-sm"> ' ;
1040
+
1041
+ // Reporting
1041
1042
if ($ is_allowed_to_track ) {
1042
- $ result .= ' <a href="../my_space/myStudents.php? ' . api_get_cidreq (). ' &student= ' . $ user_id . ' &details=true&course= ' . $ courseId . ' &origin=user_course&id_session= ' . api_get_session_id (). ' "
1043
- title=" ' . get_lang ('Reporting ' ). ' ">
1044
- ' .Display:: getMdiIcon ( ' statistics ' , ' ch-tool-icon ' , null , ICON_SIZE_SMALL , get_lang ( ' Reporting ' )). '
1045
- </a> ' ;
1043
+ $ result .= Display:: url (
1044
+ Display:: getMdiIcon (ActionIcon:: VIEW_DETAILS , ' ch-tool-icon ' , null , ICON_SIZE_MEDIUM , get_lang ('Reporting ' )),
1045
+ '../my_space/myStudents.php? ' . api_get_cidreq (). ' &student= ' . $ user_id . ' &details=true&course= ' . $ courseId . ' &origin=user_course&id_session= ' . api_get_session_id ()
1046
+ ) ;
1046
1047
}
1047
1048
1048
- // If platform admin, show the login_as icon (this drastically shortens
1049
- // time taken by support to test things out)
1049
+ // Login as
1050
1050
if (api_is_platform_admin ()) {
1051
- $ result .= ' <a
1052
- href=" ' .api_get_path (WEB_CODE_PATH ).'admin/user_list.php?action=login_as&user_id= ' .$ user_id .'&sec_token= ' .Security::getTokenFromSession ().'"> ' .
1053
- Display::getMdiIcon ('login_as ' , 'ch-tool-icon ' , null , ICON_SIZE_SMALL , get_lang ('Login as ' )).'</a> ' ;
1051
+ $ result .= Display::url (
1052
+ Display::getMdiIcon (ActionIcon::LOGIN_AS , 'ch-tool-icon ' , null , ICON_SIZE_MEDIUM , get_lang ('Login as ' )),
1053
+ api_get_path (WEB_PATH ).'?_switch_user= ' .$ userInfo ['username ' ]
1054
+ );
1054
1055
}
1055
1056
1056
1057
if (api_is_allowed_to_edit (null , true )) {
1057
1058
if (empty ($ sessionId )) {
1058
1059
$ isTutor = isset ($ data ['is_tutor ' ]) ? (int ) $ data ['is_tutor ' ] : 0 ;
1059
1060
$ isTutor = empty ($ isTutor ) ? 1 : 0 ;
1061
+ $ text = $ isTutor ? get_lang ('Convert to assistant ' ) : get_lang ('Remove assistant role ' );
1062
+ $ disabled = $ isInvitee ? 'disabled ' : '' ;
1060
1063
1061
- $ text = get_lang ('Remove assistant role ' );
1062
- if ($ isTutor ) {
1063
- $ text = get_lang ('Convert to assistant ' );
1064
- }
1065
-
1066
- if ($ isInvitee ) {
1067
- $ disabled = 'disabled ' ;
1068
- } else {
1069
- $ disabled = '' ;
1070
- }
1071
-
1072
- $ allow = api_get_configuration_value ('extra ' );
1073
- if ($ allow ) {
1074
- $ result .= '<a href=" ' .
1075
- api_get_path (WEB_CODE_PATH ).'extra/userInfo.php? ' .api_get_cidreq ().'&editMainUserInfo= ' .$ user_id .'"
1076
- title=" ' .get_lang ('Edit ' ).'" > ' .
1077
- Display::getMdiIcon (ActionIcon::EDIT , 'ch-tool-icon ' , null , ICON_SIZE_SMALL , get_lang ('Edit ' )).
1078
- '</a> ' ;
1064
+ // Edit
1065
+ if (api_get_configuration_value ('extra ' )) {
1066
+ $ result .= Display::url (
1067
+ Display::getMdiIcon (ActionIcon::EDIT , 'ch-tool-icon ' , null , ICON_SIZE_MEDIUM , get_lang ('Edit ' )),
1068
+ api_get_path (WEB_CODE_PATH ).'extra/userInfo.php? ' .api_get_cidreq ().'&editMainUserInfo= ' .$ user_id
1069
+ );
1079
1070
}
1080
1071
1072
+ // Convert to assistant / Remove
1081
1073
if (STUDENT == $ data ['user_status_in_course ' ]) {
1082
1074
$ result .= Display::url (
1083
- $ text ,
1075
+ Display:: getMdiIcon ( $ isTutor ? ActionIcon:: ACCEPT : ActionIcon:: REJECT , ' ch-tool-icon text-xl ' , ICON_SIZE_MEDIUM , null , $ text ) ,
1084
1076
'user.php? ' .api_get_cidreq ().'&action=set_tutor&is_tutor= ' .$ isTutor .'&user_id= ' .$ user_id .'&type= ' .$ type ,
1085
- ['class ' => ' btn btn--plain ' . $ disabled ]
1086
- ). ' ' ;
1077
+ ['class ' => $ disabled ]
1078
+ );
1087
1079
}
1088
1080
}
1089
1081
1090
- // edit
1091
- if ($ canEditUsers ) {
1092
- // unregister
1093
- if ($ user_id != $ current_user_id || api_is_platform_admin ()) {
1094
- $ result .= '<a
1095
- class="btn btn-sm btn--danger delete-swal"
1096
- href=" ' .api_get_self ().'? ' .api_get_cidreq ().'&type= ' .$ type .'&unregister=yes&user_id= ' .$ user_id .'"
1097
- title=" ' .addslashes (api_htmlentities (get_lang ('Unsubscribe ' ))).' " > ' .
1098
- get_lang ('Unsubscribe ' ).'</a> ' ;
1099
- }
1082
+ // Unsubscribe
1083
+ if ($ canEditUsers && ($ user_id != $ current_user_id || api_is_platform_admin ())) {
1084
+ $ result .= Display::url (
1085
+ Display::getMdiIcon (ActionIcon::EXIT , 'ch-tool-icon text-xl delete-swal ' , null , ICON_SIZE_MEDIUM , get_lang ('Unsubscribe ' )),
1086
+ api_get_self ().'? ' .api_get_cidreq ().'&type= ' .$ type .'&unregister=yes&user_id= ' .$ user_id
1087
+ );
1100
1088
}
1101
1089
} else {
1102
- // Show buttons for unsubscribe
1103
- if (1 == $ course_info ['unsubscribe ' ]) {
1104
- if ($ user_id == $ current_user_id ) {
1105
- $ result .= '<a
1106
- class="btn btn-sm btn--danger delete-swal"
1107
- href=" ' .api_get_self ().'? ' .api_get_cidreq ().'&type= ' .$ type .'&unregister=yes&user_id= ' .$ user_id .'"
1108
- title=" ' .addslashes (api_htmlentities (get_lang ('Unsubscribe ' ))).' > ' .
1109
- get_lang ('Unsubscribe ' ).'</a> ' ;
1110
- }
1090
+ if (1 == $ course_info ['unsubscribe ' ] && $ user_id == $ current_user_id ) {
1091
+ $ result .= Display::url (
1092
+ Display::getMdiIcon (ActionIcon::EXIT , 'ch-tool-icon text-xl delete-swal ' , null , ICON_SIZE_MEDIUM , get_lang ('Unsubscribe ' )),
1093
+ api_get_self ().'? ' .api_get_cidreq ().'&type= ' .$ type .'&unregister=yes&user_id= ' .$ user_id
1094
+ );
1111
1095
}
1112
1096
}
1113
1097
1098
+ $ result .= '</div> ' ;
1099
+
1114
1100
return $ result ;
1115
1101
}
0 commit comments