ILIAS  trunk Revision v12.0_alpha-1540-g00f839d5fa1
PageLayoutTableBuilder.php
Go to the documentation of this file.
1<?php
2
3/* Copyright (c) 1998-2023 ILIAS open source, Extended GPL, see docs/LICENSE */
4
5declare(strict_types=1);
6
7namespace ILIAS\COPage\Layout;
8
14use ilPageLayout;
15use ilUtil;
17
19{
20 public function __construct(
21 protected InternalDomainService $domain,
22 protected InternalGUIService $gui,
23 object $parent_gui,
24 string $parent_cmd
25 ) {
26 parent::__construct($parent_gui, $parent_cmd);
27 }
28
29 protected function getId(): string
30 {
31 return "pglayout";
32 }
33
34 protected function getTitle(): string
35 {
36 return $this->domain->lng()->txt("page_layouts");
37 }
38
39 protected function getRetrieval(): RetrievalInterface
40 {
41 return $this->domain->layoutRetrieval();
42 }
43
44 protected function transformRow(array $data_row): array
45 {
46 $lng = $this->domain->lng();
48
49 $modules = [];
50 foreach ($all_mods as $mod_id => $mod_caption) {
51 if (($mod_id == ilPageLayout::MODULE_SCORM && $data_row["mod_scorm"]) ||
52 ($mod_id == ilPageLayout::MODULE_PORTFOLIO && $data_row["mod_portfolio"]) ||
53 ($mod_id == ilPageLayout::MODULE_LM && $data_row["mod_lm"])) {
54 $modules[] = $mod_caption;
55 }
56 }
57
58 $active_img = $data_row['active']
59 ? ilUtil::getImagePath("standard/icon_ok.svg")
60 : ilUtil::getImagePath("standard/icon_not_ok.svg");
61 $active_txt = $data_row['active']
62 ? $lng->txt("active")
63 : $lng->txt("inactive");
64
65 $pgl_obj = new ilPageLayout((int) $data_row['layout_id']);
66
67 return [
68 "id" => $data_row["id"],
69 "active" => $this->gui->ui()->factory()->symbol()->icon()->custom($active_img, $active_txt),
70 "preview" => $pgl_obj->getPreview(),
71 "title" => $data_row["title"],
72 "description" => $data_row["description"],
73 "modules" => implode(", ", $modules)
74 ];
75 }
76
78 {
79 $lng = $this->domain->lng();
80 $lng->loadLanguageModule("copg");
82 ->iconColumn("active", $lng->txt("active"))
83 ->textColumn("preview", $lng->txt("thumbnail"), false)
84 ->textColumn("title", $lng->txt("title"), true)
85 ->textColumn("description", $lng->txt("description"), true)
86 ->textColumn("modules", $lng->txt("copg_obj_types"), false)
87 ->singleAction("editPg", $lng->txt("edit"))
88 ->singleRedirectAction(
89 "properties",
90 $lng->txt("settings"),
91 [ilPageLayoutGUI::class],
92 "properties",
93 "obj_id"
94 )
95 ->singleAction("exportLayout", $lng->txt("export"))
96 ->singleAction("deletePgl", $lng->txt("delete"), true)
97 ->multiAction("activate", $lng->txt("activate"))
98 ->multiAction("deactivate", $lng->txt("deactivate"))
99 ->multiAction("deletePgl", $lng->txt("delete"), true);
100
101 return $table;
102 }
103}
transformRow(array $data_row)
transform raw data array to table row data array
__construct(protected InternalDomainService $domain, protected InternalGUIService $gui, object $parent_gui, string $parent_cmd)
iconColumn(string $key, string $title, bool $sortable=false)
Class ilPageLayoutGUI GUI class.
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
static getAvailableModules()
Util class various functions, usage as namespace.
static getImagePath(string $image_name, string $module_path="", string $mode="output", bool $offline=false)
get image path (for images located in a template directory)
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
__construct(Container $dic, ilPlugin $plugin)
@inheritDoc
global $lng
Definition: privfeed.php:26