ILIAS  trunk Revision v11.0_alpha-3011-gc6b235a2e85
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: shib_login.php:26

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

226 : void
227 {
228 $ctrl = $this->gui->ctrl();
229 $ctrl->redirectByClass("ilobjstylesheetgui", "create");
230 }

◆ deleteStyle()

ilObjectContentStyleSettingsGUI::deleteStyle ( )

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

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

◆ editStyle()

ilObjectContentStyleSettingsGUI::editStyle ( )

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

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

◆ 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 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 }

References forwardToStyleSheet().

+ Here is the call graph for this function:

◆ forwardToStyleSheet()

ilObjectContentStyleSettingsGUI::forwardToStyleSheet ( )

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

191 {
192 $ctrl = $this->gui->ctrl();
193 $cmd = $ctrl->getCmd();
194
195 $style_gui = new ilObjStyleSheetGUI(
196 "",
197 $this->current_style_id,
198 false
199 );
200 $style_id = $ctrl->forwardCommand($style_gui);
201 if (in_array($cmd, ["save", "copyStyle", "importStyle", "confirmedDelete"])) {
202 $style_id = $style_gui->getObject()->getId();
203 if ($cmd == "confirmedDelete") {
204 $style_id = 0;
205 } else {
206 $this->setOwnerId($style_id);
207 }
208 $this->updateStyleId($style_id);
209 if (in_array($cmd, ["save", "copyStyle", "importStyle"])) {
210 $ctrl->redirect($this, "editStyle");
211 }
212 $ctrl->redirect($this, "settings");
213 }
214 }
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 103 of file class.ilObjectContentStyleSettingsGUI.php.

104 {
105 $ilCtrl = $this->gui->ctrl();
106 $lng = $this->domain->lng();
107
108 $style_id = $this->current_style_id;
109
110 $lng->loadLanguageModule("style");
111
112 $form = new ilPropertyFormGUI();
113 if ($this->object_manager->globalFixed()) {
114 $st = new ilNonEditableValueGUI($lng->txt("style_current_style"));
115 $st->setValue($this->object_manager->getGlobalFixedTitle() . " (" .
116 $lng->txt("global_fixed") . ")");
117 $form->addItem($st);
118 } else {
119 $st_styles = $this->object_manager->getSelectableStyles();
120
121 $default_title = "";
122 if ($this->object_manager->getGlobalDefaultTitle() !== "") {
123 $default_title = " (" . $this->object_manager->getGlobalDefaultTitle() . ")";
124 }
125 $st_styles[0] = $lng->txt("default") . $default_title;
126 ksort($st_styles);
127
128 // individual style
129 if ($this->object_manager->hasEffectiveIndividualStyle($style_id)) {
130 $st = new ilNonEditableValueGUI($lng->txt("style_current_style"));
131 $st->setValue(ilObject::_lookupTitle($style_id));
132 $form->addItem($st);
133
134 if ($this->isContainer()) {
135 $cb = new ilCheckboxInputGUI($lng->txt("style_support_reuse"), "support_reuse");
136 $cb->setInfo($lng->txt("style_support_reuse_info"));
137 $cb->setChecked($this->container_manager->getReuse());
138 $form->addItem($cb);
139 $form->addCommandButton(
140 "saveIndividualStyleSettings",
141 $lng->txt("save")
142 );
143 }
144
145 $form->addCommandButton(
146 "editStyle",
147 $lng->txt("style_edit_style")
148 );
149 $form->addCommandButton(
150 "deleteStyle",
151 $lng->txt("style_delete_style")
152 );
153 }
154
155 if ($this->object_manager->canSelectStyle($style_id)) {
156 $style_sel = new ilSelectInputGUI(
157 $lng->txt("style_current_style"),
158 "style_id"
159 );
160 $style_sel->setOptions($st_styles);
161 $style_sel->setValue($style_id);
162 $form->addItem($style_sel);
163 $form->addCommandButton(
164 "saveStyleSettings",
165 $lng->txt("save")
166 );
167 $form->addCommandButton(
168 "createStyle",
169 $lng->txt("sty_create_ind_style")
170 );
171 }
172 }
173 $form->setTitle($lng->txt("obj_sty"));
174 $form->setFormAction($ilCtrl->getFormAction($this));
175
176 return $form;
177 }
This class represents a checkbox property in a property form.
This class represents a non editable value in a property form.
static _lookupTitle(int $obj_id)
This class represents a property form user interface.
This class represents a selection list property in a property form.
global $lng
Definition: privfeed.php:31

References $current_style_id, $lng, 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 179 of file class.ilObjectContentStyleSettingsGUI.php.

179 : bool
180 {
181 if ($this->ref_id > 0) {
182 $type = ilObject::_lookupType($this->ref_id, true);
183 if ($this->domain->objectDefinition()->isContainer($type)) {
184 return true;
185 }
186 }
187 return false;
188 }
static _lookupType(int $id, bool $reference=false)

References 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 263 of file class.ilObjectContentStyleSettingsGUI.php.

263 : void
264 {
265 $lng = $this->domain->lng();
266 $ctrl = $this->gui->ctrl();
267
268 $form = $this->initStylePropertiesForm();
269 $form->checkInput();
270 if ($this->isContainer()) {
271 $this->container_manager->saveReuse((bool) $form->getInput("support_reuse"));
272 $this->main_tpl->setOnScreenMessage('success', $lng->txt("msg_obj_modified"), true);
273 }
274 $ctrl->redirect($this, "settings");
275 }

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

+ Here is the call graph for this function:

◆ saveStyleSettings()

ilObjectContentStyleSettingsGUI::saveStyleSettings ( )
protected

Save style settings.

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

247 : void
248 {
249 $settings = $this->domain->settings();
250 $lng = $this->domain->lng();
251 $ctrl = $this->gui->ctrl();
252
253 $form = $this->initStylePropertiesForm();
254 $form->checkInput();
255 if ($this->object_manager->canSelectStyle($this->current_style_id)) {
256 $style_id = (int) $form->getInput("style_id");
257 $this->updateStyleId($style_id);
258 $this->main_tpl->setOnScreenMessage('success', $lng->txt("msg_obj_modified"), true);
259 }
260 $ctrl->redirect($this, "settings");
261 }

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

+ Here is the call graph for this function:

◆ setOwnerId()

ilObjectContentStyleSettingsGUI::setOwnerId ( int  $style_id)
protected

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

221 : void
222 {
223 $this->object_manager->setOwnerOfStyle($style_id);
224 }

Referenced by forwardToStyleSheet().

+ Here is the caller graph for this function:

◆ settings()

ilObjectContentStyleSettingsGUI::settings ( )
protected

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

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

References initStylePropertiesForm().

+ Here is the call graph for this function:

◆ updateStyleId()

ilObjectContentStyleSettingsGUI::updateStyleId ( int  $style_id)
protected

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

216 : void
217 {
218 $this->object_manager->updateStyleId($style_id);
219 }

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: