ILIAS  trunk Revision v12.0_alpha-1227-g7ff6d300864
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
 
ilRbacSystem $rbac_system
 

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

49 {
50 global $DIC;
51 $this->main_tpl = $DIC->ui()->mainTemplate();
52 $this->domain = $domain_service;
53 $this->gui = $gui_service;
54 $this->ref_id = $ref_id;
55 $this->obj_id = ($obj_id > 0)
56 ? $obj_id
58 $this->container_manager = $domain_service->repositoryContainer($ref_id);
59 $this->object_manager = $domain_service->object($ref_id, $this->obj_id);
60 $this->current_style_id = $current_style_id ?? $this->object_manager->getStyleId();
61 $this->rbac_system = $DIC->rbac()->system();
62 }
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 248 of file class.ilObjectContentStyleSettingsGUI.php.

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

◆ deleteStyle()

ilObjectContentStyleSettingsGUI::deleteStyle ( )

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

260 : void
261 {
262 $ctrl = $this->gui->ctrl();
263 $ctrl->redirectByClass("ilobjstylesheetgui", "delete");
264 }

◆ editStyle()

ilObjectContentStyleSettingsGUI::editStyle ( )

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

254 : void
255 {
256 $ctrl = $this->gui->ctrl();
257 $ctrl->redirectByClass("ilobjstylesheetgui", "edit");
258 }

◆ executeCommand()

ilObjectContentStyleSettingsGUI::executeCommand ( )

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

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

References forwardToStyleSheet().

+ Here is the call graph for this function:

◆ forwardToStyleSheet()

ilObjectContentStyleSettingsGUI::forwardToStyleSheet ( )

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

212 : void
213 {
214 $ctrl = $this->gui->ctrl();
215 $cmd = $ctrl->getCmd();
216
217 $style_gui = new ilObjStyleSheetGUI(
218 "",
219 $this->current_style_id,
220 false
221 );
222 $style_id = $ctrl->forwardCommand($style_gui);
223 if (in_array($cmd, ["save", "copyStyle", "importStyle", "confirmedDelete"])) {
224 $style_id = $style_gui->getObject()->getId();
225 if ($cmd == "confirmedDelete") {
226 $style_id = 0;
227 } else {
228 $this->setOwnerId($style_id);
229 }
230 $this->updateStyleId($style_id);
231 if (in_array($cmd, ["save", "copyStyle", "importStyle"])) {
232 $ctrl->redirect($this, "editStyle");
233 }
234 $ctrl->redirect($this, "settings");
235 }
236 }
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 105 of file class.ilObjectContentStyleSettingsGUI.php.

106 {
107 $ilCtrl = $this->gui->ctrl();
108 $lng = $this->domain->lng();
109
110 $style_id = $this->current_style_id;
111 $access = $this->rbac_system->checkAccess('write', $this->ref_id);
112
113 $lng->loadLanguageModule("style");
114
115 $form = new ilPropertyFormGUI();
116 if ($this->object_manager->globalFixed()) {
117 $st = new ilNonEditableValueGUI($lng->txt("style_current_style"));
118 $st->setValue($this->object_manager->getGlobalFixedTitle() . " (" .
119 $lng->txt("global_fixed") . ")");
120 $form->addItem($st);
121 } else {
122 $st_styles = $this->object_manager->getSelectableStyles();
123
124 $default_title = "";
125 if ($this->object_manager->getGlobalDefaultTitle() !== "") {
126 $default_title = " (" . $this->object_manager->getGlobalDefaultTitle() . ")";
127 }
128 $st_styles[0] = $lng->txt("default") . $default_title;
129 ksort($st_styles);
130
131 // individual style
132 if ($this->object_manager->hasEffectiveIndividualStyle($style_id)) {
133 $st = new ilNonEditableValueGUI($lng->txt("style_current_style"));
134 $st->setValue(ilObject::_lookupTitle($style_id));
135 $form->addItem($st);
136
137 if ($this->isContainer()) {
138 $cb = new ilCheckboxInputGUI($lng->txt("style_support_reuse"), "support_reuse");
139 $cb->setInfo($lng->txt("style_support_reuse_info"));
140 $cb->setChecked($this->container_manager->getReuse());
141 $form->addItem($cb);
142 if ($access) {
143 $form->addCommandButton(
144 "saveIndividualStyleSettings",
145 $lng->txt("save")
146 );
147 }
148 }
149
150 if ($access) {
151 $form->addCommandButton(
152 "editStyle",
153 $lng->txt("style_edit_style")
154 );
155
156 $form->addCommandButton(
157 "deleteStyle",
158 $lng->txt("style_delete_style")
159 );
160 }
161 }
162
163 if ($this->object_manager->canSelectStyle($style_id)) {
164 $style_sel = new ilSelectInputGUI(
165 $lng->txt("style_current_style"),
166 "style_id"
167 );
168 $style_sel->setOptions($st_styles);
169 $style_sel->setValue($style_id);
170 $form->addItem($style_sel);
171
172 if ($access) {
173 $form->addCommandButton(
174 "saveStyleSettings",
175 $lng->txt("save")
176 );
177
178 $form->addCommandButton(
179 "createStyle",
180 $lng->txt("sty_create_ind_style")
181 );
182 }
183 }
184 }
185 $form->setTitle($lng->txt("obj_sty"));
186 $form->setFormAction($ilCtrl->getFormAction($this));
187
188 if (!$access) {
189 foreach ($form->getItems() as $item) {
190 if ($item instanceof ilFormSectionHeaderGUI) {
191 continue;
192 }
193
194 $item->setDisabled(true);
195 }
196 }
197
198 return $form;
199 }
This class represents a checkbox property in a property form.
This class represents a section header 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 201 of file class.ilObjectContentStyleSettingsGUI.php.

201 : bool
202 {
203 if ($this->ref_id > 0) {
204 $type = ilObject::_lookupType($this->ref_id, true);
205 if ($this->domain->objectDefinition()->isContainer($type)) {
206 return true;
207 }
208 }
209 return false;
210 }
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 285 of file class.ilObjectContentStyleSettingsGUI.php.

285 : void
286 {
287 $lng = $this->domain->lng();
288 $ctrl = $this->gui->ctrl();
289
290 $form = $this->initStylePropertiesForm();
291 $form->checkInput();
292 if ($this->isContainer()) {
293 $this->container_manager->saveReuse((bool) $form->getInput("support_reuse"));
294 $this->main_tpl->setOnScreenMessage('success', $lng->txt("msg_obj_modified"), true);
295 }
296 $ctrl->redirect($this, "settings");
297 }

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

+ Here is the call graph for this function:

◆ saveStyleSettings()

ilObjectContentStyleSettingsGUI::saveStyleSettings ( )
protected

Save style settings.

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

269 : void
270 {
271 $settings = $this->domain->settings();
272 $lng = $this->domain->lng();
273 $ctrl = $this->gui->ctrl();
274
275 $form = $this->initStylePropertiesForm();
276 $form->checkInput();
277 if ($this->object_manager->canSelectStyle($this->current_style_id)) {
278 $style_id = (int) $form->getInput("style_id");
279 $this->updateStyleId($style_id);
280 $this->main_tpl->setOnScreenMessage('success', $lng->txt("msg_obj_modified"), true);
281 }
282 $ctrl->redirect($this, "settings");
283 }

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

243 : void
244 {
245 $this->object_manager->setOwnerOfStyle($style_id);
246 }

Referenced by forwardToStyleSheet().

+ Here is the caller graph for this function:

◆ settings()

ilObjectContentStyleSettingsGUI::settings ( )
protected

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

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

References initStylePropertiesForm().

+ Here is the call graph for this function:

◆ updateStyleId()

ilObjectContentStyleSettingsGUI::updateStyleId ( int  $style_id)
protected

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

238 : void
239 {
240 $this->object_manager->updateStyleId($style_id);
241 }

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.

◆ $rbac_system

ilRbacSystem ilObjectContentStyleSettingsGUI::$rbac_system
private

Definition at line 41 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: