ILIAS  Release_4_0_x_branch Revision 61816
 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
 insertCharacteristicTable ($a_tpl, $a_seleted_value)
 Insert characteristic table.
 insertStyleSelectionList ($a_tpl, $a_s_char)
 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.
 setStyleId ($a_styleid)
 Set Style Id.
 getStyleId ()
 Get Style Id.
 getStyle ()
 Get style object.
 setCharacteristics ($a_chars)
 Set Characteristics.
 getCharacteristics ()
 Get characteristics.
 getHierId ()
 get hierarchical id in dom object
 setHierId ($a_hier_id)
 get hierarchical id in dom object
 getBBMenu ($a_ta_name="par_content")
 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
 getTemplateOptions ($a_type)
 Get table templates.

Static Public Member Functions

static _getStandardCharacteristics ()
 Get standard characteristics.
static _getCharacteristics ($a_style_id)
 Get characteristics.
- Static Public Member Functions inherited from ilPageContentGUI
static _getCommonBBButtons ()
 Get common bb buttons.

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
- Protected Member Functions inherited from ilPageContentGUI
 getCharacteristicsOfCurrentStyle ($a_type)
 Get characteristics of current style.
- Static Protected Attributes inherited from ilPageContentGUI
static $common_bb_buttons

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 22463 2009-12-01 20:04:56Z akill

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

Member Function Documentation

static ilPCParagraphGUI::_getCharacteristics (   $a_style_id)
static

Get characteristics.

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

References $t, _getStandardCharacteristics(), and ilObject\_lookupType().

Referenced by ilPageEditorGUI\initCharacteristicForm().

{
if ($a_style_id > 0 &&
ilObject::_lookupType($a_style_id) == "sty")
{
include_once("./Services/Style/classes/class.ilObjStyleSheet.php");
$style = new ilObjStyleSheet($a_style_id);
$types = array("text_block", "heading1", "heading2", "heading3");
$chars = array();
foreach ($types as $t)
{
$chars = array_merge($chars, $style->getCharacteristics($t));
}
$new_chars = array();
foreach ($chars as $char)
{
if ($chars[$char] != "") // keep lang vars for standard chars
{
$new_chars[$char] = $chars[$char];
}
else
{
$new_chars[$char] = $char;
}
asort($new_chars);
}
$chars = $new_chars;
}
return $chars;
}

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

static ilPCParagraphGUI::_getStandardCharacteristics ( )
static

Get standard characteristics.

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

References ilPageContentGUI\$lng.

Referenced by _getCharacteristics(), and ilPCParagraphGUI().

{
global $lng;
return array("" => $lng->txt("none"),
"Headline1" => $lng->txt("cont_Headline1"),
"Headline2" => $lng->txt("cont_Headline2"),
"Headline3" => $lng->txt("cont_Headline3"),
"Citation" => $lng->txt("cont_Citation"),
"Mnemonic" => $lng->txt("cont_Mnemonic"),
"Example" => $lng->txt("cont_Example"),
"Additional" => $lng->txt("cont_Additional"),
"Remark" => $lng->txt("cont_Remark"),
"List" => $lng->txt("cont_List"),
"TableContent" => $lng->txt("cont_TableContent")
);
}

+ Here is the caller graph for this function:

ilPCParagraphGUI::create ( )

create new paragraph in dom and update page in db

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

References $_POST, $_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 137 of file class.ilPCParagraphGUI.php.

References $_GET, $_POST, $_SESSION, ilPageContentGUI\$ilias, $lang, ilPageContentGUI\$tpl, ilMDLanguageItem\_getLanguages(), ilPageContentGUI\displayValidationError(), formSelect(), ilPageContentGUI\getBBMenu(), ilPageContentGUI\getHierId(), insertHelp(), insertStyleSelectionList(), 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->setCurrentBlock("commands2");
$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->setCurrentBlock("commands2");
$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"));
}
// 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();
if ($s_char == "")
{
$s_char = "Standard";
}
}
}
else
{
if (key($_POST["cmd"]) == "create_par")
{
$s_lang = $_POST["par_language"];
$s_char = $_POST["par_characteristic"];
}
else
{
$s_char = "Standard";
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";
}
}
}
}
$this->insertStyleSelectionList($tpl, $s_char);
// $this->insertCharacteristicTable($tpl, $s_char);
$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_5/editor.js");
$this->tpl->addJavascript("./Services/COPage/js/paragraph_editing.js");
$this->setStyle();
$tpl->setVariable("TXT_LANGUAGE", $this->lng->txt("language"));
$tpl->setVariable("TXT_ANCHOR", $this->lng->txt("cont_anchor"));
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);
$tpl->setVariable("TXT_CHARACTERISTIC", $this->lng->txt("cont_characteristic"));
// $select_char = ilUtil::formSelect ($s_char,
// "par_characteristic",$this->chars,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 93 of file class.ilPCParagraphGUI.php.

References $cmd, $ret, and ilPageContentGUI\getCharacteristicsOfCurrentStyle().

{
// get next class that processes or forwards current command
$next_class = $this->ctrl->getNextClass($this);
array("text_block", "heading1", "heading2", "heading3")); // scorm-2004
// get current command
$cmd = $this->ctrl->getCmd();
switch($next_class)
{
default:
$ret =& $this->$cmd();
break;
}
return $ret;
}

+ Here is the call graph for this function:

ilPCParagraphGUI::getEnableWikiLinks ( )

Get Enable Wiki Links.

Returns
boolean Enable Wiki Links

Definition at line 129 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 24 of file class.ilPCParagraphGUI.php.

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

{
$this->setEnableWikiLinks(false);
parent::ilPageContentGUI($a_pg_obj, $a_content_obj, $a_hier_id, $a_pc_id);
// characteristics (should be flexible in the future)
}

+ Here is the call graph for this function:

ilPCParagraphGUI::insert ( )

insert paragraph form

Definition at line 399 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::insertCharacteristicTable (   $a_tpl,
  $a_seleted_value 
)

Insert characteristic table.

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

References ilPageContentGUI\getCharacteristics().

{
$i = 0;
$chars = $this->getCharacteristics();
if ($chars[$a_seleted_value] == "" && ($a_seleted_value != ""))
{
$chars = array_merge(array($a_seleted_value => $a_seleted_value),
$chars);
}
foreach ($chars as $char => $char_lang)
{
$a_tpl->setCurrentBlock("characteristic_cell");
$a_tpl->setVariable("CHAR_HTML",
'<div class="ilc_text_block_'.$char.'" style="margin-top:2px; margin-bottom:2px; position:static;">'.$char_lang."</div>");
$a_tpl->setVariable("CHAR_VALUE", $char);
if ($char == $a_seleted_value)
{
$a_tpl->setVariable("SELECTED",
' checked="checked" ');
}
$a_tpl->parseCurrentBlock();
if ((($i+1) % 3) == 0) //
{
$a_tpl->touchBlock("characteristic_row");
}
$i++;
}
$a_tpl->touchBlock("characteristic_table");
}

+ Here is the call graph for this function:

ilPCParagraphGUI::insertHelp (   $a_tpl)

Insert Help.

Definition at line 488 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::insertStyleSelectionList (   $a_tpl,
  $a_s_char 
)

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

References $t, ilAdvancedSelectionListGUI\DOWN_ARROW_DARK, ilPageContentGUI\getCharacteristics(), and ilAdvancedSelectionListGUI\ON_ITEM_CLICK_FORM_SELECT.

Referenced by edit().

{
include_once("./Services/AdvancedSelectionList/classes/class.ilAdvancedSelectionListGUI.php");
$selection = new ilAdvancedSelectionListGUI();
$selection->setFormSelectMode("par_characteristic", "", false,
"", "", "",
"", "", "", "");
$selection->setId("style_selection");
//$selection->setSelectionHeaderClass("MMInactive");
$selection->setHeaderIcon(ilAdvancedSelectionListGUI::DOWN_ARROW_DARK);
$selection->setSelectedValue($a_s_char);
//$selection->setItemLinkClass("small");
$selection->setUseImages(false);
$chars = $this->getCharacteristics();
$title_char = $chars[$a_s_char] != ""
? $chars[$a_s_char]
: $a_s_char;
$selection->setListTitle($title_char);
if ($chars[$a_seleted_value] == "" && ($a_seleted_value != ""))
{
$chars = array_merge(array($a_seleted_value => $a_seleted_value),
$chars);
}
foreach ($chars as $char => $char_lang)
{
$t = "text_block";
$tag = "div";
//echo "-".$char;
switch($char)
{
case "Headline1": $t = "heading1"; $tag = "h1"; break;
case "Headline2": $t = "heading2"; $tag = "h2"; break;
case "Headline3": $t = "heading3"; $tag = "h3"; break;
}
$html = '<'.$tag.' class="ilc_'.$t.'_'.$char.'" style="margin-top:2px; margin-bottom:2px; position:static;">'.$char_lang."</".$tag.">";
$selection->addItem($char_lang, $char, "",
"", $char, "", $html);
}
$a_tpl->setVariable("ADV_SEL_STYLE", $selection->getHTML());
}

+ 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 119 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 369 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
{
if ($this->pg_obj->getParentType() != "sahs")
{
// $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 407 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"]);
//$this->content_obj->setAnchor(ilUtil::stripSlashes($_POST["anchor"]));
//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: