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
cd8607fe
Commit
cd8607fe
authored
Apr 18, 2016
by
Shakarim Sapa
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
- Добавили CRUD стоп слов
parent
5f44bcf5
Changes
6
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
214 additions
and
0 deletions
+214
-0
common/modules/users/controllers/StopwordsAdminController.php
...on/modules/users/controllers/StopwordsAdminController.php
+116
-0
common/modules/users/forms/StopWordsForm.php
common/modules/users/forms/StopWordsForm.php
+24
-0
common/modules/users/views/stopwords-admin/create.php
common/modules/users/views/stopwords-admin/create.php
+1
-0
common/modules/users/views/stopwords-admin/manage.php
common/modules/users/views/stopwords-admin/manage.php
+35
-0
common/modules/users/views/stopwords-admin/update.php
common/modules/users/views/stopwords-admin/update.php
+1
-0
common/modules/users/views/stopwords-admin/view.php
common/modules/users/views/stopwords-admin/view.php
+37
-0
No files found.
common/modules/users/controllers/StopwordsAdminController.php
0 → 100644
View file @
cd8607fe
<?php
namespace
common\modules\users\controllers
;
use
common\components\AdminController
;
use
common\modules\analyticsSchool\models\UserStopWords
;
use
yii\data\ActiveDataProvider
;
use
yii\web\NotFoundHttpException
;
class
StopwordsAdminController
extends
AdminController
{
/**
* @return array|void
*/
public
static
function
actionsTitles
(){
return
[
'Manage'
=>
'Управление стоп словами'
,
'Create'
=>
'Добавление нового стоп-слова'
,
'View'
=>
'Просмотр стоп слова'
,
'Update'
=>
'Редактирование стоп-слова'
,
'Delete'
=>
'Удаление стоп слова'
,
];
}
/**
* @return string
*/
public
function
actionManage
(){
$dataProvider
=
new
ActiveDataProvider
([
'query'
=>
UserStopWords
::
find
(),
]);
return
$this
->
render
(
'manage'
,
[
'dataProvider'
=>
$dataProvider
,
]
);
}
/**
* @return string|\yii\web\Response
*/
public
function
actionCreate
(){
$model
=
new
UserStopWords
();
if
(
$model
->
load
(
\Yii
::
$app
->
request
->
post
()))
{
if
(
$model
->
validate
()
&&
$model
->
save
())
return
$this
->
redirect
([
'manage'
]);
}
$form
=
new
\common\components\BaseForm
(
'/common/modules/users/forms/StopWordsForm'
,
$model
);
return
$this
->
render
(
'create'
,
[
'form'
=>
$form
]
);
}
/**
* @param $id
* @return string
*/
public
function
actionView
(
$id
){
return
$this
->
render
(
'view'
,
[
'model'
=>
$this
->
findModel
(
$id
),
]);
}
/**
* @param $id
* @return string|\yii\web\Response
*/
public
function
actionUpdate
(
$id
){
/** @var UserStopWords $model */
$model
=
$this
->
findModel
(
$id
);
if
(
$model
->
load
(
\Yii
::
$app
->
request
->
post
()))
{
if
(
$model
->
validate
()
&&
$model
->
save
())
return
$this
->
redirect
([
'manage'
]);
}
$form
=
new
\common\components\BaseForm
(
'/common/modules/users/forms/StopWordsForm'
,
$model
);
return
$this
->
render
(
'update'
,
[
'form'
=>
$form
]
);
}
/**
* @param $id
* @return UserStopWords|null
* @throws NotFoundHttpException
*/
public
function
findModel
(
$id
)
{
if
((
$model
=
UserStopWords
::
findOne
(
$id
))
!==
null
)
{
return
$model
;
}
else
{
throw
new
NotFoundHttpException
(
'The requested page does not exist.'
);
}
}
/**
* @param $id
* @return \yii\web\Response
*/
public
function
actionDelete
(
$id
){
$this
->
findModel
(
$id
)
->
delete
();
return
$this
->
redirect
([
'manage'
]);
}
}
\ No newline at end of file
common/modules/users/forms/StopWordsForm.php
0 → 100644
View file @
cd8607fe
<?php
use
\yii\data\ActiveDataProvider
;
return
[
'activeForm'
=>
[
'id'
=>
'trigger-form'
,
'options'
=>
[
'enctype'
=>
'multipart/form-data'
]
],
'elements'
=>
[
'active'
=>
[
'type'
=>
'checkbox'
,
'class'
=>
'form-control'
],
'word'
=>
[
'type'
=>
'text'
,
'class'
=>
'form-control'
],
],
'buttons'
=>
[
'submit'
=>
[
'type'
=>
'submit'
,
'value'
=>
'Cохранить'
]
]
];
\ No newline at end of file
common/modules/users/views/stopwords-admin/create.php
0 → 100644
View file @
cd8607fe
<?=
$form
->
out
;
\ No newline at end of file
common/modules/users/views/stopwords-admin/manage.php
0 → 100644
View file @
cd8607fe
<?php
use
\yii\helpers\Html
;
use
yii\grid\GridView
;
/**
* @var $this \common\modules\users\controllers\StopwordsAdminController
* @var $dataProvider yii\data\ActiveDataProvider
*/
?>
<div
class=
"analytics-school-manage"
>
<h1>
<?=
Html
::
encode
(
$this
->
title
);
?>
</h1>
<p>
<?=
Html
::
a
(
'Добавить стоп слово'
,
[
'create'
],
[
'class'
=>
'btn btn-success'
]);
?>
</p>
<?=
GridView
::
widget
([
'dataProvider'
=>
$dataProvider
,
'columns'
=>
[
[
'class'
=>
'yii\grid\SerialColumn'
],
'id'
,
[
'attribute'
=>
'active'
,
'value'
=>
function
(
$model
)
{
return
(
$model
->
active
==
1
)
?
'Активно'
:
'Не активно'
;
}
],
'word'
,
[
'class'
=>
'yii\grid\ActionColumn'
],
],
]);
?>
</div>
common/modules/users/views/stopwords-admin/update.php
0 → 100644
View file @
cd8607fe
<?=
$form
->
out
;
\ No newline at end of file
common/modules/users/views/stopwords-admin/view.php
0 → 100644
View file @
cd8607fe
<?php
use
yii\widgets\DetailView
;
use
\common\modules\analyticsSchool\models\AnalyticsSchoolLesson
;
use
\yii\grid\GridView
;
/** @var AnalyticsSchoolLesson $model */
/** @var \yii\data\ActiveDataProvider $files */
?>
<h1>
Просмотр стоп слова #
<?=
$model
->
id
;
?>
</h1>
<div
class=
"analytics-school-view"
>
<?=
DetailView
::
widget
([
'model'
=>
$model
,
'attributes'
=>
[
'id'
,
[
'attribute'
=>
'active'
,
'value'
=>
(
$model
->
active
==
1
)
?
'Активно'
:
'Не активно'
],
'word'
],
]);
?>
</div>
<div
class=
"analytics-school-files-view"
>
<?=
GridView
::
widget
([
'dataProvider'
=>
$files
,
'columns'
=>
[
[
'class'
=>
'yii\grid\SerialColumn'
],
'title'
,
'file'
,
],
]);
?>
</div>
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