ILIAS  trunk Revision v11.0_alpha-3011-gc6b235a2e85
class.ilPageLayoutTableGUI.php
Go to the documentation of this file.
1<?php
2
25{
26 protected \ILIAS\DI\UIServices $ui;
27 protected array $all_mods;
29 protected ilCtrl $ctrl;
30
31 public function __construct(
32 object $a_parent_obj,
33 string $a_parent_cmd
34 ) {
35 global $DIC;
36
37 $this->ctrl = $DIC->ctrl();
38 $this->lng = $DIC->language();
39 $this->rbacsystem = $DIC->rbac()->system();
40 $ilCtrl = $DIC->ctrl();
41 $lng = $DIC->language();
42 $this->ui = $DIC->ui();
43
44 $lng->loadLanguageModule("content");
45 $lng->loadLanguageModule("copg");
46
47 parent::__construct($a_parent_obj, $a_parent_cmd);
48 $this->addColumn("", "", "2%");
49
50 $this->addColumn($lng->txt("active"));
51 $this->addColumn($lng->txt("thumbnail"));
52 $this->addColumn($lng->txt("title"));
53 $this->addColumn($lng->txt("description"));
54 $this->addColumn($lng->txt("copg_obj_types"));
55 $this->addColumn($lng->txt("actions"));
56
57 // show command buttons, if write permission is given
58 if ($a_parent_obj->checkPermission("sty_write_page_layout", false)) {
59 $this->addMultiCommand("activate", $lng->txt("activate"));
60 $this->addMultiCommand("deactivate", $lng->txt("deactivate"));
61 $this->addMultiCommand("deletePgl", $lng->txt("delete"));
62 }
63
64 $this->getPageLayouts();
65
66 $this->setSelectAllCheckbox("pglayout");
67 $this->setEnableHeader(true);
68 $this->setFormAction($ilCtrl->getFormAction($a_parent_obj));
69 $this->setRowTemplate(
70 "tpl.stys_pglayout_table_row.html",
71 "components/ILIAS/COPage/Layout"
72 );
73 $this->setTitle($lng->txt("page_layouts"));
74 }
75
79 public function getPageLayouts(): void
80 {
82 $this->all_mods = ilPageLayout::getAvailableModules();
83 }
84
85 protected function fillRow(array $a_set): void
86 {
88 $ilCtrl = $this->ctrl;
89
90 $ilCtrl->setParameter($this->parent_obj, "layout_id", "");
91
92 // modules
93 $this->tpl->setCurrentBlock("mod");
94 foreach ($this->all_mods as $mod_id => $mod_caption) {
95 if (($mod_id == ilPageLayout::MODULE_SCORM && $a_set["mod_scorm"]) ||
96 ($mod_id == ilPageLayout::MODULE_PORTFOLIO && $a_set["mod_portfolio"]) ||
97 ($mod_id == ilPageLayout::MODULE_LM && $a_set["mod_lm"])) {
98 $this->tpl->setVariable("MOD_NAME", $mod_caption);
99 $this->tpl->parseCurrentBlock();
100 }
101 }
102
103 if ($a_set['active']) {
104 $this->tpl->setVariable("IMG_ACTIVE", ilUtil::getImagePath("standard/icon_ok.svg"));
105 } else {
106 $this->tpl->setVariable("IMG_ACTIVE", ilUtil::getImagePath("standard/icon_not_ok.svg"));
107 }
108 $this->tpl->setVariable("VAL_TITLE", $a_set['title']);
109 $this->tpl->setVariable("VAL_DESCRIPTION", $a_set['description']);
110 $this->tpl->setVariable("CHECKBOX_ID", $a_set['layout_id']);
111
112 $ilCtrl->setParameter($this->parent_obj, "obj_id", $a_set['layout_id']);
113
114 if ($this->parent_obj->checkPermission("sty_write_page_layout", false)) {
115 $links[] = $this->ui->factory()->link()->standard(
116 $this->lng->txt("edit"),
117 $ilCtrl->getLinkTarget($this->parent_obj, "editPg")
118 );
119 $links[] = $this->ui->factory()->link()->standard(
120 $this->lng->txt("settings"),
121 $ilCtrl->getLinkTargetByClass("ilpagelayoutgui", "properties")
122 );
123 $links[] = $this->ui->factory()->link()->standard(
124 $this->lng->txt("export"),
125 $ilCtrl->getLinkTarget($this->parent_obj, "exportLayout")
126 );
127 $dd = $this->ui->factory()->dropdown()->standard($links);
128
129 $this->tpl->setVariable(
130 "ACTIONS",
131 $this->ui->renderer()->render($dd)
132 );
133 }
134
135 $pgl_obj = new ilPageLayout($a_set['layout_id']);
136 $this->tpl->setVariable("VAL_PREVIEW_HTML", $pgl_obj->getPreview());
137 }
138}
Class ilCtrl provides processing control methods.
setParameter(object $a_gui_obj, string $a_parameter, $a_value)
@inheritDoc
loadLanguageModule(string $a_module)
Load language module.
txt(string $a_topic, string $a_default_lang_fallback_mod="")
gets the text for a given topic if the topic is not in the list, the topic itself with "-" will be re...
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
__construct(object $a_parent_obj, string $a_parent_cmd)
fillRow(array $a_set)
Standard Version of Fill Row.
getPageLayouts()
Get a List of all Page Layouts.
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
static getAvailableModules()
static getLayoutsAsArray(int $a_active=0)
class ilRbacSystem system function like checkAccess, addActiveRole ... Supporting system functions ar...
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
setTitle(string $a_title, string $a_icon="", string $a_icon_alt="")
addMultiCommand(string $a_cmd, string $a_text)
setFormAction(string $a_form_action, bool $a_multipart=false)
addColumn(string $a_text, string $a_sort_field="", string $a_width="", bool $a_is_checkbox_action_column=false, string $a_class="", string $a_tooltip="", bool $a_tooltip_with_html=false)
setEnableHeader(bool $a_enableheader)
setSelectAllCheckbox(string $a_select_all_checkbox, bool $a_select_all_on_top=false)
setRowTemplate(string $a_template, string $a_template_dir="")
Set row template.
setData(array $a_data)
Set table data.
ilLanguage $lng
static getImagePath(string $image_name, string $module_path="", string $mode="output", bool $offline=false)
get image path (for images located in a template directory)
__construct(Container $dic, ilPlugin $plugin)
@inheritDoc
global $DIC
Definition: shib_login.php:26