Пример #1
0
<?php

$table = new Ui\Table();
$table->name = 'Шаблоны';
$table->addButton(['text' => 'Создать шаблон', 'href' => '/admin/view/createTemplate']);
$table->setCols(['Шаблон', '', '']);
if (!empty($templates['app']['installed'])) {
    foreach ($templates['app']['installed'] as $template => $name) {
        $table->addRow([$name, empty($templates['app']['current']) || $templates['app']['current'] != $template ? '<a href = "/admin/view/setDefault/' . $template . '">Установить по умолчанию</a>' : 'Тема по умолчанию', '<a href = "/admin/view/template/editFile/' . $template . '">Файлы</a> <a href = "/admin/view/editTemplate/' . $template . '">Редактировать</a>']);
    }
}
$table->draw();
Пример #2
0
<?php

$table = new Ui\Table();
$table->name = 'Установленные модули';
$table->addButton(['href' => '/admin/modules/create', 'text' => 'Создать']);
$table->addButton(['href' => '/admin/modules/install', 'text' => 'Установить']);
$table->setCols(['Модуль', 'Панель администратора', 'Публичная часть', 'Управление', 'По умолчанию']);
$default = !empty(App::$primary->config['defaultModule']) ? App::$primary->config['defaultModule'] : '';
foreach (Module::getInstalled(App::$cur) as $module) {
    $info = Module::getInfo($module);
    $table->addRow([empty($info['name']) ? $module : $info['name'], '', '', "<a class = 'btn btn-primary btn-xs' href = '/admin/modules/editor/{$module}'>Редактировать</a>", $default == $module ? 'По умолчанию' : "<a class = 'btn btn-primary btn-xs' href = '/admin/modules/setDefault/{$module}'>Установить по умолчанию</a>"]);
}
$table->draw();
Пример #3
0
<?php

$table = new Ui\Table();
$table->name = 'Страницы';
$table->setCols(['Адрес', 'Операции']);
$table->addButton(['href' => "/admin/modules/createControllerMethod/{$module}/{$type}/{$controller}", 'text' => 'Создать']);
$class = CodeGenerator::parseClass(Modules::getModulePath($module) . '/' . $type . '/' . $controller . '.php');
foreach ($class->methods as $method) {
    $name = str_replace('Action', '', $method->name);
    $table->addRow([$name, ['class' => 'actionTd', 'html' => '<a class="btn btn-xs btn-success" href="/admin/modules/editControllerMethod/' . $module . '/' . $type . '/' . $controller . '/' . $name . '"><i class="glyphicon glyphicon-edit"></i></a>' . ' <a class="btn btn-xs btn-danger" href="/admin/modules/delControllerMethod/' . $module . '/' . $type . '/' . $controller . '/' . $name . '"><i class="glyphicon glyphicon-remove"></i></a>']]);
}
$table->draw();
Пример #4
0
$table->name = 'Модели';
$table->addButton(['href' => "/admin/modules/createModel/{$module}", 'text' => 'Создать']);
$table->setCols(['Модель', 'Внешние изменения', 'Операции']);
$modulePath = Module::getModulePath($module);
$path = $modulePath . '/models';
$config = Config::custom(App::$primary->path . '/modules/' . $module . '/generatorHash.php');
if (file_exists($path)) {
    $files = array_slice(scandir($path), 2);
    foreach ($files as $file) {
        if (is_dir($path . '/' . $file)) {
            continue;
        }
        $modelName = pathinfo($file, PATHINFO_FILENAME);
        $table->addRow([$modelName, !empty($config['models/' . $file]) && $config['models/' . $file] == md5(file_get_contents($path . '/' . $file)) ? '<b class="text-success">Нету</b>' : '<b class="text-danger">Есть</b>', ['class' => 'actionTd', 'html' => '<a class="btn btn-xs btn-success" href="/admin/modules/editModel/' . $module . '/' . $modelName . '"><i class="glyphicon glyphicon-edit"></i></a>' . ' <a class="btn btn-xs btn-danger" href="/admin/modules/delModel/' . $module . '/' . $modelName . '"><i class="glyphicon glyphicon-remove"></i></a>']]);
    }
}
$table->draw();
$table = new Ui\Table();
$table->name = 'Контроллеры';
$table->addButton(['href' => "/admin/modules/createController/{$module}", 'text' => 'Создать']);
$table->setCols(['Контроллер', 'Тип', 'Операции']);
$types = ['appControllers', 'appAdminControllers', 'Controllers'];
foreach ($types as $type) {
    if (file_exists($modulePath . '/' . $type)) {
        $files = array_slice(scandir($modulePath . '/' . $type), 2);
        foreach ($files as $file) {
            $table->addRow([pathinfo($file, PATHINFO_FILENAME), $type, ['class' => 'actionTd', 'html' => '<a class="btn btn-xs btn-success" href="/admin/modules/controllerEditor/' . $module . '/' . $type . '/' . pathinfo($file, PATHINFO_FILENAME) . '"><i class="glyphicon glyphicon-edit"></i></a>' . ' <a class="btn btn-xs btn-danger" href="/admin/modules/delController/' . $module . '/' . $type . '/' . pathinfo($file, PATHINFO_FILENAME) . '"><i class="glyphicon glyphicon-remove"></i></a>']]);
        }
    }
}
$table->draw();