Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
T
test-project
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
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
Junaid Rahman pv
test-project
Commits
a761a5b2
Commit
a761a5b2
authored
Sep 08, 2016
by
Junaid Rahman pv
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
modified website module
parent
e410c978
Show whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
44 additions
and
15 deletions
+44
-15
WebsiteController.php
backend/controllers/WebsiteController.php
+20
-7
_form.php
backend/views/website/_form.php
+2
-1
create.php
backend/views/website/create.php
+3
-0
index.php
backend/views/website/index.php
+17
-7
update.php
backend/views/website/update.php
+2
-0
No files found.
backend/controllers/WebsiteController.php
View file @
a761a5b2
...
...
@@ -2,20 +2,20 @@
namespace
backend\controllers
;
use
common\models\Theme
;
use
Yii
;
use
common\models\
w
ebsite
;
use
common\models\
W
ebsite
;
use
backend\models\search\WebsiteSearch
;
use
yii\web\Controller
;
use
yii\web\NotFoundHttpException
;
use
yii\filters\VerbFilter
;
use
yii\helpers\ArrayHelper
;
/**
* WebsiteController implements the CRUD actions for website model.
*/
class
WebsiteController
extends
Controller
{
public
function
behaviors
()
{
return
[
...
...
@@ -36,10 +36,12 @@ class WebsiteController extends Controller
{
$searchModel
=
new
WebsiteSearch
();
$dataProvider
=
$searchModel
->
search
(
Yii
::
$app
->
request
->
queryParams
);
$themes
=
ArrayHelper
::
map
(
Theme
::
find
()
->
all
(),
'id'
,
'name'
);
return
$this
->
render
(
'index'
,
[
'searchModel'
=>
$searchModel
,
'dataProvider'
=>
$dataProvider
,
'themes'
=>
$themes
,
]);
}
...
...
@@ -62,18 +64,21 @@ class WebsiteController extends Controller
*/
public
function
actionCreate
()
{
$model
=
new
w
ebsite
();
$model
=
new
W
ebsite
();
$searchModel
=
new
WebsiteSearch
();
$dataProvider
=
$searchModel
->
search
(
Yii
::
$app
->
request
->
queryParams
);
$themes
=
ArrayHelper
::
map
(
Theme
::
find
()
->
all
(),
'id'
,
'name'
);
if
(
$model
->
load
(
Yii
::
$app
->
request
->
post
())
&&
$model
->
save
())
{
return
$this
->
re
direct
(
'index'
,
[
return
$this
->
re
nder
(
'index'
,
[
'searchModel'
=>
$searchModel
,
'dataProvider'
=>
$dataProvider
,
'themes'
=>
$themes
,
]);
}
else
{
return
$this
->
render
(
'create'
,
[
'model'
=>
$model
,
'themes'
=>
$themes
,
]);
}
}
...
...
@@ -87,12 +92,20 @@ class WebsiteController extends Controller
public
function
actionUpdate
(
$id
)
{
$model
=
$this
->
findModel
(
$id
);
$searchModel
=
new
WebsiteSearch
();
$dataProvider
=
$searchModel
->
search
(
Yii
::
$app
->
request
->
queryParams
);
$themes
=
ArrayHelper
::
map
(
Theme
::
find
()
->
all
(),
'id'
,
'name'
);
if
(
$model
->
load
(
Yii
::
$app
->
request
->
post
())
&&
$model
->
save
())
{
return
$this
->
redirect
([
'view'
,
'id'
=>
$model
->
id
]);
return
$this
->
render
(
'index'
,
[
'searchModel'
=>
$searchModel
,
'dataProvider'
=>
$dataProvider
,
'themes'
=>
$themes
,
]);
}
else
{
return
$this
->
render
(
'update'
,
[
'model'
=>
$model
,
'themes'
=>
$themes
,
]);
}
}
...
...
@@ -119,7 +132,7 @@ class WebsiteController extends Controller
*/
protected
function
findModel
(
$id
)
{
if
((
$model
=
w
ebsite
::
findOne
(
$id
))
!==
null
)
{
if
((
$model
=
W
ebsite
::
findOne
(
$id
))
!==
null
)
{
return
$model
;
}
else
{
throw
new
NotFoundHttpException
(
'The requested page does not exist.'
);
...
...
backend/views/website/_form.php
View file @
a761a5b2
...
...
@@ -6,6 +6,7 @@ use yii\bootstrap\ActiveForm;
/* @var $this yii\web\View */
/* @var $model common\models\website */
/* @var $form yii\bootstrap\ActiveForm */
/* @var $themes array */
?>
<div
class=
"website-form"
>
...
...
@@ -24,7 +25,7 @@ use yii\bootstrap\ActiveForm;
<div
class=
"row"
>
<div
class=
"col-md-4"
>
<?=
$form
->
field
(
$model
,
'theme_id'
)
->
textInput
(
)
?>
<?=
$form
->
field
(
$model
,
'theme_id'
)
->
dropDownList
(
$themes
,[
'prompt'
=>
' '
]
)
?>
</div>
</div>
...
...
backend/views/website/create.php
View file @
a761a5b2
...
...
@@ -5,6 +5,8 @@ use yii\helpers\Html;
/* @var $this yii\web\View */
/* @var $model common\models\website */
/* @var $themes array */
$this
->
title
=
Yii
::
t
(
'backend'
,
'Create {modelClass}'
,
[
'modelClass'
=>
'Website'
,
...
...
@@ -16,6 +18,7 @@ $this->params['breadcrumbs'][] = $this->title;
<?=
$this
->
render
(
'_form'
,
[
'model'
=>
$model
,
'themes'
=>
$themes
,
])
?>
</div>
backend/views/website/index.php
View file @
a761a5b2
...
...
@@ -6,6 +6,7 @@ use yii\grid\GridView;
/* @var $this yii\web\View */
/* @var $searchModel backend\models\search\WebsiteSearch */
/* @var $dataProvider yii\data\ActiveDataProvider */
/* @var $themes array */
$this
->
title
=
Yii
::
t
(
'backend'
,
'Websites'
);
$this
->
params
[
'breadcrumbs'
][]
=
$this
->
title
;
...
...
@@ -17,7 +18,7 @@ $this->params['breadcrumbs'][] = $this->title;
<
p
>
<?=
Html
::
a
(
Yii
::
t
(
'backend'
,
'Create {modelClass}'
,
[
'modelClass'
=>
'Website'
,
]),
[
'create'
],
[
'class'
=>
'btn btn-success'
])
?>
]),
[
'create'
],
[
'class'
=>
'btn btn-success'
])
?>
</p>
<?=
GridView
::
widget
([
...
...
@@ -28,12 +29,19 @@ $this->params['breadcrumbs'][] = $this->title;
//'id',
'business_id'
,
'theme_id'
,
[
'attribute'
=>
'theme_id'
,
'value'
=>
function
(
$model
)
{
return
$model
->
theme
->
name
;
},
'filter'
=>
Html
::
activeDropDownList
(
$searchModel
,
'theme_id'
,
$themes
,
[
'class'
=>
'form-control'
,
'prompt'
=>
' '
]),
],
'domain_name'
,
[
'class'
=>
\common\grid\EnumColumn
::
className
(),
'attribute'
=>
'status'
,
'enum'
=>
[
'class'
=>
\common\grid\EnumColumn
::
className
(),
'attribute'
=>
'status'
,
'enum'
=>
[
Yii
::
t
(
'backend'
,
'In Active'
),
Yii
::
t
(
'backend'
,
'Active'
)
],
...
...
@@ -42,8 +50,10 @@ $this->params['breadcrumbs'][] = $this->title;
// 'created_at',
// 'updated_at',
[
'class'
=>
'yii\grid\ActionColumn'
,
'template'
=>
'{update}{delete}'
],
[
'class'
=>
'yii\grid\ActionColumn'
,
'template'
=>
'{update}{delete}'
],
],
]);
?>
...
...
backend/views/website/update.php
View file @
a761a5b2
...
...
@@ -4,6 +4,7 @@ use yii\helpers\Html;
/* @var $this yii\web\View */
/* @var $model common\models\website */
/* @var $themes array */
$this
->
title
=
Yii
::
t
(
'backend'
,
'Update {modelClass}: '
,
[
'modelClass'
=>
'Website'
,
...
...
@@ -16,6 +17,7 @@ $this->params['breadcrumbs'][] = Yii::t('backend', 'Update');
<?=
$this
->
render
(
'_form'
,
[
'model'
=>
$model
,
'themes'
=>
$themes
,
])
?>
</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