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
0a811f75
Commit
0a811f75
authored
Sep 22, 2016
by
Junaid Rahman pv
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
added file editor option
parent
16402987
Hide whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
87 additions
and
38 deletions
+87
-38
ThemeController.php
backend/modules/theme/controllers/ThemeController.php
+0
-1
ThemeFileController.php
backend/modules/theme/controllers/ThemeFileController.php
+20
-17
_form.php
backend/modules/theme/views/theme-file/_form.php
+21
-17
editor.php
backend/modules/theme/views/theme-file/editor.php
+37
-0
upload.php
backend/modules/theme/views/theme-file/upload.php
+2
-2
style.less
backend/web/css/style.less
+2
-0
ThemeFiles.php
common/models/ThemeFiles.php
+5
-1
No files found.
backend/modules/theme/controllers/ThemeController.php
View file @
0a811f75
...
@@ -131,7 +131,6 @@ class ThemeController extends Controller
...
@@ -131,7 +131,6 @@ class ThemeController extends Controller
}
}
}
}
public
function
actionFiles
(
$id
)
public
function
actionFiles
(
$id
)
{
{
$model
=
$this
->
findModel
(
$id
);
$model
=
$this
->
findModel
(
$id
);
...
...
backend/modules/theme/controllers/ThemeFileController.php
View file @
0a811f75
...
@@ -14,23 +14,6 @@ class ThemeFileController extends \yii\web\Controller
...
@@ -14,23 +14,6 @@ class ThemeFileController extends \yii\web\Controller
{
{
return
$this
->
render
(
'index'
);
return
$this
->
render
(
'index'
);
}
}
/**
* Finds the Theme model based on its primary key value.
* If the model is not found, a 404 HTTP exception will be thrown.
* @param integer $id
* @return Theme the loaded model
* @throws NotFoundHttpException if the model cannot be found
*/
protected
function
findModel
(
$id
)
{
if
((
$model
=
ThemeFiles
::
findOne
(
$id
))
!==
null
)
{
return
$model
;
}
else
{
throw
new
NotFoundHttpException
(
'The requested page does not exist.'
);
}
}
public
function
actionUpload
()
public
function
actionUpload
()
{
{
$model
=
new
ThemeFiles
();
$model
=
new
ThemeFiles
();
...
@@ -58,4 +41,24 @@ class ThemeFileController extends \yii\web\Controller
...
@@ -58,4 +41,24 @@ class ThemeFileController extends \yii\web\Controller
return
$this
->
redirect
([
'theme/index'
]);
return
$this
->
redirect
([
'theme/index'
]);
}
}
public
function
actionEditor
(
$id
)
{
$model
=
$this
->
findModel
(
$id
);
if
(
$model
->
load
(
Yii
::
$app
->
request
->
post
()))
{
}
return
$this
->
render
(
'editor'
,[
'model'
=>
$model
,
]);
}
protected
function
findModel
(
$id
)
{
if
((
$model
=
ThemeFiles
::
findOne
(
$id
))
!==
null
)
{
return
$model
;
}
else
{
throw
new
NotFoundHttpException
(
'The requested page does not exist.'
);
}
}
}
}
backend/modules/theme/views/theme-file/_form.php
View file @
0a811f75
...
@@ -4,17 +4,15 @@
...
@@ -4,17 +4,15 @@
?>
?>
<?php
<?php
use
yii\helpers\Html
;
use
yii\helpers\Html
;
use
yii\widgets\ActiveForm
;
use
yii\bootstrap\Modal
;
use
yii\bootstrap\Modal
;
use
yii\helpers\Url
;
?>
?>
<div
class=
"customer-form"
>
<div
class=
"customer-form"
>
<div
class=
"
panel panel-default
"
>
<div
class=
"
col-md-6
"
>
<div
class=
"panel
-body
"
>
<div
class=
"panel
panel-default
"
>
<table>
<table
class=
"table"
>
<tr>
<tr>
<th>
File Name
</th>
<th>
File Name
</th>
<th>
Options
</th>
<th>
Options
</th>
...
@@ -30,22 +28,33 @@ use yii\helpers\Url;
...
@@ -30,22 +28,33 @@ use yii\helpers\Url;
$fileCode
=
$value
[
'code'
];
$fileCode
=
$value
[
'code'
];
$modelFiles
[
0
]
->
theme_code
=
$themeCode
;
$modelFiles
[
0
]
->
theme_code
=
$themeCode
;
$modelFiles
[
0
]
->
file_code
=
$fileCode
;
$modelFiles
[
0
]
->
file_code
=
$fileCode
;
if
(
$modelFiles
[
0
]
::
isFileExist
(
$themeCode
,
$fileCode
))
{
?>
if
(
$modelFiles
[
0
]
::
isFileExist
(
$themeCode
,
$fileCode
))
{
$fileModel
=
$modelFiles
[
0
]
::
findOne
([
'theme_code'
=>
$themeCode
,
'file_code'
=>
$fileCode
]);
?>
<td>
<?=
'edit'
?>
</td>
<td>
<?=
Html
::
a
(
' Edit '
,
[
'theme-file/editor'
,
'id'
=>
$fileModel
->
id
],
[
'class'
=>
'btn btn-primary fa fa-edit'
,
])
?>
</td>
<?php
}
else
{
?>
<?php
}
else
{
?>
<td>
<td>
<?=
Html
::
button
(
'Upload File'
,
[
<?=
Html
::
button
(
'Upload File'
,
[
'class'
=>
'btn btn-
default
'
,
'class'
=>
'btn btn-
primary
'
,
'id'
=>
'modalButton'
.
$value
[
'id'
],
'id'
=>
'modalButton'
.
$value
[
'id'
],
'onclick'
=>
'uploadJquery.upload('
.
$value
[
'id'
]
.
');'
'onclick'
=>
'uploadJquery.upload('
.
$value
[
'id'
]
.
');'
])
?>
])
?>
<?php
<?php
Modal
::
begin
([
Modal
::
begin
([
'header'
=>
'
<h3>Upload</h3>
'
,
'header'
=>
''
,
'id'
=>
'modal'
.
$value
[
'id'
],
'id'
=>
'modal'
.
$value
[
'id'
],
'size'
=>
'modal-sm'
,
'size'
=>
'modal-sm'
,
//keeps from closing modal with esc key or by clicking out of the modal.
//keeps from closing modal with esc key or by clicking out of the modal.
...
@@ -54,18 +63,13 @@ use yii\helpers\Url;
...
@@ -54,18 +63,13 @@ use yii\helpers\Url;
?>
?>
<div
id=
'modalContent'
.
<?=
$value
[
'id'
]
?>
style=
"text-align: center"
>
<div
id=
'modalContent'
<?=
$value
[
'id'
]
?>
style=
"text-align: center"
>
<?=
$this
->
render
(
'upload'
,
[
<?=
$this
->
render
(
'upload'
,
[
'model'
=>
$modelFiles
[
0
],])
?>
'model'
=>
$modelFiles
[
0
],
])
?>
</div>
</div>
<?php
<?php
yii\bootstrap\Modal
::
end
();
?>
yii\bootstrap\Modal
::
end
();
?>
</td>
</td>
...
...
backend/modules/theme/views/theme-file/editor.php
0 → 100644
View file @
0a811f75
<?php
/**
* Created by PhpStorm.
* User: user50
* Date: 22-09-2016
* Time: 02:37 PM
*/
use
yii\widgets\ActiveForm
;
use
yii\helpers\Html
;
?>
<div
class=
"text-block-form"
>
<?php
$form
=
ActiveForm
::
begin
();
?>
<?php
$file
=
yii
::
getAlias
(
'@storage/private/theme-assets/'
)
.
$model
->
theme_code
.
'/'
.
$model
->
file_code
;
$model
->
fileContent
=
file_get_contents
(
$file
);
?>
?>
<?=
$form
->
field
(
$model
,
'fileContent'
)
->
widget
(
trntv\aceeditor\AceEditor
::
className
(),
[
'mode'
=>
'html'
]
)
?>
<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/theme/views/theme-file/upload.php
View file @
0a811f75
...
@@ -19,7 +19,7 @@ use yii\bootstrap\Html;
...
@@ -19,7 +19,7 @@ use yii\bootstrap\Html;
'action'
=>
'../theme-file/upload'
'action'
=>
'../theme-file/upload'
]);
?>
]);
?>
<div
class=
"
conatiner
"
>
<div
class=
"
panel
"
>
<div
class=
"row"
>
<div
class=
"row"
>
<div
class=
"col-md-11"
>
<div
class=
"col-md-11"
>
...
@@ -43,7 +43,7 @@ use yii\bootstrap\Html;
...
@@ -43,7 +43,7 @@ use yii\bootstrap\Html;
</div>
</div>
<div
class=
"form-group"
>
<div
class=
"form-group"
>
<?=
Html
::
submitButton
(
Yii
::
t
(
'backend'
,
'
Upload
'
),
<?=
Html
::
submitButton
(
Yii
::
t
(
'backend'
,
'
Save
'
),
[
'class'
=>
'btn btn-primary'
])
?>
[
'class'
=>
'btn btn-primary'
])
?>
</div>
</div>
...
...
backend/web/css/style.less
View file @
0a811f75
...
@@ -22,4 +22,5 @@ body {
...
@@ -22,4 +22,5 @@ body {
padding-left: 10px;
padding-left: 10px;
}
}
}
}
\ No newline at end of file
common/models/ThemeFiles.php
View file @
0a811f75
...
@@ -26,6 +26,10 @@ class ThemeFiles extends \yii\db\ActiveRecord
...
@@ -26,6 +26,10 @@ class ThemeFiles extends \yii\db\ActiveRecord
* @var file upload
* @var file upload
*/
*/
public
$file
;
public
$file
;
/*
* @var file upload
*/
public
$fileContent
;
/**
/**
* @inheritdoc
* @inheritdoc
*/
*/
...
@@ -51,7 +55,7 @@ class ThemeFiles extends \yii\db\ActiveRecord
...
@@ -51,7 +55,7 @@ class ThemeFiles extends \yii\db\ActiveRecord
{
{
return
[
return
[
[[
'theme_code'
,
'file_code'
,
'file'
],
'required'
],
[[
'theme_code'
,
'file_code'
,
'file'
],
'required'
],
[[
'theme_code'
,
'file_code'
],
'string'
],
[[
'theme_code'
,
'file_code'
,
'fileContent'
],
'string'
],
[[
'created_at'
,
'updated_at'
],
'integer'
],
[[
'created_at'
,
'updated_at'
],
'integer'
],
[[
'file_code'
],
'exist'
,
'skipOnError'
=>
true
,
'targetClass'
=>
CategoryFiles
::
className
(),
'targetAttribute'
=>
[
'file_code'
=>
'id'
]],
[[
'file_code'
],
'exist'
,
'skipOnError'
=>
true
,
'targetClass'
=>
CategoryFiles
::
className
(),
'targetAttribute'
=>
[
'file_code'
=>
'id'
]],
[[
'theme_code'
],
'exist'
,
'skipOnError'
=>
true
,
'targetClass'
=>
Theme
::
className
(),
'targetAttribute'
=>
[
'theme_code'
=>
'id'
]],
[[
'theme_code'
],
'exist'
,
'skipOnError'
=>
true
,
'targetClass'
=>
Theme
::
className
(),
'targetAttribute'
=>
[
'theme_code'
=>
'id'
]],
...
...
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