Пример #1
0
 public function testSetGetSettings()
 {
     include_once "./Services/XHTMLPage/classes/class.ilXHTMLPage.php";
     $page = new ilXHTMLPage();
     $page->setContent("aaa");
     $page->save();
     $page_id = $page->getId();
     // save/read
     $page = new ilXHTMLPage($page_id);
     if ($page->getContent() == "aaa") {
         $result .= "saveread-";
     }
     $page->setContent("bbb");
     $page->save();
     // lookups
     if (ilXHTMLPage::_lookupContent($page_id) == "bbb") {
         $result .= "lookupContent-";
     }
     if (ilXHTMLPage::_lookupSavedContent($page_id) == "aaa") {
         $result .= "lookupSavedContent-";
     }
     // undo
     $page->undo();
     if (ilXHTMLPage::_lookupContent($page_id) == "aaa") {
         $result .= "undo1-";
     }
     if (ilXHTMLPage::_lookupSavedContent($page_id) == "bbb") {
         $result .= "undo2-";
     }
     // clear
     $page->clear();
     if (ilXHTMLPage::_lookupContent($page_id) == "") {
         $result .= "clear1-";
     }
     if (ilXHTMLPage::_lookupSavedContent($page_id) == "aaa") {
         $result .= "clear2-";
     }
     $this->assertEquals("saveread-lookupContent-lookupSavedContent-undo1-undo2-clear1-clear2-", $result);
 }
Пример #2
0
 function savePageContentObject()
 {
     include_once "Services/XHTMLPage/classes/class.ilXHTMLPage.php";
     include_once "./Services/AdvancedEditing/classes/class.ilObjAdvancedEditing.php";
     $xpage_id = ilContainer::_lookupContainerSetting($this->object->getId(), "xhtml_page");
     /*include_once("./Services/Form/classes/class.ilFormPropertyGUI.php");
     		include_once("./Services/Form/classes/class.ilTextAreaInputGUI.php");
     		$ta = new ilTextAreaInputGUI();
     		$ta->setRteTagSet("extended_table_img");
     		$tags = $ta->getRteTagString();*/
     //$text = ilUtil::stripSlashes($_POST["page_content"],
     //		true,
     //		$tags);
     $text = ilUtil::stripSlashes($_POST["page_content"], true, ilObjAdvancedEditing::_getUsedHTMLTagsAsString());
     if ($xpage_id > 0) {
         $xpage = new ilXHTMLPage($xpage_id);
         $xpage->setContent($text);
         $xpage->save();
     } else {
         $xpage = new ilXHTMLPage();
         $xpage->setContent($text);
         $xpage->save();
         ilContainer::_writeContainerSetting($this->object->getId(), "xhtml_page", $xpage->getId());
     }
     include_once "Services/RTE/classes/class.ilRTE.php";
     ilRTE::_cleanupMediaObjectUsage($text, $this->object->getType() . ":html", $this->object->getId());
     ilUtil::sendSuccess($this->lng->txt("msg_obj_modified"), true);
     $this->ctrl->redirect($this, "");
 }
Пример #3
0
 /**
  * Undo last change.
  */
 function undo()
 {
     global $ilDB;
     if ($this->getId() > 0) {
         $content = ilXHTMLPage::_lookupContent($this->getId());
         $save_content = ilXHTMLPage::_lookupSavedContent($this->getId());
         $ilDB->update("xhtml_page", array("content" => array("clob", $save_content), "save_content" => array("clob", $content)), array("id" => array("integer", $this->getId())));
     }
 }