ILIAS  Release_3_10_x_branch Revision 61812
 All Data Structures Namespaces Files Functions Variables Groups Pages
ilPCParagraphGUI Class Reference

Class ilPCParagraphGUI. More...

+ Inheritance diagram for ilPCParagraphGUI:
+ Collaboration diagram for ilPCParagraphGUI:

Public Member Functions

 ilPCParagraphGUI (&$a_pg_obj, &$a_content_obj, $a_hier_id, $a_pc_id="")
 Constructor public.
executeCommand ()
 execute command
 setEnableWikiLinks ($a_enablewikilinks)
 Set Enable Wiki Links.
 getEnableWikiLinks ()
 Get Enable Wiki Links.
 edit ($a_insert=false)
 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
 insertHelp ($a_tpl)
 Insert Help.
- Public Member Functions inherited from ilPageContentGUI
 ilPageContentGUI (&$a_pg_obj, &$a_content_obj, $a_hier_id=0, $a_pc_id="")
 Constructor public.
 getHierId ()
 get hierarchical id in dom object
 setHierId ($a_hier_id)
 get hierarchical id in dom object
 getBBMenu ()
 Get the bb menu incl.
 delete ()
 delete content element
 moveAfter ()
 move content element after another element
 moveBefore ()
 move content element before another element
 splitPage ()
 split page to new page at specified position
 splitPageNext ()
 split page to next page at specified position
 displayValidationError ()
 display validation errors
 cancelCreate ()
 cancel creating page content
 cancelUpdate ()
 cancel update
 deactivate ()
 gui function set enabled if is not enabled and vice versa

Private Member Functions

 setStyle ()
 Set Style.

Additional Inherited Members

- Data Fields inherited from ilPageContentGUI
 $content_obj
 $ilias
 $tpl
 $lng
 $ctrl
 $pg_obj
 $hier_id
 $dom
 $updated
 $target_script
 $return_location

Detailed Description

Class ilPCParagraphGUI.

User Interface for Paragraph Editing

Author
Alex Killing alex..nosp@m.kill.nosp@m.ing@g.nosp@m.mx.d.nosp@m.e
Version
Id:
class.ilPCParagraphGUI.php 22462 2009-12-01 20:01:12Z akill

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 318 of file class.ilPCParagraphGUI.php.

References $_SESSION, and insert().

{
$this->content_obj =& new ilPCParagraph($this->dom);
//echo "+".$this->pc_id."+";
$this->content_obj->create($this->pg_obj, $this->hier_id, $this->pc_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"]), true);
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 (   $a_insert = false)

edit paragraph form

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

References $_GET, $_SESSION, ilPageContentGUI\$ilias, $lang, ilPageContentGUI\$tpl, ilMDLanguageItem\_getLanguages(), ilPageContentGUI\displayValidationError(), formSelect(), ilPageContentGUI\getBBMenu(), ilPageContentGUI\getHierId(), insertHelp(), setStyle(), and ilUtil\stripSlashes().

Referenced by insert(), and update().

{
global $ilUser, $ilias;
// add paragraph edit template
$tpl = new ilTemplate("tpl.paragraph_edit.html", true, true, "Services/COPage");
// help text
$this->insertHelp($tpl);
// operations
if ($a_insert)
{
$tpl->setCurrentBlock("commands");
$tpl->setVariable("BTN_NAME", "create_par");
$tpl->setVariable("BTN_TEXT", $this->lng->txt("save"));
$tpl->setVariable("BTN_CANCEL", "cancelCreate");
$tpl->setVariable("TXT_CANCEL", $this->lng->txt("cancel"));
$tpl->parseCurrentBlock();
$tpl->setVariable("TXT_ACTION", $this->lng->txt("cont_insert_par"));
}
else
{
$tpl->setCurrentBlock("commands");
$tpl->setVariable("BTN_NAME", "update");
$tpl->setVariable("BTN_TEXT", $this->lng->txt("save"));
$tpl->setVariable("BTN_CANCEL", "cancelUpdate");
$tpl->setVariable("TXT_CANCEL", $this->lng->txt("cancel"));
$tpl->parseCurrentBlock();
$tpl->setVariable("TXT_ACTION", $this->lng->txt("cont_edit_par"));
}
$tpl->setVariable("FORMACTION", $this->ctrl->getFormAction($this));
$tpl->setVariable("PAR_TA_NAME", "par_content");
$tpl->setVariable("BB_MENU", $this->getBBMenu());
$this->tpl->addJavascript("./Services/COPage/phpBB/3_0_0/editor.js");
$this->tpl->addJavascript("./Services/COPage/js/paragraph_editing.js");
$this->setStyle();
// language and characteristic selection
if (!$a_insert)
{
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();
}
}
else
{
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";
}
}
}
}
$tpl->setVariable("TXT_LANGUAGE", $this->lng->txt("language"));
require_once("Services/MetaData/classes/class.ilMDLanguageItem.php");
$select_lang = ilUtil::formSelect ($s_lang,"par_language",$lang,false,true);
$tpl->setVariable("SELECT_LANGUAGE", $select_lang);
// characteristic
$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"),
"TableContent" => $this->lng->txt("cont_TableContent")
);
$tpl->setVariable("TXT_CHARACTERISTIC", $this->lng->txt("cont_characteristic"));
$select_char = ilUtil::formSelect ($s_char,
"par_characteristic",$char,false,true);
$tpl->setVariable("SELECT_CHARACTERISTIC", $select_char);
if (key($_POST["cmd"]) == "update" || key($_POST["cmd"]) == "create_par")
{
$s_text = ilUtil::stripSlashes($_POST["par_content"], false);
// prevent curly brackets from being swallowed up by template engine
$s_text = str_replace("{", "{", $s_text);
$s_text = str_replace("}", "}", $s_text);
}
else if (!$a_insert)
{
$s_text = $this->content_obj->xml2output($this->content_obj->getText());
}
$tpl->setVariable("PAR_TA_CONTENT", $s_text);
$tpl->parseCurrentBlock();
$this->tpl->setContent($tpl->get());
return $tpl->get();
}

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

