Skip to content
Snippets Groups Projects
Commit e28fc46b authored by Bruno Massa's avatar Bruno Massa
Browse files

New features:

* hook_menu() implementation, creating a settings page and a testing environment
* charts_chart() function will be the contact point to all external modules to create a chart from a data

Misc:
* File $Id: $ correctly placed
parent 7a5a0549
No related branches found
No related tags found
No related merge requests found
<?php <?php
// $Id$
/** /**
* $Id$
* @author Bruno Massa http://drupal.org/user/67164 * @author Bruno Massa http://drupal.org/user/67164
* @file charts.module * @file charts.module
* Transform DATA into INFORMATION using beautiful CHARTS. * Transform DATA into INFORMATION using beautiful CHARTS.
...@@ -8,3 +8,48 @@ ...@@ -8,3 +8,48 @@
* @note only hooks are here. * @note only hooks are here.
* @note For instructions about the API, see chart_api.txt file. * @note For instructions about the API, see chart_api.txt file.
*/ */
/**
* The main Chart API function, that calls any chart provider
* to print the given data.
*
* @param $chart_provider
* String. The chart provider. With this module you might install
* 'googlechart', 'openflashchart' and 'fusioncharts'
* @param &$data
* Array. The chart data, described on chart_api.txt
* @return
* String. The HTML with the propper chart (might include Flash or
* JavaScript external files)
*/
function charts_chart($chart_provider, &$data) {
if (function_exists()) {
$chart_provider = $chart_provider .'_printchart';
return $chart_provider($data);
}
}
/**
* Implementation of hook_menu().
*/
function charts_menu() {
$items['admin/settings/charts'] = array(
'file' => 'charts.inc',
'page callback' => 'drupal_get_form',
'page arguments' => array('_charts_settings'),
'title' => 'Charts'
);
$items['admin/settings/charts/settings'] = array(
'page arguments' => array('_charts_settings'),
'title' => 'Settings',
'type' => MENU_DEFAULT_LOCAL_TASK,
);
$items['admin/settings/charts/testing'] = array(
'file' => 'charts.inc',
'page callback' => 'drupal_get_form',
'page arguments' => array('_charts_testing'),
'title' => 'Testing',
'type' => MENU_LOCAL_TASK,
);
return $items;
}
\ No newline at end of file
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment