Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
T
taskonsite-архив-перенесен
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Packages
Packages
Container Registry
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Dmitry Korolev
taskonsite-архив-перенесен
Commits
051265f7
Commit
051265f7
authored
Apr 18, 2016
by
Shakarim Sapa
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
- Added new model
parent
8ba59592
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
72 additions
and
2 deletions
+72
-2
common/modules/analyticsSchool/controllers/CourseController.php
.../modules/analyticsSchool/controllers/CourseController.php
+2
-2
common/modules/analyticsSchool/models/CoursesSearch.php
common/modules/analyticsSchool/models/CoursesSearch.php
+70
-0
No files found.
common/modules/analyticsSchool/controllers/CourseController.php
View file @
051265f7
...
...
@@ -2,7 +2,7 @@
namespace
common\modules\analyticsSchool\controllers
;
use
common\components\FrontendController
;
use
common\modules\
school\models\SearchCourses
;
use
common\modules\
analyticsSchool\models\CoursesSearch
;
use
yii\filters\AccessControl
;
class
CourseController
extends
FrontendController
{
...
...
@@ -35,7 +35,7 @@ class CourseController extends FrontendController {
'property'
=>
'og:title'
,
'content'
=>
'Школа аналитики'
]);
$searchModel
=
new
SearchCourses
();
$searchModel
=
new
CoursesSearch
();
$search
=
\Yii
::
$app
->
request
->
queryParams
;
$dataProvider
=
$searchModel
->
search
(
$search
);
...
...
common/modules/analyticsSchool/models/CoursesSearch.php
0 → 100644
View file @
051265f7
<?php
/**
* Created by PhpStorm.
* User: PHOENIX
* Date: 18.04.16
* Time: 16:59
*/
namespace
common\modules\analyticsSchool\models
;
use
yii\base\Model
;
use
yii\data\ActiveDataProvider
;
class
CoursesSearch
extends
AnalyticsSchoolCourse
{
/**
* @inheritdoc
*/
public
function
rules
()
{
return
[
[[
'id'
],
'integer'
],
[[
'description'
,
'name'
,
'image'
],
'safe'
],
];
}
/**
* @inheritdoc
*/
public
function
scenarios
()
{
// bypass scenarios() implementation in the parent class
return
Model
::
scenarios
();
}
/**
* Creates data provider instance with search query applied
*
* @param array $params
*
* @return ActiveDataProvider
*/
public
function
search
(
$params
)
{
if
(
$params
){
$params
=
array_filter
(
$params
);
$query
=
AnalyticsSchoolCourse
::
findByCondition
(
$params
);
}
else
{
$query
=
AnalyticsSchoolCourse
::
find
();
}
$this
->
load
(
$params
);
$query
->
andFilterWhere
([
'id'
=>
$this
->
id
]);
$query
->
andFilterWhere
([
'like'
,
'description'
,
$this
->
description
])
->
andFilterWhere
([
'like'
,
'name'
,
$this
->
title
])
->
andFilterWhere
([
'like'
,
'image'
,
$this
->
image
]);
$query
->
orderBy
([
'id'
=>
SORT_DESC
]);
$dataProvider
=
new
ActiveDataProvider
([
'query'
=>
$query
,
]);
return
$dataProvider
;
}
}
\ No newline at end of file
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