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
739eae67
Commit
739eae67
authored
Apr 01, 2016
by
Tobias Munk
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
added generated code
parent
e89589e2
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
80 additions
and
0 deletions
+80
-0
Module.php
src/Module.php
+15
-0
DefaultController.php
src/controllers/DefaultController.php
+13
-0
ActiveRecordDbConnectionTrait.php
src/traits/ActiveRecordDbConnectionTrait.php
+11
-0
index.php
src/views/default/index.php
+41
-0
No files found.
src/Module.php
0 → 100644
View file @
739eae67
<?php
namespace
hrzg\widgets2
;
class
Module
extends
\yii\base\Module
{
public
$controllerNamespace
=
'hrzg\widgets2\controllers'
;
public
function
init
()
{
parent
::
init
();
// custom initialization code goes here
}
}
src/controllers/DefaultController.php
0 → 100644
View file @
739eae67
<?php
namespace
hrzg\widgets2\controllers
;
use
yii\web\Controller
;
class
DefaultController
extends
Controller
{
public
function
actionIndex
()
{
return
$this
->
render
(
'index'
);
}
}
src/traits/ActiveRecordDbConnectionTrait.php
0 → 100644
View file @
739eae67
<?php
namespace
hrzg\widgets2\traits
;
trait
ActiveRecordDbConnectionTrait
{
public
static
function
getDb
()
{
return
\Yii
::
$app
->
db
;
}
}
src/views/default/index.php
0 → 100644
View file @
739eae67
<?php
use
rmrevin\yii\fontawesome\FA
;
use
yii\helpers\Inflector
;
/*
* @var yii\web\View $this
*/
$controllers
=
\dmstr\helpers\Metadata
::
getModuleControllers
(
$this
->
context
->
module
->
id
);
$favourites
=
[];
$patterns
=
[
'^default$'
=>
[
'color'
=>
'gray'
,
'icon'
=>
FA
::
_CUBE
],
'^.*$'
=>
[
'color'
=>
'blue'
,
'icon'
=>
FA
::
_CUBE
],
];
foreach
(
$patterns
AS
$pattern
=>
$options
)
{
foreach
(
$controllers
AS
$c
=>
$item
)
{
$controllers
[
$c
][
'label'
]
=
$item
[
'name'
];
if
(
preg_match
(
"/
$pattern
/"
,
$item
[
'name'
]))
{
$favourites
[
$c
]
=
$item
;
$favourites
[
$c
][
'head'
]
=
$item
[
'name'
];
$favourites
[
$c
][
'label'
]
=
'Controller'
;
$favourites
[
$c
][
'color'
]
=
$options
[
'color'
];
$favourites
[
$c
][
'icon'
]
=
isset
(
$options
[
'icon'
])
?
$options
[
'icon'
]
:
null
;
unset
(
$controllers
[
$c
]);
}
}
}
?>
<?=
$this
->
render
(
'@vendor/dmstr/yii2-adminlte-asset/example-views/phundament/app/default/_controllers.php'
,
[
'controllers'
=>
$controllers
,
'favourites'
=>
$favourites
,
'modelNamespace'
=>
'app\models\\'
,
]
)
?>
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