Private GIT
Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
C
centreon
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Model registry
Operate
Environments
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
GitLab community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
vlbox
centreon
Commits
3e9d7859
Commit
3e9d7859
authored
Feb 28, 2018
by
Jean-Baptiste
Committed by
Loic Laurent
Feb 28, 2018
Browse files
Options
Downloads
Patches
Plain Diff
Add views - Filter And Sort (#6054)
* Fix filter bug in adding views and sorting views.
parent
7a680e03
No related branches found
No related tags found
No related merge requests found
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
www/api/class/centreon_home_customview.class.php
+30
-26
30 additions, 26 deletions
www/api/class/centreon_home_customview.class.php
with
30 additions
and
26 deletions
www/api/class/centreon_home_customview.class.php
+
30
−
26
View file @
3e9d7859
...
...
@@ -52,36 +52,41 @@ class CentreonHomeCustomview extends CentreonWebService
public
function
getListSharedViews
()
{
global
$centreon
;
$views
=
array
();
$q
=
array
();
if
(
isset
(
$this
->
arguments
[
'q'
])
&&
$this
->
arguments
[
'q'
]
!=
''
)
{
$q
[]
=
'%'
.
$this
->
arguments
[
'q'
]
.
'%'
;
}
$query
=
'SELECT custom_view_id, name FROM ('
.
'SELECT cv.custom_view_id, cv.name FROM custom_views cv '
.
'INNER JOIN custom_view_user_relation cvur ON cv.custom_view_id = cvur.custom_view_id '
.
'WHERE (cvur.user_id = '
.
$centreon
->
user
->
user_id
.
' '
.
'OR cvur.usergroup_id IN ( '
.
'SELECT contactgroup_cg_id '
.
'FROM contactgroup_contact_relation '
.
'WHERE contact_contact_id = '
.
$centreon
->
user
->
user_id
.
' '
.
') '
.
') '
.
'UNION '
.
'SELECT cv2.custom_view_id, cv2.name FROM custom_views cv2 '
.
'WHERE cv2.public = 1 ) as d '
.
'WHERE d.custom_view_id NOT IN ('
.
'SELECT cvur2.custom_view_id FROM custom_view_user_relation cvur2 '
.
'WHERE cvur2.user_id = '
.
$centreon
->
user
->
user_id
.
' '
.
'AND cvur2.is_consumed = 1) '
;
$dbResult
=
$this
->
pearDB
->
query
(
$query
);
while
(
$row
=
$dbResult
->
fetchRow
())
{
$query
=
'SELECT custom_view_id, name FROM ('
.
'SELECT cv.custom_view_id, cv.name FROM custom_views cv '
.
'INNER JOIN custom_view_user_relation cvur ON cv.custom_view_id = cvur.custom_view_id '
.
'WHERE (cvur.user_id = '
.
$centreon
->
user
->
user_id
.
' '
.
'OR cvur.usergroup_id IN ( '
.
'SELECT contactgroup_cg_id '
.
'FROM contactgroup_contact_relation '
.
'WHERE contact_contact_id = '
.
$centreon
->
user
->
user_id
.
' '
.
') '
.
') '
.
'UNION '
.
'SELECT cv2.custom_view_id, cv2.name FROM custom_views cv2 '
.
'WHERE cv2.public = 1 ) as d '
.
'WHERE d.custom_view_id NOT IN ('
.
'SELECT cvur2.custom_view_id FROM custom_view_user_relation cvur2 '
.
'WHERE cvur2.user_id = '
.
$centreon
->
user
->
user_id
.
' '
.
'AND cvur2.is_consumed = 1) '
.
(
count
(
$q
)
>
0
?
'AND d.name like ? '
:
''
)
.
') tmp ORDER BY tmp.name'
;
$stmt
=
$this
->
pearDB
->
prepare
(
$query
);
$dbResult
=
$this
->
pearDB
->
execute
(
$stmt
,
$q
);
while
(
$row
=
$dbResult
->
fetch
())
{
$views
[]
=
array
(
'id'
=>
$row
[
'custom_view_id'
],
'text'
=>
$row
[
'name'
]
);
}
return
array
(
'items'
=>
$views
,
'total'
=>
count
(
$views
)
...
...
@@ -153,7 +158,6 @@ class CentreonHomeCustomview extends CentreonWebService
'nbCols'
=>
$tab
[
'layout'
]
);
}
return
array
(
'current'
=>
$viewObj
->
getCurrentView
(),
'tabs'
=>
$tabs
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment