19declare(strict_types=1);
51 $this->main_tpl =
$DIC->ui()->mainTemplate();
52 $this->domain = $domain_service;
53 $this->gui = $gui_service;
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();
66 $ctrl = $this->gui->ctrl();
68 $next_class = $ctrl->getNextClass($this);
69 $cmd = $ctrl->getCmd(
"settings");
71 switch ($next_class) {
72 case "ilobjstylesheetgui":
73 $this->gui->tabs()->clearTargets();
74 $ctrl->setReturn($this,
"settings");
86 "saveIndividualStyleSettings"
95 $mt = $this->gui->mainTemplate();
107 $ilCtrl = $this->gui->ctrl();
108 $lng = $this->domain->lng();
111 $access = $this->rbac_system->checkAccess(
'write', $this->ref_id);
113 $lng->loadLanguageModule(
"style");
116 if ($this->object_manager->globalFixed()) {
118 $st->setValue($this->object_manager->getGlobalFixedTitle() .
" (" .
119 $lng->txt(
"global_fixed") .
")");
122 $st_styles = $this->object_manager->getSelectableStyles();
125 if ($this->object_manager->getGlobalDefaultTitle() !==
"") {
126 $default_title =
" (" . $this->object_manager->getGlobalDefaultTitle() .
")";
128 $st_styles[0] =
$lng->txt(
"default") . $default_title;
132 if ($this->object_manager->hasEffectiveIndividualStyle($style_id)) {
139 $cb->setInfo(
$lng->txt(
"style_support_reuse_info"));
140 $cb->setChecked($this->container_manager->getReuse());
143 $form->addCommandButton(
144 "saveIndividualStyleSettings",
151 $form->addCommandButton(
153 $lng->txt(
"style_edit_style")
156 $form->addCommandButton(
158 $lng->txt(
"style_delete_style")
163 if ($this->object_manager->canSelectStyle($style_id)) {
165 $lng->txt(
"style_current_style"),
168 $style_sel->setOptions($st_styles);
169 $style_sel->setValue($style_id);
170 $form->addItem($style_sel);
173 $form->addCommandButton(
178 $form->addCommandButton(
180 $lng->txt(
"sty_create_ind_style")
185 $form->setTitle(
$lng->txt(
"obj_sty"));
186 $form->setFormAction($ilCtrl->getFormAction($this));
189 foreach ($form->getItems() as $item) {
194 $item->setDisabled(
true);
203 if ($this->ref_id > 0) {
205 if ($this->domain->objectDefinition()->isContainer($type)) {
214 $ctrl = $this->gui->ctrl();
215 $cmd = $ctrl->getCmd();
219 $this->current_style_id,
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") {
231 if (in_array($cmd, [
"save",
"copyStyle",
"importStyle"])) {
232 $ctrl->redirect($this,
"editStyle");
234 $ctrl->redirect($this,
"settings");
240 $this->object_manager->updateStyleId($style_id);
245 $this->object_manager->setOwnerOfStyle($style_id);
250 $ctrl = $this->gui->ctrl();
251 $ctrl->redirectByClass(
"ilobjstylesheetgui",
"create");
256 $ctrl = $this->gui->ctrl();
257 $ctrl->redirectByClass(
"ilobjstylesheetgui",
"edit");
262 $ctrl = $this->gui->ctrl();
263 $ctrl->redirectByClass(
"ilobjstylesheetgui",
"delete");
271 $settings = $this->domain->settings();
272 $lng = $this->domain->lng();
273 $ctrl = $this->gui->ctrl();
277 if ($this->object_manager->canSelectStyle($this->current_style_id)) {
278 $style_id = (
int) $form->getInput(
"style_id");
280 $this->main_tpl->setOnScreenMessage(
'success',
$lng->txt(
"msg_obj_modified"),
true);
282 $ctrl->redirect($this,
"settings");
287 $lng = $this->domain->lng();
288 $ctrl = $this->gui->ctrl();
293 $this->container_manager->saveReuse((
bool) $form->getInput(
"support_reuse"));
294 $this->main_tpl->setOnScreenMessage(
'success',
$lng->txt(
"msg_obj_modified"),
true);
296 $ctrl->redirect($this,
"settings");
Manages container related content style behaviour.
object(int $ref_id, int $obj_id=0)
Objects without ref id (e.g.
repositoryContainer(int $ref_id)
Content style internal ui factory.
Manages repository object related content style behaviour.
This class represents a non editable value in a property form.
Class ilObjStyleSheetGUI.
Style settings of a repository object.
InternalDomainService $domain
ilRbacSystem $rbac_system
saveIndividualStyleSettings()
setOwnerId(int $style_id)
__construct(InternalDomainService $domain_service, InternalGUIService $gui_service, ?int $current_style_id, int $ref_id, int $obj_id)
saveStyleSettings()
Save style settings.
initStylePropertiesForm()
Init style properties form.
ObjectManager $object_manager
ContainerManager $container_manager
ilGlobalTemplateInterface $main_tpl
updateStyleId(int $style_id)
static _lookupType(int $id, bool $reference=false)
static _lookupObjId(int $ref_id)
static _lookupTitle(int $obj_id)
class ilRbacSystem system function like checkAccess, addActiveRole ... Supporting system functions ar...