Public Member Functions

ilPCParagraphGUI Class Reference

Inheritance diagram for ilPCParagraphGUI:
Collaboration diagram for ilPCParagraphGUI:

Public Member Functions

 ilPCParagraphGUI (&$a_pg_obj, &$a_content_obj, $a_hier_id)
 Constructor public.
executeCommand ()
 execute command
 edit ()
 edit paragraph form
 insert ()
 insert paragraph form
 update ()
 update paragraph in dom and update page in db
 create ()
 create new paragraph in dom and update page in db
 popup ()
 popup window for wysiwyg editor
 setTabs ()
 output tabs
 getTabs (&$tabs_gui)
 adds tabs to tab gui object

Detailed Description

Definition at line 38 of file class.ilPCParagraphGUI.php.


Member Function Documentation

ilPCParagraphGUI::create (  ) 

create new paragraph in dom and update page in db

Definition at line 488 of file class.ilPCParagraphGUI.php.

References $_POST, $_SESSION, and insert().

        {

                $this->content_obj =& new ilPCParagraph($this->dom);
                $this->content_obj->create($this->pg_obj, $this->hier_id);
                $this->content_obj->setLanguage($_POST["par_language"]);
                $_SESSION["il_text_lang_".$_GET["ref_id"]] = $_POST["par_language"];
                $this->content_obj->setCharacteristic($_POST["par_characteristic"]);

                $this->updated = $this->content_obj->setText(
                        $this->content_obj->input2xml($_POST["par_content"],
                                $_POST["usedwsiwygeditor"]));

                if ($this->updated !== true)
                {
                        $this->insert();
                        return;
                }
                $this->updated = $this->pg_obj->update();

                if ($this->updated === true)
                {
                        $this->ctrl->returnToParent($this, "jump".$this->hier_id);
                }
                else
                {
                        $this->insert();
                }
        }

Here is the call graph for this function:

ilPCParagraphGUI::edit (  ) 

edit paragraph form

Definition at line 75 of file class.ilPCParagraphGUI.php.

References $_GET, $_POST, ilPageContentGUI::$ilias, $lang, ilPageEditorGUI::_doJSEditing(), ilObjContentObject::_lookupStyleSheetId(), ilPageContentGUI::displayValidationError(), formSelect(), ilObjStyleSheet::getContentStylePath(), ilMetaData::getLanguages(), ilUtil::getStyleSheetLocation(), setTabs(), and ilUtil::stripSlashes().

Referenced by update().

        {
                global $ilUser, $ilias;
                
                // set tabs
                $this->setTabs();

                $this->tpl->addBlockFile("ADM_CONTENT", "adm_content", "tpl.paragraph_edit.html", "content");
                //$content = $this->pg_obj->getContent();
                //$cnt = 1;
                $this->tpl->setVariable("TXT_ACTION", $this->lng->txt("cont_edit_par"));
                $this->tpl->setVariable("FORMACTION", $this->ctrl->getFormAction($this));
                $this->tpl->setVariable("REF_ID", $_GET["ref_id"]);
                
                $this->tpl->setVariable("EDITOR_URL", ILIAS_HTTP_PATH."/content/htmlarea/");
                $this->tpl->setVariable("JS_HTMLAREA", ILIAS_HTTP_PATH."/content/htmlarea/htmlarea.js");
                $this->tpl->setVariable("JS_HANDLETAGS", ILIAS_HTTP_PATH."/content/js/handletags.js");
                $this->ctrl->setParameter($this, "ptype", "footnote");
                $this->tpl->setVariable("POPUP_TARGET_FOOTNOTE",
                        $this->ctrl->getLinkTarget($this, "popup"));    
                $this->ctrl->setParameter($this, "ptype", "xtl");
                $this->tpl->setVariable("POPUP_TARGET_XTL",
                        $this->ctrl->getLinkTarget($this, "popup"));
                        
                $this->tpl->setVariable("TXT_STR", $this->lng->txt("cont_text_str"));
                $this->tpl->setVariable("TXT_EMP", $this->lng->txt("cont_text_emp"));
                $this->tpl->setVariable("TXT_COM", $this->lng->txt("cont_text_com"));
                $this->tpl->setVariable("TXT_FN", $this->lng->txt("cont_text_fn"));
                $this->tpl->setVariable("TXT_QUOT", $this->lng->txt("cont_text_quot"));
                $this->tpl->setVariable("TXT_CODE", $this->lng->txt("cont_text_code"));
                $this->tpl->setVariable("TXT_ILN", $this->lng->txt("cont_text_iln"));
                $this->tpl->setVariable("TXT_XLN", $this->lng->txt("cont_text_xln"));
                $this->tpl->setVariable("TXT_TEX", $this->lng->txt("cont_text_tex"));

                include_once("./classes/class.ilObjStyleSheet.php");
                
                if ($this->pg_obj->getParentType() == "gdf" ||
                        $this->pg_obj->getParentType() == "lm" ||
                        $this->pg_obj->getParentType() == "dbk")
                {
                        $this->tpl->setVariable("TXT_FORMATERROR",$this->lng->txt("cont_format_error"));
                        
                        $this->tpl->setVariable("LOCATION_STYLESHEET_HTMLAREA",
                                ilUtil::getStyleSheetLocation());
                                
                        if ($this->pg_obj->getParentType() != "gdf")
                        {
                                $this->tpl->setVariable("LOCATION_CONTENT_STYLESHEET_HTMLAREA",
                                        ilObjStyleSheet::getContentStylePath(
                                                ilObjContentObject::_lookupStyleSheetId($this->pg_obj->getParentId())));
                                $this->tpl->setVariable("LOCATION_CONTENT_STYLESHEET",
                                        ilObjStyleSheet::getContentStylePath(
                                                ilObjContentObject::_lookupStyleSheetId($this->pg_obj->getParentId())));
                        }
                        else
                        {
                                $this->tpl->setVariable("LOCATION_CONTENT_STYLESHEET_HTMLAREA",
                                        ilObjStyleSheet::getContentStylePath(0));
                                $this->tpl->setVariable("LOCATION_CONTENT_STYLESHEET",
                                        ilObjStyleSheet::getContentStylePath(0));
                        }

                        if (!ilPageEditorGUI::_doJSEditing())
                        {
                                $this->tpl->setCurrentBlock("bb_ilink_button");
                                $this->tpl->setVariable("BB_LINK_ILINK",
                                        $this->ctrl->getLinkTargetByClass("ilInternalLinkGUI", "showLinkHelp"));
                                $this->tpl->setVariable("BB_TXT_ILINK", "[".$this->lng->txt("cont_internal_link")."]");
                                $this->tpl->setCurrentBlock("bb_buttons");
                                $this->tpl->parseCurrentBlock();
                        }
                        else
                        {
                                $this->tpl->setVariable("LINK_ILINK",
                                        $this->ctrl->getLinkTargetByClass("ilInternalLinkGUI", "showLinkHelp"));
                                $this->tpl->setVariable("TXT_ILINK", "[".$this->lng->txt("cont_internal_link")."]");
                        }
                        
                        $this->tpl->setVariable("REMOVELINK",$this->lng->txt("cont_removeiln"));
                                                
                        $this->tpl->touchBlock("internal_link_active1");
                        $this->tpl->touchBlock("internal_link_active2");
                }
                else
                {
                        $this->tpl->setVariable("LOCATION_STYLESHEET_HTMLAREA",
                                ilUtil::getStyleSheetLocation());
                        $this->tpl->setVariable("LOCATION_CONTENT_STYLESHEET_HTMLAREA",
                                ilObjStyleSheet::getContentStylePath(0));
                        if (!ilPageEditorGUI::_doJSEditing())
                        {
                                $this->tpl->touchBlock("bb_buttons");
                        }
                }

                $this->displayValidationError();

                // language and characteristic selection
                if (key($_POST["cmd"]) == "update")
                {
                        $s_lang = $_POST["par_language"];
                        $s_char = $_POST["par_characteristic"];
                }
                else
                {
                        $s_lang = $this->content_obj->getLanguage();
                        $s_char = $this->content_obj->getCharacteristic();
                }
                $this->tpl->setVariable("TXT_LANGUAGE", $this->lng->txt("language"));
                require_once("classes/class.ilMetaData.php");
                $lang = ilMetaData::getLanguages();
                $select_lang = ilUtil::formSelect ($s_lang,"par_language",$lang,false,true);
                $this->tpl->setVariable("SELECT_LANGUAGE", $select_lang);
                $char = array("" => $this->lng->txt("none"),
                        "Headline1" => $this->lng->txt("cont_Headline1"),
                        "Headline2" => $this->lng->txt("cont_Headline2"),
                        "Headline3" => $this->lng->txt("cont_Headline3"),
                        "Example" => $this->lng->txt("cont_Example"),
                        "Citation" => $this->lng->txt("cont_Citation"),
                        "Mnemonic" => $this->lng->txt("cont_Mnemonic"),
                        "Additional" => $this->lng->txt("cont_Additional"),
                        "List" => $this->lng->txt("cont_List"),
                        "Remark" => $this->lng->txt("cont_Remark"),
                        // "Code" => $this->lng->txt("cont_Code"),
                        "TableContent" => $this->lng->txt("cont_TableContent")
                        );
                $this->tpl->setVariable("TXT_CHARACTERISTIC", $this->lng->txt("cont_characteristic"));
                $select_char = ilUtil::formSelect ($s_char,
                        "par_characteristic",$char,false,true);
                $this->tpl->setVariable("SELECT_CHARACTERISTIC", $select_char);

                if (key($_POST["cmd"]) == "update")
                {
                        $s_text = ilUtil::stripSlashes($_POST["par_content"], false);
                }
                else
                {
                        $s_text = $this->content_obj->xml2output($this->content_obj->getText());
                }
                $this->tpl->setVariable("PAR_TA_NAME", "par_content");

                if (ilPageEditorGUI::_doJSEditing())
                {
                        // this line is necessary to prevent unwanted converts
                        // e.g. an entered "&lt;" to a "<"
                        $s_text = str_replace("&","&amp;", $s_text);

                        $this->tpl->setVariable("PAR_TA_CONTENT", $s_text);
                        $this->tpl->touchBlock("initwysiwygeditor");
                }
                else
                {
                        $this->tpl->setVariable("PAR_TA_CONTENT", $s_text);
                }

                $this->tpl->parseCurrentBlock();

                // operations
                $this->tpl->setCurrentBlock("commands");
                $this->tpl->setVariable("BTN_NAME", "update");
                $this->tpl->setVariable("BTN_TEXT", $this->lng->txt("save"));
                $this->tpl->setVariable("BTN_CANCEL", "cancelUpdate");
                $this->tpl->setVariable("TXT_CANCEL", $this->lng->txt("cancel"));
                $this->tpl->parseCurrentBlock();

        }

Here is the call graph for this function:

Here is the caller graph for this function:

& ilPCParagraphGUI::executeCommand (  ) 

execute command

Definition at line 54 of file class.ilPCParagraphGUI.php.

References $cmd.

        {
                // get next class that processes or forwards current command
                $next_class = $this->ctrl->getNextClass($this);

                // get current command
                $cmd = $this->ctrl->getCmd();

                switch($next_class)
                {
                        default:
                                $ret =& $this->$cmd();
                                break;
                }

                return $ret;
        }

ilPCParagraphGUI::getTabs ( &$  tabs_gui  ) 

adds tabs to tab gui object

Parameters:
object $tabs_gui ilTabsGUI object

Definition at line 548 of file class.ilPCParagraphGUI.php.

Referenced by setTabs().

        {
                // back to upper context
                /*
                $tabs_gui->addTarget("cont_back",
                        $this->ctrl->getParentReturn($this), "",
                        "");
                */
        }

Here is the caller graph for this function:

ilPCParagraphGUI::ilPCParagraphGUI ( &$  a_pg_obj,
&$  a_content_obj,
a_hier_id 
)

Constructor public.

Definition at line 45 of file class.ilPCParagraphGUI.php.

References ilPageContentGUI::ilPageContentGUI().

        {
                parent::ilPageContentGUI($a_pg_obj, $a_content_obj, $a_hier_id);
        }

Here is the call graph for this function:

ilPCParagraphGUI::insert (  ) 

insert paragraph form

Definition at line 246 of file class.ilPCParagraphGUI.php.

References $_GET, $_POST, $_SESSION, $lang, ilPageEditorGUI::_doJSEditing(), ilObjContentObject::_lookupStyleSheetId(), ilPageContentGUI::displayValidationError(), formSelect(), ilObjStyleSheet::getContentStylePath(), ilPageContentGUI::getHierId(), ilMetaData::getLanguages(), ilUtil::getStyleSheetLocation(), setTabs(), and ilUtil::stripSlashes().

Referenced by create().

        {
                global $ilUser;

                // set tabs
                $this->setTabs();

                // add paragraph edit template
                $this->tpl->addBlockFile("ADM_CONTENT", "adm_content", "tpl.paragraph_edit.html", "content");
                $this->tpl->setVariable("TXT_ACTION", $this->lng->txt("cont_insert_par"));
                $this->tpl->setVariable("FORMACTION", $this->ctrl->getFormAction($this));
                $this->tpl->setVariable("REF_ID", $_GET["ref_id"]);

                $this->tpl->setVariable("EDITOR_URL", ILIAS_HTTP_PATH."/content/htmlarea/");
                $this->tpl->setVariable("JS_HTMLAREA", ILIAS_HTTP_PATH."/content/htmlarea/htmlarea.js");
                $this->tpl->setVariable("JS_HANDLETAGS", ILIAS_HTTP_PATH."/content/js/handletags.js");
                $this->ctrl->setParameter($this, "ptype", "footnote");
                $this->tpl->setVariable("POPUP_TARGET_FOOTNOTE",
                        $this->ctrl->getLinkTarget($this, "popup"));    
                $this->ctrl->setParameter($this, "ptype", "xtl");
                $this->tpl->setVariable("POPUP_TARGET_XTL",
                        $this->ctrl->getLinkTarget($this, "popup"));    

                $this->tpl->setVariable("TXT_STR", $this->lng->txt("cont_text_str"));
                $this->tpl->setVariable("TXT_EMP", $this->lng->txt("cont_text_emp"));
                $this->tpl->setVariable("TXT_COM", $this->lng->txt("cont_text_com"));
                $this->tpl->setVariable("TXT_FN", $this->lng->txt("cont_text_fn"));
                $this->tpl->setVariable("TXT_QUOT", $this->lng->txt("cont_text_quot"));
                $this->tpl->setVariable("TXT_CODE", $this->lng->txt("cont_text_code"));
                $this->tpl->setVariable("TXT_ILN", $this->lng->txt("cont_text_iln"));
                $this->tpl->setVariable("TXT_XLN", $this->lng->txt("cont_text_xln"));
                $this->tpl->setVariable("TXT_TEX", $this->lng->txt("cont_text_tex"));

                include_once("./classes/class.ilObjStyleSheet.php");
                
                if ($this->pg_obj->getParentType() == "gdf" ||
                        $this->pg_obj->getParentType() == "lm" ||
                        $this->pg_obj->getParentType() == "dbk")
                {
                        $this->tpl->setVariable("TXT_FORMATERROR",$this->lng->txt("cont_format_error"));
                        
                        if ($this->pg_obj->getParentType() != "gdf")
                        {
                                $this->tpl->setVariable("LOCATION_CONTENT_STYLESHEET_HTMLAREA",
                                        ilObjStyleSheet::getContentStylePath(
                                                ilObjContentObject::_lookupStyleSheetId($this->pg_obj->getParentId())));
                                $this->tpl->setVariable("LOCATION_CONTENT_STYLESHEET",
                                        ilObjStyleSheet::getContentStylePath(
                                                ilObjContentObject::_lookupStyleSheetId($this->pg_obj->getParentId())));
                        }
                        else
                        {
                                $this->tpl->setVariable("LOCATION_CONTENT_STYLESHEET_HTMLAREA",
                                        ilObjStyleSheet::getContentStylePath(0));
                                $this->tpl->setVariable("LOCATION_CONTENT_STYLESHEET",
                                        ilObjStyleSheet::getContentStylePath(0));
                        }                                       
                                        
                        $this->tpl->setVariable("LOCATION_STYLESHEET_HTMLAREA",
                                ilUtil::getStyleSheetLocation());                       

                        if (!ilPageEditorGUI::_doJSEditing())
                        {
                                $this->tpl->setCurrentBlock("bb_ilink_button");
                                $this->tpl->setVariable("BB_LINK_ILINK",
                                        $this->ctrl->getLinkTargetByClass("ilInternalLinkGUI", "showLinkHelp"));
                                $this->tpl->setVariable("BB_TXT_ILINK", "[".$this->lng->txt("cont_internal_link")."]");
                                $this->tpl->parseCurrentBlock();
                                $this->tpl->setCurrentBlock("bb_buttons");
                                $this->tpl->parseCurrentBlock();
                        }
                        else
                        {
                                $this->tpl->setVariable("LINK_ILINK",
                                        $this->ctrl->getLinkTargetByClass("ilInternalLinkGUI", "showLinkHelp"));
                                $this->tpl->setVariable("TXT_ILINK", "[".$this->lng->txt("cont_internal_link")."]");
                        }
                        
                        $this->tpl->touchBlock("internal_link_active1");
                        $this->tpl->touchBlock("internal_link_active2");
                }
                else
                {
                        $this->tpl->setVariable("LOCATION_STYLESHEET_HTMLAREA",
                                ilUtil::getStyleSheetLocation());
                        $this->tpl->setVariable("LOCATION_CONTENT_STYLESHEET_HTMLAREA",
                                ilObjStyleSheet::getContentStylePath(0));
                        if (!ilPageEditorGUI::_doJSEditing())
                        {
                                $this->tpl->touchBlock("bb_buttons");
                        }
                }
                
                $this->displayValidationError();

                // language and characteristic selection
                $this->tpl->setVariable("TXT_LANGUAGE", $this->lng->txt("language"));
                require_once("classes/class.ilMetaData.php");
                $lang = ilMetaData::getLanguages();

                // get values from new object (repeated form display on error)
                //if (is_object($this->content_obj))
                if (key($_POST["cmd"]) == "create_par")
                {
                        $s_lang = $_POST["par_language"];
                        $s_char = $_POST["par_characteristic"];
                }
                else
                {
                        if ($_SESSION["il_text_lang_".$_GET["ref_id"]] != "")
                        {
                                $s_lang = $_SESSION["il_text_lang_".$_GET["ref_id"]];
                        }
                        else
                        {
                                $s_lang = $ilUser->getLanguage();
                        }

                        // set characteristic of new paragraphs in list items to "List"
                        $cont_obj =& $this->pg_obj->getContentObject($this->getHierId());
                        if (is_object($cont_obj))
                        {
                                if ($cont_obj->getType() == "li" ||
                                        ($cont_obj->getType() == "par" && $cont_obj->getCharacteristic() == "List"))
                                {
                                        $s_char = "List";
                                }
                                                                
                                if ($cont_obj->getType() == "td" ||
                                        ($cont_obj->getType() == "par" && $cont_obj->getCharacteristic() == "TableContent"))
                                {
                                        $s_char = "TableContent";
                                }

                        }
                }

                require_once("classes/class.ilMetaData.php");
                $lang = ilMetaData::getLanguages();
                $select_lang = ilUtil::formSelect ($s_lang,"par_language",$lang,false,true);
                $this->tpl->setVariable("SELECT_LANGUAGE", $select_lang);
                $char = array("" => $this->lng->txt("none"),
                        "Headline1" => $this->lng->txt("cont_Headline1"),
                        "Headline2" => $this->lng->txt("cont_Headline2"),
                        "Headline3" => $this->lng->txt("cont_Headline3"),
                        "Example" => $this->lng->txt("cont_Example"),
                        "Citation" => $this->lng->txt("cont_Citation"),
                        "Mnemonic" => $this->lng->txt("cont_Mnemonic"),
                        "Additional" => $this->lng->txt("cont_Additional"),
                        "List" => $this->lng->txt("cont_List"),
                        "Remark" => $this->lng->txt("cont_Remark"),
                        //"Code" => $this->lng->txt("cont_Code"),
                        "TableContent" => $this->lng->txt("cont_TableContent")
                        );
                $this->tpl->setVariable("TXT_CHARACTERISTIC", $this->lng->txt("cont_characteristic"));
                $select_char = ilUtil::formSelect ($s_char,
                        "par_characteristic",$char,false,true);
                $this->tpl->setVariable("SELECT_CHARACTERISTIC", $select_char);

                // content is in utf-8, todo: set globally
                // header('Content-type: text/html; charset=UTF-8');

                // input text area
                $this->tpl->setVariable("PAR_TA_NAME", "par_content");
                if (key($_POST["cmd"]) == "create_par")
                {
                        $this->tpl->setVariable("PAR_TA_CONTENT",
                                ilUtil::stripSlashes($_POST["par_content"], false));
                }
                else
                {
                        $this->tpl->setVariable("PAR_TA_CONTENT", "");
                }
                $this->tpl->parseCurrentBlock();

                if (ilPageEditorGUI::_doJSEditing()) 
                {
                        $this->tpl->touchBlock("initwysiwygeditor");
                }
                
                // operations
                $this->tpl->setCurrentBlock("commands");
                $this->tpl->setVariable("BTN_NAME", "create_par");      //--
                $this->tpl->setVariable("BTN_TEXT", $this->lng->txt("save"));
                $this->tpl->setVariable("BTN_CANCEL", "cancelCreate");
                $this->tpl->setVariable("TXT_CANCEL", $this->lng->txt("cancel"));
                $this->tpl->parseCurrentBlock();

        }

