Browse Source

Merge branch 'ofaj_dev' of https://github.com/chamilo/chamilo-lms into ofaj_dev

Nicolas Ducoulombier 6 years ago
parent
commit
c19479a87d

+ 5 - 3
main/inc/lib/certificate.lib.php

@@ -218,12 +218,13 @@ class Certificate extends Model
         }
 
         $params['hide_print_button'] = isset($params['hide_print_button']) ? true : false;
-
+        $categoryId = 0;
         if (isset($this->certificate_data) && isset($this->certificate_data['cat_id'])) {
-            $my_category = Category::load($this->certificate_data['cat_id']);
+            $categoryId = $this->certificate_data['cat_id'];
+            $my_category = Category::load($categoryId);
         }
 
-        if (isset($my_category[0]) &&
+        if (isset($my_category[0]) && !empty($categoryId) &&
             $my_category[0]->is_certificate_available($this->user_id)
         ) {
             $courseInfo = api_get_course_info($my_category[0]->get_course_code());
@@ -795,6 +796,7 @@ class Certificate extends Model
         $tplContent->assign('sessions', $sessionsApproved);
         $tplContent->assign('courses', $coursesApproved);
         $tplContent->assign('time_spent_in_lps', api_time_to_hms($totalTimeInLearningPaths));
+        $tplContent->assign('time_spent_in_lps_in_hours', round($totalTimeInLearningPaths / 3600, 1));
         $layoutContent = $tplContent->get_template('gradebook/custom_certificate.tpl');
         $content = $tplContent->fetch($layoutContent);
 

+ 126 - 0
main/mySpace/myStudents.php

@@ -665,6 +665,8 @@ $userGroups = $userGroupManager->getNameListByUser(
                 <tr>
                     <td><?php echo get_lang('OnLine'); ?></td>
                     <td><?php echo $online; ?></td>
+
+
                 </tr>
                 <?php
                 if (!empty($course_code)) {
@@ -690,6 +692,118 @@ $userGroups = $userGroupManager->getNameListByUser(
                     </tr>
                     <?php
                 }
+
+                // Ofaj
+                $bossList = Usermanager::getStudentBossList($student_id);
+                echo '<tr><td>';
+                echo get_lang('StudentBoss').' : ';
+                foreach ($bossList as $boss) {
+                    $bossInfo = api_get_user_info($boss['boss_id']);
+                    if ($bossInfo) {
+                        echo $bossInfo['complete_name_with_username'].'<br />';
+                    }
+                }
+                echo '</td></tr>';
+
+                echo '<tr><td>';
+                echo get_lang('Language').' : ';
+                $languageId = api_get_language_id($user_info['language']);
+                if ($languageId) {
+                    $languageInfo = api_get_language_info($languageId);
+                    echo $languageInfo['original_name'];
+                }
+                echo '</td></tr>';
+
+                $startDate = UserManager::get_extra_user_data_by_field(
+                    $user_info['user_id'],
+                    'datedebutstage'
+                );
+
+                $endDate = UserManager::get_extra_user_data_by_field(
+                    $user_info['user_id'],
+                    'datefinstage'
+                );
+
+                $extraField = new ExtraField('user');
+                $extraFieldInfoStart = $extraField->get_handler_field_info_by_field_variable(
+                    'datedebutstage'
+                );
+
+                $extraFieldInfoEnd = $extraField->get_handler_field_info_by_field_variable(
+                    'datefinstage'
+                );
+
+                echo '<tr><td>';
+                echo $extraFieldInfoStart['display_text'].' : ';
+                if (isset($startDate['datedebutstage'])) {
+                    echo $startDate['datedebutstage'];
+                }
+                echo '</td></tr>';
+
+                echo '<tr><td>';
+                echo $extraFieldInfoEnd['display_text'].' : ';
+                if (isset($endDate['datefinstage'])) {
+                    echo $endDate['datefinstage'];
+                }
+                echo '</td></tr>';
+
+                /** @var ExtraFieldSavedSearch $saved */
+                $search = [
+                    'user' => $student_id,
+                ];
+
+                $items = $em->getRepository('ChamiloCoreBundle:ExtraFieldSavedSearch')->findBy($search);
+                $listVariables = [
+                    'ecouter',
+                    'lire',
+                    'ecrire',
+                    's_exprimer_oralement_en_continu',
+                    'participer_a_une_conversation',
+                ];
+
+                $extraField = new ExtraField('session');
+
+                if ($items) {
+                    /** @var ExtraFieldSavedSearch $item */
+                    foreach ($items as $item) {
+                        $variable = $item->getField()->getVariable();
+                        if (in_array($variable, $listVariables)) {
+                            $extraFieldInfo = $extraField->get_handler_field_info_by_field_variable($variable);
+                            if ($extraFieldInfo) {
+                                echo '<tr><td>';
+                                $options = $extraFieldInfo['options'];
+                                $optionValues = array_column($options, 'display_text', 'option_value');
+                                //var_dump($optionValues);
+                                echo $extraFieldInfo['display_text'].' : ';
+                                $answers = $item->getValue();
+                                $list = [];
+                                if (is_array($answers)) {
+                                    foreach ($answers as $answer) {
+                                        $list[] = $optionValues[$answer];
+                                    }
+                                } else {
+                                    foreach ($options as $option) {
+                                        $answers = trim($answers, '.');
+                                        $answers = str_replace('-', '_', $answers);
+
+                                        if ($option['option_value'] != api_underscore_to_camel_case($answers)) {
+                                            continue;
+                                        }
+
+                                        $list[] = $option['display_text'];
+                                    }
+                                }
+                                echo '<ul><li>';
+                                echo implode('</li><li>', $list);
+                                echo '</li></ul>';
+
+                                echo '</td></tr>';
+                            }
+                        }
+                    }
+                }
+
+
                 // Display timezone if the user selected one and if the admin allows the use of user's timezone
                 $timezone = null;
                 $timezone_user = UserManager::get_extra_user_data_by_field(
@@ -800,6 +914,18 @@ $userGroups = $userGroupManager->getNameListByUser(
                         echo '</td></tr>';
                     }
                 }
+
+                $icon = ' '.Display::url(
+                        get_lang('Generate'),
+                        api_get_self().'?action=generate_certificate&student='.$student_id.'&cidReq='.$course_code.'&course='.$course_code,
+                        ['class' => 'btn btn-primary btn-xs']
+                    );
+
+                echo '<tr>
+            <td align="right">';
+                echo get_lang('Certificate').' </td>  <td align="left">'.$icon;
+                echo '</td></tr>';
+
                 ?>
                 </tbody>
             </table>

+ 1 - 0
main/template/rainbow/gradebook/custom_certificate.tpl

@@ -54,6 +54,7 @@
                                         {% endif %}
                                     </p>
                                     <br />
+                                    {#<p style="font-size: 16px;">{{ 'ThisTrainingHasXHours' | get_lang | format(time_in_platform_in_hours)}}</p><br />#}
                                     <p style="font-size: 16px;">
                                         {{ 'TimeSpentInLearningPaths' | get_lang | format (time_spent_in_lps_in_hours) }}
                                     </p>

+ 52 - 0
main/template/rainbow/skill/student_report.tpl

@@ -0,0 +1,52 @@
+<!--
+{% if allow_skill_tool %}
+    <div class="btn-group">
+        <a class="btn btn-default" href="{{ _p.web_main }}social/skills_wheel.php">
+            {{ 'SkillsWheel' | get_lang }}
+        </a>
+    </div>
+{% endif %}
+-->
+<style>
+
+
+</style>
+<h1 class="page-header">{{ 'MyBadges' | get_lang }}</h1>
+<p>
+    {{ 'MySkillsReportIntroduction' | get_lang }}
+</p>
+{% if rows %}
+    <div class="communications">
+        {% if skill_table %}
+            {{ skill_table }}
+        {% endif %}
+    </div>
+    <h6 class="table-header">{{ 'SkillsHistory' | get_lang }}</h6>
+    <table class="table">
+        <thead>
+        <tr>
+            <th>{{ 'Badge' | get_lang }}</th>
+            <th>{{ 'Skill' | get_lang }}</th>
+            <th>{{ 'Date' | get_lang }}</th>
+            <th>{{ 'Course' | get_lang }}</th>
+        </tr>
+        </thead>
+        <tbody>
+        {% for row in rows %}
+            <tr>
+                <td>{{ row.skill_badge }}</td>
+                <td>{{ row.skill_name }}</td>
+                <td>{{ row.achieved_at }}</td>
+                {% if row.course_name %}
+                    <td>
+                        <img src="{{ row.course_image }}" alt="{{ row.course_name }}" width="32">
+                        {{ row.course_name }}
+                    </td>
+                {% else %}
+                    <td> - </td>
+                {% endif %}
+            </tr>
+        {% endfor %}
+        </tbody>
+    </table>
+{% endif %}

+ 2 - 2
user_portal.php

@@ -336,9 +336,9 @@ $controller->tpl->assign('user_image_block', $controller->return_user_image_bloc
 //$controller->tpl->assign('course_block', $controller->return_course_block());
 //$controller->tpl->assign('navigation_course_links', $controller->return_navigation_links());
 //$controller->tpl->assign('search_block', $controller->return_search_block());
-//$controller->tpl->assign('notice_block', $controller->return_notice());
+$controller->tpl->assign('notice_block', $controller->return_notice());
 //$controller->tpl->assign('classes_block', $controller->returnClassesBlock());
-//$controller->tpl->assign('skills_block', $controller->returnSkillLinks());
+$controller->tpl->assign('skills_block', $controller->returnSkillLinks());
 
 $historyClass = '';
 if (!empty($_GET['history'])) {