& ilPCParagraphGUI::executeCommand ( )

execute command

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

References $cmd, and $ret.

{
// 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::getEnableWikiLinks ( )

Get Enable Wiki Links.

Returns
boolean Enable Wiki Links

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

Referenced by insertHelp().

{
return $this->enablewikilinks;
}

+ Here is the caller graph for this function:

ilPCParagraphGUI::ilPCParagraphGUI ( $a_pg_obj,
$a_content_obj,
  $a_hier_id,
  $a_pc_id = "" 
)

Constructor public.

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

References ilPageContentGUI\ilPageContentGUI(), and setEnableWikiLinks().

{
$this->setEnableWikiLinks(false);
parent::ilPageContentGUI($a_pg_obj, $a_content_obj, $a_hier_id, $a_pc_id);
}

+ Here is the call graph for this function:

ilPCParagraphGUI::insert ( )

insert paragraph form

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

References edit().

Referenced by create().

{
return $this->edit(true);
}

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

ilPCParagraphGUI::insertHelp (   $a_tpl)

Insert Help.

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

References ilPageContentGUI\$lng, and getEnableWikiLinks().

Referenced by edit().

{
global $lng;
$a_tpl->setCurrentBlock("help_item");
$a_tpl->setVariable("TXT_HELP", "<b>".$lng->txt("cont_syntax_help")."</b>");
$a_tpl->parseCurrentBlock();
$a_tpl->setCurrentBlock("help_item");
$a_tpl->setVariable("TXT_HELP", "* ".$lng->txt("cont_bullet_list"));
$a_tpl->parseCurrentBlock();
$a_tpl->setCurrentBlock("help_item");
$a_tpl->setVariable("TXT_HELP", "# ".$lng->txt("cont_numbered_list"));
$a_tpl->parseCurrentBlock();
$a_tpl->setCurrentBlock("help_item");
$a_tpl->setVariable("TXT_HELP", "=".$lng->txt("cont_Headline1")."=<br />".
"==".$lng->txt("cont_Headline2")."==<br />".
"===".$lng->txt("cont_Headline3")."===");
$a_tpl->parseCurrentBlock();
if ($this->getEnableWikiLinks())
{
$a_tpl->setCurrentBlock("help_item");
$a_tpl->setVariable("TXT_HELP", "[[".$lng->txt("cont_wiki_page_link")."]]");
$a_tpl->parseCurrentBlock();
}
$a_tpl->setCurrentBlock("help");
$a_tpl->parseCurrentBlock();
}

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

ilPCParagraphGUI::setEnableWikiLinks (   $a_enablewikilinks)

Set Enable Wiki Links.

Parameters
boolean$a_enablewikilinksEnable Wiki Links

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

Referenced by ilPCParagraphGUI().

{
$this->enablewikilinks = $a_enablewikilinks;
}

+ Here is the caller graph for this function:

ilPCParagraphGUI::setStyle ( )
private

Set Style.

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

References ilObjContentObject\_lookupStyleSheetId(), and ilObjStyleSheet\getContentStylePath().

Referenced by edit().

{
include_once("./Services/Style/classes/class.ilObjStyleSheet.php");
if ($this->pg_obj->getParentType() == "gdf" ||
$this->pg_obj->getParentType() == "lm" ||
$this->pg_obj->getParentType() == "dbk")
{
if ($this->pg_obj->getParentType() != "gdf")
{
$this->tpl->setContentStylesheet(ilObjStyleSheet::getContentStylePath(
ilObjContentObject::_lookupStyleSheetId($this->pg_obj->getParentId())));
}
else
{
$this->tpl->setContentStylesheet(ilObjStyleSheet::getContentStylePath(0));
}
}
else
{
$this->tpl->setContentStylesheet(ilObjStyleSheet::getContentStylePath(0));
}
}

+ 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 271 of file class.ilPCParagraphGUI.php.

References $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"]), true);
//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: