ILIAS  release_8 Revision v8.19
All Data Structures Namespaces Files Functions Variables Modules Pages
class.ilPageComponentPluginGUI.php
Go to the documentation of this file.
1 <?php
2 
24 {
25  protected string $mode;
26  protected ilLanguage $lng;
29 
30  public function __construct()
31  {
32  global $DIC;
33 
34  $this->lng = $DIC->language();
35  }
36 
37  public function setPCGUI(ilPCPluggedGUI $a_val): void
38  {
39  $this->pc_gui = $a_val;
40  }
41 
42  public function getPCGUI(): ilPCPluggedGUI
43  {
44  return $this->pc_gui;
45  }
46 
47  public function setPlugin(ilPageComponentPlugin $a_val): void
48  {
49  $this->plugin = $a_val;
50  }
51 
52  public function getPlugin(): ilPageComponentPlugin
53  {
54  return $this->plugin;
55  }
56 
57  final public function setMode(string $a_mode): void
58  {
59  $this->mode = $a_mode;
60  }
61 
62  final public function getMode(): string
63  {
64  return $this->mode;
65  }
66 
70  public function getHTML(): string
71  {
73  $this->insert();
74  } elseif ($this->getMode() == ilPageComponentPlugin::CMD_EDIT) {
75  $this->edit();
76  }
77  return "";
78  }
79 
80  abstract public function executeCommand(): void;
81  abstract public function insert(): void;
82  abstract public function edit(): void;
83  abstract public function create(): void;
84  abstract public function getElementHTML(
85  string $a_mode,
86  array $a_properties,
87  string $plugin_version
88  ): string;
89 
90  public function createElement(array $a_properties): bool
91  {
92  return $this->getPCGUI()->createElement($a_properties);
93  }
94 
95  public function updateElement(array $a_properties): bool
96  {
97  return $this->getPCGUI()->updateElement($a_properties);
98  }
99 
100  public function returnToParent(): void
101  {
102  $this->getPCGUI()->returnToParent();
103  }
104 
108  public function setProperties(array $a_val): void
109  {
110  $co = $this->getPCGUI()->getContentObject();
111  if (is_object($co)) {
112  $co->setProperties($a_val);
113  }
114  }
115 
116  public function getProperties(): array
117  {
118  $co = $this->getPCGUI()->getContentObject();
119  if (is_object($co)) {
120  return $co->getProperties();
121  }
122  return array();
123  }
124 
125  final protected function addCreationButton(ilPropertyFormGUI $a_form): void
126  {
127  $lng = $this->lng;
128 
129  $a_form->addCommandButton("create_plug", $lng->txt("save"));
130  }
131 }
setPlugin(ilPageComponentPlugin $a_val)
getElementHTML(string $a_mode, array $a_properties, string $plugin_version)
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...
addCreationButton(ilPropertyFormGUI $a_form)
global $DIC
Definition: feed.php:28
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
addCommandButton(string $a_cmd, string $a_text, string $a_id="")
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
setProperties(array $a_val)
Set properties.