ILIAS  release_6 Revision v6.24-5-g0c8bfefb3b8
class.ilCOPageEditGSToolProvider.php
Go to the documentation of this file.
1<?php
2
6
13{
14 const SHOW_EDITOR = 'copg_show_editor';
15
16
21 {
22 return $this->context_collection->main()->repository();
23 }
24
25
29 public function getToolsForContextStack(CalledContexts $called_contexts) : array
30 {
31 $tools = [];
32 $additional_data = $called_contexts->current()->getAdditionalData();
33 if ($additional_data->is(self::SHOW_EDITOR, true)) {
34 $title = $this->dic->language()->txt('editor');
35 $icon = $this->dic->ui()->factory()->symbol()->icon()->custom(\ilUtil::getImagePath("outlined/icon_edtr.svg"), $title);
36
37 $iff = function ($id) {
38 return $this->identification_provider->contextAwareIdentifier($id);
39 };
40 $l = function (string $content) {
41 return $this->dic->ui()->factory()->legacy($content);
42 };
43 $tools[] = $this->factory->tool($iff("copg_editor"))
44 ->withSymbol($icon)
45 ->withTitle($title)
46 ->withContent($l($this->getContent()));
47 }
48
49 return $tools;
50 }
51
52
58 private function getContent() : string
59 {
60 $lng = $this->dic->language();
61 $lng->loadLanguageModule("content");
62 $tpl = new ilTemplate("tpl.editor_slate.html", true, true, "Services/COPage");
63 $tpl->setCurrentBlock("help");
64 $tpl->setVariable("TXT_ADD_EL", $lng->txt("cont_add_elements"));
65 $tpl->setVariable("PLUS", ilGlyphGUI::get(ilGlyphGUI::ADD));
66 $tpl->setVariable("DRAG_ARROW", ilGlyphGUI::get(ilGlyphGUI::DRAG));
67 $tpl->setVariable("TXT_DRAG", $lng->txt("cont_drag_and_drop_elements"));
68 $tpl->setVariable("TXT_SEL", $lng->txt("cont_double_click_to_delete"));
69 $tpl->parseCurrentBlock();
70 return $tpl->get();
71 }
72}
An exception for terminatinating execution or to throw for unit testing.
getToolsForContextStack(CalledContexts $called_contexts)
@inheritDoc
static get($a_glyph, $a_text="")
Get glyph html.
special template class to simplify handling of ITX/PEAR
static getImagePath($img, $module_path="", $mode="output", $offline=false)
get image path (for images located in a template directory)
withSymbol(Symbol $symbol)
@inheritDoc
$lng
if(isset($_FILES['img_file']['size']) && $_FILES['img_file']['size'] > 0) $tpl