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
45d0743a
Commit
45d0743a
authored
Sep 09, 2016
by
dianc
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Category Files changes
parent
32ec38bf
Show whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
67 additions
and
59 deletions
+67
-59
CategoryController.php
backend/modules/theme/controllers/CategoryController.php
+0
-52
index.php
backend/modules/theme/views/theme/index.php
+5
-1
_form.php
backend/modules/theme/views/theme_file/_form.php
+4
-3
index.php
backend/modules/theme/views/theme_file/index.php
+53
-0
m160903_101233_theme.php
common/migrations/db/m160903_101233_theme.php
+5
-3
No files found.
backend/modules/theme/controllers/CategoryController.php
View file @
45d0743a
...
...
@@ -166,7 +166,6 @@ class CategoryController extends Controller
]);
}
/**
* Finds the Category model based on its primary key value.
* If the model is not found, a 404 HTTP exception will be thrown.
...
...
@@ -183,55 +182,4 @@ class CategoryController extends Controller
}
}
// public function actionCreatee()
// {
// $model = new Category();
// $models = [new CategoryFiles()];
// if ($model->load(Yii::$app->request->post())) {
//
// $models = Model::createMultiple(CategoryFiles::classname());
// Model::loadMultiple($models, Yii::$app->request->post());
//
// // ajax validation
// if (Yii::$app->request->isAjax) {
// Yii::$app->response->format = Response::FORMAT_JSON;
//
// return ArrayHelper::merge(
// ActiveForm::validateMultiple($models),
// ActiveForm::validate($model)
// );
// }
//
// // validate all models
// $valid = $model->validate();
// $valid = Model::validateMultiple($models) && $valid;
//
// if ($valid) {
// $transaction = \Yii::$app->db->beginTransaction();
// try {
// if ($flag = $model->save(false)) {
// foreach ($models as $modelFile) {
// $modelFile->category_id = $model->id;
// if (!($flag = $modelFile->save(false))) {
// $transaction->rollBack();
// break;
// }
// }
// }
// if ($flag) {
// $transaction->commit();
//
// return $this->redirect(['file', 'category_id' => $model->id]);
// }
// } catch (Exception $e) {
// $transaction->rollBack();
// }
// }
// }
//
// return $this->render('file', [
// 'model' => $model,
// 'modelFiles' => (empty($models)) ? [new CategoryFiles()] : $models
// ]);
// }
}
backend/modules/theme/views/theme/index.php
View file @
45d0743a
...
...
@@ -44,7 +44,11 @@ $this->params['breadcrumbs'][] = $this->title;
// 'created_at',
// 'updated_at',
[
'class'
=>
'yii\grid\ActionColumn'
],
[
'class'
=>
'yii\grid\ActionColumn'
],
// ['class' => 'yii\grid\ActionColumn',
// 'template' => '{update}{delete}'],
],
]);
?>
...
...
backend/modules/theme/views/theme_file/_form.php
View file @
45d0743a
...
...
@@ -24,9 +24,10 @@ use wbraganca\dynamicform\DynamicFormWidget;
'model'
=>
$modelFiles
[
0
],
'formId'
=>
'dynamic-form'
,
'formFields'
=>
[
'name'
,
'code'
,
'type'
,
'theme_code'
,
'file_code'
,
'base_url'
,
'base_path'
,
],
]);
?>
...
...
backend/modules/theme/views/theme_file/index.php
0 → 100644
View file @
45d0743a
<?php
use
yii\helpers\Html
;
use
yii\grid\GridView
;
use
common\grid\EnumColumn
;
use
common\models\Theme
;
/* @var $this yii\web\View */
/* @var $searchModel backend\modules\theme\models\search\ThemeSearch */
/* @var $dataProvider yii\data\ActiveDataProvider */
$this
->
title
=
Yii
::
t
(
'backend'
,
'Themes'
);
$this
->
params
[
'breadcrumbs'
][]
=
$this
->
title
;
?>
<div
class=
"theme-index"
>
<?php
// echo $this->render('_search', ['model' => $searchModel]); ?>
<
p
>
<?=
Html
::
a
(
Yii
::
t
(
'backend'
,
'Create {modelClass}'
,
[
'modelClass'
=>
'ThemeFiles'
,
]),
[
'create'
],
[
'class'
=>
'btn btn-success'
])
?>
</p>
<?=
GridView
::
widget
([
'dataProvider'
=>
$dataProvider
,
'filterModel'
=>
$searchModel
,
'columns'
=>
[
[
'class'
=>
'yii\grid\SerialColumn'
],
'id'
,
'theme_code'
,
'file_code'
,
'base_url'
,
'base_path'
,
// 'description',
// [
// 'class' => EnumColumn::className(),
// 'attribute' => 'status',
// 'enum' => Theme::statuses(),
// 'filter' => Theme::statuses()
// ],
// 'status',
// 'created_at',
// 'updated_at',
// ['class' => 'yii\grid\ActionColumn'
// ],
// ['class' => 'yii\grid\ActionColumn',
// 'template' => '{update}{delete}'],
],
]);
?>
</div>
common/migrations/db/m160903_101233_theme.php
View file @
45d0743a
...
...
@@ -26,8 +26,8 @@ class m160903_101233_theme extends Migration
$this
->
createTable
(
'{{%theme_files}}'
,
[
'id'
=>
$this
->
primaryKey
(),
'theme_
id
'
=>
$this
->
integer
()
->
notNull
(),
'file_
id'
=>
$this
->
string
(
32
)
->
notNull
(),
'theme_
code
'
=>
$this
->
integer
()
->
notNull
(),
'file_
code'
=>
$this
->
integer
(
)
->
notNull
(),
'base_url'
=>
$this
->
string
(
1024
),
'base_path'
=>
$this
->
string
(
1024
),
'created_at'
=>
$this
->
integer
(),
...
...
@@ -36,11 +36,13 @@ class m160903_101233_theme extends Migration
$this
->
addForeignKey
(
'fk_theme_category'
,
'{{%theme}}'
,
'category_id'
,
'{{%category}}'
,
'id'
,
'cascade'
,
'cascade'
);
$this
->
addForeignKey
(
'fk_theme_files_theme'
,
'{{%theme_files}}'
,
'theme_id'
,
'{{%theme}}'
,
'id'
,
'cascade'
,
'cascade'
);
$this
->
addForeignKey
(
'fk_theme_files_theme'
,
'{{%theme_files}}'
,
'theme_code'
,
'{{%theme}}'
,
'id'
,
'cascade'
,
'cascade'
);
$this
->
addForeignKey
(
'fk_theme_category_files'
,
'{{%theme_files}}'
,
'file_code'
,
'{{%category_files}}'
,
'id'
,
'cascade'
,
'cascade'
);
}
public
function
safeDown
()
{
$this
->
dropForeignKey
(
'fk_theme_category_files'
,
'{{%theme_files}}'
);
$this
->
dropForeignKey
(
'fk_theme_files_theme'
,
'{{%theme_files}}'
);
$this
->
dropForeignKey
(
'fk_theme_category'
,
'{{%theme}}'
);
...
...
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