ILIAS  trunk Revision v11.0_alpha-3011-gc6b235a2e85
class.PageContentManager.php
Go to the documentation of this file.
1<?php
2
19declare(strict_types=1);
20
21namespace ILIAS\COPage\Page;
22
24
29{
30 protected \ILIAS\COPage\Dom\DomUtil $dom_util;
31 protected \DOMDocument $dom;
32 protected \ILIAS\COPage\Link\LinkManager $link;
33 protected \ILIAS\COPage\PC\DomainService $pc_service;
34 protected \DOMNode $page_object_node;
35
36 public function __construct(
37 \DOMDocument $dom,
38 ?PCDefinition $def = null
39 ) {
40 global $DIC;
41
42 $this->dom = $dom;
43 $this->dom_util = $DIC->copage()->internal()->domain()->domUtil();
44 $this->pc_service = $DIC->copage()->internal()->domain()->pc($def);
45 $this->link = $DIC->copage()->internal()->domain()->link();
46
47 $path = "//PageObject";
48 $nodes = $this->dom_util->path($dom, $path);
49 if (count($nodes) == 1) {
50 $this->page_object_node = $nodes->item(0);
51 }
52 }
53
54 protected function getPageObjectNode(): \DOMNode
55 {
57 }
58
59 public function getContentDomNode(string $a_hier_id, string $a_pc_id = ""): ?\DOMNode
60 {
61 if ($a_hier_id == "pg") {
62 $path = "//PageObject";
63 } else {
64 // get per pc id
65 if ($a_pc_id != "") {
66 $path = "//*[@PCID = '$a_pc_id']";
67 } else {
68 // fall back to hier id
69 $path = "//*[@HierId = '$a_hier_id']";
70 }
71 }
72 $nodes = $this->dom_util->path($this->dom, $path);
73 if (count($nodes) === 1) {
74 $cont_node = $nodes->item(0);
75 return $cont_node;
76 }
77 return null;
78 }
79
80 public function deleteContent(
81 \ilPageObject $page,
82 string $a_hid,
83 string $a_pcid = "",
84 bool $move_operation = false
85 ) {
86 $curr_node = $this->getContentDomNode($a_hid, $a_pcid);
87 $this->handleDeleteContent($page, $curr_node, $move_operation);
88 $curr_node->parentNode->removeChild($curr_node);
89 }
90
91 public function deleteContents(
92 \ilPageObject $page,
93 array $a_hids,
94 bool $a_self_ass = false,
95 bool $move_operation = false
96 ) {
97 foreach ($a_hids as $a_hid) {
98 $a_hid = explode(":", $a_hid);
99 // @todo 1: hook
100 // do not delete question nodes in assessment pages
101 if (!$this->checkForTag("Question", $a_hid[0], (string) ($a_hid[1] ?? "")) || $a_self_ass) {
102 $curr_node = $this->getContentDomNode((string) $a_hid[0], (string) ($a_hid[1] ?? ""));
103 if (is_object($curr_node)) {
104 $parent_node = $curr_node->parentNode;
105 if ($parent_node->nodeName != "TableRow") {
106 $this->handleDeleteContent($page, $curr_node, $move_operation);
107 $curr_node->parentNode->removeChild($curr_node);
108 }
109 }
110 }
111 }
112 }
113
114 protected function checkForTag(
115 string $a_content_tag,
116 string $a_hier_id,
117 string $a_pc_id = ""
118 ): bool {
119 // get per pc id
120 if ($a_pc_id != "") {
121 $path = "//*[@PCID = '$a_pc_id']//" . $a_content_tag;
122 } else {
123 $path = "//*[@HierId = '$a_hier_id']//" . $a_content_tag;
124 }
125
126 $nodes = $this->dom_util->path($this->dom, $path);
127 if (count($nodes) > 0) {
128 return true;
129 }
130 return false;
131 }
132
133
134 public function handleDeleteContent(\ilPageObject $page, $a_node = null, $move_operation = false): void
135 {
136 if (!isset($a_node)) {
137 $path = "//PageContent";
138 $nodes = $this->dom_util->path($this->dom, $path);
139 } else {
140 $nodes = array($a_node);
141 }
142
143 foreach ($nodes as $node) {
144 if ($node->firstChild->nodeName === 'Plugged') {
145 \ilPCPlugged::handleDeletedPluggedNode($page, $node->firstChild, $move_operation);
146 }
147 }
148 }
149
150 public function switchEnableMultiple(
151 \ilPageObject $page,
152 array $a_hids,
153 bool $a_self_ass = false
154 ) {
155 foreach ($a_hids as $a_hid) {
156 $a_hid = explode(":", $a_hid);
157 $curr_node = $this->getContentDomNode($a_hid[0], $a_hid[1] ?? "");
158 if (is_object($curr_node)) {
159 if ($curr_node->nodeName == "PageContent") {
160 $cont_obj = $this->pc_service->getByNode($curr_node, $page);
161 if ($cont_obj->isEnabled()) {
162 // do not deactivate question nodes in assessment pages
163 if (!$this->checkForTag("Question", $a_hid[0], (string) ($a_hid[1] ?? "")) || $a_self_ass) {
164 $cont_obj->disable();
165 }
166 } else {
167 $cont_obj->enable();
168 }
169 }
170 }
171 }
172 }
173
174 public function setInitialOpenedContent(
175 string $a_type = "",
176 int $a_id = 0,
177 string $a_target = ""
178 ): void {
179 $il_node = null;
180 $link_type = "";
181 switch ($a_type) {
182 case "media":
183 $link_type = "MediaObject";
184 $a_id = "il__mob_" . $a_id;
185 break;
186
187 case "page":
188 $link_type = "PageObject";
189 $a_id = "il__pg_" . $a_id;
190 break;
191
192 case "term":
193 $link_type = "GlossaryItem";
194 $a_id = "il__git_" . $a_id;
195 $a_target = "Glossary";
196 break;
197 }
198
199 $path = "//PageObject/InitOpenedContent";
200 $nodes = $this->dom_util->path($this->dom, $path);
201 if ($link_type == "" || $a_id == "") {
202 if (count($nodes) > 0) {
203 $c = $nodes->item(0);
204 $c->parentNode->removeChild($c);
205 }
206 } else {
207 if (count($nodes) > 0) {
208 $init_node = $nodes->item(0);
209 foreach ($init_node->childNodes as $child) {
210 if ($child->nodeName === "IntLink") {
211 $il_node = $child;
212 }
213 }
214 } else {
215 $path = "//PageObject";
216 $nodes = $this->dom_util->path($this->dom, $path);
217 $page_node = $nodes->item(0);
218 $init_node = $this->dom->createElement("InitOpenedContent");
219 $init_node = $page_node->appendChild($init_node);
220 $il_node = $this->dom->createElement("IntLink");
221 $il_node = $init_node->appendChild($il_node);
222 }
223 $il_node->setAttribute("Target", $a_id);
224 $il_node->setAttribute("Type", $link_type);
225 $il_node->setAttribute("TargetFrame", $a_target);
226 }
227 }
228
232 public function getInitialOpenedContent(): array
233 {
234 $type = "";
235 $path = "//PageObject/InitOpenedContent";
236 $il_node = null;
237 $nodes = $this->dom_util->path($this->dom, $path);
238 if (count($nodes) > 0) {
239 $init_node = $nodes->item(0);
240 foreach ($init_node->childNodes as $child) {
241 if ($child->nodeName == "IntLink") {
242 $il_node = $child;
243 }
244 }
245 }
246 if (!is_null($il_node)) {
247 $id = $il_node->getAttribute("Target");
248 $link_type = $il_node->getAttribute("Type");
249 $target = $il_node->getAttribute("TargetFrame");
250
251 switch ($link_type) {
252 case "MediaObject":
253 $type = "media";
254 break;
255
256 case "PageObject":
257 $type = "page";
258 break;
259
260 case "GlossaryItem":
261 $type = "term";
262 break;
263 }
265 return array("id" => $id, "type" => $type, "target" => $target);
266 }
267
268 return array();
269 }
270
271
272 public function downloadFile(
273 \ilPageObject $page,
274 string $file_link_id
275 ): void {
276 $file_id = 0;
277
278 $page->buildDom();
279 $dom = $page->getDomDoc();
280
281 if ($this->link->containsFileLinkId($dom, $file_link_id)) {
282 $file_id = $this->link->extractFileFromLinkId($file_link_id);
283 }
284 if (in_array($file_link_id, $this->pc_service->fileList()->getAllFileObjIds($dom))) {
285 $file_id = $this->link->extractFileFromLinkId($file_link_id);
286 }
287
288 $pcs = \ilPageContentUsage::getUsagesOfPage($page->getId(), $page->getParentType() . ":pg", 0, false);
289 foreach ($pcs as $pc) {
290 $files = \ilObjFile::_getFilesOfObject("mep:pg", $pc["id"], 0);
291 $c_file = $this->link->extractFileFromLinkId($file_link_id);
292 if (in_array($c_file, $files)) {
293 $file_id = $c_file;
294 }
295 }
296
297 if ($file_id > 0) {
298 $fileObj = new \ilObjFile($file_id, false);
299 $fileObj->sendFile();
300 exit;
301 }
302 }
303
310 public function insertInstIntoIDs(
311 string $a_inst,
312 bool $a_res_ref_to_obj_id = true
313 ): void {
314 $dom = $this->dom;
315 // insert inst id into internal links
316 $path = "//IntLink";
317 $nodes = $this->dom_util->path($dom, $path);
318 foreach ($nodes as $node) {
319 $target = $node->getAttribute("Target");
320 $type = $node->getAttribute("Type");
321
322 if (substr($target, 0, 4) == "il__") {
323 $id = substr($target, 4, strlen($target) - 4);
324
325 // convert repository links obj_<ref_id> to <type>_<obj_id>
326 // this leads to bug 6685.
327 if ($a_res_ref_to_obj_id && $type == "RepositoryItem") {
328 $id_arr = explode("_", $id);
329
330 // changed due to bug 6685
331 $ref_id = $id_arr[1];
332 $obj_id = \ilObject::_lookupObjId((int) $id_arr[1]);
333
334 $otype = \ilObject::_lookupType($obj_id);
335 if ($obj_id > 0) {
336 // changed due to bug 6685
337 // the ref_id should be used, if the content is
338 // imported on the same installation
339 // the obj_id should be used, if a different
340 // installation imports, but has an import_id for
341 // the object id.
342 $id = $otype . "_" . $obj_id . "_" . $ref_id;
343 //$id = $otype."_".$ref_id;
344 }
345 }
346 $new_target = "il_" . $a_inst . "_" . $id;
347 $node->setAttribute("Target", $new_target);
348 }
349 }
350
351 // insert inst id into media aliases
352 $path = "//MediaAlias";
353 $nodes = $this->dom_util->path($dom, $path);
354 foreach ($nodes as $node) {
355 $origin_id = $node->getAttribute("OriginId");
356 if (substr($origin_id, 0, 4) == "il__") {
357 $new_id = "il_" . $a_inst . "_" . substr($origin_id, 4, strlen($origin_id) - 4);
358 $node->setAttribute("OriginId", $new_id);
359 }
360 }
361
362 // insert inst id file item identifier entries
363 $path = "//FileItem/Identifier";
364 $nodes = $this->dom_util->path($dom, $path);
365 foreach ($nodes as $node) {
366 $origin_id = $node->getAttribute("Entry");
367 if (substr($origin_id, 0, 4) == "il__") {
368 $new_id = "il_" . $a_inst . "_" . substr($origin_id, 4, strlen($origin_id) - 4);
369 $node->setAttribute("Entry", $new_id);
370 }
371 }
372
373 // insert inst id into question references
374 $path = "//Question";
375 $nodes = $this->dom_util->path($dom, $path);
376 foreach ($nodes as $node) {
377 $qref = $node->getAttribute("QRef");
378 //echo "<br>setted:".$qref;
379 if (substr($qref, 0, 4) == "il__") {
380 $new_id = "il_" . $a_inst . "_" . substr($qref, 4, strlen($qref) - 4);
381 //echo "<br>setting:".$new_id;
382 $node->setAttribute("QRef", $new_id);
383 }
384 }
385
386 // insert inst id into content snippets
387 $path = "//ContentInclude";
388 $nodes = $this->dom_util->path($dom, $path);
389 foreach ($nodes as $node) {
390 $ci = $node->getAttribute("InstId");
391 if ($ci == "") {
392 $node->setAttribute("InstId", $a_inst);
393 }
394 }
395 }
396
397 public function pasteContents(
398 \ilObjUser $user,
399 string $a_hier_id,
400 \ilPageObject $page,
401 bool $a_self_ass = false
402 ) {
403 $a_hid = explode(":", $a_hier_id);
404 $content = $user->getPCClipboardContent();
405 // we insert from last to first, because we insert all at the
406 // same hier_id
407 for ($i = count($content) - 1; $i >= 0; $i--) {
408 $c = $content[$i];
409 $error = null;
410 $temp_dom = $this->dom_util->docFromString(
411 '<?xml version="1.0" encoding="UTF-8"?>' . $c,
412 $error
413 );
414 if (empty($error)) {
415 $this->handleCopiedContent($page, $temp_dom, $a_self_ass);
416 $path = "/PageContent";
417 $nodes = $this->dom_util->path($temp_dom, $path);
418 foreach ($nodes as $node) {
419 $new_pc_node = $node;
420 $cloned_pc_node = $new_pc_node->cloneNode(true);
421 $cloned_pc_node = $this->dom->importNode($cloned_pc_node, true);
422 $this->insertContentNode(
423 $cloned_pc_node,
424 $a_hid[0],
426 $a_hid[1]
427 );
428 }
429 } else {
430 //var_dump($error);
431 }
432 }
433 }
434
435 public function copyXmlContent(
436 \ilPageObject $page,
437 bool $a_clone_mobs = false,
438 int $a_new_parent_id = 0,
439 int $obj_copy_id = 0,
440 bool $self_ass = true
441 ): string {
442 $this->handleCopiedContent($page, $this->dom, $self_ass, $a_clone_mobs, $a_new_parent_id, $obj_copy_id);
443 $this->dom->documentElement;
444 $xml = $this->dom_util->dump($this->dom->documentElement);
445 $xml = preg_replace('/<\?xml[^>]*>/i', "", $xml);
446 $xml = preg_replace('/<!DOCTYPE[^>]*>/i', "", $xml);
447 return $xml;
448 }
449
459 protected function handleCopiedContent(
460 \ilPageObject $page,
461 \DOMDocument $dom,
462 bool $a_self_ass = true,
463 bool $a_clone_mobs = false,
464 int $new_parent_id = 0,
465 int $obj_copy_id = 0
466 ): void {
467 $defs = $this->pc_service->definition()->getPCDefinitions();
468 foreach ($defs as $def) {
469 $cl = $def["pc_class"];
470 if ($cl == 'ilPCPlugged') {
471 // the page object is provided for ilPageComponentPlugin
472 \ilPCPlugged::handleCopiedPluggedContent($page, $dom);
473 } else {
474 $cl::handleCopiedContent($dom, $a_self_ass, $a_clone_mobs, $new_parent_id, $obj_copy_id);
475 }
476 }
477 }
478
479 public function insertContentNode(
480 \DOMNode $a_cont_node,
481 string $a_pos,
482 int $a_mode = IL_INSERT_AFTER,
483 string $a_pcid = ""
484 ): void {
485 // move mode into container elements is always INSERT_CHILD
486 $curr_node = $this->getContentDomNode($a_pos, $a_pcid);
487 $curr_name = $curr_node->nodeName;
488 // @todo: try to generalize
489 if (($curr_name == "TableData") || ($curr_name == "PageObject") ||
490 ($curr_name == "ListItem") || ($curr_name == "Section")
491 || ($curr_name == "Tab") || ($curr_name == "ContentPopup")
492 || ($curr_name == "GridCell")) {
493 $a_mode = IL_INSERT_CHILD;
494 }
495
496 $hid = $curr_node->getAttribute("HierId");
497 if ($hid != "") {
498 $a_pos = $hid;
499 }
500
501 if ($a_mode != IL_INSERT_CHILD) { // determine parent hierarchical id
502 // of sibling at $a_pos
503 $pos = explode("_", $a_pos);
504 $target_pos = array_pop($pos);
505 $parent_pos = implode("_", $pos);
506 } else { // if we should insert a child, $a_pos is alreade the hierarchical id
507 // of the parent node
508 $parent_pos = $a_pos;
509 }
510
511 // get the parent node
512 if ($parent_pos != "") {
513 $parent_node = $this->getContentDomNode($parent_pos);
514 } else {
515 $parent_node = $this->getPageObjectNode();
516 }
517
518 // count the parent children
519 $parent_childs = $parent_node->childNodes;
520 $cnt_parent_childs = count($parent_childs);
521 switch ($a_mode) {
522 // insert new node after sibling at $a_pos
523 case IL_INSERT_AFTER:
524 //$new_node = $a_cont_obj->getNode();
525 if ($succ_node = $curr_node->nextSibling) {
526 $a_cont_node = $succ_node->parentNode->insertBefore($a_cont_node, $succ_node);
527 } else {
528 $a_cont_node = $parent_node->appendChild($a_cont_node);
529 }
530 //$a_cont_obj->setNode($new_node);
531 break;
532
533 case IL_INSERT_BEFORE:
534 //$new_node = $a_cont_obj->getNode();
535 $succ_node = $this->getContentDomNode($a_pos);
536 $a_cont_node = $succ_node->parentNode->insertBefore($a_cont_node, $succ_node);
537 //$a_cont_obj->setNode($new_node);
538 break;
539
540 // insert new node as first child of parent $a_pos (= $a_parent)
541 case IL_INSERT_CHILD:
542 //$new_node = $a_cont_obj->getNode();
543 if ($cnt_parent_childs == 0) {
544 $a_cont_node = $parent_node->appendChild($a_cont_node);
545 } else {
546 $a_cont_node = $parent_childs->item(0)->parentNode->insertBefore($a_cont_node, $parent_childs->item(0));
547 }
548 //$a_cont_obj->setNode($new_node);
549 break;
550 }
551 }
552
553 public function insertContent(
554 \ilPageContent $a_cont_obj,
555 string $a_pos,
556 int $a_mode = IL_INSERT_AFTER,
557 string $a_pcid = "",
558 bool $remove_placeholder = true,
559 bool $placeholder_enabled = false
560 ): void {
561 if ($a_pcid == "" && $a_pos == "") {
562 $a_pos = "pg";
563 }
564 // move mode into container elements is always INSERT_CHILD
565 $curr_node = $this->getContentDomNode($a_pos, $a_pcid);
566 $curr_name = $curr_node->nodeName;
567
568 // @todo: try to generalize this
569 if (($curr_name == "TableData") || ($curr_name == "PageObject") ||
570 ($curr_name == "ListItem") || ($curr_name == "Section")
571 || ($curr_name == "Tab") || ($curr_name == "ContentPopup")
572 || ($curr_name == "GridCell")) {
573 $a_mode = IL_INSERT_CHILD;
574 }
575
576 $hid = $curr_node->getAttribute("HierId");
577 if ($hid != "") {
578 //echo "-".$a_pos."-".$hid."-";
579 $a_pos = $hid;
580 }
581
582 if ($a_mode != IL_INSERT_CHILD) { // determine parent hierarchical id
583 // of sibling at $a_pos
584 $pos = explode("_", $a_pos);
585 $target_pos = array_pop($pos);
586 $parent_pos = implode("_", $pos);
587 } else { // if we should insert a child, $a_pos is alreade the hierarchical id
588 // of the parent node
589 $parent_pos = $a_pos;
590 }
591
592 // get the parent node
593 if ($parent_pos != "") {
594 $parent_node = $this->getContentDomNode($parent_pos);
595 } else {
596 $parent_node = $this->getPageObjectNode();
597 }
598
599 // count the parent children
600 $parent_childs = $parent_node->childNodes;
601 $cnt_parent_childs = count($parent_childs);
602 //echo "ZZ$a_mode";
603 switch ($a_mode) {
604 // insert new node after sibling at $a_pos
605 case IL_INSERT_AFTER:
606 $new_node = $a_cont_obj->getDomNode();
607 //$a_pos = ilPageContent::incEdId($a_pos);
608 //$curr_node = $this->getContentNode($a_pos);
609 //echo "behind $a_pos:";
610 if ($succ_node = $curr_node->nextSibling) {
611 $new_node = $succ_node->parentNode->insertBefore($new_node, $succ_node);
612 } else {
613 //echo "movin doin append_child";
614 $new_node = $parent_node->appendChild($new_node);
615 }
616 $a_cont_obj->setDomNode($new_node);
617 break;
618
619 case IL_INSERT_BEFORE:
620 //echo "INSERT_BEF";
621 $new_node = $a_cont_obj->getDomNode();
622 $succ_node = $this->getContentDomNode($a_pos);
623 $new_node = $succ_node->parentNode->insertBefore($new_node, $succ_node);
624 $a_cont_obj->setDomNode($new_node);
625 break;
626
627 // insert new node as first child of parent $a_pos (= $a_parent)
628 case IL_INSERT_CHILD:
629 //echo "insert as child:parent_childs:$cnt_parent_childs:<br>";
630 $new_node = $a_cont_obj->getDomNode();
631 if ($cnt_parent_childs == 0) {
632 $new_node = $parent_node->appendChild($new_node);
633 } else {
634 $new_node = $parent_childs[0]->parentNode->insertBefore($new_node, $parent_childs[0]);
635 }
636 $a_cont_obj->setDomNode($new_node);
637 //echo "PP";
638 break;
639 }
640
641 //check for PlaceHolder to remove in EditMode-keep in Layout Mode
642 if ($remove_placeholder && !$placeholder_enabled) {
643 foreach ($curr_node->childNodes as $sub_node) {
644 if ($sub_node->nodeName == "PlaceHolder") {
645 $curr_node->parentNode->removeChild($curr_node);
646 }
647 }
648 }
649 }
650
663 public function moveContentAfter(
664 \ilPageObject $page,
665 string $a_source,
666 string $a_target,
667 string $a_spcid = "",
668 string $a_tpcid = ""
669 ): void {
670 // nothing to do...
671 if ($a_source === $a_target) {
672 return;
673 }
674
675 // clone the node
676 $content = $page->getContentObject($a_source, $a_spcid);
677 $source_node = $content?->getDomNode();
678 $clone_node = $source_node?->cloneNode(true);
679
680 // delete source node
681 $this->deleteContent($page, $a_source, $a_spcid, true);
682
683 // insert cloned node at target
684 if ($content) {
685 $content->setDomNode($clone_node);
686 $this->insertContent($content, $a_target, IL_INSERT_AFTER, $a_tpcid);
687 }
688 }
689
693 public function copyContents(
694 array $a_hids,
695 \ilObjUser $user
696 ): void {
697 $pc_id = null;
698
699 if (!is_array($a_hids)) {
700 return;
701 }
702
703 $time = date("Y-m-d H:i:s", time());
704
705 $hier_ids = array();
706 $skip = array();
707 foreach ($a_hids as $a_hid) {
708 if ($a_hid == "") {
709 continue;
710 }
711 $a_hid = explode(":", $a_hid);
712
713 // check, whether new hid is child of existing one or vice versa
714 reset($hier_ids);
715 foreach ($hier_ids as $h) {
716 if ($h . "_" == substr($a_hid[0], 0, strlen($h) + 1)) {
717 $skip[] = $a_hid[0];
718 }
719 if ($a_hid[0] . "_" == substr($h, 0, strlen($a_hid[0]) + 1)) {
720 $skip[] = $h;
721 }
722 }
723 $pc_id[$a_hid[0]] = $a_hid[1];
724 if ($a_hid[0] != "") {
725 $hier_ids[$a_hid[0]] = $a_hid[0];
726 }
727 }
728 foreach ($skip as $s) {
729 unset($hier_ids[$s]);
730 }
731 $hier_ids = \ilPageContent::sortHierIds($hier_ids);
732 $nr = 1;
733 foreach ($hier_ids as $hid) {
734 $curr_node = $this->getContentDomNode($hid, $pc_id[$hid]);
735 if (is_object($curr_node)) {
736 if ($curr_node->nodeName == "PageContent") {
737 $content = $this->dom_util->dump($curr_node);
738 // remove pc and hier ids
739 $content = preg_replace('/PCID=\"[a-z0-9]*\"/i', "", $content);
740 $content = preg_replace('/HierId=\"[a-z0-9_]*\"/i', "", $content);
741
742 $user->addToPCClipboard($content, $time, $nr);
743 $nr++;
744 }
745 }
746 }
748 }
749
750
751 //
752 // Specific methods, should go to other components
753 //
754}
$id
plugin.php for ilComponentBuildPluginInfoObjectiveTest::testAddPlugins
Definition: plugin.php:23
getContentDomNode(string $a_hier_id, string $a_pc_id="")
setInitialOpenedContent(string $a_type="", int $a_id=0, string $a_target="")
pasteContents(\ilObjUser $user, string $a_hier_id, \ilPageObject $page, bool $a_self_ass=false)
copyXmlContent(\ilPageObject $page, bool $a_clone_mobs=false, int $a_new_parent_id=0, int $obj_copy_id=0, bool $self_ass=true)
downloadFile(\ilPageObject $page, string $file_link_id)
getInitialOpenedContent()
Get initial opened content.
insertInstIntoIDs(string $a_inst, bool $a_res_ref_to_obj_id=true)
inserts installation id into ids (e.g.
handleDeleteContent(\ilPageObject $page, $a_node=null, $move_operation=false)
deleteContents(\ilPageObject $page, array $a_hids, bool $a_self_ass=false, bool $move_operation=false)
insertContent(\ilPageContent $a_cont_obj, string $a_pos, int $a_mode=IL_INSERT_AFTER, string $a_pcid="", bool $remove_placeholder=true, bool $placeholder_enabled=false)
moveContentAfter(\ilPageObject $page, string $a_source, string $a_target, string $a_spcid="", string $a_tpcid="")
move content object from position $a_source before position $a_target (both hierarchical content ids)
deleteContent(\ilPageObject $page, string $a_hid, string $a_pcid="", bool $move_operation=false)
handleCopiedContent(\ilPageObject $page, \DOMDocument $dom, bool $a_self_ass=true, bool $a_clone_mobs=false, int $new_parent_id=0, int $obj_copy_id=0)
Handle copied content This function copies items, that must be copied, if page content is duplicated.
copyContents(array $a_hids, \ilObjUser $user)
Copy contents to clipboard.
insertContentNode(\DOMNode $a_cont_node, string $a_pos, int $a_mode=IL_INSERT_AFTER, string $a_pcid="")
ILIAS COPage PC DomainService $pc_service
__construct(\DOMDocument $dom, ?PCDefinition $def=null)
switchEnableMultiple(\ilPageObject $page, array $a_hids, bool $a_self_ass=false)
checkForTag(string $a_content_tag, string $a_hier_id, string $a_pc_id="")
const IL_INSERT_BEFORE
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
const IL_INSERT_CHILD
const IL_INSERT_AFTER
static setAction(string $a_action)
User class.
addToPCClipboard(string $a_content, string $a_time, int $a_nr)
Add a page content item to PC clipboard (should go to another class)
getPCClipboardContent()
Add a page content item to PC clipboard (should go to another class)
static _lookupType(int $id, bool $reference=false)
static _lookupObjId(int $ref_id)
static getUsagesOfPage(int $a_usage_id, string $a_usage_type, int $a_hist_nr=0, bool $a_all_hist_nrs=false, string $a_lang="-")
Get page content usages for page.
Content object of ilPageObject (see ILIAS DTD).
static sortHierIds(array $a_array)
Sort an array of Hier IDS in ascending order.
Class ilPageObject Handles PageObjects of ILIAS Learning Modules (see ILIAS DTD)
getContentObject(string $a_hier_id, string $a_pc_id="")
Get a content object of the page.
getDomDoc()
Get dom doc (DOMDocument)
buildDom(bool $a_force=false)
$c
Definition: deliver.php:25
exit
$ref_id
Definition: ltiauth.php:66
$path
Definition: ltiservices.php:30
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
link(string $caption, string $href, bool $new_viewport=false)
if(!file_exists('../ilias.ini.php'))
global $DIC
Definition: shib_login.php:26