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