ILIAS  release_8 Revision v8.24
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 @ilCtrl_Calls 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.

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 }
object(int $ref_id, int $obj_id=0)
Objects without ref id (e.g.
static _lookupObjId(int $ref_id)
global $DIC
Definition: feed.php:28

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

+ Here is the call graph for this function:

Member Function Documentation

◆ createStyle()

ilObjectContentStyleSettingsGUI::createStyle ( )

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

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

◆ deleteStyle()

ilObjectContentStyleSettingsGUI::deleteStyle ( )

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

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

◆ editStyle()

ilObjectContentStyleSettingsGUI::editStyle ( )

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

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

◆ executeCommand()

ilObjectContentStyleSettingsGUI::executeCommand ( )

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

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
71 case "ilobjstylesheetgui":
72 $this->gui->tabs()->clearTargets();
73 $ctrl->setReturn($this, "settings");
74 $this->forwardToStyleSheet();
75 break;
76
77 default:
78 if (in_array($cmd, [
79 "settings",
80 "editStyle",
81 "updateStyle",
82 "createStyle",
83 "deleteStyle",
84 "saveStyleSettings",
85 "saveIndividualStyleSettings"
86 ])) {
87 $this->$cmd();
88 }
89 }
90 }

References forwardToStyleSheet().

+ Here is the call graph for this function:

◆ forwardToStyleSheet()

ilObjectContentStyleSettingsGUI::forwardToStyleSheet ( )

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

201 {
202 $ctrl = $this->gui->ctrl();
203 $cmd = $ctrl->getCmd();
204
205 $style_gui = new ilObjStyleSheetGUI(
206 "",
207 $this->current_style_id,
208 false
209 );
210 $style_id = $ctrl->forwardCommand($style_gui);
211 if (in_array($cmd, ["save", "copyStyle", "importStyle", "confirmedDelete"])) {
212 $style_id = $style_gui->getObject()->getId();
213 if ($cmd == "confirmedDelete") {
214 $style_id = 0;
215 } else {
216 $this->setOwnerId($style_id);
217 }
218 $this->updateStyleId($style_id);
219 $ctrl->redirect($this, "settings");
220 }
221 }
Class ilObjStyleSheetGUI.

References setOwnerId(), and updateStyleId().

Referenced by executeCommand().

+ 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 104 of file class.ilObjectContentStyleSettingsGUI.php.

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

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

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

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ isContainer()

ilObjectContentStyleSettingsGUI::isContainer ( )
protected

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

189 : bool
190 {
191 if ($this->ref_id > 0) {
192 $type = ilObject::_lookupType($this->ref_id, true);
193 if ($this->domain->objectDefinition()->isContainer($type)) {
194 return true;
195 }
196 }
197 return false;
198 }
static _lookupType(int $id, bool $reference=false)
$type

References $type, and ilObject\_lookupType().

Referenced by initStylePropertiesForm(), and saveIndividualStyleSettings().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ saveIndividualStyleSettings()

ilObjectContentStyleSettingsGUI::saveIndividualStyleSettings ( )
protected

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

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

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

+ Here is the call graph for this function:

◆ saveStyleSettings()

ilObjectContentStyleSettingsGUI::saveStyleSettings ( )
protected

Save style settings.

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

254 : void
255 {
256 $settings = $this->domain->settings();
257 $lng = $this->domain->lng();
258 $ctrl = $this->gui->ctrl();
259
260 $form = $this->initStylePropertiesForm();
261 $form->checkInput();
262 if ($this->object_manager->canSelectStyle($this->current_style_id)) {
263 $style_id = (int) $form->getInput("style_id");
264 $this->updateStyleId($style_id);
265 $this->main_tpl->setOnScreenMessage('success', $lng->txt("msg_obj_modified"), true);
266 }
267 $ctrl->redirect($this, "settings");
268 }

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

+ Here is the call graph for this function:

◆ setOwnerId()

ilObjectContentStyleSettingsGUI::setOwnerId ( int  $style_id)
protected

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

228 : void
229 {
230 $this->object_manager->setOwnerOfStyle($style_id);
231 }

Referenced by forwardToStyleSheet().

+ Here is the caller graph for this function:

◆ settings()

ilObjectContentStyleSettingsGUI::settings ( )
protected

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

92 : void
93 {
94 $mt = $this->gui->mainTemplate();
95 $form = $this->initStylePropertiesForm();
96 $mt->setContent(
97 $form->getHTML()
98 );
99 }

References initStylePropertiesForm().

+ Here is the call graph for this function:

◆ updateStyleId()

ilObjectContentStyleSettingsGUI::updateStyleId ( int  $style_id)
protected

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

223 : void
224 {
225 $this->object_manager->updateStyleId($style_id);
226 }

Referenced by forwardToStyleSheet(), and saveStyleSettings().

+ 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

◆ $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.

Referenced by __construct().

◆ $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: