"Название", "author" => "Автор", "version" => "Версия", "type" => "Тип", "description" => "Описание", "installations" => "Установки", "views" => "Просмотры" ]; $meta['params'] = ["class" => "table table-bordered"]; $meta['perPage'] = $per_page; $meta['baseUrl'] = "/admin/module_shop_client"; $meta['currentPage'] = $page_number; $meta['total'] = $module_count; $info_to_table['meta'] = $meta; $info_to_table['data'] = $modules_info; $info_to_table['filters'] = ['type']; $table = new ListJsonTable(json_encode($info_to_table, JSON_PRETTY_PRINT | JSON_UNESCAPED_UNICODE)); $table->addAction(function ($row, $url) use ($moduleService) { $url = "$url/view/" . $row['id']; return \kernel\widgets\IconBtn\IconBtnViewWidget::create(['url' => $url])->run(); }); $table->addAction(function ($row, $url) use ($moduleService){ if ($row['slug'] !== 'kernel') { if ($moduleService->isInstall($row['slug'])) { $url = "$url/delete/?slug=" . $row['slug']; return \kernel\widgets\IconBtn\IconBtnDeleteWidget::create(['url' => $url])->run(); } else { $url = "$url/install/?id=" . $row['id']; return \kernel\widgets\IconBtn\IconBtnInstallWidget::create(['url' => $url])->run(); } } return null; }); $table->addAction(function ($row, $url) use ($moduleService) { $slug = $row['slug']; if ($moduleService->isInstall($slug)) { if (!$moduleService->isLastVersion($slug)) { $url = "$url/update/?slug=" . $slug; return \kernel\widgets\IconBtn\IconBtnUpdateWidget::create(['url' => $url])->run(); } } return false; }); $table->addAction(function ($row, $url) use ($kernelService) { $slug = $row['slug']; if ($slug === 'kernel') { if (!$kernelService->isLastVersion()) { $url = "$url/kernel/update_form/"; return \kernel\widgets\IconBtn\IconBtnUpdateWidget::create(['url' => $url])->run(); } } return false; }); $table->addAction(function ($row, $url) use ($adminThemeService) { $type = $row['type']; $slug = $row['slug']; if ($type === 'admin_theme') { if ($adminThemeService->isInstall($slug)) { if (!$adminThemeService->isLastVersion($slug)) { $url = "$url/admin_theme/update/"; return \kernel\widgets\IconBtn\IconBtnUpdateWidget::create(['url' => $url])->run(); } } } return false; }); $table->afterPrint(function () { return \kernel\IGTabel\btn\PrimaryBtn::create('Сбросить все фильтры', '/admin/module_shop_client')->fetch(); }); \kernel\widgets\ModuleTabsWidget::create()->run(); $table->create(); $table->render();