Ejemplo n.º 1
0
 public function actionIndex()
 {
     $this->needAuthenticate();
     $Configurator = new Configurator(Registry::get('config'));
     $view = new ViewConfiguration();
     $view->DataGrid = new DataGrid();
     $view->DataGrid->setCaption('SCMS параметры системы')->setAttributes(['class' => 'table table-hover table-striped'])->addColumn((new Column())->setDisplayName('#')->setHeaderAttributes(['style' => 'vertical-align: middle;'])->switchOnCounter())->addColumn((new Column())->setDisplayName('Наименование')->setValueName('name')->setHeaderAttributes(['style' => 'vertical-align: middle;']))->addColumn((new Column())->setDisplayName('Значение')->setValueName('data')->setHeaderAttributes(['style' => 'vertical-align: middle;'])->setCallback(function ($data) {
         if (is_array($data['data'])) {
             echo '<ul>';
             foreach ($data['data'] as $value) {
                 echo "<li>{$value}</li>";
             }
             echo '</ul>';
         } else {
             echo $data['data'];
         }
     }))->addColumn((new Column())->setDisplayName('Новое значение')->setHeaderAttributes(['style' => 'vertical-align: middle;'])->setCallback(function ($data) {
         if (is_array($data['data'])) {
             echo '<ul>';
             foreach ($data['data'] as $name => $value) {
                 echo "<li><input name='{$name}' type='text' style='width: 100%;' /></li>";
             }
             echo '</ul>';
         } else {
             echo "<input name='{$data['name']}' type='text' style='width: 100%;' />";
         }
     }))->setDataSet($Configurator->getProjectConfigAsRows());
     // Подготовка хлебных крошек
     $viewBreadcrumbs = new ViewBreadcrumbs();
     $viewBreadcrumbs->Breadcrumbs = [new Breadcrumb('Панель управления', '/admin'), new Breadcrumb('Настройки', '')];
     $this->Frame->bindView('breadcrumbs', $viewBreadcrumbs);
     $this->Frame->bindView('content', $view);
     $this->Frame->render();
 }
Ejemplo n.º 2
0
 public function __construct()
 {
     $this->config = Registry::get('config');
     $this->Frame = Registry::frame('front');
     $this->Router = Registry::router();
     $this->currentPath = implode('/', $this->Router->explodeRoute());
     $this->Frame->bindView('menu', $this->buildMenu());
 }
Ejemplo n.º 3
0
 public function actionIndex()
 {
     $this->needAuthenticate();
     $view = new ViewAbout();
     $view->credits = Registry::get('credits');
     // Подготовка хлебных крошек
     $viewBreadcrumbs = new ViewBreadcrumbs();
     $viewBreadcrumbs->Breadcrumbs = [new Breadcrumb('Панель управления', '/admin'), new Breadcrumb('О проекте', '')];
     $this->Frame->bindView('content', $view);
     $this->Frame->bindView('breadcrumbs', $viewBreadcrumbs);
     $this->Frame->render();
 }
Ejemplo n.º 4
0
 public function __construct($ModuleDirectory = null)
 {
     $this->ModuleDirectory = $ModuleDirectory;
     $this->ModuleInstaller = new ModuleInstaller();
     $this->Response = new Response(SCMSNotificationLog::instance());
     $this->config = Registry::get('config');
     $this->Frame = Registry::frame('back');
     $this->Router = Registry::router();
     $this->EmployeeAuthentication = new Authentication();
     $this->HTTPEmployeeAuthentication = new HttpAuthentication();
     $this->Frame->addCss('/public/assets/js/fancybox2/source/jquery.fancybox.css');
     $this->Frame->bindView('menu', $this->buildMenu());
     $this->Frame->bindView('modal-notification', new ViewNotificationsModal());
     $this->Frame->bindView('modal-confirmation', new ViewConfirmationModal());
     $this->Frame->bindView('modal-information', new ViewInformationModal());
 }
Ejemplo n.º 5
0
 public function actionIndex()
 {
     $error = Param::get('error', false)->asInteger(false);
     $frame = Registry::frame('back_clear');
     $view = new ViewAuthorization();
     if (!is_null($error)) {
         switch ($error) {
             case 0:
                 $view->errorText = 'Неверный email или пароль.';
                 break;
             default:
                 $view->errorText = 'Произошла неизвестная ошибка.';
         }
     }
     $frame->bindView('modal-notification', new ViewNotificationsModal());
     $frame->bindView('modal-confirmation', new ViewConfirmationModal());
     $frame->bindView('modal-information', new ViewInformationModal());
     $frame->bindView('content', $view);
     $frame->render();
 }
 public function __construct()
 {
     $this->Proxy = new RouterProxy(Registry::router());
 }
Ejemplo n.º 7
0
 protected function getActiveFrame(Structure $oStructure)
 {
     return $oStructure->frame != '' ? Registry::frame($oStructure->frame) : $this->Frame;
 }
Ejemplo n.º 8
0
DataSource::setup('mysql', include 'App' . DIRECTORY_SEPARATOR . 'Config' . DIRECTORY_SEPARATOR . 'mysql.php');
DataSource::setCurrent('mysql');
Registry::set('config', include 'App/Config/project.php', true);
Registry::set('credits', include 'credits.php');
// Пользовательская часть
Registry::set('front', new Frame(SFW_APP_ROOT . 'Frames' . DIRECTORY_SEPARATOR), true);
Registry::frame('front')->setFrame('front')->addCss('/public/assets/js/bower_components/bootstrap/dist/css/bootstrap.css')->addCss('/public/assets/css/general.css')->addCss('/public/assets/css/main-menu.css')->addCss('/public/assets/css/carousel-actions.css')->addJs('/public/assets/js/bower_components/requirejs/require.js', ['data-main' => '/public/assets/js/appconfig'])->addMeta(['http-equiv' => 'content-type', 'content' => 'text/html; charset=utf-8'])->addMeta(['name' => 'viewport', 'content' => 'width=device-width, initial-scale=1.0'])->setFavicon(Registry::get('config')['favicon']);
// Панель управления
Registry::set('back', new Frame(SFW_APP_ROOT . 'Frames' . DIRECTORY_SEPARATOR), true);
Registry::frame('back')->setFrame('back')->addCss('/public/assets/js/bower_components/bootstrap/dist/css/bootstrap.css')->addJs('/public/assets/js/bower_components/requirejs/require.js', ['data-main' => '/public/assets/js/appconfig'])->addMeta(['http-equiv' => 'content-type', 'content' => 'text/html; charset=utf-8'])->addMeta(['name' => 'viewport', 'content' => 'width=device-width, initial-scale=1.0'])->setFavicon(Registry::get('config')['favicon']);
// "Чистая" панель управления
Registry::set('back_clear', new Frame(SFW_APP_ROOT . 'Frames' . DIRECTORY_SEPARATOR), true);
Registry::frame('back_clear')->setFrame('back_clear')->addCss('/public/assets/js/bower_components/bootstrap/dist/css/bootstrap.css')->addJs('/public/assets/js/bower_components/requirejs/require.js', ['data-main' => '/public/assets/js/appconfig'])->addMeta(['http-equiv' => 'content-type', 'content' => 'text/html; charset=utf-8'])->addMeta(['name' => 'viewport', 'content' => 'width=device-width, initial-scale=1.0'])->setFavicon(Registry::get('config')['favicon']);
// Роутинг
$configFileName = 'App' . DIRECTORY_SEPARATOR . 'Config' . DIRECTORY_SEPARATOR . 'route.php';
if (file_exists($configFileName)) {
    Registry::set('router', new Router(), true);
    $router = Registry::router();
    $router->setConfig(include $configFileName);
    $router->setRoute($_SERVER['REQUEST_URI']);
    try {
        $router->route();
    } catch (Exception $e) {
        SCMSNotificationLog::instance()->DBLogger->error($e->getMessage());
        $response = new Response(SCMSNotificationLog::instance());
        SCMSNotificationLog::instance()->pushAny(SCMSNotificationLog::TYPE_MESSAGE, $e->getMessage(), $e->getCode());
        $response->send();
    }
} else {
    throw new Exception('Конфигурация роутинга отсутствует.');
}