Here is the call graph for this function:

Here is the caller graph for this function:

ilPCParagraphGUI::popup (  ) 

popup window for wysiwyg editor

Definition at line 521 of file class.ilPCParagraphGUI.php.

References $_GET, and exit.

        {
                include_once "./content/classes/Pages/class.ilWysiwygUtil.php";
                $popup = new ilWysiwygUtil();
                $popup->show($_GET["ptype"]);
                exit;
        }

ilPCParagraphGUI::setTabs (  ) 

output tabs

Definition at line 532 of file class.ilPCParagraphGUI.php.

References getTabs().

Referenced by edit(), and insert().

        {
                global $ilTabs;

                // catch feedback message
                #include_once("classes/class.ilTabsGUI.php");
                #$tabs_gui =& new ilTabsGUI();
                $this->getTabs($ilTabs);
                #$this->tpl->setVariable("TABS", $tabs_gui->getHTML());
        }

Here is the call graph for this function:

Here is the caller graph for this function:

ilPCParagraphGUI::update (  ) 

update paragraph in dom and update page in db

Definition at line 441 of file class.ilPCParagraphGUI.php.

References $_POST, $ilBench, and edit().

        {
                global $ilBench;

                $ilBench->start("Editor","Paragraph_update");
                // set language and characteristic
                $this->content_obj->setLanguage($_POST["par_language"]);
                $this->content_obj->setCharacteristic($_POST["par_characteristic"]);

//echo "<br>PARupdate1:".$_POST["par_content"].":";
//echo "<br>PARupdate2:".htmlentities($_POST["par_content"]).":";
//echo "<br>PARupdate3:".htmlentities($this->content_obj->input2xml($_POST["par_content"])).":";
//echo "<br>PARupdate4:".$this->content_obj->input2xml($_POST["par_content"]).":";

                //$this->updated = $this->content_obj->setText(
                //      $this->content_obj->input2xml(stripslashes($_POST["par_content"]),
                //              $_POST["usedwsiwygeditor"]));
                $this->updated = $this->content_obj->setText(
                        $this->content_obj->input2xml($_POST["par_content"],
                                $_POST["usedwsiwygeditor"]));
//echo "<br>PARupdate2";
                if ($this->updated !== true)
                {
                        $ilBench->stop("Editor","Paragraph_update");
                        $this->edit();
                        return;
                }

                $this->updated = $this->pg_obj->update();
//echo "<br>PARupdate_after:".htmlentities($this->pg_obj->dom->dump_mem(0, "UTF-8")).":";

                $ilBench->stop("Editor","Paragraph_update");

                if ($this->updated === true)
                {
                        $this->ctrl->returnToParent($this, "jump".$this->hier_id);
                }
                else
                {
                        $this->edit();
                }
        }

Here is the call graph for this function:


The documentation for this class was generated from the following file: