ILIAS  release_9 Revision v9.13-25-g2c18ec4c24f
ilObjectContentStyleSettingsGUI Class Reference

Style settings of a repository object. More...

+ Collaboration diagram for ilObjectContentStyleSettingsGUI:

Public Member Functions

 __construct (InternalDomainService $domain_service, InternalGUIService $gui_service, ?int $current_style_id, int $ref_id, int $obj_id)
 
 executeCommand ()
 
 initStylePropertiesForm ()
 Init style properties form. More...
 
 forwardToStyleSheet ()
 
 createStyle ()
 
 editStyle ()
 
 deleteStyle ()
 

Protected Member Functions

 settings ()
 
 isContainer ()
 
 updateStyleId (int $style_id)
 
 setOwnerId (int $style_id)
 
 saveStyleSettings ()
 Save style settings. More...
 
 saveIndividualStyleSettings ()
 

Protected Attributes

ObjectManager $object_manager
 
ContainerManager $container_manager
 
InternalDomainService $domain
 
InternalGUIService $gui
 
int $current_style_id
 
int $ref_id
 
int $obj_id
 

Private Attributes

ilGlobalTemplateInterface $main_tpl
 

Detailed Description

Style settings of a repository object.

Author
Alexander Killing killi.nosp@m.ng@l.nosp@m.eifos.nosp@m..de ilObjectContentStyleSettingsGUI: ilObjStyleSheetGUI

Definition at line 31 of file class.ilObjectContentStyleSettingsGUI.php.

Constructor & Destructor Documentation

◆ __construct()

ilObjectContentStyleSettingsGUI::__construct ( InternalDomainService  $domain_service,
InternalGUIService  $gui_service,
?int  $current_style_id,
int  $ref_id,
int  $obj_id 
)

Definition at line 42 of file class.ilObjectContentStyleSettingsGUI.php.

References $DIC, $ref_id, ilObject\_lookupObjId(), ILIAS\Style\Content\InternalDomainService\object(), and ILIAS\Style\Content\InternalDomainService\repositoryContainer().

48  {
49  global $DIC;
50  $this->main_tpl = $DIC->ui()->mainTemplate();
51  $this->domain = $domain_service;
52  $this->gui = $gui_service;
53  $this->ref_id = $ref_id;
54  $this->obj_id = ($obj_id > 0)
55  ? $obj_id
57  $this->container_manager = $domain_service->repositoryContainer($ref_id);
58  $this->object_manager = $domain_service->object($ref_id, $this->obj_id);
59  $this->current_style_id = $current_style_id ?? $this->object_manager->getStyleId();
60  }
static _lookupObjId(int $ref_id)
global $DIC
Definition: feed.php:28
object(int $ref_id, int $obj_id=0)
Objects without ref id (e.g.
+ Here is the call graph for this function:

Member Function Documentation

◆ createStyle()

ilObjectContentStyleSettingsGUI::createStyle ( )

Definition at line 235 of file class.ilObjectContentStyleSettingsGUI.php.

235  : void
236  {
237  $ctrl = $this->gui->ctrl();
238  $ctrl->redirectByClass("ilobjstylesheetgui", "create");
239  }

◆ deleteStyle()

ilObjectContentStyleSettingsGUI::deleteStyle ( )

Definition at line 247 of file class.ilObjectContentStyleSettingsGUI.php.

247  : void
248  {
249  $ctrl = $this->gui->ctrl();
250  $ctrl->redirectByClass("ilobjstylesheetgui", "delete");
251  }

◆ editStyle()

ilObjectContentStyleSettingsGUI::editStyle ( )

Definition at line 241 of file class.ilObjectContentStyleSettingsGUI.php.

241  : void
242  {
243  $ctrl = $this->gui->ctrl();
244  $ctrl->redirectByClass("ilobjstylesheetgui", "edit");
245  }

◆ executeCommand()

ilObjectContentStyleSettingsGUI::executeCommand ( )

Definition at line 62 of file class.ilObjectContentStyleSettingsGUI.php.

References forwardToStyleSheet().

62  : void
63  {
64  $ctrl = $this->gui->ctrl();
65 
66  $next_class = $ctrl->getNextClass($this);
67  $cmd = $ctrl->getCmd("settings");
68 
69  switch ($next_class) {
70  case "ilobjstylesheetgui":
71  $this->gui->tabs()->clearTargets();
72  $ctrl->setReturn($this, "settings");
73  $this->forwardToStyleSheet();
74  break;
75 
76  default:
77  if (in_array($cmd, [
78  "settings",
79  "editStyle",
80  "updateStyle",
81  "createStyle",
82  "deleteStyle",
83  "saveStyleSettings",
84  "saveIndividualStyleSettings"
85  ])) {
86  $this->$cmd();
87  }
88  }
89  }
+ Here is the call graph for this function:

◆ forwardToStyleSheet()

ilObjectContentStyleSettingsGUI::forwardToStyleSheet ( )

Definition at line 199 of file class.ilObjectContentStyleSettingsGUI.php.

References setOwnerId(), and updateStyleId().

Referenced by executeCommand().

200  {
201  $ctrl = $this->gui->ctrl();
202  $cmd = $ctrl->getCmd();
203 
204  $style_gui = new ilObjStyleSheetGUI(
205  "",
206  $this->current_style_id,
207  false
208  );
209  $style_id = $ctrl->forwardCommand($style_gui);
210  if (in_array($cmd, ["save", "copyStyle", "importStyle", "confirmedDelete"])) {
211  $style_id = $style_gui->getObject()->getId();
212  if ($cmd == "confirmedDelete") {
213  $style_id = 0;
214  } else {
215  $this->setOwnerId($style_id);
216  }
217  $this->updateStyleId($style_id);
218  if (in_array($cmd, ["save", "copyStyle", "importStyle"])) {
219  $ctrl->redirect($this, "editStyle");
220  }
221  $ctrl->redirect($this, "settings");
222  }
223  }
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ initStylePropertiesForm()

ilObjectContentStyleSettingsGUI::initStylePropertiesForm ( )

Init style properties form.

Definition at line 103 of file class.ilObjectContentStyleSettingsGUI.php.

References $current_style_id, $lng, ILIAS\LTI\ToolProvider\$settings, ilObject\_lookupTitle(), isContainer(), and ilSelectInputGUI\setOptions().

Referenced by saveIndividualStyleSettings(), saveStyleSettings(), and settings().

104  {
105  $ilCtrl = $this->gui->ctrl();
106  $lng = $this->domain->lng();
107  $tabs = $this->gui->tabs();
108  $settings = $this->domain->settings();
109  $mt = $this->gui->mainTemplate();
110 
111  $style_id = $this->current_style_id;
112  /*
113  if (ilObject::_lookupType($style_id) == "sty") {
114  $page_gui->setStyleId($style_id);
115  } else {
116  $style_id = 0;
117  }
118 
119  $page_gui->setTabHook($this, "addPageTabs");
120  $ilCtrl->getHTML($page_gui);
121  $ilTabs->setTabActive("obj_sty");*/
122 
123  $lng->loadLanguageModule("style");
124 
125  $form = new ilPropertyFormGUI();
126  if ($this->object_manager->globalFixed()) {
127  $st = new ilNonEditableValueGUI($lng->txt("style_current_style"));
128  $st->setValue($this->object_manager->getGlobalFixedTitle() . " (" .
129  $lng->txt("global_fixed") . ")");
130  $form->addItem($st);
131  } else {
132  $st_styles = $this->object_manager->getSelectableStyles();
133 
134  $st_styles[0] = $lng->txt("default");
135  ksort($st_styles);
136 
137  // individual style
138  if ($this->object_manager->hasEffectiveIndividualStyle($style_id)) {
139  $st = new ilNonEditableValueGUI($lng->txt("style_current_style"));
140  $st->setValue(ilObject::_lookupTitle($style_id));
141  $form->addItem($st);
142 
143  if ($this->isContainer()) {
144  $cb = new ilCheckboxInputGUI($lng->txt("style_support_reuse"), "support_reuse");
145  $cb->setInfo($lng->txt("style_support_reuse_info"));
146  $cb->setChecked($this->container_manager->getReuse());
147  $form->addItem($cb);
148  $form->addCommandButton(
149  "saveIndividualStyleSettings",
150  $lng->txt("save")
151  );
152  }
153 
154  $form->addCommandButton(
155  "editStyle",
156  $lng->txt("style_edit_style")
157  );
158  $form->addCommandButton(
159  "deleteStyle",
160  $lng->txt("style_delete_style")
161  );
162  }
163 
164  if ($this->object_manager->canSelectStyle($style_id)) {
165  $style_sel = new ilSelectInputGUI(
166  $lng->txt("style_current_style"),
167  "style_id"
168  );
169  $style_sel->setOptions($st_styles);
170  $style_sel->setValue($style_id);
171  $form->addItem($style_sel);
172  $form->addCommandButton(
173  "saveStyleSettings",
174  $lng->txt("save")
175  );
176  $form->addCommandButton(
177  "createStyle",
178  $lng->txt("sty_create_ind_style")
179  );
180  }
181  }
182  $form->setTitle($lng->txt("obj_sty"));
183  $form->setFormAction($ilCtrl->getFormAction($this));
184 
185  return $form;
186  }
array $settings
Setting values (LTI parameters, custom parameters and local parameters).
Definition: System.php:200
This class represents a selection list property in a property form.
setOptions(array $a_options)
static _lookupTitle(int $obj_id)
$lng
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ isContainer()

ilObjectContentStyleSettingsGUI::isContainer ( )
protected

Definition at line 188 of file class.ilObjectContentStyleSettingsGUI.php.

References ilObject\_lookupType().

Referenced by initStylePropertiesForm(), and saveIndividualStyleSettings().

188  : bool
189  {
190  if ($this->ref_id > 0) {
191  $type = ilObject::_lookupType($this->ref_id, true);
192  if ($this->domain->objectDefinition()->isContainer($type)) {
193  return true;
194  }
195  }
196  return false;
197  }
static _lookupType(int $id, bool $reference=false)
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ saveIndividualStyleSettings()

ilObjectContentStyleSettingsGUI::saveIndividualStyleSettings ( )
protected

Definition at line 272 of file class.ilObjectContentStyleSettingsGUI.php.

References $lng, initStylePropertiesForm(), and isContainer().

272  : void
273  {
274  $lng = $this->domain->lng();
275  $ctrl = $this->gui->ctrl();
276 
277  $form = $this->initStylePropertiesForm();
278  $form->checkInput();
279  if ($this->isContainer()) {
280  $this->container_manager->saveReuse((bool) $form->getInput("support_reuse"));
281  $this->main_tpl->setOnScreenMessage('success', $lng->txt("msg_obj_modified"), true);
282  }
283  $ctrl->redirect($this, "settings");
284  }
$lng
+ Here is the call graph for this function:

◆ saveStyleSettings()

ilObjectContentStyleSettingsGUI::saveStyleSettings ( )
protected

Save style settings.

Definition at line 256 of file class.ilObjectContentStyleSettingsGUI.php.

References $lng, ILIAS\LTI\ToolProvider\$settings, initStylePropertiesForm(), ILIAS\Repository\int(), and updateStyleId().

256  : void
257  {
258  $settings = $this->domain->settings();
259  $lng = $this->domain->lng();
260  $ctrl = $this->gui->ctrl();
261 
262  $form = $this->initStylePropertiesForm();
263  $form->checkInput();
264  if ($this->object_manager->canSelectStyle($this->current_style_id)) {
265  $style_id = (int) $form->getInput("style_id");
266  $this->updateStyleId($style_id);
267  $this->main_tpl->setOnScreenMessage('success', $lng->txt("msg_obj_modified"), true);
268  }
269  $ctrl->redirect($this, "settings");
270  }
array $settings
Setting values (LTI parameters, custom parameters and local parameters).
Definition: System.php:200
$lng
+ Here is the call graph for this function:

◆ setOwnerId()

ilObjectContentStyleSettingsGUI::setOwnerId ( int  $style_id)
protected

Definition at line 230 of file class.ilObjectContentStyleSettingsGUI.php.

Referenced by forwardToStyleSheet().

230  : void
231  {
232  $this->object_manager->setOwnerOfStyle($style_id);
233  }
+ Here is the caller graph for this function:

◆ settings()

ilObjectContentStyleSettingsGUI::settings ( )
protected

Definition at line 91 of file class.ilObjectContentStyleSettingsGUI.php.

References initStylePropertiesForm().

91  : void
92  {
93  $mt = $this->gui->mainTemplate();
94  $form = $this->initStylePropertiesForm();
95  $mt->setContent(
96  $form->getHTML()
97  );
98  }
+ Here is the call graph for this function:

◆ updateStyleId()

ilObjectContentStyleSettingsGUI::updateStyleId ( int  $style_id)
protected

Definition at line 225 of file class.ilObjectContentStyleSettingsGUI.php.

Referenced by forwardToStyleSheet(), and saveStyleSettings().

225  : void
226  {
227  $this->object_manager->updateStyleId($style_id);
228  }
+ Here is the caller graph for this function:

Field Documentation

◆ $container_manager

ContainerManager ilObjectContentStyleSettingsGUI::$container_manager
protected

Definition at line 34 of file class.ilObjectContentStyleSettingsGUI.php.

◆ $current_style_id

int ilObjectContentStyleSettingsGUI::$current_style_id
protected

Definition at line 37 of file class.ilObjectContentStyleSettingsGUI.php.

Referenced by initStylePropertiesForm().

◆ $domain

InternalDomainService ilObjectContentStyleSettingsGUI::$domain
protected

Definition at line 35 of file class.ilObjectContentStyleSettingsGUI.php.

◆ $gui

InternalGUIService ilObjectContentStyleSettingsGUI::$gui
protected

Definition at line 36 of file class.ilObjectContentStyleSettingsGUI.php.

◆ $main_tpl

ilGlobalTemplateInterface ilObjectContentStyleSettingsGUI::$main_tpl
private

Definition at line 40 of file class.ilObjectContentStyleSettingsGUI.php.

◆ $obj_id

int ilObjectContentStyleSettingsGUI::$obj_id
protected

Definition at line 39 of file class.ilObjectContentStyleSettingsGUI.php.

◆ $object_manager

ObjectManager ilObjectContentStyleSettingsGUI::$object_manager
protected

Definition at line 33 of file class.ilObjectContentStyleSettingsGUI.php.

◆ $ref_id

int ilObjectContentStyleSettingsGUI::$ref_id
protected

Definition at line 38 of file class.ilObjectContentStyleSettingsGUI.php.

Referenced by __construct().


The documentation for this class was generated from the following file: