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
762a49eb
Commit
762a49eb
authored
Sep 03, 2016
by
dianc
Browse files
Options
Browse Files
Download
Plain Diff
Merge remote-tracking branch 'origin/development' into development
parents
23fcf85c
5034d186
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
13 changed files
with
102 additions
and
80 deletions
+102
-80
web.php
backend/config/web.php
+7
-6
index.php
backend/modules/business/views/business/index.php
+2
-1
DistrictController.php
backend/modules/location/controllers/DistrictController.php
+7
-0
_form.php
backend/modules/location/views/district/_form.php
+32
-37
create.php
backend/modules/location/views/district/create.php
+3
-4
index.php
backend/modules/location/views/district/index.php
+2
-1
update.php
backend/modules/location/views/district/update.php
+2
-0
_form.php
backend/modules/location/views/state/_form.php
+24
-28
index.php
backend/modules/location/views/state/index.php
+5
-1
common.php
backend/views/layouts/common.php
+0
-0
District.php
common/models/District.php
+6
-1
State.php
common/models/State.php
+5
-1
StateQuery.php
common/models/query/StateQuery.php
+7
-0
No files found.
backend/config/web.php
View file @
762a49eb
...
...
@@ -34,19 +34,20 @@ $config = [
],
],
'modules'
=>
[
'business'
=>
[
'class'
=>
'backend\modules\business\Module'
,
],
'location'
=>
[
'class'
=>
'backend\modules\location\Module'
,
],
'i18n'
=>
[
'class'
=>
'backend\modules\i18n\Module'
,
'defaultRoute'
=>
'i18n-message/index'
],
'theme'
=>
[
'class'
=>
'backend\modules\theme\Module'
,
],
'business'
=>
[
'class'
=>
'backend\modules\business\Module'
,
],
'location'
=>
[
'class'
=>
'backend\modules\location\Module'
,
]
],
'as globalAccess'
=>
[
'class'
=>
'\common\behaviors\GlobalAccessBehavior'
,
...
...
backend/modules/business/views/business/index.php
View file @
762a49eb
...
...
@@ -46,7 +46,8 @@ $this->params['breadcrumbs'][] = $this->title;
// 'created_at',
// 'updated_at',
[
'class'
=>
'yii\grid\ActionColumn'
],
[
'class'
=>
'yii\grid\ActionColumn'
,
'template'
=>
'{update}{delete}'
],
],
]);
?>
</div>
backend/modules/location/controllers/DistrictController.php
View file @
762a49eb
...
...
@@ -8,6 +8,8 @@ use backend\modules\location\models\search\DistrictSearch;
use
yii\web\Controller
;
use
yii\web\NotFoundHttpException
;
use
yii\filters\VerbFilter
;
use
yii\helpers\ArrayHelper
;
use
common\models\State
;
/**
* DistrictController implements the CRUD actions for District model.
...
...
@@ -64,12 +66,14 @@ class DistrictController extends Controller
public
function
actionCreate
()
{
$model
=
new
District
();
$states
=
ArrayHelper
::
map
(
State
::
find
()
->
all
(),
'id'
,
'name'
);
if
(
$model
->
load
(
Yii
::
$app
->
request
->
post
())
&&
$model
->
save
())
{
return
$this
->
redirect
([
'view'
,
'id'
=>
$model
->
id
]);
}
else
{
return
$this
->
render
(
'create'
,
[
'model'
=>
$model
,
'states'
=>
$states
,
]);
}
}
...
...
@@ -83,12 +87,14 @@ class DistrictController extends Controller
public
function
actionUpdate
(
$id
)
{
$model
=
$this
->
findModel
(
$id
);
$states
=
ArrayHelper
::
map
(
State
::
find
()
->
all
(),
'id'
,
'name'
);
if
(
$model
->
load
(
Yii
::
$app
->
request
->
post
())
&&
$model
->
save
())
{
return
$this
->
redirect
([
'view'
,
'id'
=>
$model
->
id
]);
}
else
{
return
$this
->
render
(
'update'
,
[
'model'
=>
$model
,
'states'
=>
$states
,
]);
}
}
...
...
@@ -106,6 +112,7 @@ class DistrictController extends Controller
return
$this
->
redirect
([
'index'
]);
}
/**
* Finds the District model based on its primary key value.
* If the model is not found, a 404 HTTP exception will be thrown.
...
...
backend/modules/location/views/district/_form.php
View file @
762a49eb
...
...
@@ -2,54 +2,49 @@
use
yii\helpers\Html
;
use
yii\widgets\ActiveForm
;
use
yii\helpers\ArrayHelper
;
use
common\models\State
;
/* @var $this yii\web\View */
/* @var $model common\models\District */
/* @var $form yii\widgets\ActiveForm */
/* @var $states array */
?>
<div
class=
"district-form"
>
<?php
$form
=
ActiveForm
::
begin
();
?>
<div
id=
"myTabContent"
class=
"tab-content"
>
<div
class=
"tab-pane fade in active"
id=
"info"
>
<div
class=
"page-header"
>
<h3>
Info
</h3>
</div>
<div
class=
"row"
>
<div
class=
"col-md-6"
>
<?=
$form
->
field
(
$model
,
'state_id'
)
->
dropDownList
(
ArrayHelper
::
map
(
State
::
find
()
->
all
(),
'id'
,
'name'
))
?>
</div>
</div>
<div
class=
"row"
>
<div
class=
"col-md-6"
>
<?php
echo
$form
->
field
(
$model
,
'name'
)
->
textInput
([
'maxlength'
=>
true
])
?>
</div>
</div>
<div
class=
"row"
>
<div
class=
"col-md-6"
>
<?php
echo
$form
->
field
(
$model
,
'slug'
)
->
textInput
([
'maxlength'
=>
true
])
?>
</div>
</div>
<div
class=
"row"
>
<div
class=
"col-md-3"
>
<?=
$form
->
field
(
$model
,
'status'
)
->
dropDownList
(
$model
::
statuses
())
?>
</div>
</div>
<div
class=
"form-group"
>
<?=
Html
::
submitButton
(
$model
->
isNewRecord
?
Yii
::
t
(
'backend'
,
'Create'
)
:
Yii
::
t
(
'backend'
,
'Update'
),
[
'class'
=>
$model
->
isNewRecord
?
'btn btn-success'
:
'btn btn-primary'
])
?>
</div>
<div
class=
"row"
>
<div
class=
"col-md-3"
>
<?=
$form
->
field
(
$model
,
'state_id'
)
->
dropDownList
(
$states
)
?>
</div>
</div>
<div
class=
"row"
>
<div
class=
"col-md-3"
>
<?=
$form
->
field
(
$model
,
'name'
)
->
textInput
([
'maxlength'
=>
true
])
?>
</div>
</div>
<div
class=
"row"
>
<div
class=
"col-md-3"
>
<?=
$form
->
field
(
$model
,
'slug'
)
->
textInput
([
'maxlength'
=>
true
])
?>
</div>
</div>
<div
class=
"row"
>
<div
class=
"col-md-3"
>
<?=
$form
->
field
(
$model
,
'status'
)
->
dropDownList
(
$model
::
statuses
())
?>
</div>
</div>
<div
class=
"form-group"
>
<?=
Html
::
submitButton
(
$model
->
isNewRecord
?
Yii
::
t
(
'backend'
,
'Create'
)
:
Yii
::
t
(
'backend'
,
'Update'
),
[
'class'
=>
$model
->
isNewRecord
?
'btn btn-success'
:
'btn btn-primary'
])
?>
</div>
...
...
backend/modules/location/views/district/create.php
View file @
762a49eb
<?php
use
yii\helpers\Html
;
/* @var $this yii\web\View */
/* @var $model common\models\District */
/* @var $states array */
$this
->
title
=
Yii
::
t
(
'backend'
,
'Create District'
);
$this
->
params
[
'breadcrumbs'
][]
=
[
'label'
=>
Yii
::
t
(
'backend'
,
'Districts'
),
'url'
=>
[
'index'
]];
$this
->
params
[
'breadcrumbs'
][]
=
$this
->
title
;
?>
<div
class=
"district-create"
>
<div
class=
"district-create"
>
<?=
$this
->
render
(
'_form'
,
[
'model'
=>
$model
,
'states'
=>
$states
])
?>
</div>
backend/modules/location/views/district/index.php
View file @
762a49eb
...
...
@@ -39,7 +39,8 @@ $this->params['breadcrumbs'][] = $this->title;
// 'created_at',
// 'updated_at',
[
'class'
=>
'yii\grid\ActionColumn'
],
[
'class'
=>
'yii\grid\ActionColumn'
,
'template'
=>
'{update}{delete}'
],
],
]);
?>
</div>
backend/modules/location/views/district/update.php
View file @
762a49eb
...
...
@@ -4,6 +4,7 @@ use yii\helpers\Html;
/* @var $this yii\web\View */
/* @var $model common\models\District */
/* @var $states array */
$this
->
title
=
Yii
::
t
(
'backend'
,
'Update {modelClass}: '
,
[
'modelClass'
=>
'District'
,
...
...
@@ -18,6 +19,7 @@ $this->params['breadcrumbs'][] = Yii::t('backend', 'Update');
<?=
$this
->
render
(
'_form'
,
[
'model'
=>
$model
,
'states'
=>
$states
])
?>
</div>
backend/modules/location/views/state/_form.php
View file @
762a49eb
...
...
@@ -12,38 +12,34 @@ use yii\widgets\ActiveForm;
<?php
$form
=
ActiveForm
::
begin
();
?>
<div
id=
"myTabContent"
class=
"tab-content"
>
<div
class=
"tab-pane fade in active"
id=
"info"
>
<div
class=
"page-header"
>
<h3>
Info
</h3>
</div>
<div
class=
"row"
>
<div
class=
"col-md-6"
>
<?php
echo
$form
->
field
(
$model
,
'name'
)
->
textInput
([
'maxlength'
=>
true
])
?>
</div>
</div>
<div
class=
"row"
>
<div
class=
"col-md-6"
>
<?php
echo
$form
->
field
(
$model
,
'slug'
)
->
textInput
([
'maxlength'
=>
true
])
?>
</div>
</div>
<div
class=
"row"
>
<div
class=
"col-md-3"
>
<?=
$form
->
field
(
$model
,
'status'
)
->
dropDownList
(
$model
::
statuses
())
?>
</div>
</div>
<div
class=
"form-group"
>
<?=
Html
::
submitButton
(
$model
->
isNewRecord
?
Yii
::
t
(
'backend'
,
'Create'
)
:
Yii
::
t
(
'backend'
,
'Update'
),
[
'class'
=>
$model
->
isNewRecord
?
'btn btn-success'
:
'btn btn-primary'
])
?>
</div>
<div
class=
"row"
>
<div
class=
"col-md-3"
>
<?=
$form
->
field
(
$model
,
'name'
)
->
textInput
([
'maxlength'
=>
true
])
?>
</div>
</div>
<div
class=
"row"
>
<div
class=
"col-md-3"
>
<?=
$form
->
field
(
$model
,
'slug'
)
->
textInput
([
'maxlength'
=>
true
])
?>
</div>
</div>
<div
class=
"row"
>
<div
class=
"col-md-3"
>
<?=
$form
->
field
(
$model
,
'status'
)
->
dropDownList
(
$model
::
statuses
())
?>
</div>
</div>
<div
class=
"form-group"
>
<?=
Html
::
submitButton
(
$model
->
isNewRecord
?
Yii
::
t
(
'backend'
,
'Create'
)
:
Yii
::
t
(
'backend'
,
'Update'
),
[
'class'
=>
$model
->
isNewRecord
?
'btn btn-success'
:
'btn btn-primary'
])
?>
</div>
<?php
ActiveForm
::
end
();
?>
</div>
backend/modules/location/views/state/index.php
View file @
762a49eb
...
...
@@ -10,6 +10,7 @@ use yii\grid\GridView;
$this
->
title
=
Yii
::
t
(
'backend'
,
'States'
);
$this
->
params
[
'breadcrumbs'
][]
=
$this
->
title
;
?>
<div
class=
"state-index"
>
<h1>
<?=
Html
::
encode
(
$this
->
title
)
?>
</h1>
...
...
@@ -18,6 +19,7 @@ $this->params['breadcrumbs'][] = $this->title;
<
p
>
<?=
Html
::
a
(
Yii
::
t
(
'backend'
,
'Create State'
),
[
'create'
],
[
'class'
=>
'btn btn-success'
])
?>
</p>
<?=
GridView
::
widget
([
'dataProvider'
=>
$dataProvider
,
'filterModel'
=>
$searchModel
,
...
...
@@ -38,7 +40,9 @@ $this->params['breadcrumbs'][] = $this->title;
//'created_at',
// 'updated_at',
[
'class'
=>
'yii\grid\ActionColumn'
],
[
'class'
=>
'yii\grid\ActionColumn'
,
'template'
=>
'{update}{delete}'
],
],
]);
?>
</div>
backend/views/layouts/common.php
View file @
762a49eb
This diff is collapsed.
Click to expand it.
common/models/District.php
View file @
762a49eb
...
...
@@ -56,6 +56,7 @@ class District extends \yii\db\ActiveRecord
{
return
[
[[
'state_id'
,
'name'
],
'required'
],
[
'name'
,
'unique'
,
'targetAttribute'
=>
[
'name'
,
'state_id'
]],
[[
'state_id'
,
'status'
,
'created_at'
,
'updated_at'
],
'integer'
],
[[
'name'
,
'slug'
],
'string'
,
'max'
=>
1024
],
[[
'state_id'
],
'exist'
,
'skipOnError'
=>
true
,
'targetClass'
=>
State
::
className
(),
'targetAttribute'
=>
[
'state_id'
=>
'id'
]],
...
...
@@ -69,7 +70,7 @@ class District extends \yii\db\ActiveRecord
{
return
[
'id'
=>
Yii
::
t
(
'common'
,
'ID'
),
'state_id'
=>
Yii
::
t
(
'common'
,
'State
ID
'
),
'state_id'
=>
Yii
::
t
(
'common'
,
'State'
),
'name'
=>
Yii
::
t
(
'common'
,
'Name'
),
'slug'
=>
Yii
::
t
(
'common'
,
'Slug'
),
'status'
=>
Yii
::
t
(
'common'
,
'Status'
),
...
...
@@ -110,4 +111,8 @@ class District extends \yii\db\ActiveRecord
self
::
STATUS_IN_ACTIVE
=>
Yii
::
t
(
'common'
,
'In Active'
),
];
}
public
static
function
statelist
(){
}
}
common/models/State.php
View file @
762a49eb
...
...
@@ -37,7 +37,6 @@ class State extends \yii\db\ActiveRecord
[
'class'
=>
SluggableBehavior
::
className
(),
'attribute'
=>
'name'
,
'immutable'
=>
true
],
[
'class'
=>
TimestampBehavior
::
className
(),
...
...
@@ -54,6 +53,7 @@ class State extends \yii\db\ActiveRecord
{
return
[
[[
'name'
],
'required'
],
[[
'name'
],
'unique'
],
[[
'status'
,
'created_at'
,
'updated_at'
],
'integer'
],
[[
'name'
,
'slug'
],
'string'
,
'max'
=>
1024
],
];
...
...
@@ -91,6 +91,10 @@ class State extends \yii\db\ActiveRecord
return
new
\common\models\query\StateQuery
(
get_called_class
());
}
/**
* List all status
* @return array
*/
public
static
function
statuses
()
{
return
[
...
...
common/models/query/StateQuery.php
View file @
762a49eb
...
...
@@ -2,6 +2,8 @@
namespace
common\models\query
;
use
common\models\State
;
/**
* This is the ActiveQuery class for [[\common\models\State]].
*
...
...
@@ -31,4 +33,9 @@ class StateQuery extends \yii\db\ActiveQuery
{
return
parent
::
one
(
$db
);
}
public
function
active
()
{
return
$this
->
andWhere
([
'status'
=>
State
::
STATUS_ACTIVE
]);
}
}
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