2013-02-06 Sergio Martin <sergio.martin@artica.es>
* include/functions_users.php include/functions_html.php: Added a new parameter on groups select functions to use any field as key of the select. Until now, the field used was only ID * include/functions_graph.php: Added a full url to the agent access graphs to show the menu of the interactive graphs in the metaconsole too: BUG 3592080 git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@7599 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f
This commit is contained in:
parent
db0aab59c0
commit
baa12cb90d
|
@ -1,3 +1,14 @@
|
|||
2013-02-06 Sergio Martin <sergio.martin@artica.es>
|
||||
|
||||
* include/functions_users.php
|
||||
include/functions_html.php: Added a new parameter
|
||||
on groups select functions to use any field as key
|
||||
of the select. Until now, the field used was only ID
|
||||
|
||||
* include/functions_graph.php: Added a full url
|
||||
to the agent access graphs to show the menu of the
|
||||
interactive graphs in the metaconsole too: BUG 3592080
|
||||
|
||||
2013-02-06 Miguel de Dios <miguel.dedios@artica.es>
|
||||
|
||||
* include/graphs/flot/pandora.flot.js: cleaned source code style.
|
||||
|
|
|
@ -1314,7 +1314,7 @@ function graphic_agentaccess ($id_agent, $width, $height, $period = 0) {
|
|||
echo fs_error_image();
|
||||
else {
|
||||
echo area_graph($config['flash_charts'], $data, $width, $height,
|
||||
null, null, null, ui_get_full_url("images/image_problem.opaque.png"), "", "", "",
|
||||
null, null, null, ui_get_full_url("images/image_problem.opaque.png"), "", "", ui_get_full_url(false, false, false, false),
|
||||
$water_mark,
|
||||
$config['fontpath'], $config['font_size'], "");
|
||||
}
|
||||
|
|
|
@ -203,16 +203,18 @@ function html_print_select_style ($fields, $name, $selected = '', $style='', $sc
|
|||
* @param bool Whether to sort the options or not (optional, unsorted by default).
|
||||
* @param string $style The string of style.
|
||||
* @param integer $id_group The id of node that must do not show the children and own.
|
||||
* @param string $keys_field The field of the group used in the array keys. By default ID
|
||||
*
|
||||
* @return string HTML code if return parameter is true.
|
||||
*/
|
||||
function html_print_select_groups($id_user = false, $privilege = "AR", $returnAllGroup = true,
|
||||
$name, $selected = '', $script = '', $nothing = '', $nothing_value = 0, $return = false,
|
||||
$multiple = false, $sort = true, $class = '', $disabled = false, $style = false, $option_style = false, $id_group = false) {
|
||||
$multiple = false, $sort = true, $class = '', $disabled = false, $style = false, $option_style = false,
|
||||
$id_group = false, $keys_field = 'id_grupo') {
|
||||
global $config;
|
||||
|
||||
$fields = users_get_groups_for_select($id_user, $privilege,
|
||||
$returnAllGroup, true, $id_group);
|
||||
$returnAllGroup, true, $id_group, $keys_field);
|
||||
|
||||
$output = html_print_select ($fields, $name, $selected, $script,
|
||||
$nothing, $nothing_value, $return, $multiple, false, $class,
|
||||
|
|
|
@ -81,16 +81,17 @@ function users_get_all_model_groups () {
|
|||
* @param boolean $returnAllGroup Flag the return group, by default true.
|
||||
* @param boolean $returnAllColumns Flag to return all columns of groups.
|
||||
* @param array $id_groups The id of node that must do not show the children and own.
|
||||
* @param string $keys_field The field of the group used in the array keys. By default ID
|
||||
*
|
||||
* @return array A list of the groups the user has certain privileges.
|
||||
*/
|
||||
function users_get_groups_for_select($id_user, $privilege = "AR", $returnAllGroup = true, $returnAllColumns = false, $id_groups = null) {
|
||||
function users_get_groups_for_select($id_user, $privilege = "AR", $returnAllGroup = true, $returnAllColumns = false, $id_groups = null, $keys_field = 'id_grupo') {
|
||||
if($id_groups === false) {
|
||||
$id_groups = null;
|
||||
}
|
||||
|
||||
$user_groups = users_get_groups ($id_user, $privilege, $returnAllGroup, $returnAllColumns);
|
||||
|
||||
$user_groups = users_get_groups ($id_user, $privilege, $returnAllGroup, $returnAllColumns, null);
|
||||
|
||||
if ($id_groups !== null) {
|
||||
$childrens = groups_get_childrens($id_groups);
|
||||
foreach ($childrens as $child) {
|
||||
|
@ -104,8 +105,8 @@ function users_get_groups_for_select($id_user, $privilege = "AR", $returnAllGro
|
|||
}
|
||||
else {
|
||||
// First group it's needed to retrieve its parent group
|
||||
$first_group = array_slice($user_groups, 0, 1);
|
||||
$parent_group = $first_group[0]['parent'];
|
||||
$first_group = reset(array_slice($user_groups, 0, 1));
|
||||
$parent_group = $first_group['parent'];
|
||||
|
||||
$user_groups_tree = groups_get_groups_tree_recursive($user_groups, $parent_group);
|
||||
}
|
||||
|
@ -113,8 +114,8 @@ function users_get_groups_for_select($id_user, $privilege = "AR", $returnAllGro
|
|||
|
||||
foreach ($user_groups_tree as $group) {
|
||||
$groupName = ui_print_truncate_text($group['nombre'], GENERIC_SIZE_TEXT, false, true, false);
|
||||
|
||||
$fields[$group['id_grupo']] = str_repeat(" ", $group['deep']) . $groupName;
|
||||
|
||||
$fields[$group[$keys_field]] = str_repeat(" ", $group['deep']) . $groupName;
|
||||
}
|
||||
|
||||
return $fields;
|
||||
|
@ -128,10 +129,11 @@ function users_get_groups_for_select($id_user, $privilege = "AR", $returnAllGro
|
|||
* @param boolean $returnAllGroup Flag the return group, by default true.
|
||||
* @param boolean $returnAllColumns Flag to return all columns of groups.
|
||||
* @param array $id_groups The list of group to scan to bottom child. By default null.
|
||||
* @param string $keys_field The field of the group used in the array keys. By default ID
|
||||
*
|
||||
* @return array A list of the groups the user has certain privileges.
|
||||
*/
|
||||
function users_get_groups ($id_user = false, $privilege = "AR", $returnAllGroup = true, $returnAllColumns = false, $id_groups = null) {
|
||||
function users_get_groups ($id_user = false, $privilege = "AR", $returnAllGroup = true, $returnAllColumns = false, $id_groups = null, $keys_field = 'id_grupo') {
|
||||
if (empty ($id_user)) {
|
||||
global $config;
|
||||
|
||||
|
@ -178,18 +180,18 @@ function users_get_groups ($id_user = false, $privilege = "AR", $returnAllGroup
|
|||
foreach ($groups as $group) {
|
||||
if ($privilege === false) {
|
||||
if ($returnAllColumns) {
|
||||
$user_groups[$group['id_grupo']] = $group;
|
||||
$user_groups[$group[$keys_field]] = $group;
|
||||
}
|
||||
else {
|
||||
$user_groups[$group['id_grupo']] = $group['nombre'];
|
||||
$user_groups[$group[$keys_field]] = $group['nombre'];
|
||||
}
|
||||
}
|
||||
else if (check_acl($id_user, $group["id_grupo"], $privilege)) {
|
||||
if ($returnAllColumns) {
|
||||
$user_groups[$group['id_grupo']] = $group;
|
||||
$user_groups[$group[$keys_field]] = $group;
|
||||
}
|
||||
else {
|
||||
$user_groups[$group['id_grupo']] = $group['nombre'];
|
||||
$user_groups[$group[$keys_field]] = $group['nombre'];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue