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
0ea084e9
Commit
0ea084e9
authored
Sep 01, 2016
by
jomon
Browse files
Options
Browse Files
Download
Plain Diff
Merge remote-tracking branch 'origin/development' into development
parents
11bb6f87
1e394749
Show whitespace changes
Inline
Side-by-side
Showing
24 changed files
with
1270 additions
and
0 deletions
+1270
-0
BusinessController.php
backend/modules/business/controllers/BusinessController.php
+124
-0
BusinessSearch.php
backend/modules/business/models/search/BusinessSearch.php
+88
-0
_form.php
backend/modules/business/views/business/_form.php
+61
-0
_search.php
backend/modules/business/views/business/_search.php
+67
-0
create.php
backend/modules/business/views/business/create.php
+21
-0
index.php
backend/modules/business/views/business/index.php
+52
-0
update.php
backend/modules/business/views/business/update.php
+23
-0
view.php
backend/modules/business/views/business/view.php
+55
-0
DistrictController.php
backend/modules/location/controllers/DistrictController.php
+124
-0
StateController.php
backend/modules/location/controllers/StateController.php
+124
-0
DistrictSearch.php
backend/modules/location/models/search/DistrictSearch.php
+74
-0
StateSearch.php
backend/modules/location/models/search/StateSearch.php
+73
-0
_form.php
backend/modules/location/views/district/_form.php
+33
-0
_search.php
backend/modules/location/views/district/_search.php
+39
-0
create.php
backend/modules/location/views/district/create.php
+21
-0
index.php
backend/modules/location/views/district/index.php
+38
-0
update.php
backend/modules/location/views/district/update.php
+23
-0
view.php
backend/modules/location/views/district/view.php
+41
-0
_form.php
backend/modules/location/views/state/_form.php
+31
-0
_search.php
backend/modules/location/views/state/_search.php
+37
-0
create.php
backend/modules/location/views/state/create.php
+21
-0
index.php
backend/modules/location/views/state/index.php
+37
-0
update.php
backend/modules/location/views/state/update.php
+23
-0
view.php
backend/modules/location/views/state/view.php
+40
-0
No files found.
backend/modules/business/controllers/BusinessController.php
0 → 100644
View file @
0ea084e9
<?php
namespace
backend\modules\business\controllers
;
use
Yii
;
use
common\models\Business
;
use
backend\modules\business\models\search\BusinessSearch
;
use
yii\web\Controller
;
use
yii\web\NotFoundHttpException
;
use
yii\filters\VerbFilter
;
/**
* BusinessController implements the CRUD actions for Business model.
*/
class
BusinessController
extends
Controller
{
/**
* @inheritdoc
*/
public
function
behaviors
()
{
return
[
'verbs'
=>
[
'class'
=>
VerbFilter
::
className
(),
'actions'
=>
[
'delete'
=>
[
'POST'
],
],
],
];
}
/**
* Lists all Business models.
* @return mixed
*/
public
function
actionIndex
()
{
$searchModel
=
new
BusinessSearch
();
$dataProvider
=
$searchModel
->
search
(
Yii
::
$app
->
request
->
queryParams
);
return
$this
->
render
(
'index'
,
[
'searchModel'
=>
$searchModel
,
'dataProvider'
=>
$dataProvider
,
]);
}
/**
* Displays a single Business model.
* @param integer $id
* @return mixed
*/
public
function
actionView
(
$id
)
{
return
$this
->
render
(
'view'
,
[
'model'
=>
$this
->
findModel
(
$id
),
]);
}
/**
* Creates a new Business model.
* If creation is successful, the browser will be redirected to the 'view' page.
* @return mixed
*/
public
function
actionCreate
()
{
$model
=
new
Business
();
if
(
$model
->
load
(
Yii
::
$app
->
request
->
post
())
&&
$model
->
save
())
{
return
$this
->
redirect
([
'view'
,
'id'
=>
$model
->
id
]);
}
else
{
return
$this
->
render
(
'create'
,
[
'model'
=>
$model
,
]);
}
}
/**
* Updates an existing Business model.
* If update is successful, the browser will be redirected to the 'view' page.
* @param integer $id
* @return mixed
*/
public
function
actionUpdate
(
$id
)
{
$model
=
$this
->
findModel
(
$id
);
if
(
$model
->
load
(
Yii
::
$app
->
request
->
post
())
&&
$model
->
save
())
{
return
$this
->
redirect
([
'view'
,
'id'
=>
$model
->
id
]);
}
else
{
return
$this
->
render
(
'update'
,
[
'model'
=>
$model
,
]);
}
}
/**
* Deletes an existing Business model.
* If deletion is successful, the browser will be redirected to the 'index' page.
* @param integer $id
* @return mixed
*/
public
function
actionDelete
(
$id
)
{
$this
->
findModel
(
$id
)
->
delete
();
return
$this
->
redirect
([
'index'
]);
}
/**
* Finds the Business model based on its primary key value.
* If the model is not found, a 404 HTTP exception will be thrown.
* @param integer $id
* @return Business the loaded model
* @throws NotFoundHttpException if the model cannot be found
*/
protected
function
findModel
(
$id
)
{
if
((
$model
=
Business
::
findOne
(
$id
))
!==
null
)
{
return
$model
;
}
else
{
throw
new
NotFoundHttpException
(
'The requested page does not exist.'
);
}
}
}
backend/modules/business/models/search/BusinessSearch.php
0 → 100644
View file @
0ea084e9
<?php
namespace
backend\modules\business\models\search
;
use
Yii
;
use
yii\base\Model
;
use
yii\data\ActiveDataProvider
;
use
common\models\Business
;
/**
* BusinessSearch represents the model behind the search form about `common\models\Business`.
*/
class
BusinessSearch
extends
Business
{
/**
* @inheritdoc
*/
public
function
rules
()
{
return
[
[[
'id'
,
'category_id'
,
'district_id'
,
'status'
,
'created_at'
,
'updated_at'
],
'integer'
],
[[
'domain_name'
,
'name'
,
'slug'
,
'address'
,
'landmark'
,
'mobile_no'
,
'toll_free_no'
,
'contact_no'
,
'fax'
,
'email'
,
'description'
,
'logo_base_url'
,
'logo_path'
,
'latitude'
,
'logitude'
],
'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
)
{
$query
=
Business
::
find
();
// add conditions that should always apply here
$dataProvider
=
new
ActiveDataProvider
([
'query'
=>
$query
,
]);
$this
->
load
(
$params
);
if
(
!
$this
->
validate
())
{
// uncomment the following line if you do not want to return any records when validation fails
// $query->where('0=1');
return
$dataProvider
;
}
// grid filtering conditions
$query
->
andFilterWhere
([
'id'
=>
$this
->
id
,
'category_id'
=>
$this
->
category_id
,
'district_id'
=>
$this
->
district_id
,
'status'
=>
$this
->
status
,
'created_at'
=>
$this
->
created_at
,
'updated_at'
=>
$this
->
updated_at
,
]);
$query
->
andFilterWhere
([
'like'
,
'domain_name'
,
$this
->
domain_name
])
->
andFilterWhere
([
'like'
,
'name'
,
$this
->
name
])
->
andFilterWhere
([
'like'
,
'slug'
,
$this
->
slug
])
->
andFilterWhere
([
'like'
,
'address'
,
$this
->
address
])
->
andFilterWhere
([
'like'
,
'landmark'
,
$this
->
landmark
])
->
andFilterWhere
([
'like'
,
'mobile_no'
,
$this
->
mobile_no
])
->
andFilterWhere
([
'like'
,
'toll_free_no'
,
$this
->
toll_free_no
])
->
andFilterWhere
([
'like'
,
'contact_no'
,
$this
->
contact_no
])
->
andFilterWhere
([
'like'
,
'fax'
,
$this
->
fax
])
->
andFilterWhere
([
'like'
,
'email'
,
$this
->
email
])
->
andFilterWhere
([
'like'
,
'description'
,
$this
->
description
])
->
andFilterWhere
([
'like'
,
'logo_base_url'
,
$this
->
logo_base_url
])
->
andFilterWhere
([
'like'
,
'logo_path'
,
$this
->
logo_path
])
->
andFilterWhere
([
'like'
,
'latitude'
,
$this
->
latitude
])
->
andFilterWhere
([
'like'
,
'logitude'
,
$this
->
logitude
]);
return
$dataProvider
;
}
}
backend/modules/business/views/business/_form.php
0 → 100644
View file @
0ea084e9
<?php
use
yii\helpers\Html
;
use
yii\widgets\ActiveForm
;
/* @var $this yii\web\View */
/* @var $model common\models\Business */
/* @var $form yii\widgets\ActiveForm */
?>
<div
class=
"business-form"
>
<?php
$form
=
ActiveForm
::
begin
();
?>
<?=
$form
->
field
(
$model
,
'category_id'
)
->
textInput
()
?>
<?=
$form
->
field
(
$model
,
'district_id'
)
->
textInput
()
?>
<?=
$form
->
field
(
$model
,
'domain_name'
)
->
textInput
([
'maxlength'
=>
true
])
?>
<?=
$form
->
field
(
$model
,
'name'
)
->
textInput
([
'maxlength'
=>
true
])
?>
<?=
$form
->
field
(
$model
,
'slug'
)
->
textInput
([
'maxlength'
=>
true
])
?>
<?=
$form
->
field
(
$model
,
'address'
)
->
textInput
([
'maxlength'
=>
true
])
?>
<?=
$form
->
field
(
$model
,
'landmark'
)
->
textInput
([
'maxlength'
=>
true
])
?>
<?=
$form
->
field
(
$model
,
'mobile_no'
)
->
textInput
([
'maxlength'
=>
true
])
?>
<?=
$form
->
field
(
$model
,
'toll_free_no'
)
->
textInput
([
'maxlength'
=>
true
])
?>
<?=
$form
->
field
(
$model
,
'contact_no'
)
->
textInput
([
'maxlength'
=>
true
])
?>
<?=
$form
->
field
(
$model
,
'fax'
)
->
textInput
([
'maxlength'
=>
true
])
?>
<?=
$form
->
field
(
$model
,
'email'
)
->
textInput
([
'maxlength'
=>
true
])
?>
<?=
$form
->
field
(
$model
,
'description'
)
->
textarea
([
'rows'
=>
6
])
?>
<?=
$form
->
field
(
$model
,
'logo_base_url'
)
->
textInput
([
'maxlength'
=>
true
])
?>
<?=
$form
->
field
(
$model
,
'logo_path'
)
->
textInput
([
'maxlength'
=>
true
])
?>
<?=
$form
->
field
(
$model
,
'latitude'
)
->
textInput
([
'maxlength'
=>
true
])
?>
<?=
$form
->
field
(
$model
,
'logitude'
)
->
textInput
([
'maxlength'
=>
true
])
?>
<?=
$form
->
field
(
$model
,
'status'
)
->
textInput
()
?>
<?=
$form
->
field
(
$model
,
'created_at'
)
->
textInput
()
?>
<?=
$form
->
field
(
$model
,
'updated_at'
)
->
textInput
()
?>
<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/business/views/business/_search.php
0 → 100644
View file @
0ea084e9
<?php
use
yii\helpers\Html
;
use
yii\widgets\ActiveForm
;
/* @var $this yii\web\View */
/* @var $model backend\modules\business\models\search\BusinessSearch */
/* @var $form yii\widgets\ActiveForm */
?>
<div
class=
"business-search"
>
<?php
$form
=
ActiveForm
::
begin
([
'action'
=>
[
'index'
],
'method'
=>
'get'
,
]);
?>
<?=
$form
->
field
(
$model
,
'id'
)
?>
<?=
$form
->
field
(
$model
,
'category_id'
)
?>
<?=
$form
->
field
(
$model
,
'district_id'
)
?>
<?=
$form
->
field
(
$model
,
'domain_name'
)
?>
<?=
$form
->
field
(
$model
,
'name'
)
?>
<?php
// echo $form->field($model, 'slug') ?>
<?
php
// echo $form->field($model, 'address') ?>
<?
php
// echo $form->field($model, 'landmark') ?>
<?
php
// echo $form->field($model, 'mobile_no') ?>
<?
php
// echo $form->field($model, 'toll_free_no') ?>
<?
php
// echo $form->field($model, 'contact_no') ?>
<?
php
// echo $form->field($model, 'fax') ?>
<?
php
// echo $form->field($model, 'email') ?>
<?
php
// echo $form->field($model, 'description') ?>
<?
php
// echo $form->field($model, 'logo_base_url') ?>
<?
php
// echo $form->field($model, 'logo_path') ?>
<?
php
// echo $form->field($model, 'latitude') ?>
<?
php
// echo $form->field($model, 'logitude') ?>
<?
php
// echo $form->field($model, 'status') ?>
<?
php
// echo $form->field($model, 'created_at') ?>
<?
php
// echo $form->field($model, 'updated_at') ?>
<
div
class
="
form
-
group
">
<?= Html::submitButton(Yii::t('backend', 'Search'), ['class' => 'btn btn-primary']) ?>
<?= Html::resetButton(Yii::t('backend', 'Reset'), ['class' => 'btn btn-default']) ?>
</div>
<?php ActiveForm::end(); ?>
</div>
backend/modules/business/views/business/create.php
0 → 100644
View file @
0ea084e9
<?php
use
yii\helpers\Html
;
/* @var $this yii\web\View */
/* @var $model common\models\Business */
$this
->
title
=
Yii
::
t
(
'backend'
,
'Create Business'
);
$this
->
params
[
'breadcrumbs'
][]
=
[
'label'
=>
Yii
::
t
(
'backend'
,
'Businesses'
),
'url'
=>
[
'index'
]];
$this
->
params
[
'breadcrumbs'
][]
=
$this
->
title
;
?>
<div
class=
"business-create"
>
<h1>
<?=
Html
::
encode
(
$this
->
title
)
?>
</h1>
<?=
$this
->
render
(
'_form'
,
[
'model'
=>
$model
,
])
?>
</div>
backend/modules/business/views/business/index.php
0 → 100644
View file @
0ea084e9
<?php
use
yii\helpers\Html
;
use
yii\grid\GridView
;
/* @var $this yii\web\View */
/* @var $searchModel backend\modules\business\models\search\BusinessSearch */
/* @var $dataProvider yii\data\ActiveDataProvider */
$this
->
title
=
Yii
::
t
(
'backend'
,
'Businesses'
);
$this
->
params
[
'breadcrumbs'
][]
=
$this
->
title
;
?>
<div
class=
"business-index"
>
<h1>
<?=
Html
::
encode
(
$this
->
title
)
?>
</h1>
<?php
// echo $this->render('_search', ['model' => $searchModel]); ?>
<
p
>
<?=
Html
::
a
(
Yii
::
t
(
'backend'
,
'Create Business'
),
[
'create'
],
[
'class'
=>
'btn btn-success'
])
?>
</p>
<?=
GridView
::
widget
([
'dataProvider'
=>
$dataProvider
,
'filterModel'
=>
$searchModel
,
'columns'
=>
[
[
'class'
=>
'yii\grid\SerialColumn'
],
'id'
,
'category_id'
,
'district_id'
,
'domain_name'
,
'name'
,
// 'slug',
// 'address',
// 'landmark',
// 'mobile_no',
// 'toll_free_no',
// 'contact_no',
// 'fax',
// 'email:email',
// 'description:ntext',
// 'logo_base_url:url',
// 'logo_path',
// 'latitude',
// 'logitude',
// 'status',
// 'created_at',
// 'updated_at',
[
'class'
=>
'yii\grid\ActionColumn'
],
],
]);
?>
</div>
backend/modules/business/views/business/update.php
0 → 100644
View file @
0ea084e9
<?php
use
yii\helpers\Html
;
/* @var $this yii\web\View */
/* @var $model common\models\Business */
$this
->
title
=
Yii
::
t
(
'backend'
,
'Update {modelClass}: '
,
[
'modelClass'
=>
'Business'
,
])
.
$model
->
name
;
$this
->
params
[
'breadcrumbs'
][]
=
[
'label'
=>
Yii
::
t
(
'backend'
,
'Businesses'
),
'url'
=>
[
'index'
]];
$this
->
params
[
'breadcrumbs'
][]
=
[
'label'
=>
$model
->
name
,
'url'
=>
[
'view'
,
'id'
=>
$model
->
id
]];
$this
->
params
[
'breadcrumbs'
][]
=
Yii
::
t
(
'backend'
,
'Update'
);
?>
<div
class=
"business-update"
>
<h1>
<?=
Html
::
encode
(
$this
->
title
)
?>
</h1>
<?=
$this
->
render
(
'_form'
,
[
'model'
=>
$model
,
])
?>
</div>
backend/modules/business/views/business/view.php
0 → 100644
View file @
0ea084e9
<?php
use
yii\helpers\Html
;
use
yii\widgets\DetailView
;
/* @var $this yii\web\View */
/* @var $model common\models\Business */
$this
->
title
=
$model
->
name
;
$this
->
params
[
'breadcrumbs'
][]
=
[
'label'
=>
Yii
::
t
(
'backend'
,
'Businesses'
),
'url'
=>
[
'index'
]];
$this
->
params
[
'breadcrumbs'
][]
=
$this
->
title
;
?>
<div
class=
"business-view"
>
<h1>
<?=
Html
::
encode
(
$this
->
title
)
?>
</h1>
<p>
<?=
Html
::
a
(
Yii
::
t
(
'backend'
,
'Update'
),
[
'update'
,
'id'
=>
$model
->
id
],
[
'class'
=>
'btn btn-primary'
])
?>
<?=
Html
::
a
(
Yii
::
t
(
'backend'
,
'Delete'
),
[
'delete'
,
'id'
=>
$model
->
id
],
[
'class'
=>
'btn btn-danger'
,
'data'
=>
[
'confirm'
=>
Yii
::
t
(
'backend'
,
'Are you sure you want to delete this item?'
),
'method'
=>
'post'
,
],
])
?>
</p>
<?=
DetailView
::
widget
([
'model'
=>
$model
,
'attributes'
=>
[
'id'
,
'category_id'
,
'district_id'
,
'domain_name'
,
'name'
,
'slug'
,
'address'
,
'landmark'
,
'mobile_no'
,
'toll_free_no'
,
'contact_no'
,
'fax'
,
'email:email'
,
'description:ntext'
,
'logo_base_url:url'
,
'logo_path'
,
'latitude'
,
'logitude'
,
'status'
,
'created_at'
,
'updated_at'
,
],
])
?>
</div>
backend/modules/location/controllers/DistrictController.php
0 → 100644
View file @
0ea084e9
<?php
namespace
backend\modules\location\controllers
;
use
Yii
;
use
common\models\District
;
use
backend\modules\location\models\search\DistrictSearch
;
use
yii\web\Controller
;
use
yii\web\NotFoundHttpException
;
use
yii\filters\VerbFilter
;
/**
* DistrictController implements the CRUD actions for District model.
*/
class
DistrictController
extends
Controller
{
/**
* @inheritdoc
*/
public
function
behaviors
()
{
return
[
'verbs'
=>
[
'class'
=>
VerbFilter
::
className
(),
'actions'
=>
[
'delete'
=>
[
'POST'
],
],
],
];
}
/**
* Lists all District models.
* @return mixed
*/
public
function
actionIndex
()
{
$searchModel
=
new
DistrictSearch
();
$dataProvider
=
$searchModel
->
search
(
Yii
::
$app
->
request
->
queryParams
);
return
$this
->
render
(
'index'
,
[
'searchModel'
=>
$searchModel
,
'dataProvider'
=>
$dataProvider
,
]);
}
/**
* Displays a single District model.
* @param integer $id
* @return mixed
*/
public
function
actionView
(
$id
)
{
return
$this
->
render
(
'view'
,
[
'model'
=>
$this
->
findModel
(
$id
),
]);
}
/**
* Creates a new District model.
* If creation is successful, the browser will be redirected to the 'view' page.
* @return mixed
*/
public
function
actionCreate
()
{
$model
=
new
District
();
if
(
$model
->
load
(
Yii
::
$app
->
request
->
post
())
&&
$model
->
save
())
{
return
$this
->
redirect
([
'view'
,
'id'
=>
$model
->
id
]);
}
else
{
return
$this
->
render
(
'create'
,
[
'model'
=>
$model
,
]);
}
}
/**
* Updates an existing District model.
* If update is successful, the browser will be redirected to the 'view' page.
* @param integer $id
* @return mixed
*/
public
function
actionUpdate
(
$id
)
{
$model
=
$this
->
findModel
(
$id
);
if
(
$model
->
load
(
Yii
::
$app
->
request
->
post
())
&&
$model
->
save
())
{
return
$this
->
redirect
([
'view'
,
'id'
=>
$model
->
id
]);
}
else
{
return
$this
->
render
(
'update'
,
[
'model'
=>
$model
,
]);
}
}
/**
* Deletes an existing District model.
* If deletion is successful, the browser will be redirected to the 'index' page.
* @param integer $id
* @return mixed
*/
public
function
actionDelete
(
$id
)
{
$this
->
findModel
(
$id
)
->
delete
();
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.
* @param integer $id
* @return District the loaded model
* @throws NotFoundHttpException if the model cannot be found
*/
protected
function
findModel
(
$id
)
{
if
((
$model
=
District
::
findOne
(
$id
))
!==
null
)
{
return
$model
;
}
else
{
throw
new
NotFoundHttpException
(
'The requested page does not exist.'
);
}
}
}
backend/modules/location/controllers/StateController.php
0 → 100644
View file @
0ea084e9
<?php
namespace
backend\modules\location\controllers
;
use
Yii
;
use
common\models\State
;
use
backend\modules\location\models\search\StateSearch
;
use
yii\web\Controller
;
use
yii\web\NotFoundHttpException
;
use
yii\filters\VerbFilter
;
/**
* StateController implements the CRUD actions for State model.
*/
class
StateController
extends
Controller
{
/**
* @inheritdoc
*/
public
function
behaviors
()
{
return
[
'verbs'
=>
[
'class'
=>
VerbFilter
::
className
(),
'actions'
=>
[
'delete'
=>
[
'POST'
],
],
],
];
}
/**
* Lists all State models.
* @return mixed
*/
public
function
actionIndex
()
{
$searchModel
=
new
StateSearch
();
$dataProvider
=
$searchModel
->
search
(
Yii
::
$app
->
request
->
queryParams
);
return
$this
->
render
(
'index'
,
[
'searchModel'
=>
$searchModel
,
'dataProvider'
=>
$dataProvider
,
]);
}
/**
* Displays a single State model.
* @param integer $id
* @return mixed
*/
public
function
actionView
(
$id
)
{
return
$this
->
render
(
'view'
,
[
'model'
=>
$this
->
findModel
(
$id
),
]);
}
/**
* Creates a new State model.
* If creation is successful, the browser will be redirected to the 'view' page.
* @return mixed
*/
public
function
actionCreate
()
{
$model
=
new
State
();
if
(
$model
->
load
(
Yii
::
$app
->
request
->
post
())
&&
$model
->
save
())
{
return
$this
->
redirect
([
'view'
,
'id'
=>
$model
->
id
]);
}
else
{
return
$this
->
render
(
'create'
,
[
'model'
=>
$model
,
]);
}
}
/**
* Updates an existing State model.
* If update is successful, the browser will be redirected to the 'view' page.
* @param integer $id
* @return mixed
*/
public
function
actionUpdate
(
$id
)
{
$model
=
$this
->
findModel
(
$id
);
if
(
$model
->
load
(
Yii
::
$app
->
request
->
post
())
&&
$model
->
save
())
{
return
$this
->
redirect
([
'view'
,
'id'
=>
$model
->
id
]);
}
else
{
return
$this
->
render
(
'update'
,
[
'model'
=>
$model
,
]);
}
}
/**
* Deletes an existing State model.
* If deletion is successful, the browser will be redirected to the 'index' page.
* @param integer $id
* @return mixed
*/
public
function
actionDelete
(
$id
)
{
$this
->
findModel
(
$id
)
->
delete
();
return
$this
->
redirect
([
'index'
]);
}
/**
* Finds the State model based on its primary key value.
* If the model is not found, a 404 HTTP exception will be thrown.
* @param integer $id
* @return State the loaded model
* @throws NotFoundHttpException if the model cannot be found
*/
protected
function
findModel
(
$id
)
{
if
((
$model
=
State
::
findOne
(
$id
))
!==
null
)
{
return
$model
;
}
else
{
throw
new
NotFoundHttpException
(
'The requested page does not exist.'
);
}
}
}
backend/modules/location/models/search/DistrictSearch.php
0 → 100644
View file @
0ea084e9
<?php
namespace
backend\modules\location\models\search
;
use
Yii
;
use
yii\base\Model
;
use
yii\data\ActiveDataProvider
;
use
common\models\District
;
/**
* DistrictSearch represents the model behind the search form about `common\models\District`.
*/
class
DistrictSearch
extends
District
{
/**
* @inheritdoc
*/
public
function
rules
()
{
return
[
[[
'id'
,
'state_id'
,
'status'
,
'created_at'
,
'updated_at'
],
'integer'
],
[[
'name'
,
'slug'
],
'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
)
{
$query
=
District
::
find
();
// add conditions that should always apply here
$dataProvider
=
new
ActiveDataProvider
([
'query'
=>
$query
,
]);
$this
->
load
(
$params
);
if
(
!
$this
->
validate
())
{
// uncomment the following line if you do not want to return any records when validation fails
// $query->where('0=1');
return
$dataProvider
;
}
// grid filtering conditions
$query
->
andFilterWhere
([
'id'
=>
$this
->
id
,
'state_id'
=>
$this
->
state_id
,
'status'
=>
$this
->
status
,
'created_at'
=>
$this
->
created_at
,
'updated_at'
=>
$this
->
updated_at
,
]);
$query
->
andFilterWhere
([
'like'
,
'name'
,
$this
->
name
])
->
andFilterWhere
([
'like'
,
'slug'
,
$this
->
slug
]);
return
$dataProvider
;
}
}
backend/modules/location/models/search/StateSearch.php
0 → 100644
View file @
0ea084e9
<?php
namespace
backend\modules\location\models\search
;
use
Yii
;
use
yii\base\Model
;
use
yii\data\ActiveDataProvider
;
use
common\models\State
;
/**
* StateSearch represents the model behind the search form about `common\models\State`.
*/
class
StateSearch
extends
State
{
/**
* @inheritdoc
*/
public
function
rules
()
{
return
[
[[
'id'
,
'status'
,
'created_at'
,
'updated_at'
],
'integer'
],
[[
'name'
,
'slug'
],
'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
)
{
$query
=
State
::
find
();
// add conditions that should always apply here
$dataProvider
=
new
ActiveDataProvider
([
'query'
=>
$query
,
]);
$this
->
load
(
$params
);
if
(
!
$this
->
validate
())
{
// uncomment the following line if you do not want to return any records when validation fails
// $query->where('0=1');
return
$dataProvider
;
}
// grid filtering conditions
$query
->
andFilterWhere
([
'id'
=>
$this
->
id
,
'status'
=>
$this
->
status
,
'created_at'
=>
$this
->
created_at
,
'updated_at'
=>
$this
->
updated_at
,
]);
$query
->
andFilterWhere
([
'like'
,
'name'
,
$this
->
name
])
->
andFilterWhere
([
'like'
,
'slug'
,
$this
->
slug
]);
return
$dataProvider
;
}
}
backend/modules/location/views/district/_form.php
0 → 100644
View file @
0ea084e9
<?php
use
yii\helpers\Html
;
use
yii\widgets\ActiveForm
;
/* @var $this yii\web\View */
/* @var $model common\models\District */
/* @var $form yii\widgets\ActiveForm */
?>
<div
class=
"district-form"
>
<?php
$form
=
ActiveForm
::
begin
();
?>
<?=
$form
->
field
(
$model
,
'state_id'
)
->
textInput
()
?>
<?=
$form
->
field
(
$model
,
'name'
)
->
textInput
([
'maxlength'
=>
true
])
?>
<?=
$form
->
field
(
$model
,
'slug'
)
->
textInput
([
'maxlength'
=>
true
])
?>
<?=
$form
->
field
(
$model
,
'status'
)
->
textInput
()
?>
<?=
$form
->
field
(
$model
,
'created_at'
)
->
textInput
()
?>
<?=
$form
->
field
(
$model
,
'updated_at'
)
->
textInput
()
?>
<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/district/_search.php
0 → 100644
View file @
0ea084e9
<?php
use
yii\helpers\Html
;
use
yii\widgets\ActiveForm
;
/* @var $this yii\web\View */
/* @var $model backend\modules\location\models\search\DistrictSearch */
/* @var $form yii\widgets\ActiveForm */
?>
<div
class=
"district-search"
>
<?php
$form
=
ActiveForm
::
begin
([
'action'
=>
[
'index'
],
'method'
=>
'get'
,
]);
?>
<?=
$form
->
field
(
$model
,
'id'
)
?>
<?=
$form
->
field
(
$model
,
'state_id'
)
?>
<?=
$form
->
field
(
$model
,
'name'
)
?>
<?=
$form
->
field
(
$model
,
'slug'
)
?>
<?=
$form
->
field
(
$model
,
'status'
)
?>
<?php
// echo $form->field($model, 'created_at') ?>
<?
php
// echo $form->field($model, 'updated_at') ?>
<
div
class
="
form
-
group
">
<?= Html::submitButton(Yii::t('backend', 'Search'), ['class' => 'btn btn-primary']) ?>
<?= Html::resetButton(Yii::t('backend', 'Reset'), ['class' => 'btn btn-default']) ?>
</div>
<?php ActiveForm::end(); ?>
</div>
backend/modules/location/views/district/create.php
0 → 100644
View file @
0ea084e9
<?php
use
yii\helpers\Html
;
/* @var $this yii\web\View */
/* @var $model common\models\District */
$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"
>
<h1>
<?=
Html
::
encode
(
$this
->
title
)
?>
</h1>
<?=
$this
->
render
(
'_form'
,
[
'model'
=>
$model
,
])
?>
</div>
backend/modules/location/views/district/index.php
0 → 100644
View file @
0ea084e9
<?php
use
yii\helpers\Html
;
use
yii\grid\GridView
;
/* @var $this yii\web\View */
/* @var $searchModel backend\modules\location\models\search\DistrictSearch */
/* @var $dataProvider yii\data\ActiveDataProvider */
$this
->
title
=
Yii
::
t
(
'backend'
,
'Districts'
);
$this
->
params
[
'breadcrumbs'
][]
=
$this
->
title
;
?>
<div
class=
"district-index"
>
<h1>
<?=
Html
::
encode
(
$this
->
title
)
?>
</h1>
<?php
// echo $this->render('_search', ['model' => $searchModel]); ?>
<
p
>
<?=
Html
::
a
(
Yii
::
t
(
'backend'
,
'Create District'
),
[
'create'
],
[
'class'
=>
'btn btn-success'
])
?>
</p>
<?=
GridView
::
widget
([
'dataProvider'
=>
$dataProvider
,
'filterModel'
=>
$searchModel
,
'columns'
=>
[
[
'class'
=>
'yii\grid\SerialColumn'
],
'id'
,
'state_id'
,
'name'
,
'slug'
,
'status'
,
// 'created_at',
// 'updated_at',
[
'class'
=>
'yii\grid\ActionColumn'
],
],
]);
?>
</div>
backend/modules/location/views/district/update.php
0 → 100644
View file @
0ea084e9
<?php
use
yii\helpers\Html
;
/* @var $this yii\web\View */
/* @var $model common\models\District */
$this
->
title
=
Yii
::
t
(
'backend'
,
'Update {modelClass}: '
,
[
'modelClass'
=>
'District'
,
])
.
$model
->
name
;
$this
->
params
[
'breadcrumbs'
][]
=
[
'label'
=>
Yii
::
t
(
'backend'
,
'Districts'
),
'url'
=>
[
'index'
]];
$this
->
params
[
'breadcrumbs'
][]
=
[
'label'
=>
$model
->
name
,
'url'
=>
[
'view'
,
'id'
=>
$model
->
id
]];
$this
->
params
[
'breadcrumbs'
][]
=
Yii
::
t
(
'backend'
,
'Update'
);
?>
<div
class=
"district-update"
>
<h1>
<?=
Html
::
encode
(
$this
->
title
)
?>
</h1>
<?=
$this
->
render
(
'_form'
,
[
'model'
=>
$model
,
])
?>
</div>
backend/modules/location/views/district/view.php
0 → 100644
View file @
0ea084e9
<?php
use
yii\helpers\Html
;
use
yii\widgets\DetailView
;
/* @var $this yii\web\View */
/* @var $model common\models\District */
$this
->
title
=
$model
->
name
;
$this
->
params
[
'breadcrumbs'
][]
=
[
'label'
=>
Yii
::
t
(
'backend'
,
'Districts'
),
'url'
=>
[
'index'
]];
$this
->
params
[
'breadcrumbs'
][]
=
$this
->
title
;
?>
<div
class=
"district-view"
>
<h1>
<?=
Html
::
encode
(
$this
->
title
)
?>
</h1>
<p>
<?=
Html
::
a
(
Yii
::
t
(
'backend'
,
'Update'
),
[
'update'
,
'id'
=>
$model
->
id
],
[
'class'
=>
'btn btn-primary'
])
?>
<?=
Html
::
a
(
Yii
::
t
(
'backend'
,
'Delete'
),
[
'delete'
,
'id'
=>
$model
->
id
],
[
'class'
=>
'btn btn-danger'
,
'data'
=>
[
'confirm'
=>
Yii
::
t
(
'backend'
,
'Are you sure you want to delete this item?'
),
'method'
=>
'post'
,
],
])
?>
</p>
<?=
DetailView
::
widget
([
'model'
=>
$model
,
'attributes'
=>
[
'id'
,
'state_id'
,
'name'
,
'slug'
,
'status'
,
'created_at'
,
'updated_at'
,
],
])
?>
</div>
backend/modules/location/views/state/_form.php
0 → 100644
View file @
0ea084e9
<?php
use
yii\helpers\Html
;
use
yii\widgets\ActiveForm
;
/* @var $this yii\web\View */
/* @var $model common\models\State */
/* @var $form yii\widgets\ActiveForm */
?>
<div
class=
"state-form"
>
<?php
$form
=
ActiveForm
::
begin
();
?>
<?=
$form
->
field
(
$model
,
'name'
)
->
textInput
([
'maxlength'
=>
true
])
?>
<?=
$form
->
field
(
$model
,
'slug'
)
->
textInput
([
'maxlength'
=>
true
])
?>
<?=
$form
->
field
(
$model
,
'status'
)
->
textInput
()
?>
<?=
$form
->
field
(
$model
,
'created_at'
)
->
textInput
()
?>
<?=
$form
->
field
(
$model
,
'updated_at'
)
->
textInput
()
?>
<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/_search.php
0 → 100644
View file @
0ea084e9
<?php
use
yii\helpers\Html
;
use
yii\widgets\ActiveForm
;
/* @var $this yii\web\View */
/* @var $model backend\modules\location\models\search\StateSearch */
/* @var $form yii\widgets\ActiveForm */
?>
<div
class=
"state-search"
>
<?php
$form
=
ActiveForm
::
begin
([
'action'
=>
[
'index'
],
'method'
=>
'get'
,
]);
?>
<?=
$form
->
field
(
$model
,
'id'
)
?>
<?=
$form
->
field
(
$model
,
'name'
)
?>
<?=
$form
->
field
(
$model
,
'slug'
)
?>
<?=
$form
->
field
(
$model
,
'status'
)
?>
<?=
$form
->
field
(
$model
,
'created_at'
)
?>
<?php
// echo $form->field($model, 'updated_at') ?>
<
div
class
="
form
-
group
">
<?= Html::submitButton(Yii::t('backend', 'Search'), ['class' => 'btn btn-primary']) ?>
<?= Html::resetButton(Yii::t('backend', 'Reset'), ['class' => 'btn btn-default']) ?>
</div>
<?php ActiveForm::end(); ?>
</div>
backend/modules/location/views/state/create.php
0 → 100644
View file @
0ea084e9
<?php
use
yii\helpers\Html
;
/* @var $this yii\web\View */
/* @var $model common\models\State */
$this
->
title
=
Yii
::
t
(
'backend'
,
'Create State'
);
$this
->
params
[
'breadcrumbs'
][]
=
[
'label'
=>
Yii
::
t
(
'backend'
,
'States'
),
'url'
=>
[
'index'
]];
$this
->
params
[
'breadcrumbs'
][]
=
$this
->
title
;
?>
<div
class=
"state-create"
>
<h1>
<?=
Html
::
encode
(
$this
->
title
)
?>
</h1>
<?=
$this
->
render
(
'_form'
,
[
'model'
=>
$model
,
])
?>
</div>
backend/modules/location/views/state/index.php
0 → 100644
View file @
0ea084e9
<?php
use
yii\helpers\Html
;
use
yii\grid\GridView
;
/* @var $this yii\web\View */
/* @var $searchModel backend\modules\location\models\search\StateSearch */
/* @var $dataProvider yii\data\ActiveDataProvider */
$this
->
title
=
Yii
::
t
(
'backend'
,
'States'
);
$this
->
params
[
'breadcrumbs'
][]
=
$this
->
title
;
?>
<div
class=
"state-index"
>
<h1>
<?=
Html
::
encode
(
$this
->
title
)
?>
</h1>
<?php
// echo $this->render('_search', ['model' => $searchModel]); ?>
<
p
>
<?=
Html
::
a
(
Yii
::
t
(
'backend'
,
'Create State'
),
[
'create'
],
[
'class'
=>
'btn btn-success'
])
?>
</p>
<?=
GridView
::
widget
([
'dataProvider'
=>
$dataProvider
,
'filterModel'
=>
$searchModel
,
'columns'
=>
[
[
'class'
=>
'yii\grid\SerialColumn'
],
'id'
,
'name'
,
'slug'
,
'status'
,
'created_at'
,
// 'updated_at',
[
'class'
=>
'yii\grid\ActionColumn'
],
],
]);
?>
</div>
backend/modules/location/views/state/update.php
0 → 100644
View file @
0ea084e9
<?php
use
yii\helpers\Html
;
/* @var $this yii\web\View */
/* @var $model common\models\State */
$this
->
title
=
Yii
::
t
(
'backend'
,
'Update {modelClass}: '
,
[
'modelClass'
=>
'State'
,
])
.
$model
->
name
;
$this
->
params
[
'breadcrumbs'
][]
=
[
'label'
=>
Yii
::
t
(
'backend'
,
'States'
),
'url'
=>
[
'index'
]];
$this
->
params
[
'breadcrumbs'
][]
=
[
'label'
=>
$model
->
name
,
'url'
=>
[
'view'
,
'id'
=>
$model
->
id
]];
$this
->
params
[
'breadcrumbs'
][]
=
Yii
::
t
(
'backend'
,
'Update'
);
?>
<div
class=
"state-update"
>
<h1>
<?=
Html
::
encode
(
$this
->
title
)
?>
</h1>
<?=
$this
->
render
(
'_form'
,
[
'model'
=>
$model
,
])
?>
</div>
backend/modules/location/views/state/view.php
0 → 100644
View file @
0ea084e9
<?php
use
yii\helpers\Html
;
use
yii\widgets\DetailView
;
/* @var $this yii\web\View */
/* @var $model common\models\State */
$this
->
title
=
$model
->
name
;
$this
->
params
[
'breadcrumbs'
][]
=
[
'label'
=>
Yii
::
t
(
'backend'
,
'States'
),
'url'
=>
[
'index'
]];
$this
->
params
[
'breadcrumbs'
][]
=
$this
->
title
;
?>
<div
class=
"state-view"
>
<h1>
<?=
Html
::
encode
(
$this
->
title
)
?>
</h1>
<p>
<?=
Html
::
a
(
Yii
::
t
(
'backend'
,
'Update'
),
[
'update'
,
'id'
=>
$model
->
id
],
[
'class'
=>
'btn btn-primary'
])
?>
<?=
Html
::
a
(
Yii
::
t
(
'backend'
,
'Delete'
),
[
'delete'
,
'id'
=>
$model
->
id
],
[
'class'
=>
'btn btn-danger'
,
'data'
=>
[
'confirm'
=>
Yii
::
t
(
'backend'
,
'Are you sure you want to delete this item?'
),
'method'
=>
'post'
,
],
])
?>
</p>
<?=
DetailView
::
widget
([
'model'
=>
$model
,
'attributes'
=>
[
'id'
,
'name'
,
'slug'
,
'status'
,
'created_at'
,
'updated_at'
,
],
])
?>
</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