Skip to content
Toggle navigation
Toggle navigation
This project
Loading...
Sign in
Alto
/
rkn
Go to a project
Toggle navigation
Toggle navigation pinning
Projects
Groups
Snippets
Help
Project
Activity
Repository
Pipelines
Graphs
Issues
0
Merge Requests
0
Wiki
Network
Create a new issue
Jobs
Commits
Issue Boards
Files
Commits
Network
Compare
Branches
Tags
Commit e56f9384
authored
2021-06-04 17:49:28 +0300
by
Скуратович Александр
Browse Files
Options
Browse Files
Tag
Download
Email Patches
Plain Diff
статистика
1 parent
718eac42
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
10 additions
and
3 deletions
controllers/SiteController.php
models/Host.php
controllers/SiteController.php
View file @
e56f938
...
...
@@ -3,6 +3,7 @@
namespace
app\controllers
;
use
app\components\Collection
;
use
app\models\Host
;
use
Yii
;
use
yii\filters\AccessControl
;
use
yii\web\Controller
;
...
...
@@ -24,7 +25,7 @@ class SiteController extends Controller
'class'
=>
AccessControl
::
className
(),
'rules'
=>
[
[
'actions'
=>
[
'index'
,
'logout'
],
'actions'
=>
[
'index'
,
'logout'
],
'allow'
=>
true
,
'roles'
=>
[
'@'
],
],
...
...
@@ -66,8 +67,13 @@ class SiteController extends Controller
{
//var_dump(Yii::$app->user->isGuest);
//var_dump(Yii::$app->user->identity);
return
$this
->
render
(
'index'
);
$statistics
=
[
'csv_date'
=>
''
];
$statistics
[
'c_status'
]
=
Host
::
find
()
->
select
([
'COUNT(*) AS cnt'
,
'wis_status'
])
->
groupBy
(
'wis_status'
)
->
all
();
$csv
=
Host
::
find
()
->
select
([
'csv_date'
])
->
orderBy
(
'csv_date ASC'
)
->
one
();
if
(
$csv
)
{
$statistics
[
'csv_date'
]
=
$csv
[
'csv_date'
];
}
return
$this
->
render
(
'index'
,
compact
(
'statistics'
));
}
}
models/Host.php
View file @
e56f938
...
...
@@ -23,6 +23,7 @@ class Host extends \yii\db\ActiveRecord
const
STATUS_FREE
=
1
;
//Свободный
const
STATUS_BUSY
=
2
;
//Занятый
public
$cnt
;
/**
* {@inheritdoc}
...
...
Write
Preview
Styling with
Markdown
is supported
Attach a file
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 post a comment