19declare(strict_types=1);
24#[AllowDynamicProperties]
28 public const PCTYPE =
'prgactionnote';
33 public function init(): void
36 $this->
lng = $DIC->language();
47 $this->cache_node = $this->dom_doc->createElement(self::PCELEMENT);
48 $this->cache_node = $this->node->appendChild($this->cache_node);
54 bool $a_abstract_only =
false
56 $parent_obj_id = $this->getPage()->getParentId();
58 $start = strpos($a_output,
"[[[PRG_ACTION_NOTE");
61 $end = strpos($a_output,
"]]]", $start);
64 if ($a_mode ===
'edit') {
66 if ($this->supportsType($parent_obj_id)) {
67 $html = $this->getTemplate();
69 $a_output = substr($a_output, 0, $start) .
71 substr($a_output, $end + 3);
73 $start = strpos($a_output,
"[[[PRG_ACTION_NOTE", $start + 3);
76 $end = strpos($a_output,
"]]]", $start);
85 $parent_obj_id = (
int) $this->getPage()->getParentId();
86 if ($this->supportsType($parent_obj_id)) {
87 $a_output = $this->replaceWithRendered($parent_obj_id, $a_output);
96 return in_array($parent_obj_id, self::PROVIDING_TYPES);
102 $builder =
$dic[
'pc.actionnote'];
103 $rendered = $builder->getNoteFor($obj_id);
104 return str_replace(self::PLACEHOLDER, $rendered, $html);
109 $template =
new ilTemplate(
"tpl.action_note_poeditor_element.html",
true,
true,
'components/ILIAS/StudyProgramme');
110 $icon =
"./assets/images/standard/icon_prg.svg";
112 $template->setVariable(
"ICON", $icon);
113 $template->setVariable(
"ICON_TEXT", $this->
lng->txt(
"study_programme_icon"));
114 $template->setVariable(
"LABEL", $this->
lng->txt(
"pc_prg_action_note_label"));
116 return $template->get();
static _lookupType(int $id, bool $reference=false)
PageComponent "Note" for PageEditor in PRGs.
modifyPageContentPostXsl(string $a_output, string $a_mode, bool $a_abstract_only=false)
Modify page content after xsl.
supportsType(int $parent_obj_id)
replaceWithRendered(int $obj_id, $html)
create(ilPageObject $a_pg_obj, string $a_hier_id, string $a_pc_id="")
Content object of ilPageObject (see ILIAS DTD).
createPageContentNode(bool $a_set_this_node=true)
Create page content node (always use this method first when adding a new element)
setType(string $a_type)
Set Type.
Class ilPageObject Handles PageObjects of ILIAS Learning Modules (see ILIAS DTD)
insertContent(ilPageContent $a_cont_obj, string $a_pos, int $a_mode=IL_INSERT_AFTER, string $a_pcid="", bool $remove_placeholder=true)
insert a content node before/after a sibling or as first child of a parent
special template class to simplify handling of ITX/PEAR