Browse Source

Add email in list, setting "show_email_addresses" must be true #12603

jmontoyaa 8 years ago
parent
commit
fc370bb387
2 changed files with 9 additions and 0 deletions
  1. 3 0
      main/lp/lp_report.php
  2. 6 0
      main/template/default/learnpath/report.tpl

+ 3 - 0
main/lp/lp_report.php

@@ -56,6 +56,7 @@ $lpInfo = Database::select(
 );
 
 $userList = [];
+$showEmail = api_get_setting('show_email_addresses');
 
 if (!empty($users)) {
     foreach ($users as $user) {
@@ -97,6 +98,7 @@ if (!empty($users)) {
             'id' => $user['user_id'],
             'first_name' => $userInfo['firstname'],
             'last_name' => $userInfo['lastname'],
+            'email' => $showEmail === 'true' ? $userInfo['email'] : '',
             'lp_time' => api_time_to_hms($lpTime),
             'lp_score' => is_numeric($lpScore) ? "$lpScore%" : $lpScore,
             'lp_progress' => "$lpProgress%",
@@ -126,6 +128,7 @@ $template->assign('user_list', $userList);
 $template->assign('session_id', api_get_session_id());
 $template->assign('course_code', api_get_course_id());
 $template->assign('lp_id', $lpId);
+$template->assign('show_email', $showEmail === 'true');
 
 $layout = $template->get_template('learnpath/report.tpl');
 

+ 6 - 0
main/template/default/learnpath/report.tpl

@@ -4,6 +4,9 @@
             <tr>
                 <th>{{ 'FirstName'|get_lang }}</th>
                 <th>{{ 'LastName'|get_lang }}</th>
+                {% if show_email %}
+                    <th>{{ 'Email'|get_lang }}</th>
+                {% endif %}
                 <th class="text-center">{{ 'ScormTime'|get_lang }}</th>
                 <th class="text-right">{{ 'Progress'|get_lang }}</th>
                 <th class="text-right">{{ 'ScormScore'|get_lang }}</th>
@@ -16,6 +19,9 @@
                 <tr id="row-{{ user.id }}">
                     <td>{{ user.first_name }}</td>
                     <td>{{ user.last_name }}</td>
+                    {% if show_email %}
+                        <td>{{ user.email }}</td>
+                    {% endif %}
                     <td class="text-center">{{ user.lp_time }}</td>
                     <td class="text-right">{{ user.lp_progress }}</td>
                     <td class="text-right">{{ user.lp_score }}</td>