/**
  * Application configuration.
  *
  * @return string
  */
 public function actionViewConfig()
 {
     $loadedModules = Metadata::getModules();
     $loadedModulesDataProvider = new ArrayDataProvider(['allModels' => $loadedModules]);
     $components = Yii::$app->getComponents();
     ksort($components);
     $modules = Yii::$app->getModules();
     ksort($modules);
     return $this->render('view-config', ['params' => Yii::$app->params, 'components' => $components, 'modules' => $modules, 'loadedModulesDataProvider' => $loadedModulesDataProvider]);
 }
Ejemplo n.º 2
0
    <div class="input-group">
        <input type="text" name="q" class="form-control" placeholder="Search..."/>
        <span class="input-group-btn">
            <button type='submit' name='seach' id='search-btn' class="btn btn-flat"><i class="fa fa-search"></i></button>
        </span>
    </div>
</form>-->
<!-- /.search form -->


<?php 
// prepare menu items, get all modules
$menuItems = [];
$favouriteMenuItems[] = ['label' => 'MAIN NAVIGATION', 'options' => ['class' => 'header']];
$developerMenuItems = [];
foreach (\dmstr\helpers\Metadata::getModules() as $name => $module) {
    $role = $name;
    $defaultItem = ['icon' => 'fa fa-cube', 'label' => $name, 'url' => ['/' . $name], 'visible' => Yii::$app->user->can($role) || Yii::$app->user->identity && Yii::$app->user->identity->isAdmin, 'items' => []];
    // check for module configuration and assign to favourites
    $moduleConfigItem = is_object($module) ? isset($module->params['menuItems']) ? $module->params['menuItems'] : [] : (isset($module['params']['menuItems']) ? $module['params']['menuItems'] : []);
    switch (true) {
        case !empty($moduleConfigItem):
            $moduleConfigItem = array_merge($defaultItem, $moduleConfigItem);
            $moduleConfigItem['visible'] = \dmstr\helpers\RouteAccess::can($moduleConfigItem['url']);
            $favouriteMenuItems[] = $moduleConfigItem;
            continue 2;
            break;
        default:
            $defaultItem['icon'] = 'fa fa-circle-o';
            $developerMenuItems[] = $defaultItem;
            break;
Ejemplo n.º 3
0
<?php

namespace _;

use dmstr\helpers\Metadata;
use Yii;
use yii\helpers\Html;
?>

<b><?php 
echo Html::a($model['route'], $model['route']);
?>
</b>

<br/>

<?php 
$controller = Yii::$app->createController($model['module'] . '/' . $model['name']);
foreach (Metadata::getControllerActions($controller[0]) as $action) {
    echo Html::a($action['route'], [$action['route']]) . '<br/>';
}
?>

<hr/>
<?php 
Ejemplo n.º 4
0
 /**
  * @return array
  */
 public function generateRouteList()
 {
     $routeList = array();
     $controllers = Metadata::getModuleControllers();
     // var_dump($controllers);
     foreach ($controllers as $controller) {
         $objController = Yii::$app->createController($controller['name'] . '/')[0];
         $actions = Metadata::getControllerActions($objController);
         foreach ($actions as $action) {
             $routeName = $objController->id . '/' . $action['name'];
             $routeList[$routeName] = $routeName;
         }
     }
     return $routeList;
 }
Ejemplo n.º 5
0
Archivo: index.php Proyecto: 7flash/app
<?php

use rmrevin\yii\fontawesome\FA;
/*
 * @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]);
        }
    }
}
?>

<?php 
echo $this->render('@vendor/dmstr/yii2-adminlte-asset/example-views/phundament/app/default/_controllers.php', ['controllers' => $controllers, 'favourites' => $favourites, 'modelNamespace' => 'app\\models\\']);
?>

Ejemplo n.º 6
0
 public function testModuleControllers()
 {
     $controllers = Metadata::getModuleControllers('user');
     $this->assertEquals('/user/admin', $controllers[0]['route']);
     $this->assertEquals('/en/user/admin', $controllers[0]['url']);
 }
Ejemplo n.º 7
0
<?php

namespace _;

use insolita\wgadminlte\Box;
use yii\data\ArrayDataProvider;
use yii\widgets\ListView;
/* @var $this \yii\web\View */
?>

<?php 
$this->beginBlock('routes');
?>

<?php 
$controllerDataProvider = new ArrayDataProvider(['allModels' => \dmstr\helpers\Metadata::getModuleControllers($key)]);
?>

<?php 
echo ListView::widget(['dataProvider' => $controllerDataProvider, 'layout' => "{items}\n{pager}", 'itemView' => '_controller']);
?>

<?php 
$this->endBlock();
?>


<?php 
Box::begin(['title' => $key . ' ' . (isset($model) && is_object($model) ? '<span class="label label-info">loaded</span>' : ''), 'collapse' => true, 'collapse_remember' => false]);
echo $this->blocks['routes'];
Box::end();