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
552d6af1
Commit
552d6af1
authored
Sep 24, 2016
by
Junaid Rahman pv
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
added file deletion option in theme,bug fix
parent
37ea8297
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
42 additions
and
15 deletions
+42
-15
ThemeFileController.php
backend/modules/theme/controllers/ThemeFileController.php
+26
-9
_form.php
backend/modules/theme/views/theme-file/_form.php
+11
-1
index.php
backend/modules/theme/views/theme/index.php
+1
-1
m160903_101233_theme.php
common/migrations/db/m160903_101233_theme.php
+4
-4
No files found.
backend/modules/theme/controllers/ThemeFileController.php
View file @
552d6af1
...
@@ -40,7 +40,7 @@ class ThemeFileController extends \yii\web\Controller
...
@@ -40,7 +40,7 @@ class ThemeFileController extends \yii\web\Controller
'type'
=>
'warning'
,
'type'
=>
'warning'
,
'duration'
=>
4000
,
'duration'
=>
4000
,
'icon'
=>
'fa fa-file'
,
'icon'
=>
'fa fa-file'
,
'message'
=>
''
.
$model
->
file_code
.
' Uploading...'
,
'message'
=>
''
.
$model
->
file_code
.
' Uploading...'
,
'showSeparator'
=>
true
,
'showSeparator'
=>
true
,
'title'
=>
' File Upload'
,
'title'
=>
' File Upload'
,
'showProgressbar'
=>
true
,
'showProgressbar'
=>
true
,
...
@@ -80,10 +80,8 @@ class ThemeFileController extends \yii\web\Controller
...
@@ -80,10 +80,8 @@ class ThemeFileController extends \yii\web\Controller
return
$this
->
redirect
([
'theme/files'
,
'id'
=>
$model
->
theme_id
]);
return
$this
->
redirect
([
'theme/files'
,
'id'
=>
$model
->
theme_id
]);
}
}
public
public
function
actionEditor
(
$id
)
function
actionEditor
(
{
$id
)
{
$model
=
$this
->
findModel
(
$id
);
$model
=
$this
->
findModel
(
$id
);
if
(
$model
->
load
(
Yii
::
$app
->
request
->
post
()))
{
if
(
$model
->
load
(
Yii
::
$app
->
request
->
post
()))
{
$file
=
yii
::
getAlias
(
'@storage/private/theme-assets/'
)
.
$model
->
theme_code
.
'/'
.
$model
->
file_code
;
$file
=
yii
::
getAlias
(
'@storage/private/theme-assets/'
)
.
$model
->
theme_code
.
'/'
.
$model
->
file_code
;
...
@@ -105,10 +103,29 @@ class ThemeFileController extends \yii\web\Controller
...
@@ -105,10 +103,29 @@ class ThemeFileController extends \yii\web\Controller
]);
]);
}
}
protected
public
function
actionDelete
(
$id
)
function
findModel
(
{
$id
$model
=
$this
->
findModel
(
$id
);
)
{
if
(
$model
->
load
(
Yii
::
$app
->
request
->
post
()))
{
$file
=
yii
::
getAlias
(
'@storage/private/theme-assets/'
)
.
$model
->
theme_code
.
'/'
.
$model
->
file_code
;
unlink
(
$file
);
$this
->
findModel
(
$id
)
->
delete
();
Yii
::
$app
->
getSession
()
->
setFlash
(
'Delete Theme file'
,
[
'type'
=>
'success'
,
'duration'
=>
5000
,
'icon'
=>
'fa fa-file'
,
'message'
=>
' File successfully Deleted'
,
'showSeparator'
=>
true
,
'title'
=>
' Theme Files'
,
'positonY'
=>
'top'
,
'positonX'
=>
'right'
]);
}
return
$this
->
redirect
([
'theme/files'
,
'id'
=>
$model
->
theme_id
]);
}
protected
function
findModel
(
$id
)
{
if
((
$model
=
ThemeFiles
::
findOne
(
$id
))
!==
null
)
{
if
((
$model
=
ThemeFiles
::
findOne
(
$id
))
!==
null
)
{
return
$model
;
return
$model
;
}
else
{
}
else
{
...
...
backend/modules/theme/views/theme-file/_form.php
View file @
552d6af1
...
@@ -5,6 +5,7 @@
...
@@ -5,6 +5,7 @@
<?php
<?php
use
yii\helpers\Html
;
use
yii\helpers\Html
;
use
yii\bootstrap\Modal
;
use
yii\bootstrap\Modal
;
use
yii\widgets\ActiveForm
;
?>
?>
...
@@ -36,11 +37,20 @@ use yii\bootstrap\Modal;
...
@@ -36,11 +37,20 @@ use yii\bootstrap\Modal;
?>
?>
<td>
<td>
<?php
$form
=
ActiveForm
::
begin
([
'action'
=>
'../theme-file/delete?id='
.
$fileModel
->
id
]);
?>
<?=
$form
->
field
(
$fileModel
,
'theme_id'
)
->
hiddenInput
([
'value'
=>
$model
->
id
])
->
label
(
false
)
?>
<?=
Html
::
a
(
' Edit '
,
[
'theme-file/editor'
,
'id'
=>
$fileModel
->
id
],
[
<?=
Html
::
a
(
' Edit '
,
[
'theme-file/editor'
,
'id'
=>
$fileModel
->
id
],
[
'class'
=>
'btn btn-primary fa fa-edit'
,
'class'
=>
'btn btn-primary fa fa-edit'
,
])
?>
])
?>
<?=
Html
::
submitButton
(
Yii
::
t
(
'backend'
,
' Delete'
),
[
'class'
=>
'btn btn-primary fa fa-trash'
,
'onclick'
=>
'return confirm("Are you sure?")'
])
?>
<?php
ActiveForm
::
end
();
?>
</td>
</td>
<?php
}
else
{
?>
<?php
}
else
{
?>
...
...
backend/modules/theme/views/theme/index.php
View file @
552d6af1
...
@@ -49,7 +49,7 @@ $this->params['breadcrumbs'][] = $this->title;
...
@@ -49,7 +49,7 @@ $this->params['breadcrumbs'][] = $this->title;
'template'
=>
'{update} {files} {delete}'
,
'template'
=>
'{update} {files} {delete}'
,
'buttons'
=>
[
'buttons'
=>
[
'files'
=>
function
(
$url
)
{
'files'
=>
function
(
$url
)
{
return
Html
::
a
(
'
<span class="fa fa-file"></span>
'
,
$url
,
[
return
Html
::
a
(
'
<span class="fa fa-file"> </span>
'
,
$url
,
[
'title'
=>
Yii
::
t
(
'yii'
,
'Files'
),
'title'
=>
Yii
::
t
(
'yii'
,
'Files'
),
]);
]);
...
...
common/migrations/db/m160903_101233_theme.php
View file @
552d6af1
...
@@ -38,10 +38,10 @@ class m160903_101233_theme extends Migration
...
@@ -38,10 +38,10 @@ class m160903_101233_theme extends Migration
$this
->
createIndex
(
'idx_theme_files_theme_code'
,
'{{%theme_files}}'
,
'theme_code'
);
$this
->
createIndex
(
'idx_theme_files_theme_code'
,
'{{%theme_files}}'
,
'theme_code'
);
$this
->
createIndex
(
'idx_theme_files_file_code'
,
'{{%theme_files}}'
,
'file_code'
);
$this
->
createIndex
(
'idx_theme_files_file_code'
,
'{{%theme_files}}'
,
'file_code'
);
$this
->
addForeignKey
(
'fk_theme_category'
,
'{{%theme}}'
,
'category_id'
,
'{{%category}}'
,
'id'
,
'
RESTRICT
'
,
$this
->
addForeignKey
(
'fk_theme_category'
,
'{{%theme}}'
,
'category_id'
,
'{{%category}}'
,
'id'
,
'
cascade
'
,
'
RESTRICT
'
);
'
cascade
'
);
$this
->
addForeignKey
(
'fk_theme_files_theme'
,
'{{%theme_files}}'
,
'theme_code'
,
'{{%theme}}'
,
'code'
,
'
RESTRICT
'
,
$this
->
addForeignKey
(
'fk_theme_files_theme'
,
'{{%theme_files}}'
,
'theme_code'
,
'{{%theme}}'
,
'code'
,
'
cascade
'
,
'
RESTRICT
'
);
'
cascade
'
);
$this
->
addForeignKey
(
'fk_theme_files_category_files'
,
'{{%theme_files}}'
,
'file_code'
,
'{{%category_files}}'
,
'code'
,
$this
->
addForeignKey
(
'fk_theme_files_category_files'
,
'{{%theme_files}}'
,
'file_code'
,
'{{%category_files}}'
,
'code'
,
'cascade'
,
'cascade'
);
'cascade'
,
'cascade'
);
}
}
...
...
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