1<?php 2/* Copyright (c) 1998-2009 ILIAS open source, Extended GPL, see docs/LICENSE */ 3 4require_once("./Services/COPage/classes/class.ilPCDataTable.php"); 5require_once("./Services/COPage/classes/class.ilPCTableGUI.php"); 6require_once("./Services/COPage/classes/class.ilPageContentGUI.php"); 7 8/** 9 * Class ilPCTableGUI 10 * 11 * User Interface for Data Table Editing 12 * 13 * @author Alex Killing <alex.killing@gmx.de> 14 * @version $Id$ 15 * 16 * @ingroup ServicesCOPage 17 */ 18class ilPCDataTableGUI extends ilPCTableGUI 19{ 20 /** 21 * @var ilTabsGUI 22 */ 23 protected $tabs; 24 25 26 /** 27 * Constructor 28 * @access public 29 */ 30 public function __construct(&$a_pg_obj, &$a_content_obj, $a_hier_id, $a_pc_id = "") 31 { 32 global $DIC; 33 34 $this->lng = $DIC->language(); 35 $this->ctrl = $DIC->ctrl(); 36 $this->tabs = $DIC->tabs(); 37 parent::__construct($a_pg_obj, $a_content_obj, $a_hier_id, $a_pc_id); 38 $this->setCharacteristics(array("StandardTable" => $this->lng->txt("cont_StandardTable"))); 39 } 40 41 /** 42 * execute command 43 */ 44 public function executeCommand() 45 { 46 $this->getCharacteristicsOfCurrentStyle("table"); // scorm-2004 47 48 // get next class that processes or forwards current command 49 $next_class = $this->ctrl->getNextClass($this); 50 51 // get current command 52 $cmd = $this->ctrl->getCmd(); 53 54 switch ($next_class) { 55 default: 56 $ret = $this->$cmd(); 57 break; 58 } 59 60 return $ret; 61 } 62 63 64 //// 65 //// Classic editing 66 //// 67 68 /** 69 * Edit data of table. (classic version) 70 */ 71 public function editDataCl() 72 { 73 $lng = $this->lng; 74 $ilCtrl = $this->ctrl; 75 //var_dump($_GET); 76 //var_dump($_POST); 77 78 $this->setTabs(); 79 80 $this->displayValidationError(); 81 82 include_once("./Services/COPage/classes/class.ilPCParagraph.php"); 83 84 $this->tpl->addBlockFile("ADM_CONTENT", "adm_content", "tpl.tabledata.html", "Services/COPage"); 85 $dtpl = $this->tpl; 86 //$dtpl = new ilTemplate("tpl.tabledata.html", true, true, "Services/COPage"); 87 $dtpl->setVariable("FORMACTION", $this->ctrl->getFormAction($this, "tableAction")); 88 $dtpl->setVariable("BB_MENU", $this->getBBMenu("cell_0_0")); 89 90 ilYuiUtil::initDragDrop(); 91 ilYuiUtil::initConnection(); 92 ilYuiUtil::initPanel(false); 93 $this->tpl->addJavascript("./Services/COPage/phpBB/3_0_5/editor.js"); 94 $this->tpl->addJavascript("./Services/COPage/js/page_editing.js"); 95 $this->tpl->addJavascript("./Services/COPage/js/paragraph_editing.js"); 96 97 // get all rows 98 $xpc = xpath_new_context($this->dom); 99 $path = "//PageContent[@HierId='" . $this->getHierId() . "']" . 100 "/Table/TableRow"; 101 $res = xpath_eval($xpc, $path); 102 103 for ($i = 0; $i < count($res->nodeset); $i++) { 104 $xpc2 = xpath_new_context($this->dom); 105 $path2 = "//PageContent[@HierId='" . $this->getHierId() . "']" . 106 "/Table/TableRow[$i+1]/TableData"; 107 $res2 = xpath_eval($xpc2, $path2); 108 109 // if this is the first row -> col icons 110 if ($i == 0) { 111 for ($j = 0; $j < count($res2->nodeset); $j++) { 112 if ($j == 0) { 113 $dtpl->touchBlock("empty_td"); 114 } 115 116 if ($j == 0) { 117 if (count($res2->nodeset) == 1) { 118 $move_type = "none"; 119 } else { 120 $move_type = "forward"; 121 } 122 } elseif ($j == (count($res2->nodeset) - 1)) { 123 $move_type = "backward"; 124 } else { 125 $move_type = "both"; 126 } 127 $dtpl->setCurrentBlock("col_icon"); 128 $dtpl->setVariable("COL_ICON_ALT", $lng->txt("content_column")); 129 $dtpl->setVariable("COL_ICON", ilUtil::getImagePath("col.svg")); 130 $dtpl->setVariable("COL_ONCLICK", "COL_" . $move_type); 131 $dtpl->setVariable("NR", $j); 132 $dtpl->parseCurrentBlock(); 133 } 134 $dtpl->setCurrentBlock("row"); 135 $dtpl->parseCurrentBlock(); 136 } 137 138 139 for ($j = 0; $j < count($res2->nodeset); $j++) { 140 // first col: row icons 141 if ($j == 0) { 142 if ($i == 0) { 143 if (count($res->nodeset) == 1) { 144 $move_type = "none"; 145 } else { 146 $move_type = "forward"; 147 } 148 } elseif ($i == (count($res->nodeset) - 1)) { 149 $move_type = "backward"; 150 } else { 151 $move_type = "both"; 152 } 153 $dtpl->setCurrentBlock("row_icon"); 154 $dtpl->setVariable("ROW_ICON_ALT", $lng->txt("content_row")); 155 $dtpl->setVariable("ROW_ICON", ilUtil::getImagePath("row.svg")); 156 $dtpl->setVariable("ROW_ONCLICK", "ROW_" . $move_type); 157 $dtpl->setVariable("NR", $i); 158 $dtpl->parseCurrentBlock(); 159 } 160 161 // cell 162 if ($res2->nodeset[$j]->get_attribute("Hidden") != "Y") { 163 $dtpl->setCurrentBlock("cell"); 164 165 if (is_array($_POST["cmd"]) && key($_POST["cmd"]) == "update") { 166 $s_text = ilUtil::stripSlashes("cell_" . $i . "_" . $j, false); 167 } else { 168 $s_text = ilPCParagraph::xml2output($this->content_obj->getCellText($i, $j)); 169 } 170 171 $dtpl->setVariable("PAR_TA_NAME", "cell[" . $i . "][" . $j . "]"); 172 $dtpl->setVariable("PAR_TA_ID", "cell_" . $i . "_" . $j); 173 $dtpl->setVariable("PAR_TA_CONTENT", $s_text); 174 175 $cs = $res2->nodeset[$j]->get_attribute("ColSpan"); 176 $rs = $res2->nodeset[$j]->get_attribute("RowSpan"); 177 // $dtpl->setVariable("WIDTH", "140"); 178 // $dtpl->setVariable("HEIGHT", "80"); 179 if ($cs > 1) { 180 $dtpl->setVariable("COLSPAN", 'colspan="' . $cs . '"'); 181 $dtpl->setVariable("WIDTH", (140 + ($cs - 1) * 146)); 182 } 183 if ($rs > 1) { 184 $dtpl->setVariable("ROWSPAN", 'rowspan="' . $rs . '"'); 185 $dtpl->setVariable("HEIGHT", (80 + ($rs - 1) * 86)); 186 } 187 $dtpl->parseCurrentBlock(); 188 } 189 } 190 $dtpl->setCurrentBlock("row"); 191 $dtpl->parseCurrentBlock(); 192 } 193 194 // init menues 195 $types = array("row", "col"); 196 $moves = array("none", "backward", "both", "forward"); 197 $commands = array( 198 "row" => array( "newRowAfter" => "cont_ed_new_row_after", 199 "newRowBefore" => "cont_ed_new_row_before", 200 "moveRowUp" => "cont_ed_row_up", 201 "moveRowDown" => "cont_ed_row_down", 202 "deleteRow" => "cont_ed_delete_row"), 203 "col" => array( "newColAfter" => "cont_ed_new_col_after", 204 "newColBefore" => "cont_ed_new_col_before", 205 "moveColLeft" => "cont_ed_col_left", 206 "moveColRight" => "cont_ed_col_right", 207 "deleteCol" => "cont_ed_delete_col") 208 ); 209 foreach ($types as $type) { 210 foreach ($moves as $move) { 211 foreach ($commands[$type] as $command => $lang_var) { 212 if ($move == "none" && (substr($command, 0, 4) == "move" || substr($command, 0, 6) == "delete")) { 213 continue; 214 } 215 if (($move == "backward" && (in_array($command, array("movedown", "moveright")))) || 216 ($move == "forward" && (in_array($command, array("moveup", "moveleft"))))) { 217 continue; 218 } 219 $this->tpl->setCurrentBlock("menu_item"); 220 $this->tpl->setVariable("MENU_ITEM_TITLE", $lng->txt($lang_var)); 221 $this->tpl->setVariable("CMD", $command); 222 $this->tpl->setVariable("TYPE", $type); 223 $this->tpl->parseCurrentBlock(); 224 } 225 $this->tpl->setCurrentBlock("menu"); 226 $this->tpl->setVariable("TYPE", $type); 227 $this->tpl->setVariable("MOVE", $move); 228 $this->tpl->parseCurrentBlock(); 229 } 230 } 231 232 // update/cancel 233 $this->tpl->setCurrentBlock("commands"); 234 $this->tpl->setVariable("BTN_NAME", "update"); 235 $this->tpl->setVariable("BTN_TEXT", $this->lng->txt("save")); 236 $this->tpl->parseCurrentBlock(); 237 238 $this->tpl->setVariable( 239 "FORMACTION2", 240 $ilCtrl->getFormAction($this, "tableAction") 241 ); 242 $this->tpl->setVariable("TXT_ACTION", $this->lng->txt("cont_table")); 243 } 244 245 /** 246 * Update table data in dom and update page in db 247 */ 248 public function update($a_redirect = true) 249 { 250 $lng = $this->lng; 251 252 // handle input data 253 include_once("./Services/COPage/classes/class.ilPCParagraph.php"); 254 $data = array(); 255 //var_dump($_POST["cell"]); 256 //var_dump($_GET); 257 if (is_array($_POST["cell"])) { 258 foreach ($_POST["cell"] as $i => $row) { 259 if (is_array($row)) { 260 foreach ($row as $j => $cell) { 261 $data[$i][$j] = 262 ilPCParagraph::_input2xml( 263 $cell, 264 $this->content_obj->getLanguage() 265 ); 266 } 267 } 268 } 269 } 270 271 $this->updated = $this->content_obj->setData($data); 272 273 if ($this->updated !== true) { 274 $this->editData(); 275 return; 276 } 277 278 $this->updated = $this->pg_obj->update(); 279 280 if ($a_redirect) { 281 ilUtil::sendSuccess($lng->txt("msg_obj_modified"), true); 282 $this->ctrl->redirect($this, "editData"); 283 } 284 } 285 286 /** 287 * Update via JavaScript 288 */ 289 public function updateJS() 290 { 291 $lng = $this->lng; 292 $ilCtrl = $this->ctrl; 293 294 if ($_POST["cancel_update"]) { 295 // $this->ctrl->redirect($this, "editData"); 296 $this->ctrl->returnToParent($this, "jump" . $this->hier_id); 297 } 298 299 // handle input data 300 include_once("./Services/COPage/classes/class.ilPCParagraph.php"); 301 include_once("./Services/COPage/classes/class.ilPCParagraphGUI.php"); 302 $data = array(); 303 foreach ($_POST as $k => $content) { 304 if (substr($k, 0, 5) != "cell_") { 305 continue; 306 } 307 308 // determine cell content 309 $div = ilUtil::stripSlashes($content, false); 310 $p1 = strpos($div, '>'); 311 $div = substr($div, $p1 + 1); 312 $div = "<div class='ilc_text_block_TableContent'>" . $div; 313 $text = ilPCParagraph::handleAjaxContent($div); 314 if ($text === false) { 315 $ilCtrl->returnToParent($this, "jump" . $this->hier_id); 316 } 317 $text = $text["text"]; 318 319 $text = ilPCParagraph::_input2xml( 320 $text, 321 $this->content_obj->getLanguage(), 322 true, 323 false 324 ); 325 $text = ilPCParagraph::handleAjaxContentPost($text); 326 327 // set content in data array 328 $id = explode("_", $k); 329 $data[(int) $id[1]][(int) $id[2]] = $text; 330 } 331 332 // update data 333 $this->updated = $this->content_obj->setData($data); 334 335 if ($this->updated !== true) { 336 $this->editData(); 337 return; 338 } 339 340 $this->updated = $this->pg_obj->update(); 341 342 343 // perform table action? (move...?) 344 //$this->update(false); 345 $this->pg_obj->addHierIDs(); 346 $failed = false; 347 if ($_POST["tab_cmd"] != "") { 348 $cell_hier_id = ($_POST["tab_cmd_type"] == "col") 349 ? $this->hier_id . "_1_" . ($_POST["tab_cmd_id"] + 1) 350 : $this->hier_id . "_" . ($_POST["tab_cmd_id"] + 1) . "_1"; 351 $cell_obj = $this->pg_obj->getContentObject($cell_hier_id); 352 if (is_object($cell_obj)) { 353 $tab_cmd = $_POST["tab_cmd"]; 354 $cell_obj->$tab_cmd(); 355 $ret = $this->pg_obj->update(); 356 if ($ret !== true) { 357 ilUtil::sendFailure($ret[0][1], true); 358 $failed = true; 359 } 360 } 361 } 362 363 if (!$failed) { 364 ilUtil::sendSuccess($lng->txt("msg_obj_modified"), true); 365 } 366 if ($_POST["save_return"]) { 367 $this->ctrl->returnToParent($this, "jump" . $this->hier_id); 368 } else { 369 $this->ctrl->redirect($this, "editData"); 370 } 371 } 372 373 374 /** 375 * Get new table object 376 */ 377 public function getNewTableObject() 378 { 379 return new ilPCDataTable($this->getPage()); 380 } 381 382 /** 383 * After creation processing 384 */ 385 public function afterCreation() 386 { 387 $ilCtrl = $this->ctrl; 388 389 $this->pg_obj->stripHierIDs(); 390 $this->pg_obj->addHierIDs(); 391 $ilCtrl->setParameter($this, "hier_id", $this->content_obj->readHierId()); 392 $ilCtrl->setParameter($this, "pc_id", $this->content_obj->readPCId()); 393 $this->content_obj->setHierId($this->content_obj->readHierId()); 394 $this->setHierId($this->content_obj->readHierId()); 395 $this->content_obj->setPCId($this->content_obj->readPCId()); 396 $this->editData(); 397 } 398 399 /** 400 * Perform operation on table (adding, moving, deleting rows/cols) 401 */ 402 public function tableAction() 403 { 404 $ilCtrl = $this->ctrl; 405 406 $this->update(false); 407 $this->pg_obj->addHierIDs(); 408 409 $cell_hier_id = ($_POST["type"] == "col") 410 ? $this->hier_id . "_1_" . ($_POST["id"] + 1) 411 : $this->hier_id . "_" . ($_POST["id"] + 1) . "_1"; 412 $cell_obj = $this->pg_obj->getContentObject($cell_hier_id); 413 if (is_object($cell_obj)) { 414 $action = (string) ($_POST["action"]); 415 $cell_obj->$action(); 416 $_SESSION["il_pg_error"] = $this->pg_obj->update(); 417 } 418 $ilCtrl->redirect($this, "editData"); 419 } 420 421 /** 422 * Set tabs 423 */ 424 public function setTabs() 425 { 426 $ilCtrl = $this->ctrl; 427 $ilTabs = $this->tabs; 428 429 parent::setTabs(); 430 431 $ilTabs->addTarget( 432 "cont_ed_edit_data", 433 $ilCtrl->getLinkTarget($this, "editData"), 434 "editData", 435 get_class($this) 436 ); 437 } 438 439 440 //// 441 //// Full JS implementation 442 //// 443 444 /** 445 * Edit data of table 446 */ 447 public function editData() 448 { 449 $lng = $this->lng; 450 $ilCtrl = $this->ctrl; 451 452 453 if (!ilPageEditorGUI::_doJSEditing()) { 454 return $this->editDataCl(); 455 } 456 457 //var_dump($_GET); 458 //var_dump($_POST); 459 460 $this->setTabs(); 461 462 $this->displayValidationError(); 463 464 465 include_once("./Services/COPage/classes/class.ilPCParagraph.php"); 466 467 //$this->tpl->addBlockFile("ADM_CONTENT", "adm_content", "tpl.tabledata2.html", "Services/COPage"); 468 //$dtpl = $this->tpl; 469 $dtpl = new ilTemplate("tpl.tabledata2.html", true, true, "Services/COPage"); 470 $dtpl->setVariable("FORMACTION", $this->ctrl->getFormAction($this, "tableAction")); 471 472 473 $dtpl->setVariable( 474 "WYSIWYG_ACTION", 475 $ilCtrl->getFormAction($this, "updateJS") 476 ); 477 478 // get all rows 479 $xpc = xpath_new_context($this->dom); 480 $path = "//PageContent[@HierId='" . $this->getHierId() . "']" . 481 "/Table/TableRow"; 482 $res = xpath_eval($xpc, $path); 483 484 for ($i = 0; $i < count($res->nodeset); $i++) { 485 $xpc2 = xpath_new_context($this->dom); 486 $path2 = "//PageContent[@HierId='" . $this->getHierId() . "']" . 487 "/Table/TableRow[$i+1]/TableData"; 488 $res2 = xpath_eval($xpc2, $path2); 489 490 // if this is the first row -> col icons 491 if ($i == 0) { 492 for ($j = 0; $j < count($res2->nodeset); $j++) { 493 if ($j == 0) { 494 $dtpl->touchBlock("empty_td"); 495 } 496 497 if ($j == 0) { 498 if (count($res2->nodeset) == 1) { 499 $move_type = "none"; 500 } else { 501 $move_type = "forward"; 502 } 503 } elseif ($j == (count($res2->nodeset) - 1)) { 504 $move_type = "backward"; 505 } else { 506 $move_type = "both"; 507 } 508 $dtpl->setCurrentBlock("col_icon"); 509 $dtpl->setVariable("COL_ICON_ALT", $lng->txt("content_column")); 510 $dtpl->setVariable("COL_ICON", ilUtil::getImagePath("col.svg")); 511 $dtpl->setVariable("COL_ONCLICK", "COL_" . $move_type); 512 $dtpl->setVariable("NR", $j); 513 $dtpl->parseCurrentBlock(); 514 } 515 $dtpl->setCurrentBlock("row"); 516 $dtpl->parseCurrentBlock(); 517 } 518 519 520 for ($j = 0; $j < count($res2->nodeset); $j++) { 521 // first col: row icons 522 if ($j == 0) { 523 if ($i == 0) { 524 if (count($res->nodeset) == 1) { 525 $move_type = "none"; 526 } else { 527 $move_type = "forward"; 528 } 529 } elseif ($i == (count($res->nodeset) - 1)) { 530 $move_type = "backward"; 531 } else { 532 $move_type = "both"; 533 } 534 $dtpl->setCurrentBlock("row_icon"); 535 $dtpl->setVariable("ROW_ICON_ALT", $lng->txt("content_row")); 536 $dtpl->setVariable("ROW_ICON", ilUtil::getImagePath("row.svg")); 537 $dtpl->setVariable("ROW_ONCLICK", "ROW_" . $move_type); 538 $dtpl->setVariable("NR", $i); 539 $dtpl->parseCurrentBlock(); 540 } 541 542 // cell 543 if ($res2->nodeset[$j]->get_attribute("Hidden") != "Y") { 544 $dtpl->setCurrentBlock("cell"); 545 546 if (is_array($_POST["cmd"]) && key($_POST["cmd"]) == "update") { 547 $s_text = ilUtil::stripSlashes("cell_" . $i . "_" . $j, false); 548 } else { 549 $s_text = ilPCParagraph::xml2output( 550 $this->content_obj->getCellText($i, $j), 551 true, 552 false 553 ); 554 include_once("./Services/COPage/classes/class.ilPCParagraphGUI.php"); 555 $s_text = ilPCParagraphGUI::xml2outputJS( 556 $s_text, 557 "TableContent", 558 $this->content_obj->readPCId() . "_" . $i . "_" . $j 559 ); 560 } 561 562 // #20628 563 $s_text = str_replace("{", "{", $s_text); 564 $s_text = str_replace("}", "}", $s_text); 565 566 $dtpl->setVariable("PAR_TA_NAME", "cell[" . $i . "][" . $j . "]"); 567 $dtpl->setVariable("PAR_TA_ID", "cell_" . $i . "_" . $j); 568 569 $dtpl->setVariable("PAR_TA_CONTENT", $s_text); 570 571 $cs = $res2->nodeset[$j]->get_attribute("ColSpan"); 572 $rs = $res2->nodeset[$j]->get_attribute("RowSpan"); 573 $dtpl->setVariable("WIDTH", "140"); 574 $dtpl->setVariable("HEIGHT", "80"); 575 if ($cs > 1) { 576 $dtpl->setVariable("COLSPAN", 'colspan="' . $cs . '"'); 577 $dtpl->setVariable("WIDTH", (140 + ($cs - 1) * 146)); 578 } 579 if ($rs > 1) { 580 $dtpl->setVariable("ROWSPAN", 'rowspan="' . $rs . '"'); 581 $dtpl->setVariable("HEIGHT", (80 + ($rs - 1) * 86)); 582 } 583 $dtpl->parseCurrentBlock(); 584 } 585 } 586 $dtpl->setCurrentBlock("row"); 587 $dtpl->parseCurrentBlock(); 588 } 589 590 // init menues 591 $types = array("row", "col"); 592 $moves = array("none", "backward", "both", "forward"); 593 $commands = array( 594 "row" => array( "newRowAfter" => "cont_ed_new_row_after", 595 "newRowBefore" => "cont_ed_new_row_before", 596 "moveRowUp" => "cont_ed_row_up", 597 "moveRowDown" => "cont_ed_row_down", 598 "deleteRow" => "cont_ed_delete_row"), 599 "col" => array( "newColAfter" => "cont_ed_new_col_after", 600 "newColBefore" => "cont_ed_new_col_before", 601 "moveColLeft" => "cont_ed_col_left", 602 "moveColRight" => "cont_ed_col_right", 603 "deleteCol" => "cont_ed_delete_col") 604 ); 605 606 foreach ($types as $type) { 607 foreach ($moves as $move) { 608 foreach ($commands[$type] as $command => $lang_var) { 609 if ($move == "none" && (substr($command, 0, 4) == "move" || substr($command, 0, 6) == "delete")) { 610 continue; 611 } 612 if (($move == "backward" && (in_array($command, array("movedown", "moveright")))) || 613 ($move == "forward" && (in_array($command, array("moveup", "moveleft"))))) { 614 continue; 615 } 616 $dtpl->setCurrentBlock("menu_item"); 617 $dtpl->setVariable("MENU_ITEM_TITLE", $lng->txt($lang_var)); 618 $dtpl->setVariable("CMD", $command); 619 $dtpl->setVariable("TYPE", $type); 620 $dtpl->parseCurrentBlock(); 621 } 622 $dtpl->setCurrentBlock("menu"); 623 $dtpl->setVariable("TYPE", $type); 624 $dtpl->setVariable("MOVE", $move); 625 $dtpl->parseCurrentBlock(); 626 } 627 } 628 629 630 $dtpl->setVariable( 631 "FORMACTION2", 632 $ilCtrl->getFormAction($this, "tableAction") 633 ); 634 $dtpl->setVariable("TXT_ACTION", $this->lng->txt("cont_table")); 635 636 // js editing preparation 637 include_once("./Services/YUI/classes/class.ilYuiUtil.php"); 638 ilYuiUtil::initDragDrop(); 639 ilYuiUtil::initConnection(); 640 ilYuiUtil::initPanel(false); 641 //$GLOBALS["tpl"]->addJavascript("Services/COPage/tiny/4_2_4/tinymce.js"); 642 $GLOBALS["tpl"]->addJavascript("./libs/bower/bower_components/tinymce/tinymce.min.js"); 643 $GLOBALS["tpl"]->addJavaScript("./Services/COPage/js/ilcopagecallback.js"); 644 $GLOBALS["tpl"]->addJavascript("Services/COPage/js/page_editing.js"); 645 646 $GLOBALS["tpl"]->addOnloadCode("var preloader = new Image(); 647 preloader.src = './templates/default/images/loader.svg'; 648 ilCOPage.setContentCss('" . 649 ilObjStyleSheet::getContentStylePath((int) $this->getStyleId()) . 650 ", " . ilUtil::getStyleSheetLocation() . ", ./Services/COPage/css/tiny_extra.css'); 651 ilCOPage.editTD('cell_0_0'); 652 "); 653 foreach (ilPCParagraphGUI::_getTextCharacteristics($this->getStyleId()) as $c) { 654 $GLOBALS["tpl"]->addOnloadCode("ilCOPage.addTextFormat('" . $c . "');"); 655 } 656 657 $cfg = $this->getPageConfig(); 658 659 $dtpl->setVariable( 660 "IL_TINY_MENU", 661 ilPageObjectGUI::getTinyMenu( 662 $this->pg_obj->getParentType(), 663 $cfg->getEnableInternalLinks(), 664 $cfg->getEnableWikiLinks(), 665 $cfg->getEnableKeywords(), 666 $this->getStyleId(), 667 false, 668 true, 669 $cfg->getEnableAnchors(), 670 false 671 ) 672 ); 673 674 // add int link parts 675 if ($cfg->getEnableInternalLinks() || $cfg->getEnableWikiLinks()) { 676 include_once("./Services/Link/classes/class.ilInternalLinkGUI.php"); 677 $dtpl->setCurrentBlock("int_link_prep"); 678 $dtpl->setVariable("INT_LINK_PREP", ilInternalLinkGUI::getInitHTML( 679 $ilCtrl->getLinkTargetByClass( 680 array("ilpageeditorgui", "ilinternallinkgui"), 681 "", 682 false, 683 true, 684 false 685 ) 686 )); 687 } 688 689 $this->tpl->setContent($dtpl->get()); 690 } 691} 692