From 5cdadaa2e7de0e86c2daa224db86450b281b56f7 Mon Sep 17 00:00:00 2001 From: Isaac Flores Date: Tue, 21 Apr 2009 20:57:51 +0200 Subject: [PATCH] [svn r19949] logic changes - allow see stats of total colum - (partial FS#4073) --- main/gradebook/lib/fe/displaygradebook.php | 2 +- main/gradebook/lib/fe/flatviewtable.class.php | 30 +++++++++---------- .../lib/flatview_data_generator.class.php | 18 +++++++---- 3 files changed, 28 insertions(+), 22 deletions(-) diff --git a/main/gradebook/lib/fe/displaygradebook.php b/main/gradebook/lib/fe/displaygradebook.php index b969ae2178..462a969187 100644 --- a/main/gradebook/lib/fe/displaygradebook.php +++ b/main/gradebook/lib/fe/displaygradebook.php @@ -135,7 +135,7 @@ class DisplayGradebook */ function display_header_reduce_flatview($catobj, $showeval, $showlink,$simple_search_form) { $header = '
'; - $header .= ''. Display::return_icon('folder_document.gif') . get_lang('FolderView') . ''; + $header .= ''. Display::return_icon('folder_document.gif',get_lang('FolderView')) . get_lang('FolderView') . ''; // $header .= ' . get_lang( ' . get_lang('ExportPDF') . ''; diff --git a/main/gradebook/lib/fe/flatviewtable.class.php b/main/gradebook/lib/fe/flatviewtable.class.php index 60abe33fdc..8d501057d5 100644 --- a/main/gradebook/lib/fe/flatviewtable.class.php +++ b/main/gradebook/lib/fe/flatviewtable.class.php @@ -186,25 +186,22 @@ class FlatViewTable extends SortableTable if ($this->datagen->get_total_items_count()>0 && $total_users > 0 ) { array_shift($header_name); array_shift($header_name); - array_pop($header_name); - + $displayscore= ScoreDisplay :: instance(); $customdisplays = $displayscore->get_custom_score_display_settings(); if (is_array($customdisplays) && count(($customdisplays))) { - $user_results = ($this->datagen->get_data_to_graph2()); + $user_results = ($this->datagen->get_data_to_graph2()); $pre_result = $new_result = array(); - //print_r($user_results); $DataSet = new pData; - //filling the Dataset + //filling the Dataset foreach($user_results as $result) { - //print_r($result); - for($i=0; $i< count($header_name); $i++) { + //print_r($result); + for($i=0; $i< count($header_name); $i++) { $pre_result[$i+3][]=$result[$i+1]; $pre_result_pie[$i+3][] = $result[$i+1][0]; } - } - + } /*$display_list = array(); foreach( $customdisplays as $display) { $display_list[] = $display['display']; @@ -215,6 +212,7 @@ class FlatViewTable extends SortableTable $resource_list = array(); $pre_result2 = array(); //print_r($pre_result); exit; + foreach($pre_result as $key=>$res_array) { rsort($res_array); $pre_result2[] = $res_array; @@ -226,7 +224,7 @@ class FlatViewTable extends SortableTable //$resource_list //$total = $res / ($total_users*100); // mayor a menor - $key_list = array(); + $key_list = array(); foreach($res_array as $user_result) { $resource_list[$key][$user_result[1]]+=1; $key_list[] = $user_result[1]; @@ -245,21 +243,23 @@ class FlatViewTable extends SortableTable $i = 1; $j = 0; // here----------------------------------- - //print_r($resource_list); + //print_r($resource_list); foreach($resource_list as $key=>$resource) { $new_resource_list = $new_resource_list_name = array(); - $DataSet = new pData; + $DataSet = new pData; foreach($resource as $name=>$cant) { //$new_resource_list[]=$cant; //$new_resource_list_name[]=$name; $DataSet->AddPoint($cant,"Serie".$j); $DataSet->SetSerieName(strip_tags($name),"Serie".$j); $j++; - } + } //print_r($pre_result); print_r($header_name); // Dataset definition - $DataSet->AddAllSeries(); - $DataSet->SetAbsciseLabelSerie(); + $DataSet->AddAllSeries(); + $DataSet->SetAbsciseLabelSerie(''); + $DataSet->SetXAxisName(get_lang('GradebookSkillsRanking')); + $DataSet->SetYAxisName(get_lang('Students')); $show_draw = true; // Cache definition $Cache = new pCache(); diff --git a/main/gradebook/lib/flatview_data_generator.class.php b/main/gradebook/lib/flatview_data_generator.class.php index 09ed7a18ed..f301f70e39 100644 --- a/main/gradebook/lib/flatview_data_generator.class.php +++ b/main/gradebook/lib/flatview_data_generator.class.php @@ -216,7 +216,7 @@ class FlatViewDataGenerator usort($usertable, array ('FlatViewDataGenerator','sort_by_first_name')); // generate actual data array - $scoredisplay = ScoreDisplay :: instance(); + $scoredisplay = ScoreDisplay :: instance(); $data= array (); $displaytype = SCORE_DIV; $selected_users = $usertable; @@ -234,11 +234,17 @@ class FlatViewDataGenerator $item_total+=$item->get_weight(); $score_denom=($score[1]==0) ? 1 : $score[1]; $score_final = round(($score[0] / $score_denom) * 100,2); - $row[] = array ($score_final, strip_tags($scoredisplay->display_score($score,SCORE_DIV_PERCENT, SCORE_ONLY_CUSTOM))); - } - $total_score=array($item_value,$item_total); - $score_final = round(($item_value / $item_total) * 100,2); - $row[] = $score_final; + $row[] = array ($score_final, strip_tags($scoredisplay->display_score($score,SCORE_DIV_PERCENT, SCORE_ONLY_CUSTOM))); + + } + $total_score=array($item_value,$item_total); + $score_final = round(($item_value / $item_total) * 100,2); + $row[] =array ($score_final, strip_tags($scoredisplay->display_score($score,SCORE_DIV_PERCENT, SCORE_ONLY_CUSTOM))); + //$total_score=array($item_value,$item_total); + //$score_final = round(($item_value / $item_total) * 100,2); + //$row[] = $score_final; + //var_dump($score_final); + //var_dump($row); $data[] = $row; } return $data;