Browse Source

Minor - format code.

Julio Montoya 10 years ago
parent
commit
9418d8da68

+ 6 - 6
main/gradebook/lib/fe/flatviewtable.class.php

@@ -43,6 +43,7 @@ class FlatViewTable extends SortableTable
         $mainCourseCategory = null
     ) {
         parent :: __construct('flatviewlist', null, null, (api_is_western_name_order() xor api_sort_by_first_name()) ? 1 : 0);
+
         $this->selectcat = $selectcat;
 
         $this->datagen = new FlatViewDataGenerator(
@@ -558,16 +559,15 @@ class FlatViewTable extends SortableTable
 
         $header_names = $this->datagen->get_header_names($this->offset, $selectlimit);
 
-        $column = 0;
-
         if ($is_western_name_order) {
-            $this->set_header($column++, $header_names[1]);
-            $this->set_header($column++, $header_names[0]);
+            $this->set_header(0, $header_names[1]);
+            $this->set_header(1, $header_names[0]);
         } else {
-            $this->set_header($column++, $header_names[0]);
-            $this->set_header($column++, $header_names[1]);
+            $this->set_header(0, $header_names[0]);
+            $this->set_header(1, $header_names[1]);
         }
 
+        $column = 2;
         while ($column < count($header_names)) {
             $this->set_header($column, $header_names[$column], false);
             $column++;

+ 16 - 9
main/gradebook/lib/flatview_data_generator.class.php

@@ -157,9 +157,11 @@ class FlatViewDataGenerator
             $session_id,
             'ORDER BY id'
         );
+
         $evaluationsAdded = array();
         if ($parent_id == 0 && !empty($allcat)) {
             // Means there are any subcategory
+
             foreach ($allcat as $sub_cat) {
                 $sub_cat_weight = round(100 * $sub_cat->get_weight() / $main_weight, 1);
                 $add_weight = " $sub_cat_weight %";
@@ -216,7 +218,8 @@ class FlatViewDataGenerator
                 $max = $score[0];
             }
         }
-        return $max ;
+
+        return $max;
     }
 
     /**
@@ -389,7 +392,12 @@ class FlatViewDataGenerator
 
             $course_code = api_get_course_id();
             $session_id = api_get_session_id();
-            $allcat = $this->category->get_subcategories(null, $course_code, $session_id, 'ORDER BY id');
+            $allcat = $this->category->get_subcategories(
+                null,
+                $course_code,
+                $session_id,
+                'ORDER BY id'
+            );
 
             $evaluationsAdded = array();
 
@@ -400,7 +408,7 @@ class FlatViewDataGenerator
 
                     $real_score = $score;
 
-                    $divide = ( ($score[1])==0 ) ? 1 : $score[1];
+                    $divide = $score[1] == 0 ? 1 : $score[1];
 
                     $sub_cat_percentage = $sum_categories_weight_array[$sub_cat->get_id()];
                     $item_value  = $score[0]/$divide*$main_weight;
@@ -410,10 +418,10 @@ class FlatViewDataGenerator
                     $item_value = $percentage*$item_value;
                     $item_total += $sub_cat->get_weight();
                     /*
-                                        if ($convert_using_the_global_weight) {
-                                            $score[0] = $score[0]/$main_weight*$sub_cat->get_weight();
-                                            $score[1] = $main_weight ;
-                                        }
+                        if ($convert_using_the_global_weight) {
+                            $score[0] = $score[0]/$main_weight*$sub_cat->get_weight();
+                            $score[1] = $main_weight ;
+                        }
                     */
                     if (api_get_setting('gradebook_show_percentage_in_reports') == 'false') {
                         //if (true)
@@ -427,8 +435,7 @@ class FlatViewDataGenerator
                     }
 
                     if (!isset($this->params['only_total_category']) ||
-                        (isset($this->params['only_total_category']) &&
-                            $this->params['only_total_category'] == false)
+                        (isset($this->params['only_total_category']) && $this->params['only_total_category'] == false)
                     ) {
                         if (!$show_all) {
                             $row[] = $temp_score.' ';

+ 67 - 67
main/template/default/layout/footer.tpl

@@ -20,7 +20,7 @@
                         {{ plugin_footer_left }}
                     </div>
                 {% endif %}
-                 &nbsp;
+                &nbsp;
             </div>
 
             <div id="footer_center" class="span4">
@@ -30,7 +30,7 @@
                         {{ plugin_footer_center }}
                     </div>
                 {% endif %}
-                 &nbsp;
+                &nbsp;
             </div>
 
             <div id="footer_right" class="span4">
@@ -62,27 +62,7 @@
 {% raw %}
 <script>
 
-$("form").on("click", ' .advanced_parameters', function() {
-    var id = $(this).attr('id') + '_options';
-    var button = $(this);
-    $("#"+id).toggle(function() {
-        button.toggleClass('active');
-    });
-});
-
-
-/* Makes row highlighting possible */
-$(document).ready( function() {
-    /**
-     * Advanced options
-     * Usage
-     * <a id="link" href="url">Advanced</a>
-     * <div id="link_options">
-     *     hidden content :)
-     * </div>
-     * */
-    $(".advanced_options").on("click", function(event) {
-        event.preventDefault();
+    $("form").on("click", ' .advanced_parameters', function() {
         var id = $(this).attr('id') + '_options';
         var button = $(this);
         $("#"+id).toggle(function() {
@@ -90,58 +70,78 @@ $(document).ready( function() {
         });
     });
 
-    /**
-     * <a class="advanced_options_open" href="http://" rel="div_id">Open</a>
-     * <a class="advanced_options_close" href="http://" rel="div_id">Close</a>
-     * <div id="div_id">Div content</div>
-     * */
-    $(".advanced_options_open").on("click", function(event) {
-        event.preventDefault();
-        var id = $(this).attr('rel');
-        $("#"+id).show();
-    });
 
-    $(".advanced_options_close").on("click", function(event) {
-        event.preventDefault();
-        var id = $(this).attr('rel');
-        $("#"+id).hide();
-    });
+    /* Makes row highlighting possible */
+    $(document).ready( function() {
+        /**
+         * Advanced options
+         * Usage
+         * <a id="link" href="url">Advanced</a>
+         * <div id="link_options">
+         *     hidden content :)
+         * </div>
+         * */
+        $(".advanced_options").on("click", function(event) {
+            event.preventDefault();
+            var id = $(this).attr('id') + '_options';
+            var button = $(this);
+            $("#"+id).toggle(function() {
+                button.toggleClass('active');
+            });
+        });
 
-    // Chosen select
-    $(".chzn-select").chosen({
-        disable_search_threshold: 10
-    });
+        /**
+         * <a class="advanced_options_open" href="http://" rel="div_id">Open</a>
+         * <a class="advanced_options_close" href="http://" rel="div_id">Close</a>
+         * <div id="div_id">Div content</div>
+         * */
+        $(".advanced_options_open").on("click", function(event) {
+            event.preventDefault();
+            var id = $(this).attr('rel');
+            $("#"+id).show();
+        });
 
-    $(".jp-jplayer audio").addClass('skip');
+        $(".advanced_options_close").on("click", function(event) {
+            event.preventDefault();
+            var id = $(this).attr('rel');
+            $("#"+id).hide();
+        });
 
-    // Mediaelement
-    jQuery('video:not(.skip), audio:not(.skip)').mediaelementplayer(/* Options */);
+        // Chosen select
+        $(".chzn-select").chosen({
+            disable_search_threshold: 10
+        });
+
+        $(".jp-jplayer audio").addClass('skip');
+
+        // Mediaelement
+        jQuery('video:not(.skip), audio:not(.skip)').mediaelementplayer(/* Options */);
+
+        // Table highlight.
+        $("form .data_table input:checkbox").click(function() {
+            if ($(this).is(":checked")) {
+                $(this).parentsUntil("tr").parent().addClass("row_selected");
 
-    // Table highlight.
-    $("form .data_table input:checkbox").click(function() {
-        if ($(this).is(":checked")) {
-            $(this).parentsUntil("tr").parent().addClass("row_selected");
+            } else {
+                $(this).parentsUntil("tr").parent().removeClass("row_selected");
+            }
+        });
 
-        } else {
-            $(this).parentsUntil("tr").parent().removeClass("row_selected");
+        /* For non HTML5 browsers */
+        if ($("#formLogin".length > 1)) {
+            $("input[name=login]").focus();
         }
-    });
 
-    /* For non HTML5 browsers */
-    if ($("#formLogin".length > 1)) {
-        $("input[name=login]").focus();
-    }
-
-    /* For IOS users */
-    $('.autocapitalize_off').attr('autocapitalize', 'off');
-
-    //Tool tip (in exercises)
-    var tip_options = {
-        placement : 'right'
-    }
-    $('.boot-tooltip').tooltip(tip_options);
-});
-{% endraw %}
+        /* For IOS users */
+        $('.autocapitalize_off').attr('autocapitalize', 'off');
+
+        //Tool tip (in exercises)
+        var tip_options = {
+            placement : 'right'
+        };
+        $('.boot-tooltip').tooltip(tip_options);
+    });
+    {% endraw %}
 
 </script>