diff --git a/charts.admin.inc b/charts.admin.inc index dbde71d1e34b3006a02c5995c5077a546878af32..aa37e92925f83c7394810e68ec20075b48684784 100644 --- a/charts.admin.inc +++ b/charts.admin.inc @@ -48,7 +48,7 @@ function _charts_color_form_complete(&$form, $default) { ); } - drupal_add_js(drupal_get_path('module', 'charts') .'/charts_color.js'); + drupal_add_js(drupal_get_path('module', 'charts') . '/charts_color.js'); drupal_add_js(array('chartsColorCustom' => t('Custom')), 'setting'); } @@ -110,7 +110,7 @@ function _charts_module_invoke_all() { unset($args[0]); $return = array(); foreach (module_implements($hook) as $module) { - $function = $module .'_'. $hook; + $function = $module . '_' . $hook; $result = call_user_func_array($function, $args); if (isset($result) && is_array($result)) { $return += $result; @@ -227,7 +227,7 @@ function _charts_settings_page_submit(&$form, &$form_state) { // merge between the chart data and the defaults easier on every // chart display. foreach ($settings as $index => $value) { - $default['#'. $index] = $value; + $default['#' . $index] = $value; } // Save the data into database diff --git a/charts.hooks.inc b/charts.hooks.inc new file mode 100644 index 0000000000000000000000000000000000000000..5559d2546dcd89afaca13e184a71443df9df89b1 --- /dev/null +++ b/charts.hooks.inc @@ -0,0 +1,64 @@ +<?php +// $Id$ +/** + * @author Bruno Massa http://drupal.org/user/67164 + * @file + * Transform DATA into INFORMATION using beautiful CHARTS. + * + * @note only cachable hooks are here. + */ + +/** + * Implementation of hook_chart_types(). + */ +function charts_chart_types() { + return array( + 'line2D' => t('Line 2D'), + 'hbar2D' => t('Horizontal Bar 2D'), + 'vbar2D' => t('Vertical Bar 2D'), + 'pie2D' => t('Pie 2D'), + 'pie3D' => t('Pie 3D'), + ); +} + +/** + * Implementation of hook_menu(). + */ +function charts_menu() { + $items['admin/settings/charts'] = array( + 'access arguments' => array('set default settings for charts'), + 'description' => 'Set the default behaviour and look of all your charts', + 'page callback' => 'drupal_get_form', + 'page arguments' => array('_charts_settings_page'), + 'title' => 'Charts' + ); + return $items; +} + +/** + * Implementation of hook_perm(). + */ +function charts_perm() { + return array('set default settings for charts'); +} + +/** + * Implementation of hook_theme(). + */ +function charts_theme() { + return array( + 'charts_settings_color' => array( + 'arguments' => array('form' => NULL), + ), + ); +} + +/** + * Implementation of hook_views_api(). + */ +function charts_views_api() { + return array( + 'api' => 2, + 'path' => drupal_get_path('module', 'charts') . '/views', + ); +} diff --git a/charts.inc b/charts.inc index 5bcb3b1f31b3b8b2cd3085599c9f9b7f572b4c2b..0f1c5197b07d016266e70203ef39bf22019df3d9 100644 --- a/charts.inc +++ b/charts.inc @@ -73,7 +73,9 @@ function _charts_chart(&$data) { */ function _chart_series_attributes(&$data, &$value, &$settings) { foreach ($settings['#series_attributes'] as $attribute) { - $data[$attribute] = $settings[$attribute][$value]; + if (isset($settings[$attribute][$value])) { + $data[$attribute] = $settings[$attribute][$value]; + } } } diff --git a/charts.info b/charts.info index b4bca202535e8ef28bdcb74a339c981f77dc8ece..f42e5a20cf3419698019c83b3ecedf77166861da 100644 --- a/charts.info +++ b/charts.info @@ -1,5 +1,10 @@ ; $Id$ -core = "6.x" +core = "7.x" description = "Transform DATA into INFORMATION using beautiful CHARTS." +files[] = charts.module +files[] = charts.admin.inc +files[] = charts.inc +files[] = charts.hooks.inc +files[] = charts.install name = "Charts" -package = "Charts" \ No newline at end of file +package = "Charts" diff --git a/charts.install b/charts.install index 6493359d90c3463f92f7d1762b304d10dd4f1b4f..8a8e6c5c54b3c06509a5404674315896e85d2468 100644 --- a/charts.install +++ b/charts.install @@ -6,7 +6,7 @@ * Install and unistall functions for this module */ -DEFINE(CHARTS_MINIMUM_PHP, '5.2.0'); +DEFINE('CHARTS_MINIMUM_PHP', '5.2.0'); /** * Implementation of hook_uninstall(). diff --git a/charts.module b/charts.module index 98154967cbb3cf09c0ccc26e8c2aea49146ca47a..315672929d8ee15afd0e220e8f14093df34ec4a8 100644 --- a/charts.module +++ b/charts.module @@ -5,7 +5,6 @@ * @file * Transform DATA into INFORMATION using beautiful CHARTS. * - * @note only hooks are here. * @note For instructions about the API, see chart_api.txt file. */ @@ -23,59 +22,3 @@ function charts_chart(&$data) { module_load_include('inc', 'charts'); return _charts_chart($data); } - -/** - * Immplementation of hook_chart_types(). - */ -function charts_chart_types() { - return array( - 'line2D' => t('Line 2D'), - 'hbar2D' => t('Horizontal Bar 2D'), - 'vbar2D' => t('Vertical Bar 2D'), - 'pie2D' => t('Pie 2D'), - 'pie3D' => t('Pie 3D'), - ); -} - -/** - * Implementation of hook_menu(). - */ -function charts_menu() { - $items['admin/settings/charts'] = array( - 'access arguments' => array('set default settings for charts'), - 'description' => 'Set the default behaviour and look of all your charts', - 'file' => 'charts.admin.inc', - 'page callback' => 'drupal_get_form', - 'page arguments' => array('_charts_settings_page'), - 'title' => 'Charts' - ); - return $items; -} - -/** - * Implementation of hook_perm(). - */ -function charts_perm() { - return array('set default settings for charts'); -} - -/** - * Implementation of hook_theme(). - */ -function charts_theme() { - return array( - 'charts_settings_color' => array( - 'arguments' => array('form' => NULL), - ), - ); -} - -/** - * Implementation of hook_views_api(). - */ -function charts_views_api() { - return array( - 'api' => 2, - 'path' => drupal_get_path('module', 'charts') .'/views', - ); -} diff --git a/charts_system/charts_system.hooks.inc b/charts_system/charts_system.hooks.inc new file mode 100644 index 0000000000000000000000000000000000000000..78986b1dc0521e39e466bf2a6acd1ba6d560905a --- /dev/null +++ b/charts_system/charts_system.hooks.inc @@ -0,0 +1,47 @@ +<?php +// $Id$ +/** + * @author Bruno Massa http://drupal.org/user/67164 + * @author TJ (based on his Chart module) + * @file + * Use Charts for Drupal administration + */ + +/** + * Implementation of hook_menu(). + */ +function charts_system_menu() { + $items['admin/reports/charts'] = array( + 'access arguments' => array('access site reports'), + 'file' => 'charts_system.inc', + 'page callback' => '_charts_system_charts', + 'page arguments' => array('nodes'), + 'title' => 'Charts' + ); + $items['admin/reports/charts/nodes'] = array( + 'access arguments' => array('access site reports'), + 'file' => 'charts_system.inc', + 'page callback' => '_charts_system_charts', + 'page arguments' => array('nodes'), + 'title' => 'Nodes', + 'type' => MENU_DEFAULT_LOCAL_TASK + ); + $items['admin/reports/charts/users'] = array( + 'access arguments' => array('access site reports'), + 'file' => 'charts_system.inc', + 'page callback' => '_charts_system_charts', + 'page arguments' => array('users'), + 'title' => 'Users', + 'type' => MENU_LOCAL_TASK + ); + $items['admin/reports/charts/watchdog'] = array( + 'access arguments' => array('access site reports'), + 'file' => 'charts_system.inc', + 'page callback' => '_charts_system_charts', + 'page arguments' => array('watchdog'), + 'title' => 'Watchdog', + 'type' => MENU_LOCAL_TASK + ); + + return $items; +} diff --git a/charts_system/charts_system.inc b/charts_system/charts_system.inc index db7758a4a5f360725bd743cd777672420d79f3c8..945e4279383cdad4d0a19d5f7b25b56532fe6024 100644 --- a/charts_system/charts_system.inc +++ b/charts_system/charts_system.inc @@ -81,7 +81,7 @@ function _charts_system_charts($ctype) { break; } - return '<div id="charts-system">'. $output .'</div>'; + return '<div id="charts-system">' . $output . '</div>'; } /** @@ -109,7 +109,7 @@ function _charts_system_generate($title, $sql, $callback = NULL) { $data[] = array( '#value' => $result['count'], - '#label' => $result['name'] .': '. $result['count'] + '#label' => $result['name'] . ': ' . $result['count'] ); } @@ -132,7 +132,7 @@ function _charts_system_generate($title, $sql, $callback = NULL) { * String. The HTML chart when all data is fine or a blank string */ function _charts_system_node_activity() { - $now = time(); + $now = REQUEST_TIME; $results = db_query('SELECT type, created FROM {node} @@ -144,11 +144,17 @@ function _charts_system_node_activity() { $max = array(); $counts = array(); $types = array(); + $type = 0; - while ($result = db_fetch_array($results)) { - $day = ltrim(date('d', $result['created']), '0'); - $types[$result['type']] = $type++; - $counts[$day][$result['type']]++; + foreach ($results as $result) { + $day = ltrim(date('d', $result->created), '0'); + $types[$result->type] = $type++; + if (isset($counts[$day][$result->type])) { + $counts[$day][$result->type]++; + } + else { + $counts[$day][$result->type] = 1; + } } // Generate data and labels diff --git a/charts_system/charts_system.info b/charts_system/charts_system.info index 8a9279155e64efe9aea635d5c7b89e475e79139a..c48030d197a61b1b57a636af5686735b29c6e2de 100644 --- a/charts_system/charts_system.info +++ b/charts_system/charts_system.info @@ -1,6 +1,8 @@ ; $Id$ -core = "6.x" +core = "7.x" dependencies[] = charts description = "Use Charts for Drupal administration" +files[] = charts_system.inc +files[] = charts_system.hooks.inc name = "Charts System" package = "Charts" diff --git a/charts_system/charts_system.module b/charts_system/charts_system.module index 78986b1dc0521e39e466bf2a6acd1ba6d560905a..b3d9bbc7f3711e882119cd6b3af051245d859d04 100644 --- a/charts_system/charts_system.module +++ b/charts_system/charts_system.module @@ -1,47 +1 @@ <?php -// $Id$ -/** - * @author Bruno Massa http://drupal.org/user/67164 - * @author TJ (based on his Chart module) - * @file - * Use Charts for Drupal administration - */ - -/** - * Implementation of hook_menu(). - */ -function charts_system_menu() { - $items['admin/reports/charts'] = array( - 'access arguments' => array('access site reports'), - 'file' => 'charts_system.inc', - 'page callback' => '_charts_system_charts', - 'page arguments' => array('nodes'), - 'title' => 'Charts' - ); - $items['admin/reports/charts/nodes'] = array( - 'access arguments' => array('access site reports'), - 'file' => 'charts_system.inc', - 'page callback' => '_charts_system_charts', - 'page arguments' => array('nodes'), - 'title' => 'Nodes', - 'type' => MENU_DEFAULT_LOCAL_TASK - ); - $items['admin/reports/charts/users'] = array( - 'access arguments' => array('access site reports'), - 'file' => 'charts_system.inc', - 'page callback' => '_charts_system_charts', - 'page arguments' => array('users'), - 'title' => 'Users', - 'type' => MENU_LOCAL_TASK - ); - $items['admin/reports/charts/watchdog'] = array( - 'access arguments' => array('access site reports'), - 'file' => 'charts_system.inc', - 'page callback' => '_charts_system_charts', - 'page arguments' => array('watchdog'), - 'title' => 'Watchdog', - 'type' => MENU_LOCAL_TASK - ); - - return $items; -} diff --git a/fusioncharts/fusioncharts.hooks.inc b/fusioncharts/fusioncharts.hooks.inc new file mode 100644 index 0000000000000000000000000000000000000000..aa63611d5fc18797e250daa190fa66c74fd784a3 --- /dev/null +++ b/fusioncharts/fusioncharts.hooks.inc @@ -0,0 +1,37 @@ +<?php +// $Id$ +/** + * @author Bruno Massa http://drupal.org/user/67164 + * @file + * Use FusionCharts on your site. + * + * @note only hooks are here. + */ + +/** + * Implementation of hook_charts_info(). + * + * Its a Charts module hook. It defines almost all aspects + * of a chart provider, like its name, what types of charts + * it can perform and what are the restrictions. + */ +function fusioncharts_charts_info() { + return array( + 'fusioncharts' => array( + 'file' => drupal_get_path('module', 'fusioncharts') . '/fusioncharts.inc', + 'name' => t('FusionCharts'), + 'render' => '_fusioncharts_charts_render', + 'types' => array('line2D', 'hbar2D', 'hbar3D', 'vbar2D', 'vbar3D', 'pie2D', 'pie3D'), + ), + ); +} + +/** + * Implementation of hook_chart_types(). + */ +function fusioncharts_chart_types() { + return array( + 'hbar3D' => t('Horizontal Bar 3D'), + 'vbar3D' => t('Vertical Bar 3D'), + ); +} diff --git a/fusioncharts/fusioncharts.inc b/fusioncharts/fusioncharts.inc index 2a66aa2323c87bc4765021d6e437774e042a9f80..0fc3020666d3d23b17038564de1b8f885b122b04 100644 --- a/fusioncharts/fusioncharts.inc +++ b/fusioncharts/fusioncharts.inc @@ -101,7 +101,7 @@ function _fusioncharts_charts_render(&$data) { return t('This type is not possible using %chartplugin', array('%chartplugin' => 'FusionCharts')); } - $file = file_create_url('fusioncharts') .'/'. $options[$data['#type']]; + $file = file_create_url('fusioncharts') . '/' . $options[$data['#type']]; // Convert the chat SIZE into the FusionCharts way. // Since its a requirement to build the chart on Google, if the value @@ -129,7 +129,7 @@ function _fusioncharts_charts_render(&$data) { return $message; } - $chart = '&dataXML='. str_replace('"', "'", format_xml_elements(array($chart))); + $chart = '&dataXML=' . str_replace('"', "'", format_xml_elements(array($chart))); // Its the HTML tag to include the chart return <<<FUSIONCHARTS diff --git a/fusioncharts/fusioncharts.info b/fusioncharts/fusioncharts.info index f74acb561939b1c21397e05ddfefc31cfd2928b4..d98e53c801be009a33f107ced00960b3b6139aa3 100644 --- a/fusioncharts/fusioncharts.info +++ b/fusioncharts/fusioncharts.info @@ -1,6 +1,9 @@ ; $Id$ -core = "6.x" +core = "7.x" dependencies[] = charts description = "Use FusionCharts on your site." +files[] = fusioncharts.inc +files[] = fusioncharts.hooks.inc +files[] = fusioncharts.install name = "FusionCharts" package = "Charts" diff --git a/fusioncharts/fusioncharts.install b/fusioncharts/fusioncharts.install index f59f1e7abbf543201e250287f2da6df5d86835b4..d5c142b4ee35813de4023b94a15186a195cb3977 100644 --- a/fusioncharts/fusioncharts.install +++ b/fusioncharts/fusioncharts.install @@ -10,8 +10,8 @@ * Implementation of hook_requirements(). */ function fusioncharts_requirements($phase) { - $path = file_create_path() .'/fusioncharts'; - if (!file_exists($path .'/MSLine.swf')) { + $path = file_create_path() . '/fusioncharts'; + if (!file_exists($path . '/MSLine.swf')) { $requirements['charts']['title'] = t('FusionCharts'); $requirements['charts']['value'] = t('FusionCharts flash files not installed'); $requirements['charts']['severity'] = REQUIREMENT_ERROR; diff --git a/fusioncharts/fusioncharts.module b/fusioncharts/fusioncharts.module index 03df4eea6688e6b7d2212f5ed8fa185b1ce448b1..b3d9bbc7f3711e882119cd6b3af051245d859d04 100644 --- a/fusioncharts/fusioncharts.module +++ b/fusioncharts/fusioncharts.module @@ -1,37 +1 @@ <?php -// $Id$ -/** - * @author Bruno Massa http://drupal.org/user/67164 - * @file - * Use FusionCharts on your site. - * - * @note only hooks are here. - */ - -/** - * Immplementation of hook_charts_info(). - * - * Its a Charts module hook. It defines almost all aspects - * of a chart provider, like its name, what types of charts - * it can perform and what are the restrictions. - */ -function fusioncharts_charts_info() { - return array( - 'fusioncharts' => array( - 'file' => drupal_get_path('module', 'fusioncharts') .'/fusioncharts.inc', - 'name' => t('FusionCharts'), - 'render' => '_fusioncharts_charts_render', - 'types' => array('line2D', 'hbar2D', 'hbar3D', 'vbar2D', 'vbar3D', 'pie2D', 'pie3D'), - ), - ); -} - -/** - * Immplementation of hook_chart_types(). - */ -function fusioncharts_chart_types() { - return array( - 'hbar3D' => t('Horizontal Bar 3D'), - 'vbar3D' => t('Vertical Bar 3D'), - ); -} diff --git a/google_charts/google_charts.hooks.inc b/google_charts/google_charts.hooks.inc new file mode 100644 index 0000000000000000000000000000000000000000..649d3b6d87abd0029bdc0cc1f7668bc3ca14ed6f --- /dev/null +++ b/google_charts/google_charts.hooks.inc @@ -0,0 +1,37 @@ +<?php +// $Id$ +/** + * @author Bruno Massa http://drupal.org/user/67164 + * @file + * Use Google Charts on your site. + * + * @note only hooks are here. + */ + +/** + * Implementation of hook_charts_info(). + * + * Its a Charts module hook. It defines almost all aspects + * of a chart provider, like its name, what types of charts + * it can perform and what are the restrictions. + */ +function google_charts_charts_info() { + return array( + 'google' => array( + 'file' => drupal_get_path('module', 'google_charts') . '/google_charts.inc', + 'name' => t('Google Chart'), + 'render' => '_google_charts_render', + 'types' => array('line2D', 'hbar2D', 'vbar2D', 'pie2D', 'pie3D', 'venn', 'scatter'), + ), + ); +} + +/** + * Implementation of hook_chart_types(). + */ +function google_charts_chart_types() { + return array( + 'venn' => t('Venn'), + 'scatter' => t('Scatter Plot'), + ); +} diff --git a/google_charts/google_charts.inc b/google_charts/google_charts.inc index 300ccd027c6c80ecf872357d4e21ba05861047b4..db26f35d2f669fb0817243232430755f54ff7ae6 100644 --- a/google_charts/google_charts.inc +++ b/google_charts/google_charts.inc @@ -42,7 +42,7 @@ function _google_charts_chart(&$chart, &$data) { $chart[] = 'cht=pc'; } else { - $chart[] = 'cht='. $options['typecode']; + $chart[] = 'cht=' . $options['typecode']; } // Convert the chat SIZE into the Google Chart way. @@ -51,17 +51,17 @@ function _google_charts_chart(&$chart, &$data) { if (empty($data['#width']) or empty($data['#height'])) { return t('Height and Width are required'); } - $chart[] = 'chs='. $data['#width'] .'x'. $data['#height']; + $chart[] = 'chs=' . $data['#width'] . 'x' . $data['#height']; // Add Title and Description to the chart if (!empty($data['#title'])) { - $chart[] = 'chtt='. $data['#title']; + $chart[] = 'chtt=' . $data['#title']; } // Chart background color. Since the default color // is white (#ffffff), only different colors are considered if (!empty($data['#color']['background']) and $data['#color']['background'] != '#ffffff') { - $chart[] = 'chf=bg,s,'. substr($data['#color']['background'], 1); + $chart[] = 'chf=bg,s,' . substr($data['#color']['background'], 1); } return; @@ -117,7 +117,7 @@ function _google_charts_render(&$data) { } // If its all ok, build the HTML img tag - return '<img src="http://chart.apis.google.com/chart?'. implode('&', $chart) .'" />'; + return '<img src="http://chart.apis.google.com/chart?' . implode('&', $chart) . '" />'; } /** @@ -165,10 +165,10 @@ function _google_charts_series(&$chart, &$data) { // Get the highlight points if (!empty($svalue['#highlight']) or ($data['#type'] == 'scatter' and ($series % 2 == 0))) { - $highlight[] = 't'. $svalue['#label'] .','. - (empty($svalue['#color']) ? substr($data[$series]['#color'], 1) : substr($svalue['#color'], 1)) .','. - $series .','. - $value .','. + $highlight[] = 't' . $svalue['#label'] . ',' . + (empty($svalue['#color']) ? substr($data[$series]['#color'], 1) : substr($svalue['#color'], 1)) . ',' . + $series . ',' . + $value . ',' . (empty($svalue['#size']) ? 10 : $svalue['#size']); } @@ -199,27 +199,27 @@ function _google_charts_series(&$chart, &$data) { } // Insert data - $chart[] = 'chd=s:'. $chart_data; + $chart[] = 'chd=s:' . $chart_data; // Insert series color if (!empty($colors)) { - $chart[] = 'chco='. implode(',', $colors); + $chart[] = 'chco=' . implode(',', $colors); } // Insert values labels if (!empty($value_labels)) { - $chart[] = 'chl='. implode('|', $value_labels); + $chart[] = 'chl=' . implode('|', $value_labels); } // Insert multiple series tag if ($options['legend'] and !empty($legends)) { - $chart[] = 'chdl='. implode('|', $legends); + $chart[] = 'chdl=' . implode('|', $legends); } // Insert values labels if (!empty($highlight)) { - $chart[] = 'chm='. implode('|', $highlight); + $chart[] = 'chm=' . implode('|', $highlight); } return; diff --git a/google_charts/google_charts.info b/google_charts/google_charts.info index 1c2f5a7dcebb6e869d8bb1b8ebfb869dd0db7254..5cbd0fe32ca8dd1e2c5000a65eb5d1a96b626d99 100644 --- a/google_charts/google_charts.info +++ b/google_charts/google_charts.info @@ -1,6 +1,8 @@ ; $Id$ -core = "6.x" +core = "7.x" dependencies[] = charts description = "Use Google Charts on your site." +files[] = google_charts.inc +files[] = google_charts.hooks.inc name = "Google" package = "Charts" diff --git a/google_charts/google_charts.module b/google_charts/google_charts.module index 2b28c96d97a51c5d905e8cd8bd66aeda9949851d..b3d9bbc7f3711e882119cd6b3af051245d859d04 100644 --- a/google_charts/google_charts.module +++ b/google_charts/google_charts.module @@ -1,37 +1 @@ <?php -// $Id$ -/** - * @author Bruno Massa http://drupal.org/user/67164 - * @file - * Use Google Charts on your site. - * - * @note only hooks are here. - */ - -/** - * Immplementation of hook_charts_info(). - * - * Its a Charts module hook. It defines almost all aspects - * of a chart provider, like its name, what types of charts - * it can perform and what are the restrictions. - */ -function google_charts_charts_info() { - return array( - 'google' => array( - 'file' => drupal_get_path('module', 'google_charts') .'/google_charts.inc', - 'name' => t('Google Chart'), - 'render' => '_google_charts_render', - 'types' => array('line2D', 'hbar2D', 'vbar2D', 'pie2D', 'pie3D', 'venn', 'scatter'), - ), - ); -} - -/** - * Immplementation of hook_chart_types(). - */ -function google_charts_chart_types() { - return array( - 'venn' => t('Venn'), - 'scatter' => t('Scatter Plot'), - ); -} diff --git a/openflashchart/openflashchart.hooks.inc b/openflashchart/openflashchart.hooks.inc new file mode 100644 index 0000000000000000000000000000000000000000..ce9627d30c1700e05dc9d55c24e66807f8b96fb5 --- /dev/null +++ b/openflashchart/openflashchart.hooks.inc @@ -0,0 +1,27 @@ +<?php +// $Id$ +/** + * @author Bruno Massa http://drupal.org/user/67164 + * @file + * Use Open Flash Chart on your site. + * + * @note only hooks are here. + */ + +/** + * Implementation of hook_charts_info(). + * + * Its a Charts module hook. It defines almost all aspects + * of a chart provider, like its name, what types of charts + * it can perform and what are the restrictions. + */ +function openflashchart_charts_info() { + return array( + 'openflashchart' => array( + 'file' => drupal_get_path('module', 'openflashchart') . '/openflashchart.inc', + 'name' => t('Open Flash Chart'), + 'render' => '_openflashchart_charts_render', + 'types' => array('line2D', 'vbar2D', 'vbar3D', 'pie2D'), + ), + ); +} diff --git a/openflashchart/openflashchart.info b/openflashchart/openflashchart.info index 244a1a19e76dd0fad5cbb1b00f06fab1b99d8d21..c122d41e8c896951154dc0498ce9bab7b9ed1d45 100644 --- a/openflashchart/openflashchart.info +++ b/openflashchart/openflashchart.info @@ -1,7 +1,9 @@ ; $Id$ -core = "6.x" +core = "7.x" dependencies[] = charts dependencies[] = open_flash_chart_api description = "Use Open Flash Charts on your site." +files[] = openflashchart.inc +files[] = openflashchart.hooks.inc name = "Open Flash Chart" package = "Charts" diff --git a/openflashchart/openflashchart.module b/openflashchart/openflashchart.module index c17cc8146d23f32dc81289c0bdca17dae7d8e85b..b3d9bbc7f3711e882119cd6b3af051245d859d04 100644 --- a/openflashchart/openflashchart.module +++ b/openflashchart/openflashchart.module @@ -1,27 +1 @@ <?php -// $Id$ -/** - * @author Bruno Massa http://drupal.org/user/67164 - * @file - * Use Open Flash Chart on your site. - * - * @note only hooks are here. - */ - -/** - * Immplementation of hook_charts_info(). - * - * Its a Charts module hook. It defines almost all aspects - * of a chart provider, like its name, what types of charts - * it can perform and what are the restrictions. - */ -function openflashchart_charts_info() { - return array( - 'openflashchart' => array( - 'file' => drupal_get_path('module', 'openflashchart') .'/openflashchart.inc', - 'name' => t('Open Flash Chart'), - 'render' => '_openflashchart_charts_render', - 'types' => array('line2D', 'vbar2D', 'vbar3D', 'pie2D'), - ), - ); -} diff --git a/views/charts.views.inc b/views/charts.views.inc index 474956ed9f93d2d8e5352c1e18b22c739f126080..834b7227d2a4bfa76968671b00a66d7a5fd059b0 100644 --- a/views/charts.views.inc +++ b/views/charts.views.inc @@ -7,10 +7,10 @@ */ /** -* Implementation of hook_views_plugins(). -* -* Define charts style for Views. -*/ + * Implementation of hook_views_plugins(). + * + * Define charts style for Views. + */ function charts_views_plugins() { // Views support is only possible if Views Calc module is enabled. It // is responsible for turn the Views values into a aggregates. @@ -24,7 +24,7 @@ function charts_views_plugins() { 'chart' => array( 'handler' => 'charts_plugin_style_chart', 'help' => t('Displays the content in several Chart styles.'), - 'path' => drupal_get_path('module', 'charts') .'/views', + 'path' => drupal_get_path('module', 'charts') . '/views', 'parent' => 'parent', 'title' => t('Chart'), 'type' => 'normal', diff --git a/views/charts_plugin_style_chart.inc b/views/charts_plugin_style_chart.inc index f957aa3fb1e9e24d533fe2ace7cae2d6b14a0a5e..0b6fa1a48343b0b32ed6e33d1742e5ccfdb2ad23 100644 --- a/views/charts_plugin_style_chart.inc +++ b/views/charts_plugin_style_chart.inc @@ -95,7 +95,7 @@ class charts_plugin_style_chart extends views_plugin_style { function options_submit(&$form, &$form_state) { $chart = &$form_state['values']['style_options']['charts']; foreach (element_children($chart) as $index) { - $chart['#'. $index] = $chart[$index]; + $chart['#' . $index] = $chart[$index]; unset($chart[$index]); } } @@ -158,7 +158,7 @@ class charts_plugin_style_chart extends views_plugin_style { } $value['#label'] = strip_tags(theme_views_view_field($this->view, $this->view->field[$key], $row)); if ($this->options['show_sums']) { - $value['#label'] .= ' ('. $row->$calc .')'; + $value['#label'] .= ' (' . $row->$calc . ')'; } $value['#value'] = $row->$calc; $chart[$calc][] = $value; @@ -188,7 +188,7 @@ class charts_plugin_style_chart extends views_plugin_style { // another aggregation in for this field. foreach ($this->view->field as $field) { - $query_field = substr($field->field, 0, 3) == 'cid' ? $field->definition['calc'] : $field->table .'.'. $field->field; + $query_field = substr($field->field, 0, 3) == 'cid' ? $field->definition['calc'] : $field->table . '.' . $field->field; $query_alias = $field->field_alias; // Add the aggregation. @@ -204,7 +204,7 @@ class charts_plugin_style_chart extends views_plugin_style { } // Add computed values. if (in_array($field->field, $this->calc_fields())) { - $sql = "ROUND(". $this->options['calc'] ."($query_field), ". $this->options['precision'] .")"; + $sql = "ROUND(" . $this->options['calc'] . "($query_field), " . $this->options['precision'] . ")"; $this->view->query->add_field(NULL, $sql, $field->field, array('aggregate' => TRUE)); // TODO This part is not relationship-safe, needs additional work