module shop
This commit is contained in:
@ -34,18 +34,30 @@ class ModuleShopClientController extends AdminController
|
||||
*/
|
||||
public function actionIndex(int $page_number = 1): void
|
||||
{
|
||||
$per_page = 8;
|
||||
$modules_info = RESTClient::request($_ENV['MODULE_SHOP_URL'] . '/api/module_shop/gb_slug');
|
||||
$modules_info = json_decode($modules_info->getBody()->getContents(), true);
|
||||
$module_count = count($modules_info);
|
||||
$modules_info = array_slice($modules_info, $per_page*($page_number-1), $per_page);
|
||||
$this->cgView->render("index.php", [
|
||||
'modules_info' => $modules_info,
|
||||
'moduleService' => $this->moduleService,
|
||||
'page_number' => $page_number,
|
||||
'module_count' => $module_count,
|
||||
'per_page' => $per_page,
|
||||
]);
|
||||
|
||||
if ($this->moduleService->issetModuleShopToken()) {
|
||||
if ($this->moduleService->isServerAvailable()) {
|
||||
|
||||
$per_page = 8;
|
||||
$modules_info = RESTClient::request($_ENV['MODULE_SHOP_URL'] . '/api/module_shop/gb_slug');
|
||||
$modules_info = json_decode($modules_info->getBody()->getContents(), true);
|
||||
$module_count = count($modules_info);
|
||||
$modules_info = array_slice($modules_info, $per_page * ($page_number - 1), $per_page);
|
||||
|
||||
$this->cgView->render("index.php", [
|
||||
'modules_info' => $modules_info,
|
||||
'moduleService' => $this->moduleService,
|
||||
'page_number' => $page_number,
|
||||
'module_count' => $module_count,
|
||||
'per_page' => $per_page,
|
||||
]);
|
||||
} else {
|
||||
$this->cgView->render("module_shop_error_connection.php");
|
||||
}
|
||||
|
||||
} else {
|
||||
$this->cgView->render("login_at_module_shop.php");
|
||||
}
|
||||
}
|
||||
|
||||
public function actionView(int $id): void
|
||||
|
@ -0,0 +1,34 @@
|
||||
<?php
|
||||
|
||||
use itguild\forms\ActiveForm;
|
||||
|
||||
\kernel\widgets\ModuleTabsWidget::create()->run();
|
||||
|
||||
echo \kernel\helpers\Html::h(2, "Форма авторизации");
|
||||
|
||||
$form = new ActiveForm();
|
||||
$form->beginForm("/admin/module_shop_client/auth/");
|
||||
|
||||
$form->field(\itguild\forms\inputs\TextInput::class, 'key', [
|
||||
'class' => "form-control",
|
||||
'placeholder' => 'Email',
|
||||
])
|
||||
->setLabel("Email")
|
||||
->render();
|
||||
?>
|
||||
|
||||
<div class="row">
|
||||
<div class="col-sm-2">
|
||||
<?php
|
||||
$form->field(\itguild\forms\inputs\Button::class, name: "btn-submit", params: [
|
||||
'class' => "btn btn-primary ",
|
||||
'value' => 'Отправить',
|
||||
'typeInput' => 'submit'
|
||||
])
|
||||
->render();
|
||||
?>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
<?php
|
||||
$form->endForm();
|
@ -0,0 +1,6 @@
|
||||
<?php
|
||||
\kernel\widgets\ModuleTabsWidget::create()->run();
|
||||
?>
|
||||
|
||||
<h1>Ошибка подключения к сервису</h1>
|
||||
|
Reference in New Issue
Block a user