53 public static string $style_selector_reset =
"margin-top:2px; margin-bottom:2px; text-indent:0px; position:static; float:none; width: auto;";
57 "str" =>
"Strong",
"emp" =>
"Emph",
"imp" =>
"Important",
58 "sup" =>
"Sup",
"sub" =>
"Sub",
60 "quot" =>
"Quotation",
"acc" =>
"Accent",
"code" =>
"Code",
"tex" =>
"Tex",
61 "fn" =>
"Footnote",
"xln" =>
"ExternalLink" 68 string $a_hier_id =
"",
73 $lng = $DIC->language();
74 $ilCtrl = $DIC->ctrl();
78 $this->tpl = $DIC->ui()->mainTemplate();
80 $this->pg_obj = $a_pg_obj;
81 $this->
ctrl = $ilCtrl;
82 $this->content_obj = $a_content_obj;
83 $service = $DIC->copage()->internal();
91 $this->sub_command = $this->request->getSubCmd();
92 $this->requested_ref_id = $this->request->getRefId();
94 if ($a_hier_id !==
"0") {
95 $this->hier_id = $a_hier_id;
96 $this->pc_id = $a_pc_id;
98 $this->dom = $a_pg_obj->
getDom();
104 $this->content_obj = $a_val;
114 $this->pg_obj = $a_val;
124 $this->page_config = $a_val;
134 return self::$common_bb_buttons;
139 $this->styleid = $a_styleid;
149 if ((!is_object($this->style) || $this->
getStyleId() != $this->style->getId()) && $this->
getStyleId() > 0) {
164 $service = $DIC->contentStyle()->internal();
165 $access_manager =
$service->domain()->access(
166 $this->requested_ref_id,
167 $DIC->user()->getId()
172 $char_manager =
$service->domain()->characteristic(
177 if (!is_array($a_type)) {
178 $a_type = array($a_type);
180 $chars = $char_manager->getByTypes($a_type,
false,
false);
181 $new_chars = array();
182 foreach ($chars as $char) {
183 if (($this->chars[$char->getCharacteristic()] ??
"") !=
"") {
184 $title = $char_manager->getPresentationTitle(
186 $char->getCharacteristic()
189 $title = $this->chars[$char->getCharacteristic()];
191 $new_chars[$char->getCharacteristic()] = $title;
193 $new_chars[$char->getCharacteristic()] = $char_manager->getPresentationTitle(
195 $char->getCharacteristic()
205 $this->chars = $a_chars;
210 return $this->chars ?? [];
223 $this->hier_id = $a_hier_id;
227 public function delete():
void 229 $updated = $this->pg_obj->deleteContent($this->hier_id);
231 $this->edit_repo->setPageError(
$updated);
233 $this->edit_repo->clearPageError();
235 $this->
ctrl->returnToParent($this,
"jump" . $this->hier_id);
244 $target = $this->request->getStringArray(
"target");
246 if (count($target) == 0) {
248 $this->
lng->txt(
"no_checkbox")
253 if (count($target) > 1) {
255 $this->
lng->txt(
"only_one_target")
259 $a_hid = explode(
":", $target[0]);
263 if ($this->hier_id == substr($a_hid[0], 0, strlen($this->hier_id))) {
268 $curr_node = $this->pg_obj->getContentNode($a_hid[0], $a_hid[1]);
269 if (is_object($curr_node) && $curr_node->node_name() ==
"FileItem") {
274 $first_hier_character = substr($a_hid[0], 0, 1);
275 if ($first_hier_character ==
"c" ||
276 $first_hier_character ==
"r" ||
277 $first_hier_character ==
"i") {
278 $a_hid[0] = substr($a_hid[0], 1);
282 $updated = $this->pg_obj->moveContentAfter(
285 $this->content_obj->getPCId(),
289 $this->edit_repo->setPageError(
$updated);
291 $this->edit_repo->clearPageError();
293 $this->log->debug(
"return to parent jump" . $this->hier_id);
294 $this->
ctrl->returnToParent($this,
"jump" . $this->hier_id);
303 $target = $this->request->getStringArray(
"target");
305 if (count($target) == 0) {
310 if (count($target) > 1) {
314 $a_hid = explode(
":", $target[0]);
317 if ($this->hier_id == substr($a_hid[0], 0, strlen($this->hier_id))) {
322 $curr_node = $this->pg_obj->getContentNode($a_hid[0], $a_hid[1]);
323 if (is_object($curr_node) && $curr_node->node_name() ==
"FileItem") {
328 $first_hier_character = substr($a_hid[0], 0, 1);
329 if ($first_hier_character ==
"c" ||
330 $first_hier_character ==
"r" ||
331 $first_hier_character ==
"i") {
332 $a_hid[0] = substr($a_hid[0], 1);
336 $updated = $this->pg_obj->moveContentBefore(
339 $this->content_obj->getPCId(),
343 $this->edit_repo->setPageError(
$updated);
345 $this->edit_repo->clearPageError();
347 $this->
ctrl->returnToParent($this,
"jump" . $this->hier_id);
357 if ($this->pg_obj->getParentType() !=
"lm") {
359 $this->pg_obj->getParentType() .
")");
362 $this->pg_obj->getId(),
363 $this->pg_obj->getParentType(),
368 $this->
ctrl->setParameterByClass(
"illmpageobjectgui",
"obj_id", $lm_page->getId());
369 $this->
ctrl->redirectByClass(
"illmpageobjectgui",
"edit");
372 $this->
ctrl->returnToParent($this,
"jump" . ($this->hier_id - 1));
381 if ($this->pg_obj->getParentType() !=
"lm") {
383 $this->pg_obj->getParentType() .
")");
386 $this->pg_obj->getId(),
387 $this->pg_obj->getParentType(),
393 $this->
ctrl->setParameterByClass(
"illmpageobjectgui",
"obj_id", $succ_id);
394 $this->
ctrl->redirectByClass(
"illmpageobjectgui",
"edit");
397 $this->
ctrl->returnToParent($this,
"jump" . ($this->hier_id - 1));
402 if (is_array($this->updated)) {
403 $error_str =
"<b>Error(s):</b><br>";
404 foreach ($this->updated as $error) {
405 $err_mess = implode(
" - ", $error);
406 if (!is_int(strpos($err_mess,
":0:"))) {
407 $error_str .= htmlentities($err_mess) .
"<br />";
410 $this->tpl->setOnScreenMessage(
'failure', $error_str);
411 } elseif ($this->updated !=
"" && $this->updated !==
true) {
412 $this->tpl->setOnScreenMessage(
'failure',
"<b>Error(s):</b><br />" .
422 $this->
ctrl->returnToParent($this,
"jump" . $this->hier_id);
430 $this->
ctrl->returnToParent($this,
"jump" . $this->hier_id);
438 $this->
ctrl->returnToParent($this,
"jump" . $this->hier_id);
449 if ($obj->isEnabled()) {
460 public function cut(): void
462 $updated = $this->pg_obj->cutContents(array($this->hier_id .
":" . $this->pc_id));
464 $this->edit_repo->setPageError(
$updated);
466 $this->edit_repo->clearPageError();
469 $this->log->debug(
"return to parent jump" . $this->hier_id);
470 $this->
ctrl->returnToParent($this,
"jump" . $this->hier_id);
478 $this->pg_obj->copyContents(array($this->hier_id .
":" . $this->pc_id));
479 $this->
ctrl->returnToParent($this,
"jump" . $this->hier_id);
490 if (is_object($style)) {
493 foreach ($ts as $t) {
494 $options[
"t:" . $t[
"id"] .
":" . $t[
"name"]] = $t[
"name"];
504 if ($hier_id ==
"") {
507 $pcid = $this->pg_obj->getPCIdForHierId($hier_id);
508 $ilCtrl->returnToParent($this,
"add" . $pcid);
513 if ($hier_id ==
"") {
517 $pcid = $this->pg_obj->getPCIdForHierId($hier_id);
523 $up = $this->pg_obj->update();
525 $this->edit_repo->clearPageError();
527 $this->edit_repo->setPageError($this->pg_obj->update());
534 $this->edit_repo->setTextLang($this->requested_ref_id, $lang_key);
539 return $this->edit_repo->getTextLang($this->requested_ref_id);
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.
splitPage()
split page to new page at specified position
setHierId(string $a_hier_id)
set hierarchical id in dom object
redirectToParent(string $hier_id="")
setCharacteristics(array $a_chars)
cancelCreate()
cancel creating page content
cancelUpdate()
cancel update
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
splitPageNext()
split page to next page at specified position
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
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
setContentObject(ilPageContent $a_val)
static _splitPage(int $a_page_id, string $a_pg_parent_type, string $a_hier_id)
split page at hierarchical id the main reason for this method being static is that a lm page object i...
getParentReturn(string $hier_id="")
moveAfter()
move content element after another element
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)
moveBefore()
move content element before another element
setCurrentTextLang(string $lang_key)
static array $common_bb_buttons
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.
static _splitPageNext(int $a_page_id, string $a_pg_parent_type, string $a_hier_id)
split page to next page at hierarchical id
setPageConfig(ilPageConfig $a_val)