예제 #1
0
파일: index.php 프로젝트: krvd/cms-Inji
<?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->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();
예제 #3
0
파일: pays.php 프로젝트: krvd/cms-Inji
<div class="money">
  <div class="content">
    <?php 
$table = new \Ui\Table();
$table->name = 'Ваши счета';
$table->setCols(['№', 'Описание', 'Сумма', 'Валюта', '', '']);
foreach ($pays as $pay) {
    $table->addRow([$pay->id, $pay->description, $pay->sum, $pay->currency->name(), '<a href = "/money/merchants/pay/' . $pay->id . '" class="btn btn-success btn-sm">Оплатить</a>', '<a href = "/money/merchants/cancelPay/' . $pay->id . '" class="btn btn-danger btn-sm">Отказаться</a>']);
}
$table->draw();
?>
  </div>
</div>
예제 #4
0
<h3>Блокировки на счете</h3>
<?php 
$currency_id = !empty($_GET['currency_id']) ? (int) $_GET['currency_id'] : 0;
$wallets = App::$cur->money->getUserWallets();
if ($currency_id && empty($wallets[$currency_id])) {
    Msg::add('У вас нет такого кошелька');
    Msg::show();
    return;
}
if ($currency_id) {
    $ids = $wallets[$currency_id]->id;
} else {
    $ids = [];
    foreach ($wallets as $wallet) {
        $ids[] = $wallet->id;
    }
    $ids = implode(',', $ids);
}
$table = new \Ui\Table();
$table->setCols(['№', 'Кошелек', 'Сумма', 'Комментарий', 'Дата']);
//items pages
$pages = new \Ui\Pages($_GET, ['count' => \Money\Wallet\Block::getCount(['where' => ['wallet_id', $ids, 'IN']]), 'limit' => 20]);
$histories = \Money\Wallet\Block::getList(['where' => ['wallet_id', $ids, 'IN'], 'order' => [['date_create', 'DESC'], ['id', 'DESC']], 'start' => $pages->params['start'], 'limit' => $pages->params['limit']]);
foreach ($histories as $history) {
    $amount = $history->amount;
    $table->addRow([$history->id, $history->wallet->currency->name(), '<span class = "' . ($amount > 0 ? "text-success" : 'text-danger') . '">' . $amount . '</span>', $history->comment, $history->date_create]);
}
$table->draw();
$pages->draw();
예제 #5
0
 public function loadRowsAction()
 {
     $result = new Server\Result();
     $result->content = [];
     ob_start();
     $request = $this->parseRequest();
     $dataManager = new Ui\DataManager($request['modelName'], $request['managerName']);
     if ($request['download']) {
         ini_set('memory_limit', '2000M');
         set_time_limit(0);
         $request['params']['all'] = true;
         $request['params']['download'] = true;
         ob_end_clean();
         header('Content-Encoding: UTF-8');
         header("Content-Type: text/csv");
         header("Content-Disposition: attachment; filename=" . $request['modelName']::$objectName . '.csv');
         echo "";
         // UTF-8 BOM
         $cols = $dataManager->getCols();
         $cols = array_slice($cols, 1);
         $endRow = true;
         foreach ($cols as $colName => $options) {
             if (!$endRow) {
                 echo ";";
             }
             $endRow = false;
             echo '"' . $options['label'] . '"';
         }
         echo "\n";
         $endRow = true;
     }
     if (!$request['params']['all']) {
         $pages = $dataManager->getPages($request['params'], $request['model']);
         $request['params']['page'] = $pages->params['page'];
         $request['params']['limit'] = $pages->params['limit'];
     }
     $rows = $dataManager->getRows($request['params'], $request['model']);
     foreach ($rows as $row) {
         if ($request['download']) {
             $row = array_slice($row, 1, -1);
             foreach ($row as $col) {
                 if (!$endRow) {
                     echo ";";
                 }
                 $endRow = false;
                 echo '"' . str_replace(["\n", '"'], ['“'], $col) . '"';
             }
             echo "\n";
             $endRow = true;
         } else {
             Ui\Table::drawRow($row);
         }
     }
     if ($request['download']) {
         exit;
     }
     $result->content['rows'] = ob_get_contents();
     ob_clean();
     $result->content['pages'] = '';
     if (isset($pages) && $pages) {
         if ($pages) {
             $pages->draw();
             echo '<div style="background:#fff;">записей: <b>' . $pages->options['count'] . '</b>. страница <b>' . $pages->params['page'] . '</b> из <b>' . $pages->params['pages'] . '</b></div>';
         }
         $result->content['pages'] = ob_get_contents();
         ob_end_clean();
     }
     $result->send();
 }
예제 #6
0
파일: index.php 프로젝트: krvd/cms-Inji
<?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();
예제 #7
0
파일: view.php 프로젝트: krvd/cms-Inji
<?php

$modelName = get_class($item);
$table = new Ui\Table();
$table->name = $item->name();
$row = [];
foreach ($modelName::$cols as $colName => $options) {
    $modelName = get_class($item);
    $colInfo = $modelName::getColInfo($colName);
    $type = !empty($colInfo['colParams']['type']) ? $colInfo['colParams']['type'] : 'string';
    switch ($type) {
        case 'select':
            switch ($colInfo['colParams']['source']) {
                case 'array':
                    $value = !empty($colInfo['colParams']['sourceArray'][$item->{$colName}]) ? $colInfo['colParams']['sourceArray'][$item->{$colName}] : 'Не задано';
                    break;
                case 'method':
                    if (!empty($colInfo['colParams']['params'])) {
                        $values = call_user_func_array([App::$cur->{$colInfo}['colParams']['module'], $colInfo['colParams']['method']], $colInfo['colParams']['params']);
                    } else {
                        $values = App::$primary->{$colInfo}['colParams']['module']->{$colInfo}['colParams']['method']();
                    }
                    $value = !empty($values[$item->{$colName}]) ? $values[$item->{$colName}] : 'Не задано';
                    break;
                case 'relation':
                    $relations = $colInfo['modelName']::relations();
                    $relValue = $relations[$colInfo['colParams']['relation']]['model']::get($item->{$colName});
                    $value = $relValue ? "<a href='/admin/" . str_replace('\\', '/view/', $relations[$colInfo['colParams']['relation']]['model']) . "/" . $relValue->pk() . "'>" . $relValue->name() . "</a>" : 'Не задано';
                    break;
            }
            break;
예제 #8
0
파일: editor.php 프로젝트: krvd/cms-Inji
$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();