Эх сурвалжийг харах

add type icon status user - refs BT#15175

Alex Aragón 6 жил өмнө
parent
commit
e64553becf

+ 5 - 0
app/Resources/public/css/themes/rainbow/default.css

@@ -32,6 +32,11 @@ a:focus {
 hr{
     border-top: 1px solid #96bd0d;
 }
+.avatar-icon{
+    text-align: center;
+    padding-bottom: 5px;
+    padding-top: 5px;
+}
 .logo-ofaj{
     padding: 5px;
     margin-bottom: 0;

+ 18 - 0
main/forum/viewthread_flat.inc.php

@@ -134,6 +134,24 @@ if (isset($current_thread['thread_id'])) {
                     display_user_link($posterId, $name),
                     ['class' => 'title-username']
                 );
+                $urlImg = api_get_path(WEB_IMG_PATH);
+                $iconStatus = null;
+                $isAdmin = UserManager::is_admin($userId);
+
+                if($_user['status']==5) {
+                    if($_user['has_certificates']){
+                        $iconStatus = '<img src="'.$urlImg.'icons/svg/ofaj_graduated.svg" width="22px" height="22px">';
+                    }else{
+                        $iconStatus = '<img src="'.$urlImg.'icons/svg/ofaj_student.svg" width="22px" height="22px">';
+                    }
+                }else if($_user['status'] == 1){
+                    if($isAdmin){
+                        $iconStatus = '<img src="'.$urlImg.'icons/svg/ofaj_admin.svg" width="22px" height="22px">';
+                    }else{
+                        $iconStatus = '<img src="'.$urlImg.'icons/svg/ofaj_teacher.svg" width="22px" height="22px">';
+                    }
+                }
+                $html .= '<div class="text-center">'.$iconStatus.'</div>';
             } else {
                 if (api_get_course_setting('allow_user_image_forum')) {
                     $html .= '<div class="thumbnail">'.display_user_image($posterId, $name, $origin).'</div>';

+ 6 - 0
main/inc/lib/api.lib.php

@@ -1580,6 +1580,12 @@ function _api_format_user($user, $add_password = false, $loadAvatars = true)
 
     $result['profile_url'] = api_get_path(WEB_CODE_PATH).'social/profile.php?u='.$user_id;
 
+    $hasCertificates = Certificate::getCertificateByUser($user_id);
+    $result['has_certificates'] = 0;
+    if (!empty($hasCertificates)) {
+        $result['has_certificates'] = 1;
+    }
+
     // Send message link
     $sendMessage = api_get_path(WEB_AJAX_PATH).'user_manager.ajax.php?a=get_user_popup&user_id='.$user_id;
     $result['complete_name_with_message_link'] = Display::url(

+ 22 - 1
main/inc/lib/social.lib.php

@@ -2450,9 +2450,27 @@ class SocialManager extends UserManager
     private static function headerMessagePost($authorInfo, $receiverInfo, $message)
     {
         $currentUserId = api_get_user_id();
-
+        $iconStatus = null;
         $authorId = (int) $authorInfo['user_id'];
         $receiverId = (int) $receiverInfo['user_id'];
+        $userStatus = $authorInfo['status'];
+        $urlImg = api_get_path(WEB_IMG_PATH);
+        $isAdmin = self::is_admin($authorId);
+
+        if($userStatus==5) {
+            if($authorInfo['has_certificates']){
+                $iconStatus = '<img class="pull-left" src="'.$urlImg.'icons/svg/ofaj_graduated.svg" width="22px" height="22px">';
+            }else{
+                $iconStatus = '<img class="pull-left" src="'.$urlImg.'icons/svg/ofaj_student.svg" width="22px" height="22px">';
+            }
+        }else if($userStatus == 1){
+            if($isAdmin){
+                $iconStatus = '<img class="pull-left" src="'.$urlImg.'icons/svg/ofaj_admin.svg" width="22px" height="22px">';
+            }else{
+                $iconStatus = '<img class="pull-left" src="'.$urlImg.'icons/svg/ofaj_teacher.svg" width="22px" height="22px">';
+            }
+        }
+
 
         $date = Display::dateToStringAgoAndLongDate($message['send_date']);
         $avatarAuthor = $authorInfo['avatar'];
@@ -2491,11 +2509,14 @@ class SocialManager extends UserManager
         }
 
         $html .= '<div class="user-image" >';
+
+
         $html .= '<a href="'.$urlAuthor.'">
                     <img class="avatar-thumb" src="'.$avatarAuthor.'" alt="'.$nameCompleteAuthor.'"></a>';
         $html .= '</div>';
 
         $html .= '<div class="user-data">';
+        $html .= $iconStatus;
         $html .= '<div class="username"><a href="'.$urlAuthor.'">'.$nameCompleteAuthor.'</a>'.$htmlReceiver.'</div>';
         $html .= '<div>'.$date.'</div>';
         $html .= '</div>';

+ 15 - 10
main/template/default/social/user_block.tpl

@@ -12,18 +12,23 @@
                 <div class="panel-body">
                     {{ social_avatar_block }}
                     {# Ofaj #}
+
                     {% if user.status == 5 %}
-                        {% if user.has_certificates %}
-                            <img src="{{ _p.web_img }}icons/svg/ofaj_graduated.svg" width="32px" height="32px">
-                        {% else %}
-                            <img src="{{ _p.web_img }}icons/svg/ofaj_student.svg" width="32px" height="32px">
-                        {% endif %}
+                        <div class="avatar-icon">
+                            {% if user.has_certificates %}
+                                <img src="{{ _p.web_img }}icons/svg/ofaj_graduated.svg" width="32px" height="32px">
+                            {% else %}
+                                <img src="{{ _p.web_img }}icons/svg/ofaj_student.svg" width="32px" height="32px">
+                            {% endif %}
+                        </div>
                     {% elseif user.status == 1 %}
-                        {% if user.is_admin %}
-                            <img src="{{ _p.web_img }}icons/svg/ofaj_admin.svg" width="32px" height="32px">
-                        {% else %}
-                            <img src="{{ _p.web_img }}icons/svg/ofaj_teacher.svg" width="32px" height="32px">
-                        {% endif %}
+                        <div class="avatar-icon">
+                            {% if user.is_admin %}
+                                <img src="{{ _p.web_img }}icons/svg/ofaj_admin.svg" width="32px" height="32px">
+                            {% else %}
+                                <img src="{{ _p.web_img }}icons/svg/ofaj_teacher.svg" width="32px" height="32px">
+                            {% endif %}
+                        </div>
                     {% endif %}
                     <ul class="list-user-data">
                         <li class="item">