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
17a7367f
Commit
17a7367f
authored
Aug 31, 2016
by
jomon
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
code review changes
parent
2740d958
Show whitespace changes
Inline
Side-by-side
Showing
8 changed files
with
0 additions
and
398 deletions
+0
-398
CategoryController.php
backend/modules/theme/controllers/CategoryController.php
+0
-121
_form.php
backend/modules/theme/views/theme-category/_form.php
+0
-39
_search.php
backend/modules/theme/views/theme-category/_search.php
+0
-43
create.php
backend/modules/theme/views/theme-category/create.php
+0
-21
index.php
backend/modules/theme/views/theme-category/index.php
+0
-43
update.php
backend/modules/theme/views/theme-category/update.php
+0
-21
view.php
backend/modules/theme/views/theme-category/view.php
+0
-41
CategorySearch.php
common/models/CategorySearch.php
+0
-69
No files found.
backend/modules/theme/controllers/CategoryController.php
deleted
100644 → 0
View file @
2740d958
<?php
namespace
backend\modules\theme\controllers
;
use
Yii
;
use
common\models\Category
;
use
common\models\CategorySearch
;
use
yii\web\Controller
;
use
yii\web\NotFoundHttpException
;
use
yii\filters\VerbFilter
;
/**
* CategoryController implements the CRUD actions for Category model.
*/
class
CategoryController
extends
Controller
{
public
function
behaviors
()
{
return
[
'verbs'
=>
[
'class'
=>
VerbFilter
::
className
(),
'actions'
=>
[
'delete'
=>
[
'post'
],
],
],
];
}
/**
* Lists all Category models.
* @return mixed
*/
public
function
actionIndex
()
{
$searchModel
=
new
CategorySearch
();
$dataProvider
=
$searchModel
->
search
(
Yii
::
$app
->
request
->
queryParams
);
return
$this
->
render
(
'index'
,
[
'searchModel'
=>
$searchModel
,
'dataProvider'
=>
$dataProvider
,
]);
}
/**
* Displays a single Category model.
* @param integer $id
* @return mixed
*/
public
function
actionView
(
$id
)
{
return
$this
->
render
(
'view'
,
[
'model'
=>
$this
->
findModel
(
$id
),
]);
}
/**
* Creates a new Category model.
* If creation is successful, the browser will be redirected to the 'view' page.
* @return mixed
*/
public
function
actionCreate
()
{
$model
=
new
Category
();
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 Category 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 Category 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 Category model based on its primary key value.
* If the model is not found, a 404 HTTP exception will be thrown.
* @param integer $id
* @return Category the loaded model
* @throws NotFoundHttpException if the model cannot be found
*/
protected
function
findModel
(
$id
)
{
if
((
$model
=
Category
::
findOne
(
$id
))
!==
null
)
{
return
$model
;
}
else
{
throw
new
NotFoundHttpException
(
'The requested page does not exist.'
);
}
}
}
backend/modules/theme/views/theme-category/_form.php
deleted
100644 → 0
View file @
2740d958
<?php
use
yii\helpers\Html
;
use
yii\bootstrap\ActiveForm
;
/* @var $this yii\web\View */
/* @var $model common\models\Category */
/* @var $form yii\bootstrap\ActiveForm */
?>
<div
class=
"category-form"
>
<?php
$form
=
ActiveForm
::
begin
();
?>
<?php
echo
$form
->
errorSummary
(
$model
);
?>
<?php
echo
$form
->
field
(
$model
,
'name'
)
->
textInput
([
'maxlength'
=>
true
])
?>
<?php
echo
$form
->
field
(
$model
,
'slug'
)
->
textInput
([
'maxlength'
=>
true
])
?>
<?php
echo
$form
->
field
(
$model
,
'description'
)
->
textInput
([
'maxlength'
=>
true
])
?>
<?php
echo
$form
->
field
(
$model
,
'image_url'
)
->
textInput
([
'maxlength'
=>
true
])
?>
<?php
echo
$form
->
field
(
$model
,
'image_path'
)
->
textInput
([
'maxlength'
=>
true
])
?>
<?php
echo
$form
->
field
(
$model
,
'status'
)
->
textInput
()
?>
<?php
echo
$form
->
field
(
$model
,
'created_at'
)
->
textInput
()
?>
<?php
echo
$form
->
field
(
$model
,
'updated_at'
)
->
textInput
()
?>
<div
class=
"form-group"
>
<?php
echo
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/theme/views/theme-category/_search.php
deleted
100644 → 0
View file @
2740d958
<?php
use
yii\helpers\Html
;
use
yii\bootstrap\ActiveForm
;
/* @var $this yii\web\View */
/* @var $model common\models\CategorySearch */
/* @var $form yii\bootstrap\ActiveForm */
?>
<div
class=
"category-search"
>
<?php
$form
=
ActiveForm
::
begin
([
'action'
=>
[
'index'
],
'method'
=>
'get'
,
]);
?>
<?php
echo
$form
->
field
(
$model
,
'id'
)
?>
<?php
echo
$form
->
field
(
$model
,
'name'
)
?>
<?php
echo
$form
->
field
(
$model
,
'slug'
)
?>
<?php
echo
$form
->
field
(
$model
,
'description'
)
?>
<?php
echo
$form
->
field
(
$model
,
'image_url'
)
?>
<?php
// echo $form->field($model, 'image_path') ?>
<?
php
// echo $form->field($model, 'status') ?>
<?
php
// echo $form->field($model, 'created_at') ?>
<?
php
// echo $form->field($model, 'updated_at') ?>
<
div
class
="
form
-
group
">
<?php echo Html::submitButton(Yii::t('backend', 'Search'), ['class' => 'btn btn-primary']) ?>
<?php echo Html::resetButton(Yii::t('backend', 'Reset'), ['class' => 'btn btn-default']) ?>
</div>
<?php ActiveForm::end(); ?>
</div>
backend/modules/theme/views/theme-category/create.php
deleted
100644 → 0
View file @
2740d958
<?php
use
yii\helpers\Html
;
/* @var $this yii\web\View */
/* @var $model common\models\Category */
$this
->
title
=
Yii
::
t
(
'backend'
,
'Create {modelClass}'
,
[
'modelClass'
=>
'Category'
,
]);
$this
->
params
[
'breadcrumbs'
][]
=
[
'label'
=>
Yii
::
t
(
'backend'
,
'Categories'
),
'url'
=>
[
'index'
]];
$this
->
params
[
'breadcrumbs'
][]
=
$this
->
title
;
?>
<div
class=
"category-create"
>
<?php
echo
$this
->
render
(
'_form'
,
[
'model'
=>
$model
,
])
?>
</div>
backend/modules/theme/views/theme-category/index.php
deleted
100644 → 0
View file @
2740d958
<?php
use
yii\helpers\Html
;
use
yii\grid\GridView
;
/* @var $this yii\web\View */
/* @var $searchModel common\models\CategorySearch */
/* @var $dataProvider yii\data\ActiveDataProvider */
$this
->
title
=
Yii
::
t
(
'backend'
,
'Categories'
);
$this
->
params
[
'breadcrumbs'
][]
=
$this
->
title
;
?>
<div
class=
"category-index"
>
<?php
// echo $this->render('_search', ['model' => $searchModel]); ?>
<
p
>
<?
php
echo
Html
::
a
(
Yii
::
t
(
'backend'
,
'Create {modelClass}'
,
[
'modelClass'
=>
'Category'
,
]),
[
'create'
],
[
'class'
=>
'btn btn-success'
])
?>
</p>
<?php
echo
GridView
::
widget
([
'dataProvider'
=>
$dataProvider
,
'filterModel'
=>
$searchModel
,
'columns'
=>
[
[
'class'
=>
'yii\grid\SerialColumn'
],
'id'
,
'name'
,
'slug'
,
'description'
,
'image_url:url'
,
// 'image_path',
// 'status',
// 'created_at',
// 'updated_at',
[
'class'
=>
'yii\grid\ActionColumn'
],
],
]);
?>
</div>
backend/modules/theme/views/theme-category/update.php
deleted
100644 → 0
View file @
2740d958
<?php
use
yii\helpers\Html
;
/* @var $this yii\web\View */
/* @var $model common\models\Category */
$this
->
title
=
Yii
::
t
(
'backend'
,
'Update {modelClass}: '
,
[
'modelClass'
=>
'Category'
,
])
.
' '
.
$model
->
name
;
$this
->
params
[
'breadcrumbs'
][]
=
[
'label'
=>
Yii
::
t
(
'backend'
,
'Categories'
),
'url'
=>
[
'index'
]];
$this
->
params
[
'breadcrumbs'
][]
=
[
'label'
=>
$model
->
name
,
'url'
=>
[
'view'
,
'id'
=>
$model
->
id
]];
$this
->
params
[
'breadcrumbs'
][]
=
Yii
::
t
(
'backend'
,
'Update'
);
?>
<div
class=
"category-update"
>
<?php
echo
$this
->
render
(
'_form'
,
[
'model'
=>
$model
,
])
?>
</div>
backend/modules/theme/views/theme-category/view.php
deleted
100644 → 0
View file @
2740d958
<?php
use
yii\helpers\Html
;
use
yii\widgets\DetailView
;
/* @var $this yii\web\View */
/* @var $model common\models\Category */
$this
->
title
=
$model
->
name
;
$this
->
params
[
'breadcrumbs'
][]
=
[
'label'
=>
Yii
::
t
(
'backend'
,
'Categories'
),
'url'
=>
[
'index'
]];
$this
->
params
[
'breadcrumbs'
][]
=
$this
->
title
;
?>
<div
class=
"category-view"
>
<p>
<?php
echo
Html
::
a
(
Yii
::
t
(
'backend'
,
'Update'
),
[
'update'
,
'id'
=>
$model
->
id
],
[
'class'
=>
'btn btn-primary'
])
?>
<?php
echo
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>
<?php
echo
DetailView
::
widget
([
'model'
=>
$model
,
'attributes'
=>
[
'id'
,
'name'
,
'slug'
,
'description'
,
'image_url:url'
,
'image_path'
,
'status'
,
'created_at'
,
'updated_at'
,
],
])
?>
</div>
common/models/CategorySearch.php
deleted
100644 → 0
View file @
2740d958
<?php
namespace
common\models
;
use
Yii
;
use
yii\base\Model
;
use
yii\data\ActiveDataProvider
;
use
common\models\Category
;
/**
* CategorySearch represents the model behind the search form about `common\models\Category`.
*/
class
CategorySearch
extends
Category
{
/**
* @inheritdoc
*/
public
function
rules
()
{
return
[
[[
'id'
,
'status'
,
'created_at'
,
'updated_at'
],
'integer'
],
[[
'name'
,
'slug'
,
'description'
,
'image_url'
,
'image_path'
],
'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
=
Category
::
find
();
$dataProvider
=
new
ActiveDataProvider
([
'query'
=>
$query
,
]);
if
(
!
(
$this
->
load
(
$params
)
&&
$this
->
validate
()))
{
return
$dataProvider
;
}
$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
])
->
andFilterWhere
([
'like'
,
'description'
,
$this
->
description
])
->
andFilterWhere
([
'like'
,
'image_url'
,
$this
->
image_url
])
->
andFilterWhere
([
'like'
,
'image_path'
,
$this
->
image_path
]);
return
$dataProvider
;
}
}
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