From 95b336dea38ab1819983476bba7d18ed470e7404 Mon Sep 17 00:00:00 2001 From: Cameron Date: Wed, 1 May 2019 17:08:33 -0700 Subject: [PATCH] Fix for getUsersInClass() query. Chart class experiment (commented out) --- e107_handlers/chart_class.php | 88 ++++++++++++++++++++++++++++++- e107_handlers/userclass_class.php | 4 +- e107_plugins/poll/poll_menu.php | 2 +- 3 files changed, 91 insertions(+), 3 deletions(-) diff --git a/e107_handlers/chart_class.php b/e107_handlers/chart_class.php index 1073cc318..67f8c0e67 100644 --- a/e107_handlers/chart_class.php +++ b/e107_handlers/chart_class.php @@ -451,8 +451,94 @@ class e_chart break; } + + + // Toggle Data from clicking on Legend. //FIXME + /* $js .= " + + + // create columns array + var columns".$id." = []; + // display these data series by default + var defaultSeries = [1, 3]; + var series".$id." = {}; + for (var i = 0; i < data.getNumberOfColumns(); i++) { + if (i == 0 || defaultSeries.indexOf(i) > -1) { + // if the column is the domain column or in the default list, display the series + columns".$id.".push(i); + } + else { + // otherwise, hide it + columns".$id.".push({ + label: data.getColumnLabel(i), + type: data.getColumnType(i), + sourceColumn: i, + calc: function () { + return null; + } + }); + } + if (i > 0) { + columns".$id.".push({ + calc: 'stringify', + sourceColumn: i, + type: 'string', + role: 'annotation' + }); + // set the default series option + series".$id."[i - 1] = {}; + if (defaultSeries.indexOf(i) == -1) { + // backup the default color (if set) + if (typeof(series".$id."[i - 1].color) !== 'undefined') { + series".$id."[i - 1].backupColor = series".$id."[i - 1].color; + } + series".$id."[i - 1].color = '#CCCCCC'; + } + } + } + + + function showHideSeries".$id." () { + var sel = chart.getSelection(); + // if selection length is 0, we deselected an element + if (sel.length > 0) { + // if row is undefined, we clicked on the legend + if (sel[0].row == null) { + var col = sel[0].column; + if (typeof(columns".$id."[col]) == 'number') { + var src = columns".$id."[col]; - + // hide the data series + columns".$id."[col] = { + label: data.getColumnLabel(src), + type: data.getColumnType(src), + sourceColumn: src, + calc: function () { + return null; + } + }; + + // grey out the legend entry + series".$id."[src - 1].color = '#CCCCCC'; + } + else { + var src = columns".$id."[col].sourceColumn; + + // show the data series + columns".$id."[col] = src; + series".$id."[src - 1].color = null; + } + var view = new google.visualization.DataView(data); + view.setColumns(columns".$id."); + chart.draw(view, options); + } + } + } + + google.visualization.events.addListener(chart, 'select', showHideSeries".$id."); + "; +*/ + $js .= " chart.draw(data, options); } diff --git a/e107_handlers/userclass_class.php b/e107_handlers/userclass_class.php index f16881aa0..599390132 100644 --- a/e107_handlers/userclass_class.php +++ b/e107_handlers/userclass_class.php @@ -268,11 +268,13 @@ class user_class $blockers = array(e_UC_PUBLIC => 1, e_UC_READONLY => 1, e_UC_MEMBER => 1, e_UC_NOBODY => 1, e_UC_GUEST => 1, e_UC_NEWUSER => 1, e_UC_BOTS => 1); $possibles = array_flip(explode(',',$classList)); unset($possibles[e_UC_READONLY]); + foreach ($this->class_tree as $uc => $uv) { if (!isset($blockers[$uc])) { $ec = $uv['userclass_editclass']; + // $ec = $uv['userclass_visibility']; if (isset($possibles[$ec])) { $ret[] = $uc; @@ -1189,7 +1191,7 @@ class user_class { $class_regex = implode('|', array_flip($classList)); $regex = "(^|,)(".e107::getParser()->toDB($class_regex).")(,|$)"; - $qry[] = "user_class REGEXP '{$regex}' ORDER BY '{$orderBy}'"; + $qry[] = "user_class REGEXP '{$regex}' "; } if(empty($qry)) diff --git a/e107_plugins/poll/poll_menu.php b/e107_plugins/poll/poll_menu.php index 39e202ee4..ec8bc0eba 100644 --- a/e107_plugins/poll/poll_menu.php +++ b/e107_plugins/poll/poll_menu.php @@ -19,7 +19,7 @@ if(defined("POLLRENDERED")) if (!e107::isInstalled('poll')) { - return null; + return null; } if(!defined("POLLCLASS"))