mirror of
https://github.com/pandorafms/pandorafms.git
synced 2025-07-29 08:45:12 +02:00
Merge branch 'ent-7222-Bug-en-widget-Defined-custom-graph' into 'develop'
fixed minor error See merge request artica/pandorafms!3960
This commit is contained in:
commit
316aa0a691
@ -113,7 +113,7 @@ function custom_graphs_create(
|
|||||||
* @param $returnAllGroup Wheter to return graphs of group All or not.
|
* @param $returnAllGroup Wheter to return graphs of group All or not.
|
||||||
* @param $privileges Privileges to check in user group
|
* @param $privileges Privileges to check in user group
|
||||||
*
|
*
|
||||||
* @return Custom graphs of a an user. Empty array if none.
|
* @return array graphs of a an user. Empty array if none.
|
||||||
*/
|
*/
|
||||||
function custom_graphs_get_user($id_user=0, $only_names=false, $returnAllGroup=true, $privileges='RR')
|
function custom_graphs_get_user($id_user=0, $only_names=false, $returnAllGroup=true, $privileges='RR')
|
||||||
{
|
{
|
||||||
|
@ -245,17 +245,26 @@ class CustomGraphWidget extends Widget
|
|||||||
|
|
||||||
$return_all_group = false;
|
$return_all_group = false;
|
||||||
|
|
||||||
if (users_can_manage_group_all('RM')) {
|
if (users_can_manage_group_all('RM') === true) {
|
||||||
$return_all_group = true;
|
$return_all_group = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Custom graph.
|
// Custom graph.
|
||||||
$fields = \custom_graphs_get_user(0, false, $return_all_group);
|
$fields = \custom_graphs_get_user(0, false, $return_all_group);
|
||||||
|
|
||||||
// If currently selected graph is not included in fields array (it belongs to a group over which user has no permissions), then add it to fields array.
|
// If currently selected graph is not included in fields array
|
||||||
// This is aimed to avoid overriding this value when a user with narrower permissions edits widget configuration.
|
// (it belongs to a group over which user has no permissions),
|
||||||
if ($values['id_graph'] !== null && !array_key_exists($values['id_graph'], $fields)) {
|
// then add it to fields array.
|
||||||
$selected_graph = db_get_row('tgraph', 'id_graph', $values['id_graph']);
|
// This is aimed to avoid overriding this value when a user
|
||||||
|
// with narrower permissions edits widget configuration.
|
||||||
|
if ($values['id_graph'] !== null
|
||||||
|
&& array_key_exists($values['id_graph'], $fields) === false
|
||||||
|
) {
|
||||||
|
$selected_graph = db_get_row(
|
||||||
|
'tgraph',
|
||||||
|
'id_graph',
|
||||||
|
$values['id_graph']
|
||||||
|
);
|
||||||
|
|
||||||
$fields[$values['id_graph']] = $selected_graph;
|
$fields[$values['id_graph']] = $selected_graph;
|
||||||
}
|
}
|
||||||
@ -366,7 +375,8 @@ class CustomGraphWidget extends Widget
|
|||||||
);
|
);
|
||||||
|
|
||||||
$hackLegendHight = (30 * count($sources));
|
$hackLegendHight = (30 * count($sources));
|
||||||
if ($hackLegendHight > ($size['height'] - 10 - $hackLegendHight)) {
|
$operation = ($size['height'] - 10 - $hackLegendHight);
|
||||||
|
if ($hackLegendHight < $operation) {
|
||||||
$height = ($size['height'] - $hackLegendHight);
|
$height = ($size['height'] - $hackLegendHight);
|
||||||
} else {
|
} else {
|
||||||
$height = ($size['height'] - 10);
|
$height = ($size['height'] - 10);
|
||||||
@ -406,7 +416,6 @@ class CustomGraphWidget extends Widget
|
|||||||
'height' => $height,
|
'height' => $height,
|
||||||
'only_image' => false,
|
'only_image' => false,
|
||||||
'homeurl' => $config['homeurl'],
|
'homeurl' => $config['homeurl'],
|
||||||
'percentil' => $percentil,
|
|
||||||
'backgroundColor' => 'transparent',
|
'backgroundColor' => 'transparent',
|
||||||
'menu' => false,
|
'menu' => false,
|
||||||
'show_legend' => $this->values['showLegend'],
|
'show_legend' => $this->values['showLegend'],
|
||||||
|
Loading…
x
Reference in New Issue
Block a user