ILIAS  release_8 Revision v8.24
class.SectionStyleSelector.php
Go to the documentation of this file.
1<?php
2
20
23
28{
29 public static string $style_selector_reset = "margin-top:2px; margin-bottom:2px; text-indent:0px; position:static; float:none; width: auto;";
30 protected int $style_id = 0;
31
33 protected \ILIAS\DI\UIServices $ui;
34 protected \ilLanguage $lng;
35
36 public function __construct(
38 int $style_id
39 ) {
40 global $DIC;
41
42 $this->ui = $DIC->ui();
43 $this->ui_wrapper = $ui_wrapper;
44 $this->style_id = $style_id;
45 $this->lng = $DIC->language();
46 }
47
48 public function getStyleSelector(
49 string $a_selected,
50 string $type = "sec-action",
51 string $action = "sec.class",
52 string $attr = "class",
53 bool $include_none = false
54 ): Dropdown {
55 $a_chars = \ilPCSectionGUI::_getCharacteristics($this->style_id);
57 $ui = $this->ui;
59
60 $buttons = [];
61 if ($include_none) {
62 $t = "section";
63 $tag = "div";
64 $html = '<div class="ilCOPgEditStyleSelectionItem"><' . $tag . ' class="" style="' . self::$style_selector_reset . '">' . $lng->txt("cont_none") . "</" . $tag . "></div>";
65 $buttons[] = $ui_wrapper->getButton($html, $type, $action, [$attr => ""]);
66 }
67 foreach ($a_chars as $char => $char_lang) {
68 $t = "section";
69 $tag = "div";
70 $html = '<div class="ilCOPgEditStyleSelectionItem"><' . $tag . ' class="ilc_' . $t . '_' . $char . '" style="' . self::$style_selector_reset . '">' . $char_lang . "</" . $tag . "></div>";
71 $buttons[] = $ui_wrapper->getButton($html, $type, $action, [$attr => $char]);
72 }
73 $dd = $ui->factory()->dropdown()->standard($buttons)->withLabel($a_selected);
74 return $dd;
75 }
76}
getStyleSelector(string $a_selected, string $type="sec-action", string $action="sec.class", string $attr="class", bool $include_none=false)
getButton(string $content, string $type, string $action, array $data=null, string $component="", string $aria_label="")
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...
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
global $DIC
Definition: feed.php:28
This describes commonalities between all types of Dropdowns.
Definition: Dropdown.php:35
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
$type