Browse Source

add tpl user information

Alex Aragón 5 years ago
parent
commit
96207a964f

+ 19 - 0
app/Resources/public/css/base.css

@@ -10027,6 +10027,10 @@ ul.dropdown-menu.inner > li > a {
     background-color: #fb5f0442 !important;
     color: #FF5722;
 }
+.details{
+    margin-top: 2rem;
+    padding: 1rem;
+}
 .details .user .avatar,
 .details .user .name,
 .details .user .access
@@ -10043,6 +10047,9 @@ ul.dropdown-menu.inner > li > a {
     margin-top: 1rem;
     padding-top: 1rem;
 }
+.details .user .parameters .create{
+    text-align: center;
+}
 .details .easypiechart-legend{
     text-align: center;
 }
@@ -10050,6 +10057,18 @@ ul.dropdown-menu.inner > li > a {
     padding-bottom: 10px;
     margin-bottom: 10px;
 }
+.details .list-card{
+    display: grid;
+    grid-gap: 1rem;
+    grid-row-gap: 16px;
+    grid-template-columns: repeat(3, 1fr);
+}
+.details .list-box-widget{
+    display: grid;
+    grid-gap: 1rem;
+    grid-row-gap: 16px;
+    grid-template-columns: repeat(2, 1fr);
+}
 @media (min-width: 768px) {
     .clear-rows-6-4-3 .col-sm-6:nth-child(2n+1) {
         clear: left;

+ 55 - 36
main/admin/user_information.php

@@ -27,7 +27,7 @@ $user = api_get_user_info($userId, true);
 if (empty($user)) {
     api_not_allowed(true);
 }
-
+$tpl = new Template(null,false,false,false,false,false,false);
 /** @var User $userEntity */
 $userEntity = api_get_user_entity($user['user_id']);
 $myUserId = api_get_user_id();
@@ -128,7 +128,7 @@ if (api_is_platform_admin()) {
         );
     }
 }
