Update to use c-pchart from composer - refs CT#7408

1.10.x
Daniel Barreto 11 years ago
parent bb7a74aec5
commit 2ec4b9803e
  1. 4
      main/auth/inscription.php
  2. 7
      main/gradebook/lib/fe/flatviewtable.class.php
  3. 19
      main/inc/autoload.inc.php
  4. 4
      main/inc/lib/autoload.class.php
  5. 33
      main/inc/lib/tracking.lib.php
  6. 4
      main/inc/lib/userportal.lib.php
  7. 24
      main/mySpace/myspace.lib.php
  8. 12
      plugin/dashboard/block_evaluation_graph/block_evaluation_graph.class.php
  9. 9
      plugin/dashboard/block_student_graph/block_student_graph.class.php
  10. 9
      plugin/dashboard/block_teacher_graph/block_teacher_graph.class.php

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

@ -85,11 +85,6 @@ class FlatViewTable extends SortableTable
*/ */
public function display_graph_by_resource() public function display_graph_by_resource()
{ {
require_once api_get_path(LIBRARY_PATH) . 'pChart2/class/pData.class.php';
require_once api_get_path(LIBRARY_PATH) . 'pChart2/class/pDraw.class.php';
require_once api_get_path(LIBRARY_PATH) . 'pChart2/class/pImage.class.php';
require_once api_get_path(LIBRARY_PATH) . 'pChart2/class/pCache.class.php';
$headerName = $this->datagen->get_header_names(); $headerName = $this->datagen->get_header_names();
$total_users = $this->datagen->get_total_users_count(); $total_users = $this->datagen->get_total_users_count();
@ -215,7 +210,7 @@ class FlatViewTable extends SortableTable
/* Set the default font */ /* Set the default font */
$myPicture->setFontProperties( $myPicture->setFontProperties(
array( array(
'FontName' => api_get_path(LIBRARY_PATH) . "pChart2/fonts/verdana.ttf", 'FontName' => api_get_path(SYS_CSS_PATH) . 'opensans/OpenSans-Regular.ttf',
'FontSize' => 10 'FontSize' => 10
) )
); );

@ -0,0 +1,19 @@
<?php
/**
* Set up the Chamilo autoload stack. Can be called several time if needed also
* better to avoid it.
*/
require_once dirname(__FILE__) . '/lib/autoload.class.php';
require_once __DIR__ . '/../../vendor/autoload.php';
Autoload::register();
/**
use Symfony\Component\ClassLoader\UniversalClassLoader;
$loader = new UniversalClassLoader();
$loader->registerNamespaces(array(
'Symfony\\Component\\HttpFoundation', __DIR__.'/vendor/symfony/http-foundation',
));
$loader->register();
*/

@ -974,10 +974,6 @@ class Autoload
$result['learnpath_processor'] = '/main/inc/lib/search/tool_processors/learnpath_processor.class.php'; $result['learnpath_processor'] = '/main/inc/lib/search/tool_processors/learnpath_processor.class.php';
$result['link_processor'] = '/main/inc/lib/search/tool_processors/link_processor.class.php'; $result['link_processor'] = '/main/inc/lib/search/tool_processors/link_processor.class.php';
$result['net\HttpChannel'] = '/main/inc/lib/system/net/http_channel.class.php'; $result['net\HttpChannel'] = '/main/inc/lib/system/net/http_channel.class.php';
$result['pCache'] = '/main/inc/lib/pChart2/class/pCache.class.php';
$result['pDraw'] = '/main/inc/lib/pChart2/class/pDraw.class.php';
$result['pImage'] = '/main/inc/lib/pChart2/class/pImage.class.php';
$result['pData'] = '/main/inc/lib/pChart2/class/pData.class.php';
$result['quiz_processor'] = '/main/inc/lib/search/tool_processors/quiz_processor.class.php'; $result['quiz_processor'] = '/main/inc/lib/search/tool_processors/quiz_processor.class.php';
$result['scorm'] = '/main/newscorm/scorm.class.php'; $result['scorm'] = '/main/newscorm/scorm.class.php';
$result['scormItem'] = '/main/newscorm/scormItem.class.php'; $result['scormItem'] = '/main/newscorm/scormItem.class.php';

@ -4,6 +4,10 @@
require_once api_get_path(SYS_CODE_PATH).'exercice/exercise.lib.php'; require_once api_get_path(SYS_CODE_PATH).'exercice/exercise.lib.php';
require_once api_get_path(SYS_CODE_PATH).'newscorm/learnpathList.class.php'; require_once api_get_path(SYS_CODE_PATH).'newscorm/learnpathList.class.php';
use CpChart\Classes\pData as pData;
use CpChart\Classes\pImage as pImage;
use CpChart\Classes\pCache as pCache;
/** /**
* Class Tracking * Class Tracking
* *
@ -4579,10 +4583,6 @@ class Tracking
*/ */
static function generate_session_exercise_graph($names, $my_results, $average) static function generate_session_exercise_graph($names, $my_results, $average)
{ {
require_once api_get_path(LIBRARY_PATH).'pChart2/class/pData.class.php';
require_once api_get_path(LIBRARY_PATH).'pChart2/class/pDraw.class.php';
require_once api_get_path(LIBRARY_PATH).'pChart2/class/pCache.class.php';
/* Create and populate the pData object */ /* Create and populate the pData object */
$myData = new pData(); $myData = new pData();
$myData->addPoints($names, 'Labels'); $myData->addPoints($names, 'Labels');
@ -4595,8 +4595,7 @@ class Tracking
$myData->setSerieDescription('Serie1', get_lang('MyResults')); $myData->setSerieDescription('Serie1', get_lang('MyResults'));
$myData->setSerieDescription('Serie2', get_lang('AverageScore')); $myData->setSerieDescription('Serie2', get_lang('AverageScore'));
$myData->setAxisUnit(0, '%'); $myData->setAxisUnit(0, '%');
// @TODO: Define a custom pallete // @TODO: Define a custom palette
$myData->loadPalette(api_get_path(LIBRARY_PATH) . 'pChart2/palettes/evening.color', true);
// Cache definition // Cache definition
$cachePath = api_get_path(SYS_ARCHIVE_PATH); $cachePath = api_get_path(SYS_ARCHIVE_PATH);
@ -4621,8 +4620,8 @@ class Tracking
$myPicture->Antialias = false; $myPicture->Antialias = false;
/* Draw the background */ /* Draw the background */
$Settings = array('R' => 255, 'G' => 255, 'B' => 255); $settings = array('R' => 255, 'G' => 255, 'B' => 255);
$myPicture->drawFilledRectangle(0, 0, $mainWidth, $mainHeight, $Settings); $myPicture->drawFilledRectangle(0, 0, $mainWidth, $mainHeight, $settings);
/* Add a border to the picture */ /* Add a border to the picture */
$myPicture->drawRectangle( $myPicture->drawRectangle(
@ -4636,7 +4635,7 @@ class Tracking
/* Set the default font */ /* Set the default font */
$myPicture->setFontProperties( $myPicture->setFontProperties(
array( array(
'FontName' => api_get_path(LIBRARY_PATH) . "pChart2/fonts/verdana.ttf", 'FontName' => api_get_path(SYS_CSS_PATH) . 'opensans/OpenSans-Regular.ttf',
'FontSize' => 10) 'FontSize' => 10)
); );
/* Write the chart title */ /* Write the chart title */
@ -4653,7 +4652,7 @@ class Tracking
/* Set the default font */ /* Set the default font */
$myPicture->setFontProperties( $myPicture->setFontProperties(
array( array(
'FontName' => api_get_path(LIBRARY_PATH) . "pChart2/fonts/verdana.ttf", 'FontName' => api_get_path(SYS_CSS_PATH) . 'opensans/OpenSans-Regular.ttf',
'FontSize' => 6 'FontSize' => 6
) )
); );
@ -4695,7 +4694,7 @@ class Tracking
/* Draw the line chart */ /* Draw the line chart */
$myPicture->setFontProperties( $myPicture->setFontProperties(
array( array(
'FontName' => api_get_path(LIBRARY_PATH) . "pChart2/fonts/verdana.ttf", 'FontName' => api_get_path(SYS_CSS_PATH) . 'opensans/OpenSans-Regular.ttf',
'FontSize' => 10 'FontSize' => 10
) )
); );
@ -4745,10 +4744,6 @@ class Tracking
*/ */
static function generate_exercise_result_thumbnail_graph($attempts) static function generate_exercise_result_thumbnail_graph($attempts)
{ {
require_once api_get_path(LIBRARY_PATH) . 'pChart2/class/pData.class.php';
require_once api_get_path(LIBRARY_PATH) . 'pChart2/class/pDraw.class.php';
require_once api_get_path(LIBRARY_PATH) . 'pChart2/class/pCache.class.php';
$exercise_title = $attempts['title']; $exercise_title = $attempts['title'];
$attempts = $attempts['data']; $attempts = $attempts['data'];
$my_exercise_result_array = $exercise_result = array(); $my_exercise_result_array = $exercise_result = array();
@ -4846,7 +4841,7 @@ class Tracking
$myPicture->drawRectangle(0, 0, $widthSize - 1, $heightSize - 1, array('R' => 0, 'G' => 0, 'B' => 0)); $myPicture->drawRectangle(0, 0, $widthSize - 1, $heightSize - 1, array('R' => 0, 'G' => 0, 'B' => 0));
/* Set the default font */ /* Set the default font */
$myPicture->setFontProperties(array('FontName' => api_get_path(LIBRARY_PATH) . "pChart2/fonts/verdana.ttf", 'FontSize' => $fontSize)); $myPicture->setFontProperties(array('FontName' => api_get_path(SYS_CSS_PATH) . 'opensans/OpenSans-Regular.ttf', 'FontSize' => $fontSize));
/* Do not write the chart title */ /* Do not write the chart title */
@ -4925,10 +4920,6 @@ class Tracking
*/ */
static function generate_exercise_result_graph($attempts) static function generate_exercise_result_graph($attempts)
{ {
require_once api_get_path(LIBRARY_PATH).'pChart2/class/pData.class.php';
require_once api_get_path(LIBRARY_PATH).'pChart2/class/pDraw.class.php';
require_once api_get_path(LIBRARY_PATH).'pChart2/class/pCache.class.php';
$exercise_title = strip_tags($attempts['title']); $exercise_title = strip_tags($attempts['title']);
$attempts = $attempts['data']; $attempts = $attempts['data'];
$my_exercise_result_array = $exercise_result = array(); $my_exercise_result_array = $exercise_result = array();
@ -5033,7 +5024,7 @@ class Tracking
$myPicture->drawRectangle(0, 0, $widthSize - 1, $heightSize - 1, array('R' => 0, 'G' => 0, 'B' => 0)); $myPicture->drawRectangle(0, 0, $widthSize - 1, $heightSize - 1, array('R' => 0, 'G' => 0, 'B' => 0));
/* Set the default font */ /* Set the default font */
$myPicture->setFontProperties(array('FontName' => api_get_path(LIBRARY_PATH) . "pChart2/fonts/verdana.ttf", 'FontSize' => 10)); $myPicture->setFontProperties(array('FontName' => api_get_path(SYS_CSS_PATH) . 'opensans/OpenSans-Regular.ttf', 'FontSize' => 10));
/* Write the chart title */ /* Write the chart title */
$myPicture->drawText( $myPicture->drawText(

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

@ -4,6 +4,10 @@
require_once api_get_path(LIBRARY_PATH).'export.lib.inc.php'; require_once api_get_path(LIBRARY_PATH).'export.lib.inc.php';
require_once api_get_path(LIBRARY_PATH).'tracking.lib.php'; require_once api_get_path(LIBRARY_PATH).'tracking.lib.php';
use CpChart\Classes\pData as pData;
use CpChart\Classes\pImage as pImage;
use CpChart\Classes\pCache as pCache;
/** /**
* Class MySpace * Class MySpace
* @package chamilo.reporting * @package chamilo.reporting
@ -2781,11 +2785,8 @@ function convert_to_string($sql_result){
* @version OCT-22- 2010 * @version OCT-22- 2010
* @return string * @return string
*/ */
function grapher($sql_result, $start_date, $end_date, $type = "") { function grapher($sql_result, $start_date, $end_date, $type = "")
require_once api_get_path(LIBRARY_PATH) . 'pChart2/class/pData.class.php'; {
require_once api_get_path(LIBRARY_PATH) . 'pChart2/class/pDraw.class.php';
require_once api_get_path(LIBRARY_PATH) . 'pChart2/class/pCache.class.php';
if (empty($start_date)) { $start_date =""; } if (empty($start_date)) { $start_date =""; }
if (empty($end_date)) { $end_date =""; } if (empty($end_date)) { $end_date =""; }
if ($type == ""){ $type = 'day'; } if ($type == ""){ $type = 'day'; }
@ -2841,8 +2842,7 @@ function grapher($sql_result, $start_date, $end_date, $type = "") {
$myData->setSerieWeight('Serie1', 1); $myData->setSerieWeight('Serie1', 1);
$myData->setSerieDescription('Serie1', get_lang('MyResults')); $myData->setSerieDescription('Serie1', get_lang('MyResults'));
$myData->setAxisName(0, get_lang('Minutes')); $myData->setAxisName(0, get_lang('Minutes'));
// @TODO: Define a custom pallete // @TODO: Define a custom palette
$myData->loadPalette(api_get_path(LIBRARY_PATH) . 'pChart2/palettes/evening.color', true);
// Cache definition // Cache definition
$cachePath = api_get_path(SYS_ARCHIVE_PATH); $cachePath = api_get_path(SYS_ARCHIVE_PATH);
@ -2867,8 +2867,8 @@ function grapher($sql_result, $start_date, $end_date, $type = "") {
$myPicture->Antialias = false; $myPicture->Antialias = false;
/* Draw the background */ /* Draw the background */
$Settings = array("R" => 255, "G" => 255, "B" => 255); $settings = array("R" => 255, "G" => 255, "B" => 255);
$myPicture->drawFilledRectangle(0, 0, $mainWidth, $mainHeight, $Settings); $myPicture->drawFilledRectangle(0, 0, $mainWidth, $mainHeight, $settings);
/* Add a border to the picture */ /* Add a border to the picture */
$myPicture->drawRectangle( $myPicture->drawRectangle(
@ -2882,7 +2882,7 @@ function grapher($sql_result, $start_date, $end_date, $type = "") {
/* Set the default font */ /* Set the default font */
$myPicture->setFontProperties( $myPicture->setFontProperties(
array( array(
"FontName" => api_get_path(LIBRARY_PATH) . "pChart2/fonts/verdana.ttf", "FontName" => api_get_path(SYS_CSS_PATH) . 'opensans/OpenSans-Regular.ttf',
"FontSize" => 10) "FontSize" => 10)
); );
/* Write the chart title */ /* Write the chart title */
@ -2899,7 +2899,7 @@ function grapher($sql_result, $start_date, $end_date, $type = "") {
/* Set the default font */ /* Set the default font */
$myPicture->setFontProperties( $myPicture->setFontProperties(
array( array(
"FontName" => api_get_path(LIBRARY_PATH) . "pChart2/fonts/verdana.ttf", "FontName" => api_get_path(SYS_CSS_PATH) . 'opensans/OpenSans-Regular.ttf',
"FontSize" => 8 "FontSize" => 8
) )
); );
@ -2941,7 +2941,7 @@ function grapher($sql_result, $start_date, $end_date, $type = "") {
/* Draw the line chart */ /* Draw the line chart */
$myPicture->setFontProperties( $myPicture->setFontProperties(
array( array(
"FontName" => api_get_path(LIBRARY_PATH) . "pChart2/fonts/verdana.ttf", "FontName" => api_get_path(SYS_CSS_PATH) . 'opensans/OpenSans-Regular.ttf',
"FontSize" => 10 "FontSize" => 10
) )
); );

@ -1,8 +1,5 @@
<?php <?php
/* For licensing terms, see /license.txt */ /* For licensing terms, see /license.txt */
require_once api_get_path(LIBRARY_PATH).'pChart2/class/pData.class.php';
require_once api_get_path(LIBRARY_PATH).'pChart2/class/pDraw.class.php';
require_once api_get_path(LIBRARY_PATH).'pChart2/class/pCache.class.php';
require_once api_get_path(SYS_CODE_PATH).'gradebook/lib/be/gradebookitem.class.php'; require_once api_get_path(SYS_CODE_PATH).'gradebook/lib/be/gradebookitem.class.php';
require_once api_get_path(SYS_CODE_PATH).'gradebook/lib/be/evaluation.class.php'; require_once api_get_path(SYS_CODE_PATH).'gradebook/lib/be/evaluation.class.php';
require_once api_get_path(SYS_CODE_PATH).'gradebook/lib/be/result.class.php'; require_once api_get_path(SYS_CODE_PATH).'gradebook/lib/be/result.class.php';
@ -11,6 +8,11 @@ require_once api_get_path(SYS_CODE_PATH).'gradebook/lib/flatview_data_generator.
require_once api_get_path(SYS_CODE_PATH).'gradebook/lib/gradebook_functions.inc.php'; require_once api_get_path(SYS_CODE_PATH).'gradebook/lib/gradebook_functions.inc.php';
require_once api_get_path(SYS_CODE_PATH).'gradebook/lib/be/category.class.php'; require_once api_get_path(SYS_CODE_PATH).'gradebook/lib/be/category.class.php';
use CpChart\Classes\pData as pData;
use CpChart\Classes\pImage as pImage;
use CpChart\Classes\pCache as pCache;
/** /**
* Class BlockEvaluationGraph * Class BlockEvaluationGraph
* This class is used like controller for this evaluations graph block plugin, * This class is used like controller for this evaluations graph block plugin,
@ -197,7 +199,7 @@ class BlockEvaluationGraph extends Block
/* Set the default font */ /* Set the default font */
$myPicture->setFontProperties( $myPicture->setFontProperties(
array( array(
'FontName' => api_get_path(LIBRARY_PATH) . 'pChart2/fonts/verdana.ttf', 'FontName' => api_get_path(SYS_CSS_PATH) . 'opensans/OpenSans-Regular.ttf',
'FontSize' => 10 'FontSize' => 10
) )
); );
@ -373,7 +375,7 @@ class BlockEvaluationGraph extends Block
/* Set the default font */ /* Set the default font */
$myPicture->setFontProperties( $myPicture->setFontProperties(
array( array(
'FontName' => api_get_path(LIBRARY_PATH) . 'pChart2/fonts/verdana.ttf', 'FontName' => api_get_path(SYS_CSS_PATH) . 'opensans/OpenSans-Regular.ttf',
'FontSize' => 10 'FontSize' => 10
) )
); );

@ -14,15 +14,16 @@
*/ */
require_once api_get_path(LIBRARY_PATH).'attendance.lib.php'; require_once api_get_path(LIBRARY_PATH).'attendance.lib.php';
require_once api_get_path(LIBRARY_PATH).'pChart2/class/pData.class.php';
require_once api_get_path(LIBRARY_PATH).'pChart2/class/pDraw.class.php';
require_once api_get_path(LIBRARY_PATH).'pChart2/class/pCache.class.php';
require_once api_get_path(SYS_CODE_PATH).'gradebook/lib/be/gradebookitem.class.php'; require_once api_get_path(SYS_CODE_PATH).'gradebook/lib/be/gradebookitem.class.php';
require_once api_get_path(SYS_CODE_PATH).'gradebook/lib/be/evaluation.class.php'; require_once api_get_path(SYS_CODE_PATH).'gradebook/lib/be/evaluation.class.php';
require_once api_get_path(SYS_CODE_PATH).'gradebook/lib/be/result.class.php'; require_once api_get_path(SYS_CODE_PATH).'gradebook/lib/be/result.class.php';
require_once api_get_path(SYS_CODE_PATH).'gradebook/lib/be/linkfactory.class.php'; require_once api_get_path(SYS_CODE_PATH).'gradebook/lib/be/linkfactory.class.php';
require_once api_get_path(SYS_CODE_PATH).'gradebook/lib/be/category.class.php'; require_once api_get_path(SYS_CODE_PATH).'gradebook/lib/be/category.class.php';
use CpChart\Classes\pData as pData;
use CpChart\Classes\pImage as pImage;
use CpChart\Classes\pCache as pCache;
/** /**
* This class is used like controller for student graph block plugin, * This class is used like controller for student graph block plugin,
* the class name must be registered inside path.info file (e.g: controller = "BlockStudentGraph"), so dashboard controller will be instantiate it * the class name must be registered inside path.info file (e.g: controller = "BlockStudentGraph"), so dashboard controller will be instantiate it
@ -189,7 +190,7 @@ class BlockStudentGraph extends Block
/* Set the default font */ /* Set the default font */
$myPicture->setFontProperties( $myPicture->setFontProperties(
array( array(
'FontName' => api_get_path(LIBRARY_PATH) . 'pChart2/fonts/verdana.ttf', 'FontName' => api_get_path(SYS_CSS_PATH) . 'opensans/OpenSans-Regular.ttf',
'FontSize' => 10 'FontSize' => 10
) )
); );

@ -12,9 +12,10 @@
require_once api_get_path(LIBRARY_PATH).'usermanager.lib.php'; require_once api_get_path(LIBRARY_PATH).'usermanager.lib.php';
require_once api_get_path(LIBRARY_PATH).'course.lib.php'; require_once api_get_path(LIBRARY_PATH).'course.lib.php';
require_once api_get_path(LIBRARY_PATH).'tracking.lib.php'; require_once api_get_path(LIBRARY_PATH).'tracking.lib.php';
require_once api_get_path(LIBRARY_PATH) . 'pChart2/class/pData.class.php';
require_once api_get_path(LIBRARY_PATH) . 'pChart2/class/pDraw.class.php'; use CpChart\Classes\pData as pData;
require_once api_get_path(LIBRARY_PATH) . 'pChart2/class/pCache.class.php'; use CpChart\Classes\pImage as pImage;
use CpChart\Classes\pCache as pCache;
/** /**
* This class is used like controller for teacher graph block plugin, * This class is used like controller for teacher graph block plugin,
@ -153,7 +154,7 @@ class BlockTeacherGraph extends Block
$myPicture->drawRectangle(0, 0, $widthSize - 1, $heightSize - 1, array('R' => 0, 'G' => 0, 'B' => 0)); $myPicture->drawRectangle(0, 0, $widthSize - 1, $heightSize - 1, array('R' => 0, 'G' => 0, 'B' => 0));
/* Set the default font */ /* Set the default font */
$myPicture->setFontProperties(array('FontName' => api_get_path(LIBRARY_PATH) . 'pChart2/fonts/verdana.ttf', 'FontSize' => 10)); $myPicture->setFontProperties(array('FontName' => api_get_path(SYS_CSS_PATH) . 'opensans/OpenSans-Regular.ttf', 'FontSize' => 10));
/* Do NOT Write the chart title */ /* Do NOT Write the chart title */

Loading…
Cancel
Save