19declare(strict_types=1);
34 protected \ILIAS\Style\Content\InternalDomainService
$domain;
53 $this->tree =
$DIC->repositoryTree();
56 $this->parent_gui = $a_parent_gui;
57 $this->
ctrl = $DIC->ctrl();
58 $this->rbacsystem =
$DIC->rbac()->system();
59 $this->
toolbar = $DIC->toolbar();
60 $this->
lng = $DIC->language();
61 $this->tpl =
$DIC->ui()->mainTemplate();
62 $this->request =
$DIC->contentStyle()
67 $this->ref_id = $this->request->getRefId();
68 $this->obj_id = $this->request->getObjId();
71 $this->gui =
$DIC->contentStyle()->internal()->gui();
72 $this->domain =
$DIC->contentStyle()->internal()->domain();
77 $next_class = $this->
ctrl->getNextClass($this);
78 $cmd = $this->
ctrl->getCmd(
"edit");
80 switch ($next_class) {
81 case "ilobjstylesheetgui":
82 $this->
ctrl->setReturn($this,
"edit");
84 $this->
ctrl->forwardCommand($style_gui);
87 case strtolower(ilRepoStandardUploadHandlerGUI::class):
89 $gui = $form->getRepoStandardUploadHandlerGUI(
"import_file");
90 $this->
ctrl->forwardCommand($gui);
95 $this->parent_gui->prepareOutput();
96 if (in_array($cmd, array(
"edit",
98 "toggleGlobalDefault",
105 "moveIndividualStyles",
113 die(
"Unknown command " . $cmd);
124 if (!$this->rbacsystem->checkAccess($a_perm, $this->ref_id)) {
153 $from_styles = $to_styles =
$data = array();
154 $styles = $this->cs_settings->getStyles();
155 foreach ($styles as $style) {
157 $style[
"lm_nr"] = $this->domain->object(0)->countObjSelected((
int) $style[
"id"]);
158 $data[$style[
"title"] .
":" . $style[
"id"]]
160 if ($style[
"lm_nr"] > 0) {
161 $from_styles[$style[
"id"]] = $style[
"title"];
163 if ($style[
"active"] > 0) {
164 $to_styles[$style[
"id"]] = $style[
"title"];
169 if ($fixed_style <= 0) {
171 array(
"title" => $this->
lng->txt(
"sty_individual_styles"),
172 "id" => 0,
"lm_nr" => $this->domain->object(0)->countOverallOwned());
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"),
180 "id" => 0,
"lm_nr" => $this->domain->object(0)->countObjSelected(0));
181 $from_styles[0] = $this->
lng->txt(
"sty_default_style");
182 $to_styles[0] = $this->
lng->txt(
"sty_default_style");
185 $rendered_modal =
"";
188 $this->
lng->txt(
"sty_add_content_style"),
189 $this->ctrl->getLinkTarget($this,
"createStyle")
199 $this->
toolbar->addSeparator();
203 $this->
lng->txt(
"sty_move_obj_styles") .
": " . $this->lng->txt(
"sty_from"),
206 $si->setOptions($from_styles);
207 $this->
toolbar->addInputItem($si,
true);
211 $si->setOptions($to_styles);
212 $this->
toolbar->addInputItem($si,
true);
213 $this->
toolbar->addFormButton($this->
lng->txt(
"sty_move_style"),
"moveLMStyles");
215 $this->
toolbar->setFormAction($this->
ctrl->getFormAction($this));
219 $this->tpl->setContent($table->getHTML() . $rendered_modal);
225 return $this->gui->form([self::class],
"import")
228 $this->
lng->txt(
"import"),
229 $gui->handleImport(...),
237 public function import():
void
240 if ($form->isValid()) {
241 if ($this->request->getRefId() > 0) {
243 if ($fold->getType() ==
"stys") {
244 $obj_id = (
int) $form->getData(
"import_file");
246 $cont_style_settings->addStyle(
$obj_id);
247 $cont_style_settings->update();
249 $this->
ctrl->redirectByClass(self::class,
"");
263 if ($this->request->getFromStyleId() == -1) {
269 $this->request->getFromStyleId(),
270 $this->request->getToStyleId()
272 $this->
ctrl->redirect($this,
"edit");
283 $this->
ctrl->redirect($this,
"edit");
290 $this->
ctrl->setParameter($this,
"to_style", $this->request->getToStyleId());
293 $cgui->setFormAction($this->
ctrl->getFormAction($this));
294 $cgui->setHeaderText($this->
lng->txt(
"sty_confirm_del_ind_styles") .
": " .
296 $this->
lng->txt(
"sty_confirm_del_ind_styles_desc"),
299 $cgui->setCancel($this->
lng->txt(
"cancel"),
"edit");
300 $cgui->setConfirm($this->
lng->txt(
"ok"),
"moveIndividualStyles");
301 $this->tpl->setContent($cgui->getHTML());
311 $ids = $this->request->getIds();
312 if (count($ids) == 0) {
313 $this->tpl->setOnScreenMessage(
'failure', $this->
lng->txt(
"no_checkbox"),
true);
314 $this->
ctrl->redirect($this,
"edit");
319 $cgui->setFormAction($this->
ctrl->getFormAction($this));
320 $cgui->setHeaderText($this->
lng->txt(
"info_delete_sure"));
321 $cgui->setCancel($this->
lng->txt(
"cancel"),
"cancelDelete");
322 $cgui->setConfirm($this->
lng->txt(
"confirm"),
"confirmedDelete");
324 foreach ($ids as
$id) {
327 $cgui->addItem(
"id[]", (
string)
$id, $caption);
330 $this->tpl->setContent($cgui->getHTML());
340 $ids = $this->request->getIds();
341 foreach ($ids as
$id) {
343 $set->removeStyle(
$id);
347 $style_obj->delete();
350 $this->
ctrl->redirect($this,
"edit");
363 if ($this->request->getId() > 0) {
365 $def_style =
$ilSetting->get(
"default_content_style_id");
367 if ($def_style != $this->request->getId()) {
368 $ilSetting->set(
"default_content_style_id", (
string) $this->request->getId());
370 $ilSetting->delete(
"default_content_style_id");
372 $this->tpl->setOnScreenMessage(
'success',
$lng->
txt(
"msg_obj_modified"),
true);
387 if ($this->request->getId() > 0) {
388 $ilSetting->delete(
"default_content_style_id");
389 $fixed_style =
$ilSetting->get(
"fixed_content_style_id");
390 if ($fixed_style == $this->request->getId()) {
393 $ilSetting->set(
"fixed_content_style_id", (
string) $this->request->getId());
395 $this->tpl->setOnScreenMessage(
'success',
$lng->
txt(
"msg_obj_modified"),
true);
402 $styles = $this->cs_settings->getStyles();
403 foreach ($styles as $style) {
404 if ($this->request->getSelectedStandard($style[
"id"]) == 1) {
419 $this->tpl->setCurrentBlock(
"tbl_action_btn");
420 $this->tpl->setVariable(
"BTN_NAME",
"deleteStyle");
421 $this->tpl->setVariable(
"BTN_VALUE", $this->
lng->txt(
"delete"));
422 $this->tpl->parseCurrentBlock();
425 $this->tpl->setCurrentBlock(
"tbl_action_btn");
426 $this->tpl->setVariable(
"BTN_NAME",
"toggleGlobalDefault");
427 $this->tpl->setVariable(
"BTN_VALUE", $this->
lng->txt(
"toggleGlobalDefault"));
428 $this->tpl->parseCurrentBlock();
431 $this->tpl->setCurrentBlock(
"tbl_action_btn");
432 $this->tpl->setVariable(
"BTN_NAME",
"toggleGlobalFixed");
433 $this->tpl->setVariable(
"BTN_VALUE", $this->
lng->txt(
"toggleGlobalFixed"));
434 $this->tpl->parseCurrentBlock();
437 $this->tpl->setCurrentBlock(
"tbl_action_btn");
438 $this->tpl->setVariable(
"BTN_NAME",
"setScope");
439 $this->tpl->setVariable(
"BTN_VALUE", $this->
lng->txt(
"sty_set_scope"));
440 $this->tpl->parseCurrentBlock();
443 $this->tpl->setCurrentBlock(
"tbl_action_btn");
444 $this->tpl->setVariable(
"BTN_NAME",
"saveActiveStyles");
445 $this->tpl->setVariable(
"BTN_VALUE", $this->
lng->txt(
"sty_save_active_styles"));
446 $this->tpl->parseCurrentBlock();
448 $this->tpl->setCurrentBlock(
"tbl_action_row");
450 $this->tpl->parseCurrentBlock();
455 $this->tpl->setOnScreenMessage(
'info', $this->
lng->txt(
"msg_cancel"),
true);
456 $this->
ctrl->redirect($this,
"edit");
466 $ilCtrl->saveParameter($this,
"id");
474 $exp->setTypeWhiteList(array(
"root",
"cat"));
475 if (!$exp->handleCommand()) {
486 $cat_id = $this->request->getCatId();
493 $this->tpl->setOnScreenMessage(
'success', $this->
lng->txt(
"msg_obj_modified"),
true);
$id
plugin.php for ilComponentBuildPluginInfoObjectiveTest::testAddPlugins
Customizing of pimple-DIC for ILIAS.
Content style internal ui factory.
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
Settings UI class for system styles.
moveIndividualStyles()
move all learning modules with individual styles to new style
confirmDeleteIndividualStyles()
deleteStyle()
display deletion confirmation screen
showActions(bool $with_subobjects=false)
show possible action (form buttons)
checkPermission(string $a_perm, bool $a_throw_exc=true)
Check permission.
toggleGlobalFixed()
Toggle global fixed style.
ILIAS Style Content InternalDomainService $domain
moveLMStyles()
move learning modules from one style to another
ilContentStyleSettings $cs_settings
toggleGlobalDefault()
Toggle global default style.
__construct(ilObjStyleSettingsGUI $a_parent_gui)
confirmedDelete()
delete selected style objects
ilGlobalTemplateInterface $tpl
StandardGUIRequest $request
ilObjStyleSettingsGUI $parent_gui
Class ilCtrl provides processing control methods.
redirectByClass( $a_class, ?string $a_cmd=null, ?string $a_anchor=null, bool $is_async=false)
@inheritDoc
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...
static _moveLMStyles(int $a_from_style, int $a_to_style)
move learning modules from one style to another
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
Class ilObjStyleSheetGUI.
static _writeActive(int $a_id, bool $a_active)
static _lookupActive(int $a_id)
Lookup active flag.
static _writeScope(int $a_id, int $a_scope)
static _writeStandard(int $a_id, bool $a_std)
Write standard flag.
Base exception class for object service.
static getInstanceByRefId(int $ref_id, bool $stop_on_error=true)
get an instance of an Ilias object by reference id
static getInstanceByObjId(?int $obj_id, bool $stop_on_error=true)
get an instance of an Ilias object by object id
static _lookupTitle(int $obj_id)
class ilRbacSystem system function like checkAccess, addActiveRole ... Supporting system functions ar...
Explorer for selecting repository items.
Tree class data representation in hierachical trees using the Nested Set Model with Gaps by Joe Celco...
static getImagePath(string $image_name, string $module_path="", string $mode="output", bool $offline=false)
get image path (for images located in a template directory)
static redirect(string $a_script)
setContent(string $a_html)
Sets content for standard template.