Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
R
retypos-server
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
2
Merge Requests
2
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
eterfund
retypos-server
Commits
a458c50f
Commit
a458c50f
authored
Oct 03, 2013
by
Vladislav
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Поправлено отображение данных
parent
3a61f332
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
57 additions
and
2 deletions
+57
-2
users.php
application/controllers/admins/users.php
+3
-2
mdl_sites.php
application/models/admins/mdl_sites.php
+54
-0
No files found.
application/controllers/admins/users.php
View file @
a458c50f
...
...
@@ -8,7 +8,8 @@ class Users extends CI_Controller {
function
__construct
()
{
parent
::
__construct
();
$this
->
load
->
model
(
'admins/mdl_users'
);
$this
->
load
->
model
(
'admins/mdl_sites'
);
$this
->
user_id
=
$this
->
mdl_session
->
getData
(
'user_id'
);
$this
->
usertype
=
$this
->
mdl_session
->
getData
(
'usertype'
);
if
(
$this
->
usertype
!=
'admin'
)
{
...
...
@@ -52,7 +53,7 @@ class Users extends CI_Controller {
$data
=
$this
->
mdl_jqgrid
->
collectionData
();
$data
[
'user_id'
]
=
$this
->
mdl_request
->
int
(
'id'
);
echo
json_encode
(
$this
->
mdl_
typo
s
->
getUserSites
(
$data
));
echo
json_encode
(
$this
->
mdl_
site
s
->
getUserSites
(
$data
));
return
;
}
...
...
application/models/admins/mdl_sites.php
View file @
a458c50f
...
...
@@ -117,7 +117,61 @@ class Mdl_sites extends CI_Model {
return
$return_data
;
}
/**
* Получаем сайты пользователя
*/
function
getUserSites
(
$data
)
{
$user_id
=
$data
[
'user_id'
];
//Данные для pagination jqGrid
if
(
$data
[
'querysearchstring'
]
!=
''
)
{
$data
[
'querysearchstring'
]
=
" AND "
.
$data
[
'querysearchstring'
]
.
" "
;
}
$data
[
'query_count'
]
=
"SELECT COUNT(DISTINCT user_id) AS count
FROM responsible AS r
WHERE user_id = '"
.
(
int
)
$user_id
.
"'
"
.
$data
[
'querysearchstring'
]
.
" "
;
$data_pagination
=
$this
->
mdl_jqgrid
->
Pagination
(
$data
);
/**/
$return_data
=
array
(
'page'
=>
$data_pagination
[
'page'
],
'total'
=>
$data_pagination
[
'total'
],
'records'
=>
$data_pagination
[
'records'
],
'rows'
=>
array
(),
);
$query_users
=
"SELECT DISTINCT s.site_id AS site_id,
r.status AS rstatus,
s.site AS site,
s.status AS sstatus,
r.datetime_add AS datetime_add
FROM responsible AS r
JOIN site AS s ON s.site_id = r.site_id
WHERE r.user_id = '"
.
(
int
)
$user_id
.
"'
"
.
$data
[
'querysearchstring'
]
.
"
ORDER BY "
.
$data
[
'sidx'
]
.
" "
.
$data
[
'sord'
]
.
"
LIMIT "
.
$data_pagination
[
'start'
]
.
" , "
.
$data_pagination
[
'limit'
]
.
" "
;
$query
=
$this
->
db
->
query
(
$query_users
);
if
(
$query
->
num_rows
()
>
0
)
{
foreach
(
$query
->
result_array
()
as
$row
)
{
$return_data
[
'rows'
][]
=
array
(
'id'
=>
$row
[
'site_id'
],
'cell'
=>
array
(
$row
[
'site_id'
],
$row
[
'site'
],
$row
[
'rstatus'
],
$row
[
'datetime_add'
],
)
);
}
}
return
$return_data
;
}
/*Добавление сайта*/
function
addSite
(
$data
)
{
return
$this
->
mdl_stored_query
->
insertSite
(
$data
);
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment