Merge branch 'dashboards-in-home-page-dev' into 'develop'
Added dashboards to "edit my user" section See merge request !391
This commit is contained in:
commit
3118a70f66
|
@ -1990,9 +1990,32 @@ function get_os_name ($id_os) {
|
|||
* @return array Dashboard name of the given user.
|
||||
*/
|
||||
function get_user_dashboards ($id_user) {
|
||||
$sql = "SELECT name
|
||||
FROM tdashboard
|
||||
WHERE id_user="."'".$id_user."'";
|
||||
if (users_is_admin($id_user)) {
|
||||
$sql = "SELECT name
|
||||
FROM tdashboard WHERE id_user = '" . $id_user ."' OR id_user = ''";
|
||||
}
|
||||
else {
|
||||
$user_can_manage_all = users_can_manage_group_all('RR');
|
||||
if ($user_can_manage_all) {
|
||||
$sql = "SELECT name
|
||||
FROM tdashboard WHERE id_user = '" . $id_user ."' OR id_user = ''";
|
||||
}
|
||||
else {
|
||||
$user_groups = users_get_groups($id_user, "RR", false);
|
||||
if (empty($user_groups)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
$u_groups = array();
|
||||
foreach ($user_groups as $id => $group_name) {
|
||||
$u_groups[] = $id;
|
||||
}
|
||||
|
||||
$sql = "SELECT name
|
||||
FROM tdashboard
|
||||
WHERE id_group IN (" . implode(",", $u_groups) . ") AND (id_user = '" . $id_user ."' OR id_user = '')";
|
||||
}
|
||||
}
|
||||
|
||||
return db_get_all_rows_sql ($sql);
|
||||
}
|
||||
|
|
|
@ -288,6 +288,7 @@ if (!$meta) {
|
|||
|
||||
if (enterprise_installed()) {
|
||||
$dashboards = get_user_dashboards ($config['id_user']);
|
||||
|
||||
$dashboards_aux = array();
|
||||
if ($dashboards === false) {
|
||||
$dashboards = array('None'=>'None');
|
||||
|
|
Loading…
Reference in New Issue