Browse Source

Delete last old pchart use - refs CT#7408

Daniel Barreto 10 years ago
parent
commit
33936cdfac

+ 2 - 2
main/auth/inscription.php

@@ -165,8 +165,8 @@ if ($user_already_registered_show_terms == false) {
             'sessionVar'   => basename(__FILE__, '.php'),
             'imageOptions' => array(
                 'font_size' => 20,
-                'font_path' => api_get_path(LIBRARY_PATH).'pchart/fonts/',
-                'font_file' => 'tahoma.ttf',
+                'font_path' => api_get_path(LIBRARY_PATH).'pChart2/fonts/',
+                'font_file' => 'verdana.ttf',
                     //'output' => 'gif'
             )
         );

+ 0 - 2
main/gradebook/gradebook_flatview.php

@@ -282,8 +282,6 @@ if (isset($_GET['isStudentView']) && $_GET['isStudentView'] == 'false') {
 
     // main graph
     $flatviewtable->display();
-    // @todo this needs a fix
-    //$image_file = $flatviewtable->display_graph();
     //@todo load images with jquery
     echo '<div id="contentArea" style="text-align: center;" >';
     if (!empty($image_file)) {

+ 0 - 122
main/gradebook/lib/fe/flatviewtable.class.php

@@ -80,128 +80,6 @@ class FlatViewTable extends SortableTable
         return $this->mainCourseCategory;
     }
 
-    /**
-     * Display the graph of the total results of all students
-     * */
-    public function display_graph()
-    {
-        include_once api_get_path(LIBRARY_PATH) . 'pchart/pData.class.php';
-        include_once api_get_path(LIBRARY_PATH) . 'pchart/pChart.class.php';
-        include_once api_get_path(LIBRARY_PATH) . 'pchart/pCache.class.php';
-
-        $header_name = $this->datagen->get_header_names();
-        $total_users = $this->datagen->get_total_users_count();
-
-        $img_file = '';
-
-        if ($this->datagen->get_total_items_count() > 0 && $total_users > 0) {
-            // Removing user names and total
-            array_shift($header_name);
-            array_shift($header_name);
-            array_pop($header_name);
-
-            $user_results = $this->datagen->get_data_to_graph();
-
-            $pre_result = $new_result = array();
-            $DataSet = new pData();
-
-            //$pre_result total score of students
-            //filling the Dataset
-            foreach ($user_results as $result) {
-                for ($i = 0; $i < count($header_name); $i++) {
-                    $pre_result[$i + 3]+= $result[$i + 1];
-                }
-            }
-
-            $i = 1;
-            $show_draw = false;
-            if ($total_users > 0) {
-                foreach ($pre_result as $res) {
-                    $total = $res / ($total_users);
-                    if ($total != 0) {
-                        $show_draw = true;
-                    }
-                    $DataSet->AddPoint($total, "Serie" . $i);
-                    $DataSet->SetSerieName(strip_tags($header_name[$i - 1]), "Serie" . $i);
-
-                    // Dataset definition
-                    $DataSet->AddAllSeries();
-                    $DataSet->SetAbsciseLabelSerie();
-                    $i++;
-                }
-            }
-
-            // Cache definition
-            $Cache = new pCache();
-            // the graph id
-            $gradebook_id = intval($_GET['selectcat']);
-            $graph_id = api_get_user_id() . 'AverageResultsVsResource' . $gradebook_id . api_get_course_id();
-            $data = $DataSet->GetData();
-
-            if ($show_draw) {
-                if ($Cache->IsInCache($graph_id, $DataSet->GetData())) {
-                    //if (0) {
-                    //if we already created the img
-                    //echo 'in cache';
-                    $img_file = $Cache->GetHash($graph_id, $DataSet->GetData());
-                } else {
-                    // if the image does not exist in the archive/ folder
-                    // Initialise the graph
-                    $angle = -30;
-                    $Test = new pChart(760, 360);
-
-                    // set font of the axes
-                    $Test->setFontProperties(api_get_path(LIBRARY_PATH) . "pchart/fonts/tahoma.ttf", 8);
-
-                    $Test = $Test->fixHeightByRotation($DataSet->GetData(), $DataSet->GetDataDescription(), $angle);
-
-                    //which schema of color will be used
-                    $quant_resources = count($data[0]) - 1;
-                    // Adding the color schemma
-                    if ($quant_resources < 8) {
-                        $Test->loadColorPalette(api_get_path(LIBRARY_PATH) . "pchart/palette/reduced.txt");
-                    } else {
-                        $Test->loadColorPalette(api_get_path(LIBRARY_PATH) . "pchart/palette/default.txt");
-                    }
-
-                    $Test->setGraphArea(50, 30, 610, 300);
-
-                    $Test->drawFilledRoundedRectangle(7, 7, $Test->XSize + 20, $Test->YSize - 30, 5, 240, 240, 240);
-                    //$Test->drawRoundedRectangle(5,5,790,330,5,230,230,230);
-                    //background color area & stripe or not
-                    $Test->drawGraphArea(255, 255, 255, TRUE);
-                    $Test->drawScale($DataSet->GetData(), $DataSet->GetDataDescription(), SCALE_START0, 150, 150, 150, TRUE, 0, 1, FALSE);
-
-                    //background grid
-                    $Test->drawGrid(4, TRUE, 230, 230, 230, 50);
-
-                    // Draw the 0 line
-                    //$Test->setFontProperties(api_get_path(LIBRARY_PATH)."pchart/fonts/tahoma.ttf",6);
-                    //$Test->drawTreshold(0,143,55,72,TRUE,TRUE);
-                    // Draw the bar graph
-                    $Test->drawBarGraph($DataSet->GetData(), $DataSet->GetDataDescription(), TRUE);
-
-                    //Set legend properties: width, height and text color and font
-                    $Test->setFontProperties(api_get_path(LIBRARY_PATH) . "pchart/fonts/tahoma.ttf", 9);
-                    $Test->drawLegend(620, 70, $DataSet->GetDataDescription(), 255, 255, 255);
-
-                    //Set title properties
-                    $Test->setFontProperties(api_get_path(LIBRARY_PATH) . "pchart/fonts/tahoma.ttf", 10);
-                    $Test->drawTitle(50, 22, get_lang('AverageResultsVsResource'), 50, 50, 80, 620);
-
-                    //------------------
-                    //echo 'not in cache';
-                    $Cache->WriteToCache($graph_id, $DataSet->GetData(), $Test);
-                    ob_start();
-                    $Test->Stroke();
-                    ob_end_clean();
-                    $img_file = $Cache->GetHash($graph_id, $DataSet->GetData());
-                }
-            }
-        }
-        return api_get_path(WEB_ARCHIVE_PATH) . $img_file;
-    }
-
     /**
      *
      */

+ 0 - 1
main/inc/lib/autoload.class.php

@@ -751,7 +751,6 @@ class Autoload
         $result['MultipleAnswerCombination'] = '/main/exercice/multiple_answer_combination.class.php';
         $result['MultipleAnswerCombinationTrueFalse'] = '/main/exercice/multiple_answer_combination_true_false.class.php';
         $result['MultipleAnswerTrueFalse'] = '/main/exercice/multiple_answer_true_false.class.php';
-        $result['MyHorBar'] = '/main/inc/lib/pchart/MyHorBar.class.php';
         $result['MySpace'] = '/main/mySpace/myspace.lib.php';
         $result['Nanogong'] = '/main/inc/lib/nanogong.lib.php';
         $result['NotebookManager'] = '/main/inc/lib/notebook.lib.php';

+ 2 - 2
main/inc/lib/userportal.lib.php

@@ -719,8 +719,8 @@ class IndexManager
                     'sessionVar'   => basename(__FILE__, '.php'),
                     'imageOptions' => array(
                         'font_size' => 20,
-                        'font_path' => api_get_path(LIBRARY_PATH).'pchart/fonts/',
-                        'font_file' => 'tahoma.ttf',
+                        'font_path' => api_get_path(LIBRARY_PATH).'pChart2/fonts/',
+                        'font_file' => 'verdana.ttf',
                         //'output' => 'gif'
                     )
                 );