From e28fc46b6d926641d7a846194a0d02a684cbee23 Mon Sep 17 00:00:00 2001 From: Bruno Massa <brmassa@67164.no-reply.drupal.org> Date: Tue, 11 Mar 2008 03:47:08 +0000 Subject: [PATCH] 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 --- charts.module | 47 ++++++++++++++++++++++++++++++++++++++++++++++- 1 file changed, 46 insertions(+), 1 deletion(-) diff --git a/charts.module b/charts.module index 6968a30..34c0de4 100644 --- a/charts.module +++ b/charts.module @@ -1,6 +1,6 @@ <?php +// $Id$ /** - * $Id$ * @author Bruno Massa http://drupal.org/user/67164 * @file charts.module * Transform DATA into INFORMATION using beautiful CHARTS. @@ -8,3 +8,48 @@ * @note only hooks are here. * @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 -- GitLab