Skip to content

Commit

Permalink
changed: updated for Elgg 6
Browse files Browse the repository at this point in the history
  • Loading branch information
jdalsem committed May 23, 2024
1 parent 5c61699 commit c0e1409
Show file tree
Hide file tree
Showing 104 changed files with 672 additions and 32,130 deletions.
4 changes: 3 additions & 1 deletion .github/workflows/phpunit.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@ name: PHPUnit Plugin Tests
on: [push, pull_request]

jobs:
lint:
phpunit:
name: Run PHPUnit test suites
uses: ColdTrick/.github/.github/workflows/phpunit.yml@master
with:
elgg_major_version: 6
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
Advanced Statistics
===================

![Elgg 5.0](https://img.shields.io/badge/Elgg-5.0-green.svg)
![Elgg 6.0](https://img.shields.io/badge/Elgg-6.0-green.svg)
![Lint Checks](https://github.com/ColdTrick/advanced_statistics/actions/workflows/lint.yml/badge.svg?event=push)
[![Latest Stable Version](https://poser.pugx.org/coldtrick/advanced_statistics/v/stable.svg)](https://packagist.org/packages/coldtrick/advanced_statistics)
[![License](https://poser.pugx.org/coldtrick/advanced_statistics/license.svg)](https://packagist.org/packages/coldtrick/advanced_statistics)
Expand Down
16 changes: 15 additions & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,21 @@
"source": "https://github.com/ColdTrick/advanced_statistics",
"issues": "https://github.com/ColdTrick/advanced_statistics/issues"
},
"require": {
"npm-asset/chart.js": "~4.4.0"
},
"repositories": [
{
"type": "composer",
"url": "https://asset-packagist.org"
}
],
"config": {
"fxp-asset": {
"enabled": false
}
},
"conflict": {
"elgg/elgg": "<5.0"
"elgg/elgg": "<6.0"
}
}
32 changes: 30 additions & 2 deletions composer.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

14 changes: 12 additions & 2 deletions elgg-plugin.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,11 @@

require_once(dirname(__FILE__) . '/lib/functions.php');

$composer_path = '';
if (is_dir(__DIR__ . '/vendor')) {
$composer_path = __DIR__ . '/';
}

use Elgg\Router\Middleware\GroupPageOwnerCanEditGatekeeper;

return [
Expand Down Expand Up @@ -36,24 +41,29 @@
],
'views' => [
'default' => [
'js/jqplot/' => __DIR__ . '/vendors/jqplot',
'chartjs.mjs' => $composer_path . 'vendor/npm-asset/chart.js/dist/chart.umd.js',
],
],
'view_extensions' => [
'admin.css' => [
'advanced_statistics/charts.css' => [],
],
'advanced_statistics/account/statistics/likes' => [
'advanced_statistics/account/statistics/likes_graph' => [],
],
'core/settings/statistics' => [
'advanced_statistics/account/statistics/likes' => [],
],
'elgg.css' => [
'advanced_statistics/charts.css' => [],
],
],
'view_options' => [
'widgets/online_user_count/content' => ['ajax' => true],
'advanced_statistics/account/statistics/details' => ['ajax' => true],
'advanced_statistics/account' => ['ajax' => true],
'advanced_statistics/admin_data' => ['ajax' => true],
'advanced_statistics/group_data' => ['ajax' => true],
'css/advanced_statistics/jqplot' => ['simplecache' => true],
],
'widgets' => [
'advanced_statistics' => [
Expand Down
11 changes: 5 additions & 6 deletions languages/en.php
Original file line number Diff line number Diff line change
Expand Up @@ -74,17 +74,16 @@
'advanced_statistics:groups:most_active' => "Most active groups (last week)",
'advanced_statistics:groups:least_active' => "Least active groups",
'advanced_statistics:groups:dead_vs_alive' => "Dead vs. Alive",
'advanced_statistics:groups:dead_vs_alive:last_month' => "< 1 month [%d]",
'advanced_statistics:groups:dead_vs_alive:3_months' => "< 3 months [%d]",
'advanced_statistics:groups:dead_vs_alive:6_months' => "< 6 months [%d]",
'advanced_statistics:groups:dead_vs_alive:year' => "< 1 year [%d]",
'advanced_statistics:groups:dead_vs_alive:more_year' => "> 1 year [%d]",
'advanced_statistics:groups:dead_vs_alive:last_month' => "< 1 month",
'advanced_statistics:groups:dead_vs_alive:3_months' => "< 3 months",
'advanced_statistics:groups:dead_vs_alive:6_months' => "< 6 months",
'advanced_statistics:groups:dead_vs_alive:year' => "< 1 year",
'advanced_statistics:groups:dead_vs_alive:more_year' => "> 1 year",

// widgets
'widgets:advanced_statistics:name' => "Advanced Statistics",
'widgets:advanced_statistics:description' => "Show some advanced statistics",
'advanced_statistics:widgets:advanced_statistics:content:no_chart' => "Edit the widget to select a chart.",
'advanced_statistics:widgets:advanced_statistics:content:no_jqplot' => "Please refresh the page to make this widget work.",

'widgets:online_user_count:name' => "Online Users Counter",
'widgets:online_user_count:description' => "Show the amount of online users and will automatically refresh",
Expand Down
11 changes: 5 additions & 6 deletions languages/es.php
Original file line number Diff line number Diff line change
Expand Up @@ -33,15 +33,14 @@
'advanced_statistics:groups:most_active' => 'Grupos más activos (última semana)',
'advanced_statistics:groups:least_active' => 'Grupos menos activos',
'advanced_statistics:groups:dead_vs_alive' => 'Muertos vs. Vivos',
'advanced_statistics:groups:dead_vs_alive:last_month' => '< 1 mes [%d]',
'advanced_statistics:groups:dead_vs_alive:3_months' => '< 3 meses [%d]',
'advanced_statistics:groups:dead_vs_alive:6_months' => '< 6 meses [%d]',
'advanced_statistics:groups:dead_vs_alive:year' => '< 1 año [%d]',
'advanced_statistics:groups:dead_vs_alive:more_year' => '> 1 año [%d]',
'advanced_statistics:groups:dead_vs_alive:last_month' => '< 1 mes',
'advanced_statistics:groups:dead_vs_alive:3_months' => '< 3 meses',
'advanced_statistics:groups:dead_vs_alive:6_months' => '< 6 meses',
'advanced_statistics:groups:dead_vs_alive:year' => '< 1 año',
'advanced_statistics:groups:dead_vs_alive:more_year' => '> 1 año',
'widgets:advanced_statistics:name' => 'Estadísticas avanzadas',
'widgets:advanced_statistics:description' => 'Mostrar algunas estadísticas avanzadas',
'advanced_statistics:widgets:advanced_statistics:content:no_chart' => 'Editar el widget para elegir un gráfico.',
'advanced_statistics:widgets:advanced_statistics:content:no_jqplot' => 'Por favor actualiza la página para que este widget funcione.',
'widgets:online_user_count:name' => 'Contador de usuarios en linea',
'widgets:online_user_count:description' => 'Mostrar la cantidad de usuario en linea y actualizar automáticamente',
);
11 changes: 5 additions & 6 deletions languages/fr.php
Original file line number Diff line number Diff line change
Expand Up @@ -33,15 +33,14 @@
'advanced_statistics:groups:most_active' => 'Groupes les plus actifs (dernière semaine)',
'advanced_statistics:groups:least_active' => 'Groupes les moins actifs',
'advanced_statistics:groups:dead_vs_alive' => 'Inactif vs. Actif',
'advanced_statistics:groups:dead_vs_alive:last_month' => '< 1 mois [%d]',
'advanced_statistics:groups:dead_vs_alive:3_months' => '< 3 mois [%d]',
'advanced_statistics:groups:dead_vs_alive:6_months' => '< 6 mois [%d]',
'advanced_statistics:groups:dead_vs_alive:year' => '< 1 an [%d]',
'advanced_statistics:groups:dead_vs_alive:more_year' => '> 1 an [%d]',
'advanced_statistics:groups:dead_vs_alive:last_month' => '< 1 mois',
'advanced_statistics:groups:dead_vs_alive:3_months' => '< 3 mois',
'advanced_statistics:groups:dead_vs_alive:6_months' => '< 6 mois',
'advanced_statistics:groups:dead_vs_alive:year' => '< 1 an',
'advanced_statistics:groups:dead_vs_alive:more_year' => '> 1 an',
'widgets:advanced_statistics:name' => 'Statistiques avancées',
'widgets:advanced_statistics:description' => 'Afficher quelques statistiques avancées',
'advanced_statistics:widgets:advanced_statistics:content:no_chart' => 'Configurer le widget pour sélectionner un graphique.',
'advanced_statistics:widgets:advanced_statistics:content:no_jqplot' => 'Veuillez rafraîchir la page pour afficher le contenu de ce widget.',
'widgets:online_user_count:name' => 'Compteur de membres connectés',
'widgets:online_user_count:description' => 'Affiche le nombre de membres connectés et se rafraîchit automatiquement',
);
11 changes: 5 additions & 6 deletions languages/nl.php
Original file line number Diff line number Diff line change
Expand Up @@ -77,15 +77,14 @@
'advanced_statistics:groups:most_active' => 'Meest actieve groepen (laatste week)',
'advanced_statistics:groups:least_active' => 'Minst actieve groepen',
'advanced_statistics:groups:dead_vs_alive' => 'Dood vs Levend',
'advanced_statistics:groups:dead_vs_alive:last_month' => '< 1 maand [%d]',
'advanced_statistics:groups:dead_vs_alive:3_months' => '< 3 maanden [%d]',
'advanced_statistics:groups:dead_vs_alive:6_months' => '< 6 maanden [%d]',
'advanced_statistics:groups:dead_vs_alive:year' => '< 1 jaar [%d]',
'advanced_statistics:groups:dead_vs_alive:more_year' => '> 1 jaar [%d]',
'advanced_statistics:groups:dead_vs_alive:last_month' => '< 1 maand',
'advanced_statistics:groups:dead_vs_alive:3_months' => '< 3 maanden',
'advanced_statistics:groups:dead_vs_alive:6_months' => '< 6 maanden',
'advanced_statistics:groups:dead_vs_alive:year' => '< 1 jaar',
'advanced_statistics:groups:dead_vs_alive:more_year' => '> 1 jaar',
'widgets:advanced_statistics:name' => 'Geavanceerde Statistieken',
'widgets:advanced_statistics:description' => 'Toon enkele geavanceerde statistieken',
'advanced_statistics:widgets:advanced_statistics:content:no_chart' => 'Bewerk de widget om een grafiek te selecteren',
'advanced_statistics:widgets:advanced_statistics:content:no_jqplot' => 'Ververs de pagina om deze widget te laten werken',
'widgets:online_user_count:name' => 'Online gebruikers teller',
'widgets:online_user_count:description' => 'Toont het aantal online gebruikers en zal dit automatisch verversen',
'advanced_statistics:users:friend_bundled' => 'Gegroepeerde aantallen vrienden',
Expand Down
69 changes: 30 additions & 39 deletions lib/functions.php
Original file line number Diff line number Diff line change
Expand Up @@ -45,59 +45,50 @@ function advanced_statistics_get_timestamp_query_part(string $field_name): strin
* @return array
*/
function advanced_statistics_get_default_chart_options(string $type): array {

$defaults = [
'pie' => [
'seriesDefaults' => [
'renderer' => '$.jqplot.PieRenderer',
'rendererOptions' => [
'showDataLabels' => true
'options' => [
'maintainAspectRatio' => false,
'plugins' => [
'legend' => [
'display' => false,
],
],
'legend' => [
'show' => true,
'location' => 'e',
],
],
'bar' => [
'seriesDefaults' => [
'renderer' => '$.jqplot.BarRenderer',
'pointLabels' => [
'show' => true,
'stackedValue' => true,
];

$type_defaults = [
'pie' => [
'type' => 'pie',
'options' => [
'plugins' => [
'legend' => [
'display' => true,
],
],
],
'legend' => [
'show' => false,
],
'axes' => [
'xaxis' => [
'renderer' => '$.jqplot.CategoryAxisRenderer',
],
'bar' => [
'type' => 'bar',
'options' => [
'scales' => [
'y' => [
'min' => 0,
],
],
],
],
'date' => [
'axes' => [
'xaxis' => [
'renderer' => '$.jqplot.DateAxisRenderer',
],
'yaxis' => [
'autoscale' => true,
'min' => 0,
],
'y2axis' => [
'autoscale' => true,
'min' => 0,
'tickOptions' => [
'showGridline' => false,
'type' => 'line',
'options' => [
'scales' => [
'y' => [
'min' => 0,
],
],
],
'highlighter' => [
'show' => true,
'sizeAdjust' => 7.5,
],
],
];

return $defaults[$type];
return array_merge_recursive($defaults, $type_defaults[$type]);
}
21 changes: 0 additions & 21 deletions vendors/jqplot/MIT-LICENSE.txt

This file was deleted.

Loading

0 comments on commit c0e1409

Please sign in to comment.