32 protected \ILIAS\COPage\InternalGUIService
$gui;
55 public static string $style_selector_reset =
"margin-top:2px; margin-bottom:2px; text-indent:0px; position:static; float:none; width: auto;";
57 protected \ILIAS\GlobalScreen\ScreenContext\ContextServices
$tool_context;
61 "str" =>
"Strong",
"emp" =>
"Emph",
"imp" =>
"Important",
62 "sup" =>
"Sup",
"sub" =>
"Sub",
64 "quot" =>
"Quotation",
"acc" =>
"Accent",
"code" =>
"Code",
"tex" =>
"Tex",
65 "fn" =>
"Footnote",
"xln" =>
"ExternalLink" 72 string $a_hier_id =
"",
77 $lng = $DIC->language();
78 $ilCtrl = $DIC->ctrl();
82 $this->tpl = $DIC->ui()->mainTemplate();
84 $this->pg_obj = $a_pg_obj;
85 $this->
ctrl = $ilCtrl;
86 $this->content_obj = $a_content_obj;
87 $service = $DIC->copage()->internal();
95 $this->sub_command = $this->request->getSubCmd();
96 $this->requested_ref_id = $this->request->getRefId();
99 if ($a_hier_id !==
"0") {
100 $this->hier_id = $a_hier_id;
101 $this->pc_id = $a_pc_id;
105 $this->tool_context = $DIC->globalScreen()->tool()->context();
106 $this->editor_gui = $DIC->copage()->internal()->gui()->edit();
111 $this->content_obj = $a_val;
121 $this->pg_obj = $a_val;
131 $this->page_config = $a_val;
141 return self::$common_bb_buttons;
146 $this->styleid = $a_styleid;
156 if ((!is_object($this->style) || $this->
getStyleId() != $this->style->getId()) && $this->
getStyleId() > 0) {
171 $service = $DIC->contentStyle()->internal();
172 $access_manager =
$service->domain()->access(
173 $this->requested_ref_id,
174 $DIC->user()->getId()
179 $char_manager =
$service->domain()->characteristic(
184 if (!is_array($a_type)) {
185 $a_type = array($a_type);
187 $chars = $char_manager->getByTypes($a_type,
false,
false);
188 $new_chars = array();
189 foreach ($chars as $char) {
190 if (($this->chars[$char->getCharacteristic()] ??
"") !=
"") {
191 $title = $char_manager->getPresentationTitle(
193 $char->getCharacteristic()
196 $title = $this->chars[$char->getCharacteristic()];
198 $new_chars[$char->getCharacteristic()] = $title;
200 $new_chars[$char->getCharacteristic()] = $char_manager->getPresentationTitle(
202 $char->getCharacteristic()
212 $this->chars = $a_chars;
217 return $this->chars ?? [];
230 $this->hier_id = $a_hier_id;
234 public function delete():
void 236 $updated = $this->pg_obj->deleteContent($this->hier_id);
238 $this->edit_repo->setPageError(
$updated);
240 $this->edit_repo->clearPageError();
242 $this->
ctrl->returnToParent($this,
"jump" . $this->hier_id);
247 if (is_array($this->updated)) {
248 $error_str =
"<strong>Error(s):</strong><br>";
249 foreach ($this->updated as $error) {
250 $err_mess = implode(
" - ", $error);
251 if (!is_int(strpos($err_mess,
":0:"))) {
252 $error_str .= htmlentities($err_mess) .
"<br />";
255 $this->tpl->setOnScreenMessage(
'failure', $error_str);
256 } elseif ($this->updated !=
"" && $this->updated !==
true) {
257 $this->tpl->setOnScreenMessage(
'failure',
"<strong>Error(s):</strong><br />" .
267 $this->
ctrl->returnToParent($this,
"jump" . $this->hier_id);
275 $this->
ctrl->returnToParent($this,
"jump" . $this->hier_id);
283 $this->
ctrl->returnToParent($this,
"jump" . $this->hier_id);
294 if ($obj->isEnabled()) {
305 public function cut(): void
307 $updated = $this->pg_obj->cutContents(array($this->hier_id .
":" . $this->pc_id));
309 $this->edit_repo->setPageError(
$updated);
311 $this->edit_repo->clearPageError();
314 $this->log->debug(
"return to parent jump" . $this->hier_id);
315 $this->
ctrl->returnToParent($this,
"jump" . $this->hier_id);
323 $this->pg_obj->copyContents(array($this->hier_id .
":" . $this->pc_id));
324 $this->
ctrl->returnToParent($this,
"jump" . $this->hier_id);
335 if (is_object($style)) {
338 foreach ($ts as $t) {
339 $options[
"t:" . $t[
"id"] .
":" . $t[
"name"]] = $t[
"name"];
349 if ($hier_id ==
"") {
352 $pcid = $this->pg_obj->getPCIdForHierId($hier_id);
353 $ilCtrl->returnToParent($this,
"add" . $pcid);
358 if ($hier_id ==
"") {
362 $pcid = $this->pg_obj->getPCIdForHierId($hier_id);
368 $up = $this->pg_obj->update();
370 $this->edit_repo->clearPageError();
372 $this->edit_repo->setPageError($this->pg_obj->update());
379 $this->edit_repo->setTextLang($this->requested_ref_id, $lang_key);
384 return $this->edit_repo->getTextLang($this->requested_ref_id);
389 $collection = $this->tool_context->current()->getAdditionalData();
400 $this->editor_gui->init()->initUI($this->tpl);
405 return $this->editor_gui->init()->getInitHtml(
"", $form_pc_id, $form_cname);
ilPageContent $content_obj
deactivate()
gui function set enabled if is not enabled and vice versa
setPage(ilPageObject $a_val)
getCharacteristicsOfCurrentStyle(array $a_type)
Get characteristics of current style and call setCharacteristics, if style is given.
Editing session repository.
EditSessionRepository $edit_repo
static getLogger(string $a_component_id)
Get component logger.
setHierId(string $a_hier_id)
set hierarchical id in dom object
redirectToParent(string $hier_id="")
getDomDoc()
Get dom doc (DOMDocument)
setCharacteristics(array $a_chars)
cancelCreate()
cancel creating page content
cancelUpdate()
cancel update
Content object of ilPageObject (see ILIAS DTD).
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
static string $style_selector_reset
User Interface for Editing of Page Content Objects (Paragraphs, Tables, ...)
getParentReturn(object $a_gui_obj)
Style Content CharacteristicManager $char_manager
setContentObject(ilPageContent $a_val)
getParentReturn(string $hier_id="")
Class ilPageObject Handles PageObjects of ILIAS Learning Modules (see ILIAS DTD)
getTemplates(string $a_type)
Get table templates of style.
ilGlobalTemplateInterface $tpl
Page component editing request.
setStyleId(int $a_styleid)
setCurrentTextLang(string $lang_key)
ILIAS GlobalScreen ScreenContext ContextServices $tool_context
static array $common_bb_buttons
getEditorScriptTag(string $form_pc_id="", string $form_cname="")
ilPageConfig $page_config
static _getCommonBBButtons()
__construct(ilPageObject $a_pg_obj, ?ilPageContent $a_content_obj, string $a_hier_id="", string $a_pc_id="0")
static _lookupType(int $id, bool $reference=false)
copy()
Copy single element.
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
getTemplateOptions(string $a_type="")
Get table templates.
ILIAS COPage Editor GUIService $editor_gui
setPageConfig(ilPageConfig $a_val)
ILIAS COPage InternalGUIService $gui