• Main Page
  • Related Pages
  • Modules
  • Namespaces
  • Data Structures
  • Files
  • File List
  • Globals

Services/Form/classes/class.ilTextAreaInputGUI.php

Go to the documentation of this file.
00001 <?php
00002 /*
00003         +-----------------------------------------------------------------------------+
00004         | ILIAS open source                                                           |
00005         +-----------------------------------------------------------------------------+
00006         | Copyright (c) 1998-2007 ILIAS open source, University of Cologne            |
00007         |                                                                             |
00008         | This program is free software; you can redistribute it and/or               |
00009         | modify it under the terms of the GNU General Public License                 |
00010         | as published by the Free Software Foundation; either version 2              |
00011         | of the License, or (at your option) any later version.                      |
00012         |                                                                             |
00013         | This program is distributed in the hope that it will be useful,             |
00014         | but WITHOUT ANY WARRANTY; without even the implied warranty of              |
00015         | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the               |
00016         | GNU General Public License for more details.                                |
00017         |                                                                             |
00018         | You should have received a copy of the GNU General Public License           |
00019         | along with this program; if not, write to the Free Software                 |
00020         | Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA. |
00021         +-----------------------------------------------------------------------------+
00022 */
00023 
00024 include_once("./Services/Form/classes/class.ilSubEnabledFormPropertyGUI.php");
00025 
00033 class ilTextAreaInputGUI extends ilSubEnabledFormPropertyGUI
00034 {
00035         protected $value;
00036         protected $cols;
00037         protected $rows;
00038         protected $usert;
00039         protected $rtetags;
00040         
00041         protected $rte_tag_set = array(
00042                 "standard" => array ("strong", "em", "u", "ol", "li", "ul", "p", "div",
00043                         "i", "b", "code", "sup", "sub", "pre", "strike", "gap"),
00044                 "extended" => array (
00045                         "a","blockquote","br","cite","code","div","em","h1","h2","h3",
00046                         "h4","h5","h6","hr","li","ol","p",
00047                         "pre","span","strike","strong","sub","sup","u","ul",
00048                         "i", "b", "gap"),
00049                 "extended_img" => array (
00050                         "a","blockquote","br","cite","code","div","em","h1","h2","h3",
00051                         "h4","h5","h6","hr","img","li","ol","p",
00052                         "pre","span","strike","strong","sub","sup","u","ul",
00053                         "i", "b", "gap"),
00054                 "extended_table" => array (
00055                         "a","blockquote","br","cite","code","div","em","h1","h2","h3",
00056                         "h4","h5","h6","hr","li","ol","p",
00057                         "pre","span","strike","strong","sub","sup","table","td",
00058                         "tr","u","ul", "i", "b", "gap"),
00059                 "extended_table_img" => array (
00060                         "a","blockquote","br","cite","code","div","em","h1","h2","h3",
00061                         "h4","h5","h6","hr","img","li","ol","p",
00062                         "pre","span","strike","strong","sub","sup","table","td",
00063                         "tr","u","ul", "i", "b", "gap"),
00064                 "full" => array (
00065                         "a","blockquote","br","cite","code","div","em","h1","h2","h3",
00066                         "h4","h5","h6","hr","img","li","ol","p",
00067                         "pre","span","strike","strong","sub","sup","table","td",
00068                         "tr","u","ul","ruby","rbc","rtc","rb","rt","rp", "i", "b", "gap"));
00069                 
00070         
00077         function __construct($a_title = "", $a_postvar = "")
00078         {
00079                 parent::__construct($a_title, $a_postvar);
00080                 $this->setType("textarea");
00081                 $this->setRteTagSet("standard");
00082         }
00083 
00089         function setValue($a_value)
00090         {
00091                 $this->value = $a_value;
00092         }
00093 
00099         function getValue()
00100         {
00101                 return $this->value;
00102         }
00103 
00109         function setCols($a_cols)
00110         {
00111                 $this->cols = $a_cols;
00112         }
00113 
00119         function getCols()
00120         {
00121                 return $this->cols;
00122         }
00123 
00129         function setRows($a_rows)
00130         {
00131                 $this->rows = $a_rows;
00132         }
00133 
00139         function getRows()
00140         {
00141                 return $this->rows;
00142         }
00143 
00149         function setUseRte($a_usert)
00150         {
00151                 $this->usert = $a_usert;
00152         }
00153 
00159         function getUseRte()
00160         {
00161                 return $this->usert;
00162         }
00163 
00169         function setRteTags($a_rtetags)
00170         {
00171                 $this->rtetags = $a_rtetags;
00172         }
00173 
00179         function getRteTags()
00180         {
00181                 return $this->rtetags;
00182         }
00183         
00190         function setRteTagSet($a_set_name)
00191         {
00192                 $this->setRteTags($this->rte_tag_set[$a_set_name]);
00193         }
00194 
00201         function getRteTagSet($a_set_name)
00202         {
00203                 return $this->rte_tag_set[$a_set_name];
00204         }
00205 
00206         
00210         function getRteTagString()
00211         {
00212                 $result = "";
00213                 foreach ($this->getRteTags() as $tag)
00214                 {
00215                         $result .= "<$tag>";
00216                 }
00217                 return $result;
00218         }
00219 
00225         function setValueByArray($a_values)
00226         {
00227                 $this->setValue($a_values[$this->getPostVar()]);
00228         }
00229 
00235         function checkInput()
00236         {
00237                 global $lng;
00238                 
00239                 include_once("./classes/class.ilObjAdvancedEditing.php");
00240                 
00241                 $_POST[$this->getPostVar()] = ($this->getUseRte())
00242                         ? ilUtil::stripSlashes($_POST[$this->getPostVar()], true,
00243                                 $this->getRteTagString())
00244                         : ilUtil::stripSlashes($_POST[$this->getPostVar()]);
00245 
00246                 if ($this->getRequired() && trim($_POST[$this->getPostVar()]) == "")
00247                 {
00248                         $this->setAlert($lng->txt("msg_input_is_required"));
00249 
00250                         return false;
00251                 }
00252                 return $this->checkSubItemsInput();
00253         }
00254 
00260         function insert(&$a_tpl)
00261         {
00262                 if ($this->getUseRte())
00263                 {
00264                         include_once "./Services/RTE/classes/class.ilRTE.php";
00265                         $rtestring = ilRTE::_getRTEClassname();
00266                         include_once "./Services/RTE/classes/class.$rtestring.php";
00267                         $rte = new $rtestring();
00268                         
00269                         // @todo: Check this.
00270                         $rte->addPlugin("emotions");
00271                         $rte->addCustomRTESupport(0, "", $this->getRteTags());
00272                         
00273                         $a_tpl->touchBlock("prop_ta_w");
00274                         $a_tpl->setCurrentBlock("prop_textarea");
00275                         $a_tpl->setVariable("ROWS", $this->getRows());
00276                 }
00277                 else
00278                 {
00279                         $a_tpl->touchBlock("no_rteditor");
00280                         $a_tpl->setCurrentBlock("prop_ta_c");
00281                         $a_tpl->setVariable("COLS", $this->getCols());
00282                         $a_tpl->parseCurrentBlock();
00283                         
00284                         $a_tpl->setCurrentBlock("prop_textarea");
00285                         $a_tpl->setVariable("ROWS", $this->getRows());
00286                 }
00287                 $a_tpl->setVariable("POST_VAR",
00288                         ilUtil::prepareFormOutput($this->getPostVar()));
00289                 $a_tpl->setVariable("ID", $this->getFieldId());
00290                 if($this->getDisabled())
00291                 {
00292                         $a_tpl->setVariable('DISABLED','disabled="disabled" ');
00293                 }
00294                 $a_tpl->setVariable("PROPERTY_VALUE", $this->getValue());
00295                 $a_tpl->parseCurrentBlock();
00296         }
00297 
00298 }

Generated on Fri Dec 13 2013 17:56:57 for ILIAS Release_3_9_x_branch .rev 46835 by  doxygen 1.7.1