Browse Source

Minor - format code, clean code

Julio Montoya 6 years ago
parent
commit
c6a2618ca2

+ 1 - 1
main/forum/viewforumcategory.php

@@ -129,7 +129,7 @@ $logInfo = [
     'tool_id' => 0,
     'tool_id_detail' => 0,
     'action' => $action,
-    'info' => $_GET['content'],
+    'info' => isset($_GET['content']) ? $_GET['content'] : '',
 ];
 Event::registerLog($logInfo);
 

+ 21 - 18
src/FaqBundle/Resources/views/Faq/index.html.twig

@@ -1,29 +1,32 @@
 {% extends '@ChamiloTheme/Layout/layout_cms.html.twig' %}
 
 {% block sonata_page_container %}
- <script type="text/javascript">
-        function backToTopGo () {
-          window.scroll(0, 0);
-          backToTopScroll();
-        }
-        $(document).on('ready', function(){
-            var positionCurrent, positionNew = 0;
-            $(window).scroll(function(){
+<script>
+    function backToTopGo() {
+        window.scroll(0, 0);
+        backToTopScroll();
+    }
+
+    $(document).on('ready', function () {
+        var positionCurrent, positionNew = 0;
+        $(window).scroll(function () {
             positionNew = $(this).scrollTop();
-            if(positionNew>positionCurrent){
+            if (positionNew > positionCurrent) {
                 $('#barra').show('slow');
-            } else if(positionNew<positionCurrent){
+            } else if (positionNew < positionCurrent) {
                 $('#barra').hide('slow');
             }
-            positionCurrent=positionNew;
-            });
+            positionCurrent = positionNew;
         });
-    </script>
-    <a id="barra" class="btn btn-primary back_to_top_wrap" onclick="backToTopGo()">
-        <div class="back_to_top">
-            <i class="fa fa-arrow-up" aria-hidden="true"></i> Go up
-        </div>
-    </a>
+    });
+</script>
+
+<a id="barra" class="btn btn-primary back_to_top_wrap" onclick="backToTopGo()">
+    <div class="back_to_top">
+        <i class="fa fa-arrow-up" aria-hidden="true"></i> Go up
+    </div>
+</a>
+
 <div class="page-faq">
     <h1 class="title">FAQ</h1>
     <div class="list-faq">

+ 6 - 11
src/ThemeBundle/Resources/views/Layout/base-layout.html.twig

@@ -34,13 +34,11 @@
 <!-- END HEADER -->
 
 <div class="app-body">
-
     <!-- SIDEBAR -->
     {% block page_sidebar %}
         {% include '@ChamiloTheme/Layout/sidebar.html.twig' %}
     {% endblock %}
     <!-- END SIDEBAR -->
-
     <main id="app-main" class="main">
         <!-- BREADCRUMB -->
         {% block chamilo_breadcrumb %}
@@ -53,7 +51,6 @@
         {% endblock %}
         <!-- END CONTENT -->
     </main>
-
 </div>
 {% endblock %}
 <!-- END PAGE -->
@@ -68,7 +65,9 @@
     <div class="modal-dialog modal-lg">
         <div class="modal-content">
             <div class="modal-header">
-                <button type="button" class="close" data-dismiss="modal" aria-label="{{ "Close" | trans }}"><span aria-hidden="true">&times;</span></button>
+                <button type="button" class="close" data-dismiss="modal" aria-label="{{ "Close" | trans }}">
+                    <span aria-hidden="true">&times;</span>
+                </button>
                 <h4 class="modal-title" id="expand-image-modal-title">&nbsp;</h4>
             </div>
             <div class="modal-body">
@@ -94,16 +93,15 @@
         </div>
     </div>
 </div>
-<script type="text/javascript">
+<script>
     // MODAL DELETE CONFIRM
-
     $('.delete-swal').click(function (e) {
         e.preventDefault(); // Prevent the href from redirecting directly
         var linkURL = $(this).attr("href");
         var title = $(this).attr("title");
         deleteConfirm(linkURL, title);
-    })
-    function deleteConfirm(linkURL, title){
+    });
+    function deleteConfirm(linkURL, title) {
         swal({
             //title: '{{ 'Warning'|trans }}',
             text: title,
@@ -116,9 +114,6 @@
             }
         });
     }
-
-
-
 </script>
 </body>
 </html>

+ 63 - 64
src/ThemeBundle/Resources/views/Layout/header.html.twig

@@ -1,70 +1,70 @@
 {% autoescape false %}
-<script type="text/javascript">
-    $(function () {
-        /**
-         * Notifications Systems
-         */
+<script>
+$(function () {
+    /**
+     * Notifications Systems
+     */
+    $.get(
+        '{{ url('legacy_main', { name : 'inc/ajax/message.ajax.php'}) }}',
+        {'a': 'get_count_message'},
+        function (data) {
+            var countFriends = data.ms_friends;
+            var countInbox = data.ms_inbox
+            if (countFriends != 0) {
+                $("#notifications-social").removeClass('d-none');
+                $("#notifications-social").append(countFriends);
+            }
+            if (countInbox != 0) {
+                $("#notifications-inbox").removeClass('d-none');
+                $("#notifications-inbox").append(countInbox);
+            }
+        }
+    );
+
+    $('#list_notifications_friends').on('click', e => {
+        const $listFriends = $('#list_friends .content');
+        let $html;
         $.get(
             '{{ url('legacy_main', { name : 'inc/ajax/message.ajax.php'}) }}',
-            {'a': 'get_count_message'},
+            {'a': 'get_notifications_friends'},
             function (data) {
-                var countFriends = data.ms_friends;
-                var countInbox = data.ms_inbox
-                if (countFriends != 0) {
-                    $("#notifications-social").removeClass('d-none');
-                    $("#notifications-social").append(countFriends);
-                }
-                if (countInbox != 0) {
-                    $("#notifications-inbox").removeClass('d-none');
-                    $("#notifications-inbox").append(countInbox);
+                $listFriends.empty();
+                for (let i in data) {
+                    $html = '<a class="dropdown-item preview-item">';
+                    $html += '<div class="preview-thumbnail"><img class="rounded-circle" src="' + data[i].avatar + '"/></div>';
+                    $html += '<div class="preview-item-content flex-grow">';
+                    $html += '<h6 class="preview-subject">' + data[i].fullname + '<span class="date-ago float-right">' + data[i].date + '</span></h6>';
+                    $html += '<p class="preview-text">' + data[i].content + '</p>';
+                    $html += '</div></a>';
+                    $listFriends.append($html);
                 }
             }
         );
+    });
 
-        $('#list_notifications_friends').on('click', e => {
-            const $listFriends = $('#list_friends .content');
-            let $html;
-            $.get(
-                '{{ url('legacy_main', { name : 'inc/ajax/message.ajax.php'}) }}',
-                {'a': 'get_notifications_friends'},
-                function (data) {
-                    $listFriends.empty();
-                    for (let i in data) {
-                        $html = '<a class="dropdown-item preview-item">';
-                        $html += '<div class="preview-thumbnail"><img class="rounded-circle" src="' + data[i].avatar + '"/></div>';
-                        $html += '<div class="preview-item-content flex-grow">';
-                        $html += '<h6 class="preview-subject">' + data[i].fullname + '<span class="date-ago float-right">' + data[i].date + '</span></h6>';
-                        $html += '<p class="preview-text">' + data[i].content + '</p>';
-                        $html += '</div></a>';
-                        $listFriends.append($html);
-                    }
-                }
-            );
-        });
-
-        $('#list_notifications_inbox').on('click', e => {
-            const $listInbox = $('#list_inbox .content');
-            let $html;
-            $.get(
-                '{{ url('legacy_main', { name : 'inc/ajax/message.ajax.php'}) }}',
-                {'a': 'get_notifications_inbox'},
-                function (data) {
-                    $listInbox.empty();
-                    for (let i in data) {
-                        $html = '<a class="dropdown-item preview-item" href="' + data[i].url + '">';
-                        $html += '<div class="preview-thumbnail"><div class="preview-icon bg-info">';
-                        $html += '<i class="far fa-envelope"></i>';
-                        $html += '</div></div>';
-                        $html += '<div class="preview-item-content flex-grow">';
-                        $html += '<h6 class="preview-subject">' + data[i].fullname + '<span class="date-ago float-right">' + data[i].date + '</span></h6>';
-                        $html += '<p class="preview-text">' + data[i].title + '</p>';
-                        $html += '</div></a>';
-                        $listInbox.append($html);
-                    }
+    $('#list_notifications_inbox').on('click', e => {
+        const $listInbox = $('#list_inbox .content');
+        let $html;
+        $.get(
+            '{{ url('legacy_main', { name : 'inc/ajax/message.ajax.php'}) }}',
+            {'a': 'get_notifications_inbox'},
+            function (data) {
+                $listInbox.empty();
+                for (let i in data) {
+                    $html = '<a class="dropdown-item preview-item" href="' + data[i].url + '">';
+                    $html += '<div class="preview-thumbnail"><div class="preview-icon bg-info">';
+                    $html += '<i class="far fa-envelope"></i>';
+                    $html += '</div></div>';
+                    $html += '<div class="preview-item-content flex-grow">';
+                    $html += '<h6 class="preview-subject">' + data[i].fullname + '<span class="date-ago float-right">' + data[i].date + '</span></h6>';
+                    $html += '<p class="preview-text">' + data[i].title + '</p>';
+                    $html += '</div></a>';
+                    $listInbox.append($html);
                 }
-            );
-        });
+            }
+        );
     });
+});
 </script>
 <header class="app-header navbar">
     <button class="navbar-toggler sidebar-toggler d-lg-none mr-auto" type="button" data-toggle="sidebar-show">
@@ -74,8 +74,12 @@
         <span class="navbar-toggler-icon"></span>
     </button>
     <a class="navbar-brand" href="{{ url('legacy_index') }}">
-        <img class="navbar-brand-full" width="130" src="{{ url('legacy_public') ~ 'build/css/themes/'~ theme ~'/images/logo_chamilo.svg' }}" alt="Chamilo"/>
-        <img class="navbar-brand-minimized" width="35" src="{{ url('legacy_public') ~ 'build/css/themes/'~ theme ~'/images/avatar.svg' }}"  alt="Chamilo">
+        <img class="navbar-brand-full" width="130"
+             src="{{ url('legacy_public') ~ 'build/css/themes/'~ theme ~'/images/logo_chamilo.svg' }}"
+             alt="Chamilo"/>
+        <img class="navbar-brand-minimized" width="35"
+             src="{{ url('legacy_public') ~ 'build/css/themes/'~ theme ~'/images/avatar.svg' }}"
+             alt="Chamilo">
     </a>
 
     <ul class="nav navbar-nav d-md-down-none">
@@ -139,9 +143,7 @@
             </ul>
         </li>
         <li class="nav-item dropdown">
-
             {% set avatar %}
-
                 {% if app.user.pictureUri is empty %}
                     <img
                         class="img-avatar"
@@ -192,7 +194,6 @@
                     <i class="fa fa-sign-out-alt"></i>
                     {{ "Logout"|trans }}
                 </a>
-
             </div>
         </li>
     {% else %}
@@ -209,9 +210,7 @@
                 {{ "Sign in"|trans }}
             </a>
         </li>
-
     {% endif %}
     </ul>
-
 </header>
 {% endautoescape %}

+ 0 - 3
src/ThemeBundle/Resources/views/Layout/sidebar.html.twig

@@ -1,11 +1,8 @@
 {% autoescape false %}
 <div class="sidebar">
     <nav class="sidebar-nav">
-
         {% set menu = knp_menu_get('menuApp') %}
         {{ knp_menu_render(menu, {'ancestorClass': 'current_open open', 'template': '@ChamiloTheme/Menu/left_menu.html.twig'}) }}
-
-
         <ul class="navbar-nav">
             <li class="nav-item">
                 <a class='nav-link' href="https://docs.chamilo.org/">

+ 0 - 7
src/ThemeBundle/Resources/views/Layout/welcome_to_course.html.twig

@@ -1,13 +1,6 @@
 {% autoescape false %}
-
     <h1>{{ "Welcome to your website Chamilo" | trans }}</h1>
-
     {{ "HelloXAsYouCanSeeYourCourseListIsEmpty" | trans | format(app.user.completeName) }}
-
-    <div class="">
-
-    </div>
-
     {#{% if count_courses == 0 %}
         {{ "PleaseAllowUsALittleTimeToSubscribeYouToOneOfOurCourses"|trans }}
     {% else %}