-
+$userInfo = null;
 $studentBossList = UserManager::getStudentBossList($userId);
 $studentBossListToString = '';
 if (!empty($studentBossList)) {
@@ -161,11 +161,21 @@ $data = [
     get_lang('Status') => $user['status'] == 1 ? get_lang('Teacher') : get_lang('Student'),
 ];
 
+$userInfo = [
+    'complete_name' => $user['complete_name'],
+    'email' => $user['email'],
+    'phone' => $user['phone'],
+    'official_code' => $user['official_code'],
+    'user_is_online' => !empty($user['user_is_online']) ? Display::return_icon('online.png') : Display::return_icon('offline.png'),
+    'status' => $user['status'] == 1 ? get_lang('Teacher') : get_lang('Student'),
+    'avatar' => $user['avatar']
+];
+
 // Show info about who created this user and when
 $creatorId = $user['creator_id'];
 $creatorInfo = api_get_user_info($creatorId);
 if (!empty($creatorId) && !empty($creatorInfo)) {
-    $data[null] = sprintf(
+    $userInfo['created'] = sprintf(
         get_lang('CreatedByXYOnZ'),
         'user_information.php?user_id='.$creatorId,
         $creatorInfo['username'],
@@ -173,6 +183,8 @@ if (!empty($creatorId) && !empty($creatorInfo)) {
     );
 }
 
+
+
 $row = 1;
 foreach ($data as $label => $item) {
     if (!empty($label)) {
@@ -182,7 +194,7 @@ foreach ($data as $label => $item) {
     $csvContent[] = [$label, strip_tags($item)];
     $row++;
 }
-$userInformation = $table->toHtml();
+//$userInformation = $table->toHtml();
 
 $table = new HTML_Table(['class' => 'data_table']);
 $table->setHeaderContents(0, 0, get_lang('Tracking'));
@@ -191,6 +203,9 @@ $data = [
     get_lang('FirstLogin') => Tracking::get_first_connection_date($userId),
     get_lang('LatestLogin') => Tracking::get_last_connection_date($userId, true),
 ];
+$userInfo['first_connection'] = Tracking::get_first_connection_date($userId);
+$userInfo['last_connection'] = Tracking::get_last_connection_date($userId, true);
+
 
 if (api_get_setting('allow_terms_conditions') === 'true') {
     $extraFieldValue = new ExtraFieldValue('user');
@@ -201,21 +216,29 @@ if (api_get_setting('allow_terms_conditions') === 'true') {
     $icon = Display::return_icon('accept_na.png');
     if (!empty($value['value'])) {
         list($legalId, $legalLanguageId, $legalTime) = explode(':', $value['value']);
-        $icon = Display::return_icon('accept.png').' '.api_get_local_time($legalTime);
-        $icon .= ' '.Display::url(
+        $icon = Display::return_icon('accept.png');
+        $timeLegalAccept = api_get_local_time($legalTime);
+        $btn = Display::url(
             get_lang('DeleteLegal'),
             api_get_self().'?action=delete_legal&user_id='.$userId,
-            ['class' => 'btn btn-danger btn-xs']
+            ['class' => 'btn btn-danger']
         );
     } else {
-        $icon .= ' '.Display::url(
+        $btn = Display::url(
             get_lang('SendLegal'),
             api_get_self().'?action=send_legal&user_id='.$userId,
-            ['class' => 'btn btn-primary btn-xs']
+            ['class' => 'btn btn-primary']
         );
+        $timeLegalAccept = get_lang('NotRegistered');
     }
 
     $data[get_lang('LegalAccepted')] = $icon;
+
+    $userInfo['legal'] = [
+        'icon' => $icon,
+        'datetime' => $timeLegalAccept,
+        'url_send' => $btn,
+    ];
 }
 $row = 1;
 foreach ($data as $label => $item) {
@@ -226,8 +249,8 @@ foreach ($data as $label => $item) {
     $csvContent[] = [$label, strip_tags($item)];
     $row++;
 }
-$trackingInformation = $table->toHtml();
-$socialInformation = '';
+
+
 
 /**
  * Show social activity.
@@ -249,13 +272,20 @@ if (api_get_setting('allow_social_tool') === 'true') {
     $friends = SocialManager::getCountFriends($user['user_id']);
     $data[] = [get_lang('Friends'), $friends];
 
-    $count = SocialManager::getCountInvitationSent($user['user_id']);
-    $data[] = [get_lang('InvitationSent'), $count];
+    $countSent = SocialManager::getCountInvitationSent($user['user_id']);
+    $data[] = [get_lang('InvitationSent'), $countSent];
 
-    $count = SocialManager::get_message_number_invitation_by_user_id($user['user_id']);
-    $data[] = [get_lang('InvitationReceived'), $count];
+    $countReceived = SocialManager::get_message_number_invitation_by_user_id($user['user_id']);
+    $data[] = [get_lang('InvitationReceived'), $countReceived];
 
-    $socialInformation = Display::return_sortable_table('', $data);
+    $userInfo['social'] = [
+        'friends' => $friends,
+        'invitation_sent' => $countSent,
+        'invitation_received' => $countReceived,
+        'messages_posted' => $wallMessagesPosted,
+        'message_sent' => $messagesSent,
+        'message_received' => $messagesReceived
+    ];
 }
 
 /**
@@ -585,7 +615,7 @@ if (isset($_GET['action'])) {
 Display::display_header($tool_name);
 
 echo Display::toolbarAction('toolbar-user-information', [implode(PHP_EOL, $actions)]);
-echo Display::page_header($tool_name);
+
 
 $fullUrlBig = UserManager::getUserPicture(
     $userId,
@@ -597,21 +627,6 @@ $fullUrl = UserManager::getUserPicture(
     USER_IMAGE_SIZE_ORIGINAL
 );
 
-echo '<div class="row">';
-
-echo '<div class="col-md-2">';
-echo '<a class="thumbnail expand-image" href="'.$fullUrlBig.'">'
-    .'<img src="'.$fullUrl.'" /></a><br />';
-echo '</div>';
-
-echo '<div class="col-md-5">';
-echo $userInformation;
-echo '</div>';
-
-echo '<div class="col-md-5">';
-echo $trackingInformation;
-echo '</div>';
-echo '</div>';
 
 if ($studentBossList) {
     echo Display::page_subheader(get_lang('StudentBossList'));
@@ -676,11 +691,13 @@ if ($user['status'] == DRH) {
         echo '</div>';
     }
 }
+$socialTool = api_get_setting('allow_social_tool');
+$tpl->assign('social_tool', $socialTool);
 
-if (api_get_setting('allow_social_tool') === 'true') {
-    echo Display::page_subheader(get_lang('SocialData'));
-    echo $socialInformation;
-}
+$tpl->assign('user', $userInfo);
+$layoutTemplate = $tpl->get_template('admin/user_information.tpl');
+$content = $tpl->fetch($layoutTemplate);
+echo $content;
 
 echo Display::page_subheader(get_lang('SessionList'));
 echo $sessionInformation;
@@ -695,4 +712,6 @@ echo Tracking::displayUserSkills(
     0
 );
 
+
+
 Display::display_footer();

+ 176 - 0
main/template/default/admin/user_information.tpl

@@ -0,0 +1,176 @@
+<div class="details">
+    <div class="row">
+        <div class="col-md-4">
+            <div class="panel panel-default">
+                <div class="panel-body">
+                    <div class="user">
+                        <div class="avatar">
+                            <img width="128px" src="{{ user.avatar }}" class="img-responsive" >
+                        </div>
+                        <div class="name">
+                            <h3>{{ user.complete_name }}</h3>
+                            <p class="email">{{ user.email }}</p>
+                        </div>
+                        <div class="parameters">
+                            <dl class="dl-horizontal">
+                                <dt>{{ 'Tel'|get_lang }}</dt>
+                                <dd>{{ user.phone == '' ? 'NoTel'|get_lang : user.phone }}</dd>
+                                <dt>{{ 'OfficialCode'|get_lang }}</dt>
+                                <dd>{{ user.official_code == '' ? 'NoOfficialCode'|get_lang : user.official_code }}</dd>
+                                <dt>{{ 'OnLine'|get_lang }}</dt>
+                                <dd>{{ user.user_is_online }}</dd>
+                                <dt>{{ 'Status'|get_lang }}</dt>
+                                <dd>{{ user.status }}</dd>
+                            </dl>
+                            <div class="create">{{ user.created }}</div>
+                        </div>
+                    </div>
+                </div>
+            </div>
+        </div>
+        <div class="col-md-8">
+            <div class="list-card">
+
+                <div class="card card-first-date">
+                    <div class="card-body">
+                        <div class="stat-widget-five">
+                            <div class="stat-icon">
+                                <i class="fa fa-calendar" aria-hidden="true"></i>
+                            </div>
+                            <div class="stat-content">
+                                <div class="text-left">
+                                    <div class="stat-text">
+                                        {{ user.first_connection }}
+                                    </div>
+                                    <div class="stat-heading">
+                                        {{ 'FirstLoginInPlatform'|get_lang }}
+                                    </div>
+                                </div>
+                            </div>
+                        </div>
+                    </div>
+                </div>
+
+                <div class="card card-last-date">
+                    <div class="card-body">
+                        <div class="stat-widget-five">
+                            <div class="stat-icon">
+                                <i class="fa fa-calendar" aria-hidden="true"></i>
+                            </div>
+                            <div class="stat-content">
+                                <div class="text-left">
+                                    <div class="stat-text">
+                                        {{ user.last_connection }}
+                                    </div>
+                                    <div class="stat-heading">
+                                        {{ 'LatestLoginInPlatform'|get_lang }}
+                                    </div>
+                                </div>
+                            </div>
+                        </div>
+                    </div>
+                </div>
+
+                <div class="card card-legal">
+                    <div class="card-body">
+                        <div class="stat-widget-five">
+                            <div class="stat-icon">
+                                <i class="fa fa-gavel" aria-hidden="true"></i>
+                                <span class="active-icon">{{ user.legal.icon }}</span>
+                            </div>
+                            <div class="stat-content">
+                                <div class="text-left">
+                                    <div class="stat-text">
+                                        {{ user.legal.datetime }}
+                                    </div>
+                                    <div class="stat-heading">
+                                        {{ 'LegalAccepted'|get_lang }}
+                                    </div>
+                                </div>
+                            </div>
+                        </div>
+                    </div>
+                </div>
+
+            </div>
+            {% if social_tool %}
+            <div class="list-box-widget">
+
+                <div class="card box-widget">
+                    <div class="card-body">
+                        <div class="stat-widget-five">
+                            <i class="fa fa-users" aria-hidden="true"></i>
+                            {{ user.social.friends }}
+                            <div class="box-name">
+                                {{ 'Friends'|get_lang }}
+                            </div>
+                        </div>
+                    </div>
+                </div>
+
+                <div class="card box-widget">
+                    <div class="card-body">
+                        <div class="stat-widget-five">
+                            <i class="fa fa-paper-plane" aria-hidden="true"></i>
+                            {{ user.social.invitation_sent }}
+                            <div class="box-name">
+                                {{ 'InvitationSent'|get_lang }}
+                            </div>
+                        </div>
+                    </div>
+                </div>
+
+                <div class="card box-widget">
+                    <div class="card-body">
+                        <div class="stat-widget-five">
+                            <i class="fa fa-smile-o" aria-hidden="true"></i>
+                            {{ user.social.invitation_received }}
+                            <div class="box-name">
+                                {{ 'InvitationReceived'|get_lang }}
+                            </div>
+                        </div>
+                    </div>
+                </div>
+
+                <div class="card box-widget">
+                    <div class="card-body">
+                        <div class="stat-widget-five">
+                            <i class="fa fa-comments" aria-hidden="true"></i>
+                            {{ user.social.messages_posted }}
+                            <div class="box-name">
+                                {{ 'WallMessagesPosted'|get_lang }}
+                            </div>
+                        </div>
+                    </div>
+                </div>
+
+                <div class="card box-widget">
+                    <div class="card-body">
+                        <div class="stat-widget-five">
+                            <i class="fa fa-envelope" aria-hidden="true"></i>
+                            {{ user.social.messages_posted }}
+                            <div class="box-name">
+                                {{ 'MessagesSent'|get_lang }}
+                            </div>
+                        </div>
+                    </div>
+                </div>
+
+                <div class="card box-widget">
+                    <div class="card-body">
+                        <div class="stat-widget-five">
+                            <i class="fa fa-envelope-open-o" aria-hidden="true"></i>
+                            {{ user.social.message_received }}
+                            <div class="box-name">
+                                {{ 'MessagesReceived'|get_lang }}
+                            </div>
+                        </div>
+                    </div>
+                </div>
+
+            </div>
+            {% endif %}
+
+        </div>
+    </div>
+</div>