19 declare(strict_types=1);
52 $this->tree = $DIC->repositoryTree();
55 $this->parent_gui = $a_parent_gui;
56 $this->
ctrl = $DIC->ctrl();
57 $this->rbacsystem = $DIC->rbac()->system();
58 $this->
toolbar = $DIC->toolbar();
59 $this->
lng = $DIC->language();
60 $this->tpl = $DIC->ui()->mainTemplate();
61 $this->request = $DIC->contentStyle()
66 $this->ref_id = $this->request->getRefId();
67 $this->obj_id = $this->request->getObjId();
70 $this->gui = $DIC->contentStyle()->internal()->gui();
75 $next_class = $this->
ctrl->getNextClass($this);
76 $cmd = $this->
ctrl->getCmd(
"edit");
78 switch ($next_class) {
79 case "ilobjstylesheetgui":
80 $this->
ctrl->setReturn($this,
"edit");
82 $this->
ctrl->forwardCommand($style_gui);
85 case strtolower(ilRepoStandardUploadHandlerGUI::class):
87 $gui = $form->getRepoStandardUploadHandlerGUI(
"import_file");
88 $this->
ctrl->forwardCommand($gui);
93 $this->parent_gui->prepareOutput();
94 if (in_array($cmd, array(
"edit",
96 "toggleGlobalDefault",
103 "moveIndividualStyles",
111 die(
"Unknown command " . $cmd);
122 if (!$this->rbacsystem->checkAccess($a_perm, $this->ref_id)) {
151 $from_styles = $to_styles =
$data = array();
152 $styles = $this->cs_settings->getStyles();
153 foreach ($styles as $style) {
156 $data[$style[
"title"] .
":" . $style[
"id"]]
158 if ($style[
"lm_nr"] > 0) {
159 $from_styles[$style[
"id"]] = $style[
"title"];
161 if ($style[
"active"] > 0) {
162 $to_styles[$style[
"id"]] = $style[
"title"];
167 if ($fixed_style <= 0) {
169 array(
"title" => $this->
lng->txt(
"sty_individual_styles"),
173 $from_styles[-1] = $this->
lng->txt(
"sty_individual_styles");
177 if ($default_style <= 0 && $fixed_style <= 0) {
179 array(
"title" => $this->
lng->txt(
"sty_default_style"),
183 $from_styles[0] = $this->
lng->txt(
"sty_default_style");
184 $to_styles[0] = $this->
lng->txt(
"sty_default_style");
187 $rendered_modal =
"";
190 $this->
lng->txt(
"sty_add_content_style"),
191 $this->
ctrl->getLinkTarget($this,
"createStyle")
201 $this->
toolbar->addSeparator();
205 $this->
lng->txt(
"sty_move_lm_styles") .
": " . $this->
lng->txt(
"sty_from"),
209 $this->
toolbar->addInputItem($si,
true);
214 $this->
toolbar->addInputItem($si,
true);
215 $this->
toolbar->addFormButton($this->
lng->txt(
"sty_move_style"),
"moveLMStyles");
217 $this->
toolbar->setFormAction($this->
ctrl->getFormAction($this));
221 $this->tpl->setContent($table->getHTML() . $rendered_modal);
227 return $this->gui->form([self::class],
"import")
230 $this->
lng->txt(
"import"),
231 $gui->handleImport(...),
239 public function import():
void 242 if ($form->isValid()) {
243 if ($this->request->getRefId() > 0) {
245 if ($fold->getType() ==
"stys") {
246 $obj_id = (
int) $form->getData(
"import_file");
248 $cont_style_settings->addStyle($obj_id);
249 $cont_style_settings->update();
251 $this->
ctrl->redirectByClass(self::class,
"");
265 if ($this->request->getFromStyleId() == -1) {
271 $this->request->getFromStyleId(),
272 $this->request->getToStyleId()
274 $this->
ctrl->redirect($this,
"edit");
285 $this->
ctrl->redirect($this,
"edit");
292 $this->
ctrl->setParameter($this,
"to_style", $this->request->getToStyleId());
295 $cgui->setFormAction($this->
ctrl->getFormAction($this));
296 $cgui->setHeaderText($this->
lng->txt(
"sty_confirm_del_ind_styles") .
": " .
298 $this->
lng->txt(
"sty_confirm_del_ind_styles_desc"),
301 $cgui->setCancel($this->
lng->txt(
"cancel"),
"edit");
302 $cgui->setConfirm($this->
lng->txt(
"ok"),
"moveIndividualStyles");
303 $this->tpl->setContent($cgui->getHTML());
313 $ids = $this->request->getIds();
314 if (count($ids) == 0) {
315 $this->tpl->setOnScreenMessage(
'failure', $this->
lng->txt(
"no_checkbox"),
true);
316 $this->
ctrl->redirect($this,
"edit");
321 $cgui->setFormAction($this->
ctrl->getFormAction($this));
322 $cgui->setHeaderText($this->
lng->txt(
"info_delete_sure"));
323 $cgui->setCancel($this->
lng->txt(
"cancel"),
"cancelDelete");
324 $cgui->setConfirm($this->
lng->txt(
"confirm"),
"confirmedDelete");
326 foreach ($ids as
$id) {
329 $cgui->addItem(
"id[]", (
string) $id, $caption);
332 $this->tpl->setContent($cgui->getHTML());
342 $ids = $this->request->getIds();
343 foreach ($ids as
$id) {
345 $set->removeStyle($id);
349 $style_obj->delete();
352 $this->
ctrl->redirect($this,
"edit");
365 if ($this->request->getId() > 0) {
367 $def_style =
$ilSetting->get(
"default_content_style_id");
369 if ($def_style != $this->request->getId()) {
370 $ilSetting->set(
"default_content_style_id", (
string) $this->request->getId());
372 $ilSetting->delete(
"default_content_style_id");
374 $this->tpl->setOnScreenMessage(
'success', $lng->
txt(
"msg_obj_modified"),
true);
389 if ($this->request->getId() > 0) {
390 $ilSetting->delete(
"default_content_style_id");
391 $fixed_style =
$ilSetting->get(
"fixed_content_style_id");
392 if ($fixed_style == $this->request->getId()) {
395 $ilSetting->set(
"fixed_content_style_id", (
string) $this->request->getId());
397 $this->tpl->setOnScreenMessage(
'success', $lng->
txt(
"msg_obj_modified"),
true);
404 $styles = $this->cs_settings->getStyles();
405 foreach ($styles as $style) {
406 if ($this->request->getSelectedStandard($style[
"id"]) == 1) {
421 $this->tpl->setCurrentBlock(
"tbl_action_btn");
422 $this->tpl->setVariable(
"BTN_NAME",
"deleteStyle");
423 $this->tpl->setVariable(
"BTN_VALUE", $this->
lng->txt(
"delete"));
424 $this->tpl->parseCurrentBlock();
427 $this->tpl->setCurrentBlock(
"tbl_action_btn");
428 $this->tpl->setVariable(
"BTN_NAME",
"toggleGlobalDefault");
429 $this->tpl->setVariable(
"BTN_VALUE", $this->
lng->txt(
"toggleGlobalDefault"));
430 $this->tpl->parseCurrentBlock();
433 $this->tpl->setCurrentBlock(
"tbl_action_btn");
434 $this->tpl->setVariable(
"BTN_NAME",
"toggleGlobalFixed");
435 $this->tpl->setVariable(
"BTN_VALUE", $this->
lng->txt(
"toggleGlobalFixed"));
436 $this->tpl->parseCurrentBlock();
439 $this->tpl->setCurrentBlock(
"tbl_action_btn");
440 $this->tpl->setVariable(
"BTN_NAME",
"setScope");
441 $this->tpl->setVariable(
"BTN_VALUE", $this->
lng->txt(
"sty_set_scope"));
442 $this->tpl->parseCurrentBlock();
445 $this->tpl->setCurrentBlock(
"tbl_action_btn");
446 $this->tpl->setVariable(
"BTN_NAME",
"saveActiveStyles");
447 $this->tpl->setVariable(
"BTN_VALUE", $this->
lng->txt(
"sty_save_active_styles"));
448 $this->tpl->parseCurrentBlock();
450 $this->tpl->setCurrentBlock(
"tbl_action_row");
452 $this->tpl->parseCurrentBlock();
457 $this->tpl->setOnScreenMessage(
'info', $this->
lng->txt(
"msg_cancel"),
true);
458 $this->
ctrl->redirect($this,
"edit");
468 $ilCtrl->saveParameter($this,
"id");
476 $exp->setTypeWhiteList(array(
"root",
"cat"));
477 if (!$exp->handleCommand()) {
488 $cat_id = $this->request->getCatId();
495 $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)
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.
Content style internal ui factory.
ilObjStyleSettingsGUI $parent_gui
static _writeScope(int $a_id, int $a_scope)
confirmedDelete()
delete selected style objects
Base exception class for object service.
moveLMStyles()
move learning modules from one style to another
setContent(string $a_html)
Sets content for standard template.
toggleGlobalDefault()
Toggle global default style.
static _writeStandard(int $a_id, bool $a_std)
Write standard flag.
deleteStyle()
display deletion confirmation screen
redirectByClass( $a_class, ?string $a_cmd=null, ?string $a_anchor=null, bool $is_async=false)
confirmDeleteIndividualStyles()
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
static _lookupTitle(int $obj_id)
static getInstanceByRefId(int $ref_id, bool $stop_on_error=true)
get an instance of an Ilias object by reference id
static _moveLMStyles(int $a_from_style, int $a_to_style)
move learning modules from one style to another
static getImagePath(string $image_name, string $module_path="", string $mode="output", bool $offline=false)
get image path (for images located in a template directory)
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
$id
plugin.php for ilComponentBuildPluginInfoObjectiveTest::testAddPlugins
static _getNrLMsIndividualStyles()
get number of learning modules with individual styles
moveIndividualStyles()
move all learning modules with individual styles to new style
checkPermission(string $a_perm, bool $a_throw_exc=true)
Check permission.
showActions(bool $with_subobjects=false)
show possible action (form buttons)
Settings UI class for system styles.