ILIAS  release_8 Revision v8.19
All Data Structures Namespaces Files Functions Variables Modules Pages
class.ilTableTemplatesTableGUI.php
Go to the documentation of this file.
1 <?php
2 
3 declare(strict_types=1);
4 
22 
29 {
30  protected string $temp_type;
35 
36  public function __construct(
37  string $a_temp_type,
38  object $a_parent_obj,
39  string $a_parent_cmd,
40  ilObjStyleSheet $a_style_obj,
41  Content\Access\StyleAccessManager $access_manager
42  ) {
43  global $DIC;
44 
45  $this->access_manager = $access_manager;
46  $this->ctrl = $DIC->ctrl();
47  $this->lng = $DIC->language();
48  $this->access = $DIC->access();
49  $this->rbacsystem = $DIC->rbac()->system();
50  $ilCtrl = $DIC->ctrl();
51  $lng = $DIC->language();
52 
53  parent::__construct($a_parent_obj, $a_parent_cmd);
54 
56 
57  $this->setTitle($lng->txt("sty_templates"));
58  $this->style_obj = $a_style_obj;
59  $this->temp_type = $a_temp_type;
60 
61  $this->addColumn("", "", "1"); // checkbox
62  $this->addColumn($this->lng->txt("sty_template_name"), "");
63  $this->addColumn($this->lng->txt("sty_preview"), "");
64  $this->addColumn($this->lng->txt("sty_commands"), "", "1");
65  $this->setEnableHeader(true);
66  $this->setFormAction($ilCtrl->getFormAction($a_parent_obj));
67  $this->setRowTemplate("tpl.style_template_row.html", "Services/Style/Content");
68  $this->getItems();
69 
70  // action commands
71  if ($this->access_manager->checkWrite()) {
72  $this->addMultiCommand("deleteTemplateConfirmation", $lng->txt("delete"));
73  }
74 
75  $this->setEnableTitle(true);
76  }
77 
78  public function getItems(): void
79  {
80  $this->setData($this->style_obj->getTemplates($this->temp_type));
81  }
82 
83  protected function fillRow(array $a_set): void
84  {
85  $lng = $this->lng;
86  $ilCtrl = $this->ctrl;
87 
88  $this->tpl->setVariable(
89  "T_PREVIEW",
90  $this->style_obj->lookupTemplatePreview((int) $a_set["id"])
91  );
92  $this->tpl->setVariable("TID", $a_set["id"]);
93  $this->tpl->setVariable("TEMPLATE_NAME", $a_set["name"]);
94  $ilCtrl->setParameter($this->parent_obj, "t_id", $a_set["id"]);
95 
96  if ($this->access_manager->checkWrite()) {
97  $this->tpl->setVariable(
98  "LINK_EDIT_TEMPLATE",
99  $ilCtrl->getLinkTarget($this->parent_obj, "editTemplate")
100  );
101  $this->tpl->setVariable("TXT_EDIT", $lng->txt("edit"));
102  }
103  }
104 }
setData(array $a_data)
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
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...
setFormAction(string $a_form_action, bool $a_multipart=false)
setEnableTitle(bool $a_enabletitle)
ilLanguage $lng
global $DIC
Definition: feed.php:28
static addCss()
Add required css.
setRowTemplate(string $a_template, string $a_template_dir="")
Set row template.
setTitle(string $a_title, string $a_icon="", string $a_icon_alt="")
__construct(Container $dic, ilPlugin $plugin)
Manages access to content style editing.
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)
__construct(string $a_temp_type, object $a_parent_obj, string $a_parent_cmd, ilObjStyleSheet $a_style_obj, Content\Access\StyleAccessManager $access_manager)
setParameter(object $a_gui_obj, string $a_parameter, $a_value)
Content Access StyleAccessManager $access_manager
addMultiCommand(string $a_cmd, string $a_text)
setEnableHeader(bool $a_enableheader)