Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Y
yii2-widgets2-module
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Commits
Open sidebar
hrzg
yii2-widgets2-module
Commits
cfc6a218
Commit
cfc6a218
authored
May 25, 2016
by
Tobias Munk
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
⚙
php-cs-fixer
parent
d35db530
Changes
33
Hide whitespace changes
Inline
Side-by-side
Showing
33 changed files
with
164 additions
and
272 deletions
+164
-272
Module.php
src/Module.php
+1
-1
DefaultController.php
src/controllers/DefaultController.php
+2
-1
WidgetController.php
src/controllers/crud/WidgetController.php
+2
-5
WidgetTemplateController.php
src/controllers/crud/WidgetTemplateController.php
+1
-6
WidgetController.php
src/controllers/crud/api/WidgetController.php
+7
-13
WidgetTemplateController.php
src/controllers/crud/api/WidgetTemplateController.php
+7
-13
WidgetController.php
src/controllers/crud/base/WidgetController.php
+16
-28
WidgetTemplateController.php
src/controllers/crud/base/WidgetTemplateController.php
+16
-28
m160401_152059_add_widget_table.php
src/migrations/m160401_152059_add_widget_table.php
+1
-2
m160401_152910_add_widget_auth_item.php
src/migrations/m160401_152910_add_widget_auth_item.php
+0
-2
WidgetContent.php
src/models/crud/WidgetContent.php
+2
-2
WidgetTemplate.php
src/models/crud/WidgetTemplate.php
+3
-2
Widget.php
src/models/crud/base/Widget.php
+10
-12
WidgetTemplate.php
src/models/crud/base/WidgetTemplate.php
+10
-12
WidgetQuery.php
src/models/crud/query/WidgetQuery.php
+4
-2
WidgetTemplateQuery.php
src/models/crud/query/WidgetTemplateQuery.php
+4
-2
WidgetContent.php
src/models/crud/search/WidgetContent.php
+6
-16
WidgetTemplate.php
src/models/crud/search/WidgetTemplate.php
+4
-14
_form.php
src/views/crud/widget-template/_form.php
+6
-10
_search.php
src/views/crud/widget-template/_search.php
+2
-6
create.php
src/views/crud/widget-template/create.php
+2
-6
index.php
src/views/crud/widget-template/index.php
+7
-10
update.php
src/views/crud/widget-template/update.php
+3
-7
view.php
src/views/crud/widget-template/view.php
+4
-8
_form.php
src/views/crud/widget/_form.php
+7
-10
_search.php
src/views/crud/widget/_search.php
+2
-6
create.php
src/views/crud/widget/create.php
+2
-6
index.php
src/views/crud/widget/index.php
+8
-12
update.php
src/views/crud/widget/update.php
+3
-4
view.php
src/views/crud/widget/view.php
+4
-8
index.php
src/views/default/index.php
+3
-3
TwigTemplate.php
src/widgets/TwigTemplate.php
+2
-1
WidgetContainer.php
src/widgets/WidgetContainer.php
+13
-14
No files found.
src/Module.php
View file @
cfc6a218
...
@@ -10,7 +10,6 @@ class Module extends \yii\base\Module
...
@@ -10,7 +10,6 @@ class Module extends \yii\base\Module
{
{
parent
::
init
();
parent
::
init
();
// custom initialization code goes here
// custom initialization code goes here
}
}
...
@@ -18,6 +17,7 @@ class Module extends \yii\base\Module
...
@@ -18,6 +17,7 @@ class Module extends \yii\base\Module
{
{
parent
::
beforeAction
(
$action
);
parent
::
beforeAction
(
$action
);
\Yii
::
$app
->
controller
->
view
->
params
[
'breadcrumbs'
][]
=
[
'label'
=>
'Widget'
,
'url'
=>
[
'/widgets'
]];
\Yii
::
$app
->
controller
->
view
->
params
[
'breadcrumbs'
][]
=
[
'label'
=>
'Widget'
,
'url'
=>
[
'/widgets'
]];
return
true
;
return
true
;
}
}
}
}
src/controllers/DefaultController.php
View file @
cfc6a218
...
@@ -9,8 +9,9 @@ class DefaultController extends Controller
...
@@ -9,8 +9,9 @@ class DefaultController extends Controller
{
{
public
function
actionIndex
()
public
function
actionIndex
()
{
{
$searchModel
=
new
WidgetTemplate
;
$searchModel
=
new
WidgetTemplate
()
;
$dataProvider
=
$searchModel
->
search
([]);
$dataProvider
=
$searchModel
->
search
([]);
return
$this
->
render
(
'index'
,
[
'templatesDataProvider'
=>
$dataProvider
]);
return
$this
->
render
(
'index'
,
[
'templatesDataProvider'
=>
$dataProvider
]);
}
}
}
}
src/controllers/crud/WidgetController.php
View file @
cfc6a218
<?php
<?php
/**
/**
* /app/src/../runtime/giiant/49eb2de82346bc30092f584268252ed2
* /app/src/../runtime/giiant/49eb2de82346bc30092f584268252ed2.
*
* @package default
*/
*/
namespace
hrzg\widget\controllers\crud
;
namespace
hrzg\widget\controllers\crud
;
use
hrzg\widget\models\crud\search\WidgetContent
;
use
hrzg\widget\models\crud\search\WidgetContent
;
...
@@ -35,6 +31,7 @@ class WidgetController extends \hrzg\widget\controllers\crud\base\WidgetControll
...
@@ -35,6 +31,7 @@ class WidgetController extends \hrzg\widget\controllers\crud\base\WidgetControll
$msg
=
(
isset
(
$e
->
errorInfo
[
2
]))
?
$e
->
errorInfo
[
2
]
:
$e
->
getMessage
();
$msg
=
(
isset
(
$e
->
errorInfo
[
2
]))
?
$e
->
errorInfo
[
2
]
:
$e
->
getMessage
();
$model
->
addError
(
'_exception'
,
$msg
);
$model
->
addError
(
'_exception'
,
$msg
);
}
}
return
$this
->
render
(
'create'
,
[
'model'
=>
$model
]);
return
$this
->
render
(
'create'
,
[
'model'
=>
$model
]);
}
}
}
}
src/controllers/crud/WidgetTemplateController.php
View file @
cfc6a218
<?php
<?php
/**
/**
* /app/src/../runtime/giiant/49eb2de82346bc30092f584268252ed2
* /app/src/../runtime/giiant/49eb2de82346bc30092f584268252ed2.
*
* @package default
*/
*/
namespace
hrzg\widget\controllers\crud
;
namespace
hrzg\widget\controllers\crud
;
/**
/**
...
@@ -13,5 +9,4 @@ namespace hrzg\widget\controllers\crud;
...
@@ -13,5 +9,4 @@ namespace hrzg\widget\controllers\crud;
*/
*/
class
WidgetTemplateController
extends
\hrzg\widget\controllers\crud\base\WidgetTemplateController
class
WidgetTemplateController
extends
\hrzg\widget\controllers\crud\base\WidgetTemplateController
{
{
}
}
src/controllers/crud/api/WidgetController.php
View file @
cfc6a218
<?php
<?php
/**
/**
* /app/src/../runtime/giiant/f197ab8e55d1e29a2dea883e84983544
* /app/src/../runtime/giiant/f197ab8e55d1e29a2dea883e84983544.
*
* @package default
*/
*/
namespace
hrzg\widget\controllers\crud\api
;
namespace
hrzg\widget\controllers\crud\api
;
/*
*
/*
* This is the class for REST controller "WidgetController".
* This is the class for REST controller "WidgetController".
*/
*/
use
yii\filters\AccessControl
;
use
yii\filters\AccessControl
;
...
@@ -19,8 +15,8 @@ class WidgetController extends \yii\rest\ActiveController
...
@@ -19,8 +15,8 @@ class WidgetController extends \yii\rest\ActiveController
public
$modelClass
=
'hrzg\widget\models\crud\Widget'
;
public
$modelClass
=
'hrzg\widget\models\crud\Widget'
;
/**
/**
* {@inheritdoc}
*
*
* @inheritdoc
* @return unknown
* @return unknown
*/
*/
public
function
behaviors
()
public
function
behaviors
()
...
@@ -34,19 +30,17 @@ class WidgetController extends \yii\rest\ActiveController
...
@@ -34,19 +30,17 @@ class WidgetController extends \yii\rest\ActiveController
[
[
'allow'
=>
true
,
'allow'
=>
true
,
/*
*
/*
*
*
*/
*/
'matchCallback'
=>
function
(
$rule
,
$action
)
{
'matchCallback'
=>
function
(
$rule
,
$action
)
{
return
\Yii
::
$app
->
user
->
can
(
$this
->
module
->
id
.
'_'
.
$this
->
id
.
'_'
.
$action
->
id
,
return
\Yii
::
$app
->
user
->
can
(
$this
->
module
->
id
.
'_'
.
$this
->
id
.
'_'
.
$action
->
id
,
[
'route'
=>
true
]);
[
'route'
=>
true
]);
},
},
]
]
,
]
]
,
]
]
,
]
]
);
);
}
}
}
}
src/controllers/crud/api/WidgetTemplateController.php
View file @
cfc6a218
<?php
<?php
/**
/**
* /app/src/../runtime/giiant/f197ab8e55d1e29a2dea883e84983544
* /app/src/../runtime/giiant/f197ab8e55d1e29a2dea883e84983544.
*
* @package default
*/
*/
namespace
hrzg\widget\controllers\crud\api
;
namespace
hrzg\widget\controllers\crud\api
;
/*
*
/*
* This is the class for REST controller "WidgetTemplateController".
* This is the class for REST controller "WidgetTemplateController".
*/
*/
use
yii\filters\AccessControl
;
use
yii\filters\AccessControl
;
...
@@ -19,8 +15,8 @@ class WidgetTemplateController extends \yii\rest\ActiveController
...
@@ -19,8 +15,8 @@ class WidgetTemplateController extends \yii\rest\ActiveController
public
$modelClass
=
'hrzg\widget\models\crud\WidgetTemplate'
;
public
$modelClass
=
'hrzg\widget\models\crud\WidgetTemplate'
;
/**
/**
* {@inheritdoc}
*
*
* @inheritdoc
* @return unknown
* @return unknown
*/
*/
public
function
behaviors
()
public
function
behaviors
()
...
@@ -34,19 +30,17 @@ class WidgetTemplateController extends \yii\rest\ActiveController
...
@@ -34,19 +30,17 @@ class WidgetTemplateController extends \yii\rest\ActiveController
[
[
'allow'
=>
true
,
'allow'
=>
true
,
/*
*
/*
*
*
*/
*/
'matchCallback'
=>
function
(
$rule
,
$action
)
{
'matchCallback'
=>
function
(
$rule
,
$action
)
{
return
\Yii
::
$app
->
user
->
can
(
$this
->
module
->
id
.
'_'
.
$this
->
id
.
'_'
.
$action
->
id
,
return
\Yii
::
$app
->
user
->
can
(
$this
->
module
->
id
.
'_'
.
$this
->
id
.
'_'
.
$action
->
id
,
[
'route'
=>
true
]);
[
'route'
=>
true
]);
},
},
]
]
,
]
]
,
]
]
,
]
]
);
);
}
}
}
}
src/controllers/crud/base/WidgetController.php
View file @
cfc6a218
<?php
<?php
/**
/**
* /app/src/../runtime/giiant/358b0e44f1c1670b558e36588c267e47
* /app/src/../runtime/giiant/358b0e44f1c1670b558e36588c267e47.
*
* @package default
*/
*/
// This class was automatically generated by a giiant build task
// This class was automatically generated by a giiant build task
// You should not change it manually as it will be overwritten on next build
// You should not change it manually as it will be overwritten on next build
...
@@ -24,17 +21,15 @@ use yii\web\HttpException;
...
@@ -24,17 +21,15 @@ use yii\web\HttpException;
*/
*/
class
WidgetController
extends
Controller
class
WidgetController
extends
Controller
{
{
/**
/**
*
* @var bool whether to enable CSRF validation for the actions in this controller.
* @var boolean whether to enable CSRF validation for the actions in this controller.
* CSRF validation is enabled only when both this property and [[Request::enableCsrfValidation]] are true.
* CSRF validation is enabled only when both this property and [[Request::enableCsrfValidation]] are true.
*/
*/
public
$enableCsrfValidation
=
false
;
public
$enableCsrfValidation
=
false
;
/**
/**
* {@inheritdoc}
*
*
* @inheritdoc
* @return unknown
* @return unknown
*/
*/
public
function
behaviors
()
public
function
behaviors
()
...
@@ -46,20 +41,19 @@ class WidgetController extends Controller
...
@@ -46,20 +41,19 @@ class WidgetController extends Controller
[
[
'allow'
=>
true
,
'allow'
=>
true
,
/*
*
/*
*
*
*/
*/
'matchCallback'
=>
function
(
$rule
,
$action
)
{
'matchCallback'
=>
function
(
$rule
,
$action
)
{
return
\Yii
::
$app
->
user
->
can
(
$this
->
module
->
id
.
'_'
.
$this
->
id
.
'_'
.
$action
->
id
,
return
\Yii
::
$app
->
user
->
can
(
$this
->
module
->
id
.
'_'
.
$this
->
id
.
'_'
.
$action
->
id
,
[
'route'
=>
true
]);
[
'route'
=>
true
]);
},
},
]
]
,
]
]
,
]
]
,
];
];
}
}
/**
/**
* Lists all Widget models.
* Lists all Widget models.
*
*
...
@@ -67,7 +61,7 @@ class WidgetController extends Controller
...
@@ -67,7 +61,7 @@ class WidgetController extends Controller
*/
*/
public
function
actionIndex
()
public
function
actionIndex
()
{
{
$searchModel
=
new
WidgetSearch
;
$searchModel
=
new
WidgetSearch
()
;
$dataProvider
=
$searchModel
->
search
(
$_GET
);
$dataProvider
=
$searchModel
->
search
(
$_GET
);
Tabs
::
clearLocalStorage
();
Tabs
::
clearLocalStorage
();
...
@@ -81,11 +75,10 @@ class WidgetController extends Controller
...
@@ -81,11 +75,10 @@ class WidgetController extends Controller
]);
]);
}
}
/**
/**
* Displays a single Widget model.
* Displays a single Widget model.
*
*
* @param int
eger
$id
* @param int $id
*
*
* @return mixed
* @return mixed
*/
*/
...
@@ -100,7 +93,6 @@ class WidgetController extends Controller
...
@@ -100,7 +93,6 @@ class WidgetController extends Controller
]);
]);
}
}
/**
/**
* Creates a new Widget model.
* Creates a new Widget model.
* If creation is successful, the browser will be redirected to the 'view' page.
* If creation is successful, the browser will be redirected to the 'view' page.
...
@@ -109,7 +101,7 @@ class WidgetController extends Controller
...
@@ -109,7 +101,7 @@ class WidgetController extends Controller
*/
*/
public
function
actionCreate
()
public
function
actionCreate
()
{
{
$model
=
new
WidgetContent
;
$model
=
new
WidgetContent
()
;
try
{
try
{
if
(
$model
->
load
(
$_POST
)
&&
$model
->
save
())
{
if
(
$model
->
load
(
$_POST
)
&&
$model
->
save
())
{
...
@@ -121,15 +113,15 @@ class WidgetController extends Controller
...
@@ -121,15 +113,15 @@ class WidgetController extends Controller
$msg
=
(
isset
(
$e
->
errorInfo
[
2
]))
?
$e
->
errorInfo
[
2
]
:
$e
->
getMessage
();
$msg
=
(
isset
(
$e
->
errorInfo
[
2
]))
?
$e
->
errorInfo
[
2
]
:
$e
->
getMessage
();
$model
->
addError
(
'_exception'
,
$msg
);
$model
->
addError
(
'_exception'
,
$msg
);
}
}
return
$this
->
render
(
'create'
,
[
'model'
=>
$model
]);
return
$this
->
render
(
'create'
,
[
'model'
=>
$model
]);
}
}
/**
/**
* Updates an existing Widget model.
* Updates an existing Widget model.
* If update is successful, the browser will be redirected to the 'view' page.
* If update is successful, the browser will be redirected to the 'view' page.
*
*
* @param int
eger
$id
* @param int $id
*
*
* @return mixed
* @return mixed
*/
*/
...
@@ -146,12 +138,11 @@ class WidgetController extends Controller
...
@@ -146,12 +138,11 @@ class WidgetController extends Controller
}
}
}
}
/**
/**
* Deletes an existing Widget model.
* Deletes an existing Widget model.
* If deletion is successful, the browser will be redirected to the 'index' page.
* If deletion is successful, the browser will be redirected to the 'index' page.
*
*
* @param int
eger
$id
* @param int $id
*
*
* @return mixed
* @return mixed
*/
*/
...
@@ -162,10 +153,10 @@ class WidgetController extends Controller
...
@@ -162,10 +153,10 @@ class WidgetController extends Controller
}
catch
(
\Exception
$e
)
{
}
catch
(
\Exception
$e
)
{
$msg
=
(
isset
(
$e
->
errorInfo
[
2
]))
?
$e
->
errorInfo
[
2
]
:
$e
->
getMessage
();
$msg
=
(
isset
(
$e
->
errorInfo
[
2
]))
?
$e
->
errorInfo
[
2
]
:
$e
->
getMessage
();
\Yii
::
$app
->
getSession
()
->
addFlash
(
'error'
,
$msg
);
\Yii
::
$app
->
getSession
()
->
addFlash
(
'error'
,
$msg
);
return
$this
->
redirect
(
Url
::
previous
());
return
$this
->
redirect
(
Url
::
previous
());
}
}
// TODO: improve detection
// TODO: improve detection
$isPivot
=
strstr
(
'$id'
,
','
);
$isPivot
=
strstr
(
'$id'
,
','
);
if
(
$isPivot
==
true
)
{
if
(
$isPivot
==
true
)
{
...
@@ -181,14 +172,13 @@ class WidgetController extends Controller
...
@@ -181,14 +172,13 @@ class WidgetController extends Controller
}
}
}
}
/**
/**
* Finds the Widget model based on its primary key value.
* Finds the Widget model based on its primary key value.
* If the model is not found, a 404 HTTP exception will be thrown.
* If the model is not found, a 404 HTTP exception will be thrown.
*
*
* @throws HttpException if the model cannot be found
* @throws HttpException if the model cannot be found
*
*
* @param int
eger
$id
* @param int $id
*
*
* @return WidgetContent the loaded model
* @return WidgetContent the loaded model
*/
*/
...
@@ -200,6 +190,4 @@ class WidgetController extends Controller
...
@@ -200,6 +190,4 @@ class WidgetController extends Controller
throw
new
HttpException
(
404
,
'The requested page does not exist.'
);
throw
new
HttpException
(
404
,
'The requested page does not exist.'
);
}
}
}
}
}
}
src/controllers/crud/base/WidgetTemplateController.php
View file @
cfc6a218
<?php
<?php
/**
/**
* /app/src/../runtime/giiant/358b0e44f1c1670b558e36588c267e47
* /app/src/../runtime/giiant/358b0e44f1c1670b558e36588c267e47.
*
* @package default
*/
*/
// This class was automatically generated by a giiant build task
// This class was automatically generated by a giiant build task
// You should not change it manually as it will be overwritten on next build
// You should not change it manually as it will be overwritten on next build
...
@@ -24,17 +21,15 @@ use yii\web\HttpException;
...
@@ -24,17 +21,15 @@ use yii\web\HttpException;
*/
*/
class
WidgetTemplateController
extends
Controller
class
WidgetTemplateController
extends
Controller
{
{
/**
/**
*
* @var bool whether to enable CSRF validation for the actions in this controller.
* @var boolean whether to enable CSRF validation for the actions in this controller.
* CSRF validation is enabled only when both this property and [[Request::enableCsrfValidation]] are true.
* CSRF validation is enabled only when both this property and [[Request::enableCsrfValidation]] are true.
*/
*/
public
$enableCsrfValidation
=
false
;
public
$enableCsrfValidation
=
false
;
/**
/**
* {@inheritdoc}
*
*
* @inheritdoc
* @return unknown
* @return unknown
*/
*/
public
function
behaviors
()
public
function
behaviors
()
...
@@ -46,20 +41,19 @@ class WidgetTemplateController extends Controller
...
@@ -46,20 +41,19 @@ class WidgetTemplateController extends Controller
[
[
'allow'
=>
true
,
'allow'
=>
true
,
/*
*
/*
*
*
*/
*/
'matchCallback'
=>
function
(
$rule
,
$action
)
{
'matchCallback'
=>
function
(
$rule
,
$action
)
{
return
\Yii
::
$app
->
user
->
can
(
$this
->
module
->
id
.
'_'
.
$this
->
id
.
'_'
.
$action
->
id
,
return
\Yii
::
$app
->
user
->
can
(
$this
->
module
->
id
.
'_'
.
$this
->
id
.
'_'
.
$action
->
id
,
[
'route'
=>
true
]);
[
'route'
=>
true
]);
},
},
]
]
,
]
]
,
]
]
,
];
];
}
}
/**
/**
* Lists all WidgetTemplate models.
* Lists all WidgetTemplate models.
*
*
...
@@ -67,7 +61,7 @@ class WidgetTemplateController extends Controller
...
@@ -67,7 +61,7 @@ class WidgetTemplateController extends Controller
*/
*/
public
function
actionIndex
()
public
function
actionIndex
()
{
{
$searchModel
=
new
WidgetTemplateSearch
;
$searchModel
=
new
WidgetTemplateSearch
()
;
$dataProvider
=
$searchModel
->
search
(
$_GET
);
$dataProvider
=
$searchModel
->
search
(
$_GET
);
Tabs
::
clearLocalStorage
();
Tabs
::
clearLocalStorage
();
...
@@ -81,11 +75,10 @@ class WidgetTemplateController extends Controller
...
@@ -81,11 +75,10 @@ class WidgetTemplateController extends Controller
]);
]);
}
}
/**
/**
* Displays a single WidgetTemplate model.
* Displays a single WidgetTemplate model.
*
*
* @param int
eger
$id
* @param int $id
*
*
* @return mixed
* @return mixed
*/
*/
...
@@ -100,7 +93,6 @@ class WidgetTemplateController extends Controller
...
@@ -100,7 +93,6 @@ class WidgetTemplateController extends Controller
]);
]);
}
}
/**
/**
* Creates a new WidgetTemplate model.
* Creates a new WidgetTemplate model.
* If creation is successful, the browser will be redirected to the 'view' page.
* If creation is successful, the browser will be redirected to the 'view' page.
...
@@ -109,7 +101,7 @@ class WidgetTemplateController extends Controller
...
@@ -109,7 +101,7 @@ class WidgetTemplateController extends Controller
*/
*/
public
function
actionCreate
()
public
function
actionCreate
()
{
{
$model
=
new
WidgetTemplate
;
$model
=
new
WidgetTemplate
()
;
try
{
try
{
if
(
$model
->
load
(
$_POST
)
&&
$model
->
save
())
{
if
(
$model
->
load
(
$_POST
)
&&
$model
->
save
())
{
...
@@ -121,15 +113,15 @@ class WidgetTemplateController extends Controller
...
@@ -121,15 +113,15 @@ class WidgetTemplateController extends Controller
$msg
=
(
isset
(
$e
->
errorInfo
[
2
]))
?
$e
->
errorInfo
[
2
]
:
$e
->
getMessage
();
$msg
=
(
isset
(
$e
->
errorInfo
[
2
]))
?
$e
->
errorInfo
[
2
]
:
$e
->
getMessage
();
$model
->
addError
(
'_exception'
,
$msg
);
$model
->
addError
(
'_exception'
,
$msg
);
}
}
return
$this
->
render
(
'create'
,
[
'model'
=>
$model
]);
return
$this
->
render
(
'create'
,
[
'model'
=>
$model
]);
}
}
/**
/**
* Updates an existing WidgetTemplate model.
* Updates an existing WidgetTemplate model.
* If update is successful, the browser will be redirected to the 'view' page.
* If update is successful, the browser will be redirected to the 'view' page.
*
*
* @param int
eger
$id
* @param int $id
*
*
* @return mixed
* @return mixed
*/
*/
...
@@ -146,12 +138,11 @@ class WidgetTemplateController extends Controller
...
@@ -146,12 +138,11 @@ class WidgetTemplateController extends Controller
}
}
}
}
/**
/**
* Deletes an existing WidgetTemplate model.
* Deletes an existing WidgetTemplate model.
* If deletion is successful, the browser will be redirected to the 'index' page.
* If deletion is successful, the browser will be redirected to the 'index' page.
*
*
* @param int
eger
$id
* @param int $id
*
*
* @return mixed
* @return mixed
*/
*/
...
@@ -162,10 +153,10 @@ class WidgetTemplateController extends Controller
...
@@ -162,10 +153,10 @@ class WidgetTemplateController extends Controller
}
catch
(
\Exception
$e
)
{
}
catch
(
\Exception
$e
)
{
$msg
=
(
isset
(
$e
->
errorInfo
[
2
]))
?
$e
->
errorInfo
[
2
]
:
$e
->
getMessage
();
$msg
=
(
isset
(
$e
->
errorInfo
[
2
]))
?
$e
->
errorInfo
[
2
]
:
$e
->
getMessage
();
\Yii
::
$app
->
getSession
()
->
addFlash
(
'error'
,
$msg
);
\Yii
::
$app
->
getSession
()
->
addFlash
(
'error'
,
$msg
);
return
$this
->
redirect
(
Url
::
previous
());
return
$this
->
redirect
(
Url
::
previous
());
}
}
// TODO: improve detection
// TODO: improve detection
$isPivot
=
strstr
(
'$id'
,
','
);
$isPivot
=
strstr
(
'$id'
,
','
);
if
(
$isPivot
==
true
)
{
if
(
$isPivot
==
true
)
{
...
@@ -181,14 +172,13 @@ class WidgetTemplateController extends Controller
...
@@ -181,14 +172,13 @@ class WidgetTemplateController extends Controller
}
}
}
}
/**
/**
* Finds the WidgetTemplate model based on its primary key value.
* Finds the WidgetTemplate model based on its primary key value.
* If the model is not found, a 404 HTTP exception will be thrown.
* If the model is not found, a 404 HTTP exception will be thrown.
*
*
* @throws HttpException if the model cannot be found
* @throws HttpException if the model cannot be found
*
*
* @param int
eger
$id
* @param int $id
*
*
* @return WidgetTemplate the loaded model
* @return WidgetTemplate the loaded model
*/
*/
...
@@ -200,6 +190,4 @@ class WidgetTemplateController extends Controller
...
@@ -200,6 +190,4 @@ class WidgetTemplateController extends Controller
throw
new
HttpException
(
404
,
'The requested page does not exist.'
);
throw
new
HttpException
(
404
,
'The requested page does not exist.'
);
}
}
}
}
}
}
src/migrations/m160401_152059_add_widget_table.php
View file @
cfc6a218
...
@@ -11,7 +11,7 @@ class m160401_152059_add_widget_table extends Migration
...
@@ -11,7 +11,7 @@ class m160401_152059_add_widget_table extends Migration
'name'
=>
'VARCHAR(255) NOT NULL'
,
'name'
=>
'VARCHAR(255) NOT NULL'
,
'php_class'
=>
'VARCHAR(255) NOT NULL'
,
'php_class'
=>
'VARCHAR(255) NOT NULL'
,
'json_schema'
=>
'TEXT NOT NULL'
,
'json_schema'
=>
'TEXT NOT NULL'
,
'twig_template'
=>
'TEXT NULL'
'twig_template'
=>
'TEXT NULL'
,
]);
]);
$this
->
createTable
(
'{{%hrzg_widget_content}}'
,
[
$this
->
createTable
(
'{{%hrzg_widget_content}}'
,
[
...
@@ -48,5 +48,4 @@ class m160401_152059_add_widget_table extends Migration
...
@@ -48,5 +48,4 @@ class m160401_152059_add_widget_table extends Migration
$this
->
dropTable
(
'{{%hrzg_widget_content}}'
);
$this
->
dropTable
(
'{{%hrzg_widget_content}}'
);
$this
->
dropTable
(
'{{%hrzg_widget_template}}'
);
$this
->
dropTable
(
'{{%hrzg_widget_template}}'
);
}
}
}
}
src/migrations/m160401_152910_add_widget_auth_item.php
View file @
cfc6a218
...
@@ -36,7 +36,5 @@ class m160401_152910_add_widget_auth_item extends Migration
...
@@ -36,7 +36,5 @@ class m160401_152910_add_widget_auth_item extends Migration
}
else
{
}
else
{
throw
new
\yii\base\Exception
(
'Application authManager must be an instance of \yii\rbac\DbManager'
);
throw
new
\yii\base\Exception
(
'Application authManager must be an instance of \yii\rbac\DbManager'
);
}
}
}
}
}
}
src/models/crud/WidgetContent.php
View file @
cfc6a218
...
@@ -3,7 +3,6 @@
...
@@ -3,7 +3,6 @@
namespace
hrzg\widget\models\crud
;
namespace
hrzg\widget\models\crud
;
use
hrzg\widget\models\crud\base\Widget
as
BaseWidget
;
use
hrzg\widget\models\crud\base\Widget
as
BaseWidget
;
use
Yii
;
use
yii\helpers\ArrayHelper
;
use
yii\helpers\ArrayHelper
;
/**
/**
...
@@ -29,8 +28,9 @@ class WidgetContent extends BaseWidget
...
@@ -29,8 +28,9 @@ class WidgetContent extends BaseWidget
*/
*/
public
function
getViewFile
()
public
function
getViewFile
()
{
{
$file
=
'/'
.
\Yii
::
getAlias
(
'@runtime'
)
.
"/"
.
md5
(
$this
->
template
->
twig_template
)
.
".twig"
;
$file
=
'/'
.
\Yii
::
getAlias
(
'@runtime'
)
.
'/'
.
md5
(
$this
->
template
->
twig_template
)
.
'.twig'
;
file_put_contents
(
$file
,
$this
->
template
->
twig_template
);
file_put_contents
(
$file
,
$this
->
template
->
twig_template
);
return
$file
;
return
$file
;
}
}
}
}
src/models/crud/WidgetTemplate.php
View file @
cfc6a218
...
@@ -26,8 +26,8 @@ class WidgetTemplate extends BaseWidgetTemplate
...
@@ -26,8 +26,8 @@ class WidgetTemplate extends BaseWidgetTemplate
}
catch
(
InvalidParamException
$e
)
{
}
catch
(
InvalidParamException
$e
)
{
$this
->
addError
(
$attribute
,
'Invalid JSON: '
.
$e
->
getMessage
());
$this
->
addError
(
$attribute
,
'Invalid JSON: '
.
$e
->
getMessage
());
}
}
}
}
,
]
]
,
]
]
);
);
}
}
...
@@ -38,6 +38,7 @@ class WidgetTemplate extends BaseWidgetTemplate
...
@@ -38,6 +38,7 @@ class WidgetTemplate extends BaseWidgetTemplate
if
(
!
isset
(
$json
->
scalar
))
{
if
(
!
isset
(
$json
->
scalar
))
{
return
[];
return
[];
}
}
return
Json
::
decode
(
$json
->
scalar
);
return
Json
::
decode
(
$json
->
scalar
);
}
}
}
}
src/models/crud/base/Widget.php
View file @
cfc6a218
...
@@ -9,7 +9,7 @@ use Yii;
...
@@ -9,7 +9,7 @@ use Yii;
/**
/**
* This is the base-model class for table "app_hrzg_widget".
* This is the base-model class for table "app_hrzg_widget".
*
*
* @property int
eger
$id
* @property int $id
* @property string $status
* @property string $status
* @property string $widget_template_id
* @property string $widget_template_id
* @property string $default_properties_json
* @property string $default_properties_json
...
@@ -29,10 +29,8 @@ use Yii;
...
@@ -29,10 +29,8 @@ use Yii;
*/
*/
abstract
class
Widget
extends
\yii\db\ActiveRecord
abstract
class
Widget
extends
\yii\db\ActiveRecord
{
{
/**
/**
*
@inheritdoc
*
{@inheritdoc}
*/
*/
public
static
function
tableName
()
public
static
function
tableName
()
{
{
...
@@ -40,7 +38,8 @@ abstract class Widget extends \yii\db\ActiveRecord
...
@@ -40,7 +38,8 @@ abstract class Widget extends \yii\db\ActiveRecord
}
}
/**
/**
* @inheritdoc
* {@inheritdoc}
*
* @return \hrzg\widget\models\crud\query\WidgetQuery the active query used by this AR class.
* @return \hrzg\widget\models\crud\query\WidgetQuery the active query used by this AR class.
*/
*/
public
static
function
find
()
public
static
function
find
()
...
@@ -50,7 +49,8 @@ abstract class Widget extends \yii\db\ActiveRecord
...
@@ -50,7 +49,8 @@ abstract class Widget extends \yii\db\ActiveRecord
/**
/**
* Alias name of table for crud viewsLists all Area models.
* Alias name of table for crud viewsLists all Area models.
* Change the alias name manual if needed later
* Change the alias name manual if needed later.
*
* @return string
* @return string
*/
*/
public
function
getAliasModel
(
$plural
=
false
)
public
function
getAliasModel
(
$plural
=
false
)
...
@@ -63,7 +63,7 @@ abstract class Widget extends \yii\db\ActiveRecord
...
@@ -63,7 +63,7 @@ abstract class Widget extends \yii\db\ActiveRecord
}
}
/**
/**
*
@inheritdoc
*
{@inheritdoc}
*/
*/
public
function
rules
()
public
function
rules
()
{
{
...
@@ -76,12 +76,12 @@ abstract class Widget extends \yii\db\ActiveRecord
...
@@ -76,12 +76,12 @@ abstract class Widget extends \yii\db\ActiveRecord
[[
'name_id'
],
'string'
,
'max'
=>
64
],
[[
'name_id'
],
'string'
,
'max'
=>
64
],
[[
'rank'
,
'access_owner'
],
'string'
,
'max'
=>
11
],
[[
'rank'
,
'access_owner'
],
'string'
,
'max'
=>
11
],
[[
'request_param'
,
'access_read'
,
'access_update'
,
'access_delete'
],
'string'
,
'max'
=>
255
],
[[
'request_param'
,
'access_read'
,
'access_update'
,
'access_delete'
],
'string'
,
'max'
=>
255
],
[[
'access_domain'
],
'string'
,
'max'
=>
8
]
[[
'access_domain'
],
'string'
,
'max'
=>
8
]
,
];
];
}
}
/**
/**
*
@inheritdoc
*
{@inheritdoc}
*/
*/
public
function
attributeLabels
()
public
function
attributeLabels
()
{
{
...
@@ -105,7 +105,7 @@ abstract class Widget extends \yii\db\ActiveRecord
...
@@ -105,7 +105,7 @@ abstract class Widget extends \yii\db\ActiveRecord
];
];
}
}
/*
*
/*
* @inheritdoc
* @inheritdoc
*/
*/
/*public function attributeHints()
/*public function attributeHints()
...
@@ -131,6 +131,4 @@ abstract class Widget extends \yii\db\ActiveRecord
...
@@ -131,6 +131,4 @@ abstract class Widget extends \yii\db\ActiveRecord
'updated_at' => Yii::t('app', 'Updated At'),
'updated_at' => Yii::t('app', 'Updated At'),
]);
]);
}*/
}*/
}
}
src/models/crud/base/WidgetTemplate.php
View file @
cfc6a218
...
@@ -9,17 +9,15 @@ use Yii;
...
@@ -9,17 +9,15 @@ use Yii;
/**
/**
* This is the base-model class for table "app_hrzg_widget_template".
* This is the base-model class for table "app_hrzg_widget_template".
*
*
* @property int
eger
$id
* @property int $id
* @property string $name
* @property string $name
* @property string $json_schema
* @property string $json_schema
* @property string $twig_template
* @property string $twig_template
*/
*/
abstract
class
WidgetTemplate
extends
\yii\db\ActiveRecord
abstract
class
WidgetTemplate
extends
\yii\db\ActiveRecord
{
{
/**
/**
*
@inheritdoc
*
{@inheritdoc}
*/
*/
public
static
function
tableName
()
public
static
function
tableName
()
{
{
...
@@ -27,7 +25,8 @@ abstract class WidgetTemplate extends \yii\db\ActiveRecord
...
@@ -27,7 +25,8 @@ abstract class WidgetTemplate extends \yii\db\ActiveRecord
}
}
/**
/**
* @inheritdoc
* {@inheritdoc}
*
* @return \hrzg\widget\models\crud\query\WidgetTemplateQuery the active query used by this AR class.
* @return \hrzg\widget\models\crud\query\WidgetTemplateQuery the active query used by this AR class.
*/
*/
public
static
function
find
()
public
static
function
find
()
...
@@ -37,7 +36,8 @@ abstract class WidgetTemplate extends \yii\db\ActiveRecord
...
@@ -37,7 +36,8 @@ abstract class WidgetTemplate extends \yii\db\ActiveRecord
/**
/**
* Alias name of table for crud viewsLists all Area models.
* Alias name of table for crud viewsLists all Area models.
* Change the alias name manual if needed later
* Change the alias name manual if needed later.
*
* @return string
* @return string
*/
*/
public
function
getAliasModel
(
$plural
=
false
)
public
function
getAliasModel
(
$plural
=
false
)
...
@@ -50,19 +50,19 @@ abstract class WidgetTemplate extends \yii\db\ActiveRecord
...
@@ -50,19 +50,19 @@ abstract class WidgetTemplate extends \yii\db\ActiveRecord
}
}
/**
/**
*
@inheritdoc
*
{@inheritdoc}
*/
*/
public
function
rules
()
public
function
rules
()
{
{
return
[
return
[
[[
'name'
,
'php_class'
,
'json_schema'
],
'required'
],
[[
'name'
,
'php_class'
,
'json_schema'
],
'required'
],
[[
'json_schema'
,
'twig_template'
],
'string'
],
[[
'json_schema'
,
'twig_template'
],
'string'
],
[[
'name'
],
'string'
,
'max'
=>
255
]
[[
'name'
],
'string'
,
'max'
=>
255
]
,
];
];
}
}
/**
/**
*
@inheritdoc
*
{@inheritdoc}
*/
*/
public
function
attributeLabels
()
public
function
attributeLabels
()
{
{
...
@@ -75,7 +75,7 @@ abstract class WidgetTemplate extends \yii\db\ActiveRecord
...
@@ -75,7 +75,7 @@ abstract class WidgetTemplate extends \yii\db\ActiveRecord
}
}
/**
/**
*
@inheritdoc
*
{@inheritdoc}
*/
*/
public
function
attributeHints
()
public
function
attributeHints
()
{
{
...
@@ -88,6 +88,4 @@ abstract class WidgetTemplate extends \yii\db\ActiveRecord
...
@@ -88,6 +88,4 @@ abstract class WidgetTemplate extends \yii\db\ActiveRecord
'twig_template'
=>
Yii
::
t
(
'app'
,
'Template'
),
'twig_template'
=>
Yii
::
t
(
'app'
,
'Template'
),
]);
]);
}
}
}
}
src/models/crud/query/WidgetQuery.php
View file @
cfc6a218
...
@@ -16,7 +16,8 @@ class WidgetQuery extends \yii\db\ActiveQuery
...
@@ -16,7 +16,8 @@ class WidgetQuery extends \yii\db\ActiveQuery
}*/
}*/
/**
/**
* @inheritdoc
* {@inheritdoc}
*
* @return \hrzg\widget\models\crud\WidgetContent[]|array
* @return \hrzg\widget\models\crud\WidgetContent[]|array
*/
*/
public
function
all
(
$db
=
null
)
public
function
all
(
$db
=
null
)
...
@@ -25,7 +26,8 @@ class WidgetQuery extends \yii\db\ActiveQuery
...
@@ -25,7 +26,8 @@ class WidgetQuery extends \yii\db\ActiveQuery
}
}
/**
/**
* @inheritdoc
* {@inheritdoc}
*
* @return \hrzg\widget\models\crud\WidgetContent|array|null
* @return \hrzg\widget\models\crud\WidgetContent|array|null
*/
*/
public
function
one
(
$db
=
null
)
public
function
one
(
$db
=
null
)
...
...
src/models/crud/query/WidgetTemplateQuery.php
View file @
cfc6a218
...
@@ -16,7 +16,8 @@ class WidgetTemplateQuery extends \yii\db\ActiveQuery
...
@@ -16,7 +16,8 @@ class WidgetTemplateQuery extends \yii\db\ActiveQuery
}*/
}*/
/**
/**
* @inheritdoc
* {@inheritdoc}
*
* @return \hrzg\widget\models\crud\WidgetTemplate[]|array
* @return \hrzg\widget\models\crud\WidgetTemplate[]|array
*/
*/
public
function
all
(
$db
=
null
)
public
function
all
(
$db
=
null
)
...
@@ -25,7 +26,8 @@ class WidgetTemplateQuery extends \yii\db\ActiveQuery
...
@@ -25,7 +26,8 @@ class WidgetTemplateQuery extends \yii\db\ActiveQuery
}
}
/**
/**
* @inheritdoc
* {@inheritdoc}
*
* @return \hrzg\widget\models\crud\WidgetTemplate|array|null
* @return \hrzg\widget\models\crud\WidgetTemplate|array|null
*/
*/
public
function
one
(
$db
=
null
)
public
function
one
(
$db
=
null
)
...
...
src/models/crud/search/WidgetContent.php
View file @
cfc6a218
<?php
<?php
/**
/**
* /app/src/../runtime/giiant/e0080b9d6ffa35acb85312bf99a557f2
* /app/src/../runtime/giiant/e0080b9d6ffa35acb85312bf99a557f2.
*
* @package default
*/
*/
namespace
hrzg\widget\models\crud\search
;
namespace
hrzg\widget\models\crud\search
;
use
hrzg\widget\models\crud\WidgetContent
as
WidgetModel
;
use
hrzg\widget\models\crud\WidgetContent
as
WidgetModel
;
use
Yii
;
use
yii\base\Model
;
use
yii\base\Model
;
use
yii\data\ActiveDataProvider
;
use
yii\data\ActiveDataProvider
;
...
@@ -18,10 +13,9 @@ use yii\data\ActiveDataProvider;
...
@@ -18,10 +13,9 @@ use yii\data\ActiveDataProvider;
*/
*/
class
WidgetContent
extends
WidgetModel
class
WidgetContent
extends
WidgetModel
{
{
/**
/**
* {@inheritdoc}
*
*
* @inheritdoc
* @return unknown
* @return unknown
*/
*/
public
function
rules
()
public
function
rules
()
...
@@ -44,17 +38,16 @@ class WidgetContent extends WidgetModel
...
@@ -44,17 +38,16 @@ class WidgetContent extends WidgetModel
'access_update'
,
'access_update'
,
'access_delete'
,
'access_delete'
,
'created_at'
,
'created_at'
,
'updated_at'
'updated_at'
,
],
],
'safe'
'safe'
,
],
],
];
];
}
}
/**
/**
* {@inheritdoc}
*
*
* @inheritdoc
* @return unknown
* @return unknown
*/
*/
public
function
scenarios
()
public
function
scenarios
()
...
@@ -63,9 +56,8 @@ class WidgetContent extends WidgetModel
...
@@ -63,9 +56,8 @@ class WidgetContent extends WidgetModel
return
Model
::
scenarios
();
return
Model
::
scenarios
();
}
}
/**
/**
* Creates data provider instance with search query applied
* Creates data provider instance with search query applied
.
*
*
*
*
* @param array $params
* @param array $params
...
@@ -110,6 +102,4 @@ class WidgetContent extends WidgetModel
...
@@ -110,6 +102,4 @@ class WidgetContent extends WidgetModel
return
$dataProvider
;
return
$dataProvider
;
}
}
}
}
src/models/crud/search/WidgetTemplate.php
View file @
cfc6a218
<?php
<?php
/**
/**
* /app/src/../runtime/giiant/e0080b9d6ffa35acb85312bf99a557f2
* /app/src/../runtime/giiant/e0080b9d6ffa35acb85312bf99a557f2.
*
* @package default
*/
*/
namespace
hrzg\widget\models\crud\search
;
namespace
hrzg\widget\models\crud\search
;
use
hrzg\widget\models\crud\WidgetTemplate
as
WidgetTemplateModel
;
use
hrzg\widget\models\crud\WidgetTemplate
as
WidgetTemplateModel
;
use
Yii
;
use
yii\base\Model
;
use
yii\base\Model
;
use
yii\data\ActiveDataProvider
;
use
yii\data\ActiveDataProvider
;
...
@@ -18,10 +13,9 @@ use yii\data\ActiveDataProvider;
...
@@ -18,10 +13,9 @@ use yii\data\ActiveDataProvider;
*/
*/
class
WidgetTemplate
extends
WidgetTemplateModel
class
WidgetTemplate
extends
WidgetTemplateModel
{
{
/**
/**
* {@inheritdoc}
*
*
* @inheritdoc
* @return unknown
* @return unknown
*/
*/
public
function
rules
()
public
function
rules
()
...
@@ -32,10 +26,9 @@ class WidgetTemplate extends WidgetTemplateModel
...
@@ -32,10 +26,9 @@ class WidgetTemplate extends WidgetTemplateModel
];
];
}
}
/**
/**
* {@inheritdoc}
*
*
* @inheritdoc
* @return unknown
* @return unknown
*/
*/
public
function
scenarios
()
public
function
scenarios
()
...
@@ -44,9 +37,8 @@ class WidgetTemplate extends WidgetTemplateModel
...
@@ -44,9 +37,8 @@ class WidgetTemplate extends WidgetTemplateModel
return
Model
::
scenarios
();
return
Model
::
scenarios
();
}
}
/**
/**
* Creates data provider instance with search query applied
* Creates data provider instance with search query applied
.
*
*
*
*
* @param array $params
* @param array $params
...
@@ -79,6 +71,4 @@ class WidgetTemplate extends WidgetTemplateModel
...
@@ -79,6 +71,4 @@ class WidgetTemplate extends WidgetTemplateModel
return
$dataProvider
;
return
$dataProvider
;
}
}
}
}
src/views/crud/widget-template/_form.php
View file @
cfc6a218
<?php
<?php
/**
/**
* /app/src/../runtime/giiant/4b7e79a8340461fe629a6ac612644d03
* /app/src/../runtime/giiant/4b7e79a8340461fe629a6ac612644d03.
*
* @package default
*/
*/
use
dmstr\bootstrap\Tabs
;
use
dmstr\bootstrap\Tabs
;
use
yii\bootstrap\ActiveForm
;
use
yii\bootstrap\ActiveForm
;
use
yii\helpers\Html
;
use
yii\helpers\Html
;
/*
*
/*
*
*
* @var yii\web\View $this
* @var yii\web\View $this
* @var hrzg\widget\models\crud\WidgetTemplate $model
* @var hrzg\widget\models\crud\WidgetTemplate $model
...
@@ -31,8 +27,8 @@ use yii\helpers\Html;
...
@@ -31,8 +27,8 @@ use yii\helpers\Html;
'wrapper'
=>
'col-sm-10'
,
'wrapper'
=>
'col-sm-10'
,
'error'
=>
''
,
'error'
=>
''
,
'hint'
=>
'hidden'
,
'hint'
=>
'hidden'
,
]
]
,
]
]
,
]
]
);
);
?>
?>
...
@@ -62,7 +58,7 @@ use yii\helpers\Html;
...
@@ -62,7 +58,7 @@ use yii\helpers\Html;
'content'
=>
$this
->
blocks
[
'main'
],
'content'
=>
$this
->
blocks
[
'main'
],
'active'
=>
true
,
'active'
=>
true
,
],
],
]
]
,
]
]
);
);
?>
?>
...
@@ -75,7 +71,7 @@ use yii\helpers\Html;
...
@@ -75,7 +71,7 @@ use yii\helpers\Html;
(
$model
->
isNewRecord
?
Yii
::
t
(
'app'
,
'Create'
)
:
Yii
::
t
(
'app'
,
'Save'
)),
(
$model
->
isNewRecord
?
Yii
::
t
(
'app'
,
'Create'
)
:
Yii
::
t
(
'app'
,
'Save'
)),
[
[
'id'
=>
'save-'
.
$model
->
formName
(),
'id'
=>
'save-'
.
$model
->
formName
(),
'class'
=>
'btn btn-success'
'class'
=>
'btn btn-success'
,
]
]
);
);
?>
?>
...
...
src/views/crud/widget-template/_search.php
View file @
cfc6a218
<?php
<?php
/**
/**
* /app/src/../runtime/giiant/eeda5c365686c9888dbc13dbc58f89a1
* /app/src/../runtime/giiant/eeda5c365686c9888dbc13dbc58f89a1.
*
* @package default
*/
*/
use
yii\helpers\Html
;
use
yii\helpers\Html
;
use
yii\widgets\ActiveForm
;
use
yii\widgets\ActiveForm
;
/*
*
/*
*
*
* @var yii\web\View $this
* @var yii\web\View $this
* @var hrzg\widget\models\crud\search\WidgetTemplate $model
* @var hrzg\widget\models\crud\search\WidgetTemplate $model
...
...
src/views/crud/widget-template/create.php
View file @
cfc6a218
<?php
<?php
/**
/**
* /app/src/../runtime/giiant/fccccf4deb34aed738291a9c38e87215
* /app/src/../runtime/giiant/fccccf4deb34aed738291a9c38e87215.
*
* @package default
*/
*/
use
yii\helpers\Html
;
use
yii\helpers\Html
;
/*
*
/*
*
*
* @var yii\web\View $this
* @var yii\web\View $this
* @var hrzg\widget\models\crud\WidgetTemplate $model
* @var hrzg\widget\models\crud\WidgetTemplate $model
...
...
src/views/crud/widget-template/index.php
View file @
cfc6a218
<?php
<?php
/**
/**
* /app/src/../runtime/giiant/a0a12d1bd32eaeeb8b2cff56d511aa22
* /app/src/../runtime/giiant/a0a12d1bd32eaeeb8b2cff56d511aa22.
*
* @package default
*/
*/
use
yii\grid\GridView
;
use
yii\grid\GridView
;
use
yii\helpers\Html
;
use
yii\helpers\Html
;
use
yii\helpers\Url
;
use
yii\helpers\Url
;
/*
*
/*
*
*
* @var yii\web\View $this
* @var yii\web\View $this
* @var yii\data\ActiveDataProvider $dataProvider
* @var yii\data\ActiveDataProvider $dataProvider
...
@@ -31,7 +27,7 @@ $this->params['breadcrumbs'][] = $this->title;
...
@@ -31,7 +27,7 @@ $this->params['breadcrumbs'][] = $this->title;
'id'
=>
'pjax-main'
,
'id'
=>
'pjax-main'
,
'enableReplaceState'
=>
false
,
'enableReplaceState'
=>
false
,
'linkSelector'
=>
'#pjax-main ul.pagination a, th a'
,
'linkSelector'
=>
'#pjax-main ul.pagination a, th a'
,
'clientOptions'
=>
[
'pjax:success'
=>
'function(){alert("yo")}'
]
'clientOptions'
=>
[
'pjax:success'
=>
'function(){alert("yo")}'
]
,
])
?>
])
?>
<h1>
<h1>
...
@@ -58,7 +54,7 @@ $this->params['breadcrumbs'][] = $this->title;
...
@@ -58,7 +54,7 @@ $this->params['breadcrumbs'][] = $this->title;
'pager'
=>
[
'pager'
=>
[
'class'
=>
yii\widgets\LinkPager
::
className
(),
'class'
=>
yii\widgets\LinkPager
::
className
(),
'firstPageLabel'
=>
Yii
::
t
(
'app'
,
'First'
),
'firstPageLabel'
=>
Yii
::
t
(
'app'
,
'First'
),
'lastPageLabel'
=>
Yii
::
t
(
'app'
,
'Last'
)
'lastPageLabel'
=>
Yii
::
t
(
'app'
,
'Last'
)
,
],
],
'filterModel'
=>
$searchModel
,
'filterModel'
=>
$searchModel
,
'tableOptions'
=>
[
'class'
=>
'table table-striped table-bordered table-hover'
],
'tableOptions'
=>
[
'class'
=>
'table table-striped table-bordered table-hover'
],
...
@@ -69,11 +65,12 @@ $this->params['breadcrumbs'][] = $this->title;
...
@@ -69,11 +65,12 @@ $this->params['breadcrumbs'][] = $this->title;
'class'
=>
'yii\grid\ActionColumn'
,
'class'
=>
'yii\grid\ActionColumn'
,
'urlCreator'
=>
function
(
$action
,
$model
,
$key
,
$index
)
{
'urlCreator'
=>
function
(
$action
,
$model
,
$key
,
$index
)
{
// using the column name as key, not mapping to 'id' like the standard generator
// using the column name as key, not mapping to 'id' like the standard generator
$params
=
is_array
(
$key
)
?
$key
:
[
$model
->
primaryKey
()[
0
]
=>
(
string
)
$key
];
$params
=
is_array
(
$key
)
?
$key
:
[
$model
->
primaryKey
()[
0
]
=>
(
string
)
$key
];
$params
[
0
]
=
\Yii
::
$app
->
controller
->
id
?
\Yii
::
$app
->
controller
->
id
.
'/'
.
$action
:
$action
;
$params
[
0
]
=
\Yii
::
$app
->
controller
->
id
?
\Yii
::
$app
->
controller
->
id
.
'/'
.
$action
:
$action
;
return
Url
::
toRoute
(
$params
);
return
Url
::
toRoute
(
$params
);
},
},
'contentOptions'
=>
[
'nowrap'
=>
'nowrap'
]
'contentOptions'
=>
[
'nowrap'
=>
'nowrap'
]
,
],
],
'name'
,
'name'
,
'php_class'
,
'php_class'
,
...
...
src/views/crud/widget-template/update.php
View file @
cfc6a218
<?php
<?php
/**
/**
* /app/src/../runtime/giiant/fcd70a9bfdf8de75128d795dfc948a74
* /app/src/../runtime/giiant/fcd70a9bfdf8de75128d795dfc948a74.
*
* @package default
*/
*/
use
yii\helpers\Html
;
use
yii\helpers\Html
;
/*
*
/*
*
*
* @var yii\web\View $this
* @var yii\web\View $this
* @var hrzg\widget\models\crud\WidgetTemplate $model
* @var hrzg\widget\models\crud\WidgetTemplate $model
*/
*/
$this
->
title
=
$model
->
getAliasModel
()
.
$model
->
name
.
', '
.
Yii
::
t
(
'app'
,
'Edit'
);
$this
->
title
=
$model
->
getAliasModel
()
.
$model
->
name
.
', '
.
Yii
::
t
(
'app'
,
'Edit'
);
$this
->
params
[
'breadcrumbs'
][]
=
[
'label'
=>
$model
->
getAliasModel
(
true
),
'url'
=>
[
'index'
]];
$this
->
params
[
'breadcrumbs'
][]
=
[
'label'
=>
$model
->
getAliasModel
(
true
),
'url'
=>
[
'index'
]];
$this
->
params
[
'breadcrumbs'
][]
=
[
'label'
=>
(
string
)
$model
->
name
,
'url'
=>
[
'view'
,
'id'
=>
$model
->
id
]];
$this
->
params
[
'breadcrumbs'
][]
=
[
'label'
=>
(
string
)
$model
->
name
,
'url'
=>
[
'view'
,
'id'
=>
$model
->
id
]];
$this
->
params
[
'breadcrumbs'
][]
=
Yii
::
t
(
'app'
,
'Edit'
);
$this
->
params
[
'breadcrumbs'
][]
=
Yii
::
t
(
'app'
,
'Edit'
);
?>
?>
<div
class=
"giiant-crud widget-template-update"
>
<div
class=
"giiant-crud widget-template-update"
>
...
...
src/views/crud/widget-template/view.php
View file @
cfc6a218
<?php
<?php
/**
/**
* /app/src/../runtime/giiant/d4b4964a63cc95065fa0ae19074007ee
* /app/src/../runtime/giiant/d4b4964a63cc95065fa0ae19074007ee.
*
* @package default
*/
*/
use
dmstr\bootstrap\Tabs
;
use
dmstr\bootstrap\Tabs
;
use
dmstr\helpers\Html
;
use
dmstr\helpers\Html
;
use
yii\widgets\DetailView
;
use
yii\widgets\DetailView
;
/*
*
/*
*
*
* @var yii\web\View $this
* @var yii\web\View $this
* @var hrzg\widget\models\crud\WidgetTemplate $model
* @var hrzg\widget\models\crud\WidgetTemplate $model
...
@@ -19,7 +15,7 @@ $copyParams = $model->attributes;
...
@@ -19,7 +15,7 @@ $copyParams = $model->attributes;
$this
->
title
=
$model
->
getAliasModel
()
.
$model
->
name
;
$this
->
title
=
$model
->
getAliasModel
()
.
$model
->
name
;
$this
->
params
[
'breadcrumbs'
][]
=
[
'label'
=>
$model
->
getAliasModel
(
true
),
'url'
=>
[
'index'
]];
$this
->
params
[
'breadcrumbs'
][]
=
[
'label'
=>
$model
->
getAliasModel
(
true
),
'url'
=>
[
'index'
]];
$this
->
params
[
'breadcrumbs'
][]
=
[
'label'
=>
(
string
)
$model
->
name
,
'url'
=>
[
'view'
,
'id'
=>
$model
->
id
]];
$this
->
params
[
'breadcrumbs'
][]
=
[
'label'
=>
(
string
)
$model
->
name
,
'url'
=>
[
'view'
,
'id'
=>
$model
->
id
]];
$this
->
params
[
'breadcrumbs'
][]
=
Yii
::
t
(
'app'
,
'View'
);
$this
->
params
[
'breadcrumbs'
][]
=
Yii
::
t
(
'app'
,
'View'
);
?>
?>
<div
class=
"giiant-crud widget-template-view"
>
<div
class=
"giiant-crud widget-template-view"
>
...
@@ -100,7 +96,7 @@ $this->params['breadcrumbs'][] = Yii::t('app', 'View');
...
@@ -100,7 +96,7 @@ $this->params['breadcrumbs'][] = Yii::t('app', 'View');
'content'
=>
$this
->
blocks
[
'hrzg\widget\models\crud\WidgetTemplate'
],
'content'
=>
$this
->
blocks
[
'hrzg\widget\models\crud\WidgetTemplate'
],
'active'
=>
true
,
'active'
=>
true
,
],
],
]
]
,
]
]
);
);
?>
?>
...
...
src/views/crud/widget/_form.php
View file @
cfc6a218
<?php
<?php
/**
/**
* /app/src/../runtime/giiant/4b7e79a8340461fe629a6ac612644d03
* /app/src/../runtime/giiant/4b7e79a8340461fe629a6ac612644d03.
*
* @package default
*/
*/
namespace
_
;
namespace
_
;
use
franciscomaya\sceditor\SCEditorAsset
;
use
franciscomaya\sceditor\SCEditorAsset
;
...
@@ -14,7 +11,7 @@ use yii\bootstrap\ActiveForm;
...
@@ -14,7 +11,7 @@ use yii\bootstrap\ActiveForm;
use
yii\helpers\Html
;
use
yii\helpers\Html
;
SCEditorAsset
::
register
(
$this
);
SCEditorAsset
::
register
(
$this
);
/*
*
/*
*
*
* @var yii\web\View $this
* @var yii\web\View $this
* @var hrzg\widget\models\crud\WidgetContent $model
* @var hrzg\widget\models\crud\WidgetContent $model
...
@@ -36,8 +33,8 @@ SCEditorAsset::register($this);
...
@@ -36,8 +33,8 @@ SCEditorAsset::register($this);
'wrapper'
=>
'col-sm-10'
,
'wrapper'
=>
'col-sm-10'
,
'error'
=>
''
,
'error'
=>
''
,
'hint'
=>
'hidden'
,
'hint'
=>
'hidden'
,
]
]
,
]
]
,
]
]
);
);
...
@@ -85,7 +82,7 @@ JS;
...
@@ -85,7 +82,7 @@ JS;
<?php
Box
::
begin
()
?>
<?php
Box
::
begin
()
?>
<?php
echo
$form
->
field
(
$model
,
'widget_template_id'
)
->
dropDownList
(
$model
::
optsWidgetTemplateId
(),
<?php
echo
$form
->
field
(
$model
,
'widget_template_id'
)
->
dropDownList
(
$model
::
optsWidgetTemplateId
(),
[
[
'onchange'
=>
'widgets.updateTemplate()'
'onchange'
=>
'widgets.updateTemplate()'
,
]
]
)
?>
)
?>
...
@@ -127,7 +124,7 @@ JS;
...
@@ -127,7 +124,7 @@ JS;
<?php
Box
::
begin
([
<?php
Box
::
begin
([
'title'
=>
'Access'
,
'title'
=>
'Access'
,
'collapse'
=>
true
,
'collapse'
=>
true
,
'collapseDefault'
=>
true
'collapseDefault'
=>
true
,
])
?>
])
?>
<?php
echo
$form
->
field
(
$model
,
'access_domain'
)
->
textInput
([
'maxlength'
=>
true
])
?>
<?php
echo
$form
->
field
(
$model
,
'access_domain'
)
->
textInput
([
'maxlength'
=>
true
])
?>
<?php
echo
$form
->
field
(
$model
,
'access_owner'
)
->
textInput
([
'maxlength'
=>
true
])
?>
<?php
echo
$form
->
field
(
$model
,
'access_owner'
)
->
textInput
([
'maxlength'
=>
true
])
?>
...
@@ -152,7 +149,7 @@ JS;
...
@@ -152,7 +149,7 @@ JS;
(
$model
->
isNewRecord
?
Yii
::
t
(
'app'
,
'Create'
)
:
Yii
::
t
(
'app'
,
'Save'
)),
(
$model
->
isNewRecord
?
Yii
::
t
(
'app'
,
'Create'
)
:
Yii
::
t
(
'app'
,
'Save'
)),
[
[
'id'
=>
'save-'
.
$model
->
formName
(),
'id'
=>
'save-'
.
$model
->
formName
(),
'class'
=>
'btn btn-success'
'class'
=>
'btn btn-success'
,
]
]
);
);
?>
?>
...
...
src/views/crud/widget/_search.php
View file @
cfc6a218
<?php
<?php
/**
/**
* /app/src/../runtime/giiant/eeda5c365686c9888dbc13dbc58f89a1
* /app/src/../runtime/giiant/eeda5c365686c9888dbc13dbc58f89a1.
*
* @package default
*/
*/
use
yii\helpers\Html
;
use
yii\helpers\Html
;
use
yii\widgets\ActiveForm
;
use
yii\widgets\ActiveForm
;
/*
*
/*
*
*
* @var yii\web\View $this
* @var yii\web\View $this
* @var hrzg\widget\models\crud\search\WidgetContent $model
* @var hrzg\widget\models\crud\search\WidgetContent $model
...
...
src/views/crud/widget/create.php
View file @
cfc6a218
<?php
<?php
/**
/**
* /app/src/../runtime/giiant/fccccf4deb34aed738291a9c38e87215
* /app/src/../runtime/giiant/fccccf4deb34aed738291a9c38e87215.
*
* @package default
*/
*/
use
yii\helpers\Html
;
use
yii\helpers\Html
;
/*
*
/*
*
*
* @var yii\web\View $this
* @var yii\web\View $this
* @var hrzg\widget\models\crud\WidgetContent $model
* @var hrzg\widget\models\crud\WidgetContent $model
...
...
src/views/crud/widget/index.php
View file @
cfc6a218
<?php
<?php
/**
/**
* /app/src/../runtime/giiant/a0a12d1bd32eaeeb8b2cff56d511aa22
* /app/src/../runtime/giiant/a0a12d1bd32eaeeb8b2cff56d511aa22.
*
* @package default
*/
*/
use
yii\grid\GridView
;
use
yii\grid\GridView
;
use
yii\helpers\Html
;
use
yii\helpers\Html
;
use
yii\helpers\Url
;
use
yii\helpers\Url
;
/*
*
/*
*
*
* @var yii\web\View $this
* @var yii\web\View $this
* @var yii\data\ActiveDataProvider $dataProvider
* @var yii\data\ActiveDataProvider $dataProvider
...
@@ -30,7 +26,7 @@ $this->params['breadcrumbs'][] = $this->title;
...
@@ -30,7 +26,7 @@ $this->params['breadcrumbs'][] = $this->title;
'id'
=>
'pjax-main'
,
'id'
=>
'pjax-main'
,
'enableReplaceState'
=>
false
,
'enableReplaceState'
=>
false
,
'linkSelector'
=>
'#pjax-main ul.pagination a, th a'
,
'linkSelector'
=>
'#pjax-main ul.pagination a, th a'
,
'clientOptions'
=>
[
'pjax:success'
=>
'function(){alert("yo")}'
]
'clientOptions'
=>
[
'pjax:success'
=>
'function(){alert("yo")}'
]
,
])
?>
])
?>
<h1>
<h1>
...
@@ -57,7 +53,7 @@ $this->params['breadcrumbs'][] = $this->title;
...
@@ -57,7 +53,7 @@ $this->params['breadcrumbs'][] = $this->title;
'pager'
=>
[
'pager'
=>
[
'class'
=>
yii\widgets\LinkPager
::
className
(),
'class'
=>
yii\widgets\LinkPager
::
className
(),
'firstPageLabel'
=>
Yii
::
t
(
'app'
,
'First'
),
'firstPageLabel'
=>
Yii
::
t
(
'app'
,
'First'
),
'lastPageLabel'
=>
Yii
::
t
(
'app'
,
'Last'
)
'lastPageLabel'
=>
Yii
::
t
(
'app'
,
'Last'
)
,
],
],
'filterModel'
=>
$searchModel
,
'filterModel'
=>
$searchModel
,
'tableOptions'
=>
[
'class'
=>
'table table-striped table-bordered table-hover'
],
'tableOptions'
=>
[
'class'
=>
'table table-striped table-bordered table-hover'
],
...
@@ -68,16 +64,17 @@ $this->params['breadcrumbs'][] = $this->title;
...
@@ -68,16 +64,17 @@ $this->params['breadcrumbs'][] = $this->title;
'class'
=>
'yii\grid\ActionColumn'
,
'class'
=>
'yii\grid\ActionColumn'
,
'urlCreator'
=>
function
(
$action
,
$model
,
$key
,
$index
)
{
'urlCreator'
=>
function
(
$action
,
$model
,
$key
,
$index
)
{
// using the column name as key, not mapping to 'id' like the standard generator
// using the column name as key, not mapping to 'id' like the standard generator
$params
=
is_array
(
$key
)
?
$key
:
[
$model
->
primaryKey
()[
0
]
=>
(
string
)
$key
];
$params
=
is_array
(
$key
)
?
$key
:
[
$model
->
primaryKey
()[
0
]
=>
(
string
)
$key
];
$params
[
0
]
=
\Yii
::
$app
->
controller
->
id
?
\Yii
::
$app
->
controller
->
id
.
'/'
.
$action
:
$action
;
$params
[
0
]
=
\Yii
::
$app
->
controller
->
id
?
\Yii
::
$app
->
controller
->
id
.
'/'
.
$action
:
$action
;
return
Url
::
toRoute
(
$params
);
return
Url
::
toRoute
(
$params
);
},
},
'contentOptions'
=>
[
'nowrap'
=>
'nowrap'
]
'contentOptions'
=>
[
'nowrap'
=>
'nowrap'
]
,
],
],
[
[
'attribute'
=>
'template.name'
,
'attribute'
=>
'template.name'
,
'header'
=>
'Template'
,
'header'
=>
'Template'
,
'contentOptions'
=>
[
'nowrap'
=>
'nowrap'
]
'contentOptions'
=>
[
'nowrap'
=>
'nowrap'
]
,
],
],
'access_domain'
,
'access_domain'
,
'route'
,
'route'
,
...
@@ -91,7 +88,6 @@ $this->params['breadcrumbs'][] = $this->title;
...
@@ -91,7 +88,6 @@ $this->params['breadcrumbs'][] = $this->title;
/*'access_update'*/
/*'access_update'*/
/*'access_delete'*/
/*'access_delete'*/
],
],
]);
?>
]);
?>
</div>
</div>
...
...
src/views/crud/widget/update.php
View file @
cfc6a218
...
@@ -2,24 +2,23 @@
...
@@ -2,24 +2,23 @@
namespace
_
;
namespace
_
;
/*
*
/*
* /app/src/../runtime/giiant/fcd70a9bfdf8de75128d795dfc948a74
* /app/src/../runtime/giiant/fcd70a9bfdf8de75128d795dfc948a74
*
*
* @package default
* @package default
*/
*/
use
Yii
;
use
Yii
;
use
yii\helpers\Html
;
use
yii\helpers\Html
;
/*
*
/*
*
*
* @var yii\web\View $this
* @var yii\web\View $this
* @var hrzg\widget\models\crud\WidgetContent $model
* @var hrzg\widget\models\crud\WidgetContent $model
*/
*/
$this
->
title
=
$model
->
getAliasModel
()
.
$model
->
id
.
', '
.
Yii
::
t
(
'app'
,
'Edit'
);
$this
->
title
=
$model
->
getAliasModel
()
.
$model
->
id
.
', '
.
Yii
::
t
(
'app'
,
'Edit'
);
$this
->
params
[
'breadcrumbs'
][]
=
[
'label'
=>
$model
->
getAliasModel
(
true
),
'url'
=>
[
'index'
]];
$this
->
params
[
'breadcrumbs'
][]
=
[
'label'
=>
$model
->
getAliasModel
(
true
),
'url'
=>
[
'index'
]];
$this
->
params
[
'breadcrumbs'
][]
=
[
'label'
=>
(
string
)
$model
->
id
,
'url'
=>
[
'view'
,
'id'
=>
$model
->
id
]];
$this
->
params
[
'breadcrumbs'
][]
=
[
'label'
=>
(
string
)
$model
->
id
,
'url'
=>
[
'view'
,
'id'
=>
$model
->
id
]];
$this
->
params
[
'breadcrumbs'
][]
=
Yii
::
t
(
'app'
,
'Edit'
);
$this
->
params
[
'breadcrumbs'
][]
=
Yii
::
t
(
'app'
,
'Edit'
);
?>
?>
<div
class=
"giiant-crud widget-update"
>
<div
class=
"giiant-crud widget-update"
>
...
...
src/views/crud/widget/view.php
View file @
cfc6a218
<?php
<?php
/**
/**
* /app/src/../runtime/giiant/d4b4964a63cc95065fa0ae19074007ee
* /app/src/../runtime/giiant/d4b4964a63cc95065fa0ae19074007ee.
*
* @package default
*/
*/
use
dmstr\bootstrap\Tabs
;
use
dmstr\bootstrap\Tabs
;
use
dmstr\helpers\Html
;
use
dmstr\helpers\Html
;
use
yii\widgets\DetailView
;
use
yii\widgets\DetailView
;
/*
*
/*
*
*
* @var yii\web\View $this
* @var yii\web\View $this
* @var hrzg\widget\models\crud\WidgetContent $model
* @var hrzg\widget\models\crud\WidgetContent $model
...
@@ -19,7 +15,7 @@ $copyParams = $model->attributes;
...
@@ -19,7 +15,7 @@ $copyParams = $model->attributes;
$this
->
title
=
$model
->
getAliasModel
()
.
$model
->
id
;
$this
->
title
=
$model
->
getAliasModel
()
.
$model
->
id
;
$this
->
params
[
'breadcrumbs'
][]
=
[
'label'
=>
$model
->
getAliasModel
(
true
),
'url'
=>
[
'index'
]];
$this
->
params
[
'breadcrumbs'
][]
=
[
'label'
=>
$model
->
getAliasModel
(
true
),
'url'
=>
[
'index'
]];
$this
->
params
[
'breadcrumbs'
][]
=
[
'label'
=>
(
string
)
$model
->
id
,
'url'
=>
[
'view'
,
'id'
=>
$model
->
id
]];
$this
->
params
[
'breadcrumbs'
][]
=
[
'label'
=>
(
string
)
$model
->
id
,
'url'
=>
[
'view'
,
'id'
=>
$model
->
id
]];
$this
->
params
[
'breadcrumbs'
][]
=
Yii
::
t
(
'app'
,
'View'
);
$this
->
params
[
'breadcrumbs'
][]
=
Yii
::
t
(
'app'
,
'View'
);
?>
?>
<div
class=
"giiant-crud widget-view"
>
<div
class=
"giiant-crud widget-view"
>
...
@@ -110,7 +106,7 @@ $this->params['breadcrumbs'][] = Yii::t('app', 'View');
...
@@ -110,7 +106,7 @@ $this->params['breadcrumbs'][] = Yii::t('app', 'View');
'content'
=>
$this
->
blocks
[
'hrzg\widget\models\crud\Widget'
],
'content'
=>
$this
->
blocks
[
'hrzg\widget\models\crud\Widget'
],
'active'
=>
true
,
'active'
=>
true
,
],
],
]
]
,
]
]
);
);
?>
?>
...
...
src/views/default/index.php
View file @
cfc6a218
...
@@ -18,7 +18,7 @@ use yii\helpers\Html;
...
@@ -18,7 +18,7 @@ use yii\helpers\Html;
[
[
'head'
=>
WidgetContent
::
find
()
->
count
(),
'head'
=>
WidgetContent
::
find
()
->
count
(),
'footer'
=>
'Contents'
,
'footer'
=>
'Contents'
,
'footer_link'
=>
[
'crud/widget'
]
'footer_link'
=>
[
'crud/widget'
]
,
]
]
)
?>
)
?>
</div>
</div>
...
@@ -28,7 +28,7 @@ use yii\helpers\Html;
...
@@ -28,7 +28,7 @@ use yii\helpers\Html;
'head'
=>
WidgetTemplate
::
find
()
->
count
(),
'head'
=>
WidgetTemplate
::
find
()
->
count
(),
'type'
=>
SmallBox
::
TYPE_PURPLE
,
'type'
=>
SmallBox
::
TYPE_PURPLE
,
'footer'
=>
'Templates'
,
'footer'
=>
'Templates'
,
'footer_link'
=>
[
'crud/widget-template'
]
'footer_link'
=>
[
'crud/widget-template'
]
,
]
]
)
?>
)
?>
</div>
</div>
...
@@ -38,7 +38,7 @@ use yii\helpers\Html;
...
@@ -38,7 +38,7 @@ use yii\helpers\Html;
'head'
=>
'+'
,
'head'
=>
'+'
,
'type'
=>
SmallBox
::
TYPE_GREEN
,
'type'
=>
SmallBox
::
TYPE_GREEN
,
'footer'
=>
'New template'
,
'footer'
=>
'New template'
,
'footer_link'
=>
[
'crud/widget-template/create'
]
'footer_link'
=>
[
'crud/widget-template/create'
]
,
]
]
)
?>
)
?>
</div>
</div>
...
...
src/widgets/TwigTemplate.php
View file @
cfc6a218
<?php
<?php
/**
/**
* @link http://www.diemeisterei.de/
* @link http://www.diemeisterei.de/
*
* @copyright Copyright (c) 2016 diemeisterei GmbH, Stuttgart
* @copyright Copyright (c) 2016 diemeisterei GmbH, Stuttgart
*
*
* For the full copyright and license information, please view the LICENSE
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
* file that was distributed with this source code.
*/
*/
namespace
hrzg\widget\widgets
;
namespace
hrzg\widget\widgets
;
use
yii\base\Widget
;
use
yii\base\Widget
;
...
@@ -20,6 +20,7 @@ class TwigTemplate extends Widget
...
@@ -20,6 +20,7 @@ class TwigTemplate extends Widget
{
{
try
{
try
{
$output
=
$this
->
renderFile
(
$this
->
_view
,
$this
->
_properties
);
$output
=
$this
->
renderFile
(
$this
->
_view
,
$this
->
_properties
);
return
$output
;
return
$output
;
}
catch
(
\Exception
$e
)
{
}
catch
(
\Exception
$e
)
{
return
$e
->
getMessage
();
return
$e
->
getMessage
();
...
...
src/widgets/WidgetContainer.php
View file @
cfc6a218
<?php
<?php
/**
/**
* @link http://www.diemeisterei.de/
* @link http://www.diemeisterei.de/
*
* @copyright Copyright (c) 2016 diemeisterei GmbH, Stuttgart
* @copyright Copyright (c) 2016 diemeisterei GmbH, Stuttgart
*
*
* For the full copyright and license information, please view the LICENSE
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
* file that was distributed with this source code.
*/
*/
namespace
hrzg\widget\widgets
;
namespace
hrzg\widget\widgets
;
use
hrzg\widget\models\crud\WidgetContent
;
use
hrzg\widget\models\crud\WidgetContent
;
use
yii\base\Event
;
use
yii\base\Event
;
use
yii\base\Widget
;
use
yii\base\Widget
;
...
@@ -36,16 +35,17 @@ class WidgetContainer extends Widget
...
@@ -36,16 +35,17 @@ class WidgetContainer extends Widget
'container_id'
=>
$this
->
id
,
'container_id'
=>
$this
->
id
,
'route'
=>
\Yii
::
$app
->
requestedRoute
,
'route'
=>
\Yii
::
$app
->
requestedRoute
,
'request_param'
=>
\Yii
::
$app
->
request
->
get
(
'id'
),
'request_param'
=>
\Yii
::
$app
->
request
->
get
(
'id'
),
'access_domain'
=>
\Yii
::
$app
->
language
'access_domain'
=>
\Yii
::
$app
->
language
,
])
])
->
all
();
->
all
();
return
$models
;
return
$models
;
}
}
private
function
renderWidgets
()
private
function
renderWidgets
()
{
{
$html
=
''
;
$html
=
''
;
foreach
(
$this
->
queryWidgets
()
AS
$widget
)
{
foreach
(
$this
->
queryWidgets
()
as
$widget
)
{
$properties
=
Json
::
decode
(
$widget
->
default_properties_json
);
$properties
=
Json
::
decode
(
$widget
->
default_properties_json
);
$class
=
\Yii
::
createObject
(
$widget
->
template
->
php_class
);
$class
=
\Yii
::
createObject
(
$widget
->
template
->
php_class
);
$class
->
setView
(
$widget
->
getViewFile
());
$class
->
setView
(
$widget
->
getViewFile
());
...
@@ -56,17 +56,16 @@ class WidgetContainer extends Widget
...
@@ -56,17 +56,16 @@ class WidgetContainer extends Widget
$html
.=
$class
->
run
();
$html
.=
$class
->
run
();
}
}
return
$html
;
return
$html
;
}
}
private
function
createWidget
()
private
function
createWidget
()
{
{
}
}
public
function
getMenuItems
()
public
function
getMenuItems
()
{
{
return
[
return
[
[
[
'label'
=>
'Create '
.
$this
->
id
.
' <span class="label label-info">widget</span>'
,
'label'
=>
'Create '
.
$this
->
id
.
' <span class="label label-info">widget</span>'
,
...
@@ -76,9 +75,9 @@ class WidgetContainer extends Widget
...
@@ -76,9 +75,9 @@ class WidgetContainer extends Widget
'route'
=>
\Yii
::
$app
->
requestedRoute
,
'route'
=>
\Yii
::
$app
->
requestedRoute
,
'container_id'
=>
$this
->
id
,
'container_id'
=>
$this
->
id
,
'request_param'
=>
\Yii
::
$app
->
request
->
get
(
'id'
),
'request_param'
=>
\Yii
::
$app
->
request
->
get
(
'id'
),
'access_domain'
=>
\Yii
::
$app
->
language
'access_domain'
=>
\Yii
::
$app
->
language
,
]
]
,
]
]
,
],
],
[
[
'label'
=>
'Edit '
.
$this
->
id
.
' <span class="label label-info">widget</span>'
,
'label'
=>
'Edit '
.
$this
->
id
.
' <span class="label label-info">widget</span>'
,
...
@@ -88,10 +87,10 @@ class WidgetContainer extends Widget
...
@@ -88,10 +87,10 @@ class WidgetContainer extends Widget
'route'
=>
\Yii
::
$app
->
requestedRoute
,
'route'
=>
\Yii
::
$app
->
requestedRoute
,
'container_id'
=>
$this
->
id
,
'container_id'
=>
$this
->
id
,
'request_param'
=>
\Yii
::
$app
->
request
->
get
(
'id'
),
'request_param'
=>
\Yii
::
$app
->
request
->
get
(
'id'
),
'access_domain'
=>
\Yii
::
$app
->
language
'access_domain'
=>
\Yii
::
$app
->
language
,
]
]
,
]
]
,
]
]
,
];
];
}
}
}
}
\ No newline at end of file
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