Minor - format code.

1.9.x
Julio Montoya 11 years ago
parent 178b2763ea
commit 9418d8da68
  1. 12
      main/gradebook/lib/fe/flatviewtable.class.php
  2. 25
      main/gradebook/lib/flatview_data_generator.class.php
  3. 134
      main/template/default/layout/footer.tpl

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

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

@ -20,7 +20,7 @@
{{ plugin_footer_left }} {{ plugin_footer_left }}
</div> </div>
{% endif %} {% endif %}
&nbsp; &nbsp;
</div> </div>
<div id="footer_center" class="span4"> <div id="footer_center" class="span4">
@ -30,7 +30,7 @@
{{ plugin_footer_center }} {{ plugin_footer_center }}
</div> </div>
{% endif %} {% endif %}
&nbsp; &nbsp;
</div> </div>
<div id="footer_right" class="span4"> <div id="footer_right" class="span4">
@ -62,27 +62,7 @@
{% raw %} {% raw %}
<script> <script>
$("form").on("click", ' .advanced_parameters', function() { $("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();
var id = $(this).attr('id') + '_options'; var id = $(this).attr('id') + '_options';
var button = $(this); var button = $(this);
$("#"+id).toggle(function() { $("#"+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) { /* Makes row highlighting possible */
event.preventDefault(); $(document).ready( function() {
var id = $(this).attr('rel'); /**
$("#"+id).hide(); * 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({ * <a class="advanced_options_open" href="http://" rel="div_id">Open</a>
disable_search_threshold: 10 * <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 // Chosen select
jQuery('video:not(.skip), audio:not(.skip)').mediaelementplayer(/* Options */); $(".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. } else {
$("form .data_table input:checkbox").click(function() { $(this).parentsUntil("tr").parent().removeClass("row_selected");
if ($(this).is(":checked")) { }
$(this).parentsUntil("tr").parent().addClass("row_selected"); });
} else { /* For non HTML5 browsers */
$(this).parentsUntil("tr").parent().removeClass("row_selected"); if ($("#formLogin".length > 1)) {
$("input[name=login]").focus();
} }
});
/* For non HTML5 browsers */ /* For IOS users */
if ($("#formLogin".length > 1)) { $('.autocapitalize_off').attr('autocapitalize', 'off');
$("input[name=login]").focus();
} //Tool tip (in exercises)
var tip_options = {
/* For IOS users */ placement : 'right'
$('.autocapitalize_off').attr('autocapitalize', 'off'); };
$('.boot-tooltip').tooltip(tip_options);
//Tool tip (in exercises) });
var tip_options = { {% endraw %}
placement : 'right'
}
$('.boot-tooltip').tooltip(tip_options);
});
{% endraw %}
</script> </script>

Loading…
Cancel
Save