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 02486e9e
authored
2021-06-17 15:43:01 +0300
by
san58
Browse Files
Options
Browse Files
Tag
Download
Email Patches
Plain Diff
добавил условие
1 parent
11fd8319
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
19 additions
and
1 deletions
controllers/HostFreeController.php
models/Host.php
models/HostSearch.php
controllers/HostFreeController.php
View file @
02486e9
...
@@ -46,8 +46,17 @@ class HostFreeController extends Controller
...
@@ -46,8 +46,17 @@ class HostFreeController extends Controller
*/
*/
public
function
actionIndex
()
public
function
actionIndex
()
{
{
$searchModel
=
new
HostSearch
([
'wis_status'
=>
Host
::
STATUS_WIS_FREE
,
'status'
=>
Filter
::
STATUS_ON
,
'f1_status'
=>
Filter
::
STATUS_ON
]);
$searchModel
=
new
HostSearch
([
'wis_status'
=>
Host
::
STATUS_WIS_FREE
,
'status'
=>
Filter
::
STATUS_ON
,
'f1_status'
=>
Filter
::
STATUS_ON
,
'free'
=>
true
// AND ( f2_status=Filter::STATUS_ON OR f3_status=Filter::STATUS_ON )
]);
$dataProvider
=
$searchModel
->
search
(
Yii
::
$app
->
request
->
queryParams
);
$dataProvider
=
$searchModel
->
search
(
Yii
::
$app
->
request
->
queryParams
);
$dataProvider
->
setSort
([
$dataProvider
->
setSort
([
'defaultOrder'
=>
[
'defaultOrder'
=>
[
...
...
models/Host.php
View file @
02486e9
...
@@ -32,6 +32,8 @@ class Host extends \yii\db\ActiveRecord
...
@@ -32,6 +32,8 @@ class Host extends \yii\db\ActiveRecord
public
$cnt
;
public
$cnt
;
public
$free
=
false
;
/**
/**
* {@inheritdoc}
* {@inheritdoc}
*/
*/
...
...
models/HostSearch.php
View file @
02486e9
...
@@ -74,6 +74,13 @@ class HostSearch extends Host
...
@@ -74,6 +74,13 @@ class HostSearch extends Host
$query
->
andFilterWhere
([
'like'
,
'domain'
,
$this
->
domain
]);
$query
->
andFilterWhere
([
'like'
,
'domain'
,
$this
->
domain
]);
if
(
$this
->
free
===
true
)
{
$query
->
andFilterWhere
([
'or'
,
[
'f2_status'
=>
Filter
::
STATUS_ON
],
[
'f3_status'
=>
Filter
::
STATUS_ON
]
]);
}
return
$dataProvider
;
return
$dataProvider
;
}
}
}
}
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