3 declare(strict_types=1);
48 $this->tree = $DIC->repositoryTree();
51 $this->parent_gui = $a_parent_gui;
52 $this->
ctrl = $DIC->ctrl();
53 $this->rbacsystem = $DIC->rbac()->system();
54 $this->
toolbar = $DIC->toolbar();
55 $this->
lng = $DIC->language();
56 $this->tpl = $DIC->ui()->mainTemplate();
57 $this->request = $DIC->contentStyle()
63 $this->ref_id = $this->request->getRefId();
64 $this->obj_id = $this->request->getObjId();
71 $next_class = $this->
ctrl->getNextClass($this);
72 $cmd = $this->
ctrl->getCmd(
"edit");
74 switch ($next_class) {
75 case "ilobjstylesheetgui":
76 $this->
ctrl->setReturn($this,
"edit");
78 $this->
ctrl->forwardCommand($style_gui);
82 $this->parent_gui->prepareOutput();
83 if (in_array($cmd, array(
"edit",
"delete",
"toggleGlobalDefault",
"toggleGlobalFixed",
"setScope",
"saveScope",
"saveActiveStyles",
84 "createStyle",
"moveLMStyles",
"moveIndividualStyles",
"deleteStyle",
"cancelDelete",
"confirmedDelete"))) {
87 die(
"Unknown command " . $cmd);
98 if (!$this->rbacsystem->checkAccess($a_perm, $this->ref_id)) {
127 $from_styles = $to_styles =
$data = array();
128 $styles = $this->cs_settings->getStyles();
129 foreach ($styles as $style) {
132 $data[$style[
"title"] .
":" . $style[
"id"]]
134 if ($style[
"lm_nr"] > 0) {
135 $from_styles[$style[
"id"]] = $style[
"title"];
137 if ($style[
"active"] > 0) {
138 $to_styles[$style[
"id"]] = $style[
"title"];
143 if ($fixed_style <= 0) {
145 array(
"title" => $this->
lng->txt(
"sty_individual_styles"),
147 $from_styles[-1] = $this->
lng->txt(
"sty_individual_styles");
151 if ($default_style <= 0 && $fixed_style <= 0) {
153 array(
"title" => $this->
lng->txt(
"sty_default_style"),
155 $from_styles[0] = $this->
lng->txt(
"sty_default_style");
156 $to_styles[0] = $this->
lng->txt(
"sty_default_style");
161 $this->
lng->txt(
"sty_add_content_style"),
162 $this->
ctrl->getLinkTarget($this,
"createStyle")
164 $this->
toolbar->addSeparator();
167 $si =
new ilSelectInputGUI($this->
lng->txt(
"sty_move_lm_styles") .
": " . $this->
lng->txt(
"sty_from"),
"from_style");
168 $si->setOptions($from_styles);
169 $this->
toolbar->addInputItem($si,
true);
173 $si->setOptions($to_styles);
174 $this->
toolbar->addInputItem($si,
true);
175 $this->
toolbar->addFormButton($this->
lng->txt(
"sty_move_style"),
"moveLMStyles");
177 $this->
toolbar->setFormAction($this->
ctrl->getFormAction($this));
181 $this->tpl->setContent($table->getHTML());
191 if ($this->request->getFromStyleId() == -1) {
197 $this->request->getFromStyleId(),
198 $this->request->getToStyleId()
200 $this->
ctrl->redirect($this,
"edit");
212 $this->
ctrl->redirect($this,
"edit");
220 $this->
ctrl->setParameter($this,
"to_style", $this->request->getToStyleId());
223 $cgui->setFormAction($this->
ctrl->getFormAction($this));
224 $cgui->setHeaderText($this->
lng->txt(
"sty_confirm_del_ind_styles") .
": " .
226 $this->
lng->txt(
"sty_confirm_del_ind_styles_desc"),
229 $cgui->setCancel($this->
lng->txt(
"cancel"),
"edit");
230 $cgui->setConfirm($this->
lng->txt(
"ok"),
"moveIndividualStyles");
231 $this->tpl->setContent($cgui->getHTML());
241 $ids = $this->request->getIds();
242 if (count($ids) == 0) {
243 $this->tpl->setOnScreenMessage(
'failure', $this->
lng->txt(
"no_checkbox"),
true);
244 $this->
ctrl->redirect($this,
"edit");
249 $cgui->setFormAction($this->
ctrl->getFormAction($this));
250 $cgui->setHeaderText($this->
lng->txt(
"info_delete_sure"));
251 $cgui->setCancel($this->
lng->txt(
"cancel"),
"cancelDelete");
252 $cgui->setConfirm($this->
lng->txt(
"confirm"),
"confirmedDelete");
254 foreach ($ids as
$id) {
257 $cgui->addItem(
"id[]", (
string) $id, $caption);
260 $this->tpl->setContent($cgui->getHTML());
271 $ids = $this->request->getIds();
272 foreach ($ids as
$id) {
274 $set->removeStyle($id);
278 $style_obj->delete();
281 $this->
ctrl->redirect($this,
"edit");
295 if ($this->request->getId() > 0) {
297 $def_style =
$ilSetting->get(
"default_content_style_id");
299 if ($def_style != $this->request->getId()) {
300 $ilSetting->set(
"default_content_style_id", (
string) $this->request->getId());
302 $ilSetting->delete(
"default_content_style_id");
304 $this->tpl->setOnScreenMessage(
'success', $lng->
txt(
"msg_obj_modified"),
true);
319 if ($this->request->getId() > 0) {
320 $ilSetting->delete(
"default_content_style_id");
321 $fixed_style =
$ilSetting->get(
"fixed_content_style_id");
322 if ($fixed_style == $this->request->getId()) {
325 $ilSetting->set(
"fixed_content_style_id", (
string) $this->request->getId());
327 $this->tpl->setOnScreenMessage(
'success', $lng->
txt(
"msg_obj_modified"),
true);
334 $styles = $this->cs_settings->getStyles();
335 foreach ($styles as $style) {
336 if ($this->request->getSelectedStandard($style[
"id"]) == 1) {
351 $this->tpl->setCurrentBlock(
"tbl_action_btn");
352 $this->tpl->setVariable(
"BTN_NAME",
"deleteStyle");
353 $this->tpl->setVariable(
"BTN_VALUE", $this->
lng->txt(
"delete"));
354 $this->tpl->parseCurrentBlock();
357 $this->tpl->setCurrentBlock(
"tbl_action_btn");
358 $this->tpl->setVariable(
"BTN_NAME",
"toggleGlobalDefault");
359 $this->tpl->setVariable(
"BTN_VALUE", $this->
lng->txt(
"toggleGlobalDefault"));
360 $this->tpl->parseCurrentBlock();
363 $this->tpl->setCurrentBlock(
"tbl_action_btn");
364 $this->tpl->setVariable(
"BTN_NAME",
"toggleGlobalFixed");
365 $this->tpl->setVariable(
"BTN_VALUE", $this->
lng->txt(
"toggleGlobalFixed"));
366 $this->tpl->parseCurrentBlock();
369 $this->tpl->setCurrentBlock(
"tbl_action_btn");
370 $this->tpl->setVariable(
"BTN_NAME",
"setScope");
371 $this->tpl->setVariable(
"BTN_VALUE", $this->
lng->txt(
"sty_set_scope"));
372 $this->tpl->parseCurrentBlock();
375 $this->tpl->setCurrentBlock(
"tbl_action_btn");
376 $this->tpl->setVariable(
"BTN_NAME",
"saveActiveStyles");
377 $this->tpl->setVariable(
"BTN_VALUE", $this->
lng->txt(
"sty_save_active_styles"));
378 $this->tpl->parseCurrentBlock();
380 $this->tpl->setCurrentBlock(
"tbl_action_row");
382 $this->tpl->parseCurrentBlock();
387 $this->tpl->setOnScreenMessage(
'info', $this->
lng->txt(
"msg_cancel"),
true);
388 $this->
ctrl->redirect($this,
"edit");
398 $ilCtrl->saveParameter($this,
"id");
406 $exp->setTypeWhiteList(array(
"root",
"cat"));
407 if (!$exp->handleCommand()) {
418 $cat_id = $this->request->getCatId();
425 $this->tpl->setOnScreenMessage(
'success', $this->
lng->txt(
"msg_obj_modified"),
true);
ilGlobalTemplateInterface $tpl
static _getNrOfAssignedLMs(int $a_style_id)
gets the number of learning modules assigned to a content style
static _getNrLMsNoStyle()
get number of learning modules assigned no style
static _writeActive(int $a_id, bool $a_active)
redirectByClass( $a_class, string $a_cmd=null, string $a_anchor=null, bool $is_async=false)
Explorer for selecting repository items.
txt(string $a_topic, string $a_default_lang_fallback_mod="")
gets the text for a given topic if the topic is not in the list, the topic itself with "-" will be re...
toggleGlobalFixed()
Toggle global fixed style.
ilObjStyleSettingsGUI $parent_gui
static _writeScope(int $a_id, int $a_scope)
confirmedDelete()
delete selected style objects
static getImagePath(string $img, string $module_path="", string $mode="output", bool $offline=false)
get image path (for images located in a template directory)
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
moveLMStyles()
move learning modules from one style to another
toggleGlobalDefault()
Toggle global default style.
deleteStyle()
display deletion confirmation screen
confirmDeleteIndividualStyles()
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
static _lookupTitle(int $obj_id)
setContent(string $a_html)
Sets content for standard template.
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
static _moveLMStyles(int $a_from_style, int $a_to_style)
move learning modules from one style to another
ilContentStyleSettings $cs_settings
static _lookupActive(int $a_id)
Lookup active flag.
static redirect(string $a_script)
__construct(ilObjStyleSettingsGUI $a_parent_gui)
static getInstanceByObjId(?int $obj_id, bool $stop_on_error=true)
get an instance of an Ilias object by object id
StandardGUIRequest $request
static _getNrLMsIndividualStyles()
get number of learning modules with individual styles
moveIndividualStyles()
move all learning modules with individual styles to new style
$id
plugin.php for ilComponentBuildPluginInfoObjectiveTest::testAddPlugins
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
checkPermission(string $a_perm, bool $a_throw_exc=true)
Check permission.
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
showActions(bool $with_subobjects=false)
show possible action (form buttons)
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
Settings UI class for system styles.