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
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
45 additions
and
16 deletions
+45
-16
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
+18
-8
update.php
backend/views/website/update.php
+2
-0
No files found.
backend/controllers/WebsiteController.php
View file @
a761a5b2
...
@@ -2,20 +2,20 @@
...
@@ -2,20 +2,20 @@
namespace
backend\controllers
;
namespace
backend\controllers
;
use
common\models\Theme
;
use
Yii
;
use
Yii
;
use
common\models\
w
ebsite
;
use
common\models\
W
ebsite
;
use
backend\models\search\WebsiteSearch
;
use
backend\models\search\WebsiteSearch
;
use
yii\web\Controller
;
use
yii\web\Controller
;
use
yii\web\NotFoundHttpException
;
use
yii\web\NotFoundHttpException
;
use
yii\filters\VerbFilter
;
use
yii\filters\VerbFilter
;
use
yii\helpers\ArrayHelper
;
/**
/**
* WebsiteController implements the CRUD actions for website model.
* WebsiteController implements the CRUD actions for website model.
*/
*/
class
WebsiteController
extends
Controller
class
WebsiteController
extends
Controller
{
{
public
function
behaviors
()
public
function
behaviors
()
{
{
return
[
return
[
...
@@ -36,10 +36,12 @@ class WebsiteController extends Controller
...
@@ -36,10 +36,12 @@ class WebsiteController extends Controller
{
{
$searchModel
=
new
WebsiteSearch
();
$searchModel
=
new
WebsiteSearch
();
$dataProvider
=
$searchModel
->
search
(
Yii
::
$app
->
request
->
queryParams
);
$dataProvider
=
$searchModel
->
search
(
Yii
::
$app
->
request
->
queryParams
);
$themes
=
ArrayHelper
::
map
(
Theme
::
find
()
->
all
(),
'id'
,
'name'
);
return
$this
->
render
(
'index'
,
[
return
$this
->
render
(
'index'
,
[
'searchModel'
=>
$searchModel
,
'searchModel'
=>
$searchModel
,
'dataProvider'
=>
$dataProvider
,
'dataProvider'
=>
$dataProvider
,
'themes'
=>
$themes
,
]);
]);
}
}
...
@@ -62,18 +64,21 @@ class WebsiteController extends Controller
...
@@ -62,18 +64,21 @@ class WebsiteController extends Controller
*/
*/
public
function
actionCreate
()
public
function
actionCreate
()
{
{
$model
=
new
w
ebsite
();
$model
=
new
W
ebsite
();
$searchModel
=
new
WebsiteSearch
();
$searchModel
=
new
WebsiteSearch
();
$dataProvider
=
$searchModel
->
search
(
Yii
::
$app
->
request
->
queryParams
);
$dataProvider
=
$searchModel
->
search
(
Yii
::
$app
->
request
->
queryParams
);
$themes
=
ArrayHelper
::
map
(
Theme
::
find
()
->
all
(),
'id'
,
'name'
);
if
(
$model
->
load
(
Yii
::
$app
->
request
->
post
())
&&
$model
->
save
())
{
if
(
$model
->
load
(
Yii
::
$app
->
request
->
post
())
&&
$model
->
save
())
{
return
$this
->
re
direct
(
'index'
,
[
return
$this
->
re
nder
(
'index'
,
[
'searchModel'
=>
$searchModel
,
'searchModel'
=>
$searchModel
,
'dataProvider'
=>
$dataProvider
,
'dataProvider'
=>
$dataProvider
,
'themes'
=>
$themes
,
]);
]);
}
else
{
}
else
{
return
$this
->
render
(
'create'
,
[
return
$this
->
render
(
'create'
,
[
'model'
=>
$model
,
'model'
=>
$model
,
'themes'
=>
$themes
,
]);
]);
}
}
}
}
...
@@ -87,12 +92,20 @@ class WebsiteController extends Controller
...
@@ -87,12 +92,20 @@ class WebsiteController extends Controller
public
function
actionUpdate
(
$id
)
public
function
actionUpdate
(
$id
)
{
{
$model
=
$this
->
findModel
(
$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
())
{
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
{
}
else
{
return
$this
->
render
(
'update'
,
[
return
$this
->
render
(
'update'
,
[
'model'
=>
$model
,
'model'
=>
$model
,
'themes'
=>
$themes
,
]);
]);
}
}
}
}
...
@@ -119,7 +132,7 @@ class WebsiteController extends Controller
...
@@ -119,7 +132,7 @@ class WebsiteController extends Controller
*/
*/
protected
function
findModel
(
$id
)
protected
function
findModel
(
$id
)
{
{
if
((
$model
=
w
ebsite
::
findOne
(
$id
))
!==
null
)
{
if
((
$model
=
W
ebsite
::
findOne
(
$id
))
!==
null
)
{
return
$model
;
return
$model
;
}
else
{
}
else
{
throw
new
NotFoundHttpException
(
'The requested page does not exist.'
);
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;
...
@@ -6,6 +6,7 @@ use yii\bootstrap\ActiveForm;
/* @var $this yii\web\View */
/* @var $this yii\web\View */
/* @var $model common\models\website */
/* @var $model common\models\website */
/* @var $form yii\bootstrap\ActiveForm */
/* @var $form yii\bootstrap\ActiveForm */
/* @var $themes array */
?>
?>
<div
class=
"website-form"
>
<div
class=
"website-form"
>
...
@@ -24,7 +25,7 @@ use yii\bootstrap\ActiveForm;
...
@@ -24,7 +25,7 @@ use yii\bootstrap\ActiveForm;
<div
class=
"row"
>
<div
class=
"row"
>
<div
class=
"col-md-4"
>
<div
class=
"col-md-4"
>
<?=
$form
->
field
(
$model
,
'theme_id'
)
->
textInput
(
)
?>
<?=
$form
->
field
(
$model
,
'theme_id'
)
->
dropDownList
(
$themes
,[
'prompt'
=>
' '
]
)
?>
</div>
</div>
</div>
</div>
...
...
backend/views/website/create.php
View file @
a761a5b2
...
@@ -5,6 +5,8 @@ use yii\helpers\Html;
...
@@ -5,6 +5,8 @@ use yii\helpers\Html;
/* @var $this yii\web\View */
/* @var $this yii\web\View */
/* @var $model common\models\website */
/* @var $model common\models\website */
/* @var $themes array */
$this
->
title
=
Yii
::
t
(
'backend'
,
'Create {modelClass}'
,
[
$this
->
title
=
Yii
::
t
(
'backend'
,
'Create {modelClass}'
,
[
'modelClass'
=>
'Website'
,
'modelClass'
=>
'Website'
,
...
@@ -16,6 +18,7 @@ $this->params['breadcrumbs'][] = $this->title;
...
@@ -16,6 +18,7 @@ $this->params['breadcrumbs'][] = $this->title;
<?=
$this
->
render
(
'_form'
,
[
<?=
$this
->
render
(
'_form'
,
[
'model'
=>
$model
,
'model'
=>
$model
,
'themes'
=>
$themes
,
])
?>
])
?>
</div>
</div>
backend/views/website/index.php
View file @
a761a5b2
...
@@ -6,6 +6,7 @@ use yii\grid\GridView;
...
@@ -6,6 +6,7 @@ use yii\grid\GridView;
/* @var $this yii\web\View */
/* @var $this yii\web\View */
/* @var $searchModel backend\models\search\WebsiteSearch */
/* @var $searchModel backend\models\search\WebsiteSearch */
/* @var $dataProvider yii\data\ActiveDataProvider */
/* @var $dataProvider yii\data\ActiveDataProvider */
/* @var $themes array */
$this
->
title
=
Yii
::
t
(
'backend'
,
'Websites'
);
$this
->
title
=
Yii
::
t
(
'backend'
,
'Websites'
);
$this
->
params
[
'breadcrumbs'
][]
=
$this
->
title
;
$this
->
params
[
'breadcrumbs'
][]
=
$this
->
title
;
...
@@ -16,8 +17,8 @@ $this->params['breadcrumbs'][] = $this->title;
...
@@ -16,8 +17,8 @@ $this->params['breadcrumbs'][] = $this->title;
<
p
>
<
p
>
<?=
Html
::
a
(
Yii
::
t
(
'backend'
,
'Create {modelClass}'
,
[
<?=
Html
::
a
(
Yii
::
t
(
'backend'
,
'Create {modelClass}'
,
[
'modelClass'
=>
'Website'
,
'modelClass'
=>
'Website'
,
]),
[
'create'
],
[
'class'
=>
'btn btn-success'
])
?>
]),
[
'create'
],
[
'class'
=>
'btn btn-success'
])
?>
</p>
</p>
<?=
GridView
::
widget
([
<?=
GridView
::
widget
([
...
@@ -28,12 +29,19 @@ $this->params['breadcrumbs'][] = $this->title;
...
@@ -28,12 +29,19 @@ $this->params['breadcrumbs'][] = $this->title;
//'id',
//'id',
'business_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'
,
'domain_name'
,
[
[
'class'
=>
\common\grid\EnumColumn
::
className
(),
'class'
=>
\common\grid\EnumColumn
::
className
(),
'attribute'
=>
'status'
,
'attribute'
=>
'status'
,
'enum'
=>
[
'enum'
=>
[
Yii
::
t
(
'backend'
,
'In Active'
),
Yii
::
t
(
'backend'
,
'In Active'
),
Yii
::
t
(
'backend'
,
'Active'
)
Yii
::
t
(
'backend'
,
'Active'
)
],
],
...
@@ -42,8 +50,10 @@ $this->params['breadcrumbs'][] = $this->title;
...
@@ -42,8 +50,10 @@ $this->params['breadcrumbs'][] = $this->title;
// 'created_at',
// 'created_at',
// 'updated_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;
...
@@ -4,6 +4,7 @@ use yii\helpers\Html;
/* @var $this yii\web\View */
/* @var $this yii\web\View */
/* @var $model common\models\website */
/* @var $model common\models\website */
/* @var $themes array */
$this
->
title
=
Yii
::
t
(
'backend'
,
'Update {modelClass}: '
,
[
$this
->
title
=
Yii
::
t
(
'backend'
,
'Update {modelClass}: '
,
[
'modelClass'
=>
'Website'
,
'modelClass'
=>
'Website'
,
...
@@ -16,6 +17,7 @@ $this->params['breadcrumbs'][] = Yii::t('backend', 'Update');
...
@@ -16,6 +17,7 @@ $this->params['breadcrumbs'][] = Yii::t('backend', 'Update');
<?=
$this
->
render
(
'_form'
,
[
<?=
$this
->
render
(
'_form'
,
[
'model'
=>
$model
,
'model'
=>
$model
,
'themes'
=>
$themes
,
])
?>
])
?>
</div>
</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