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

classes/class.ilObjAdvancedEditing.php

Go to the documentation of this file.
00001 <?php
00002 /*
00003         +-----------------------------------------------------------------------------+
00004         | ILIAS open source                                                           |
00005         +-----------------------------------------------------------------------------+
00006         | Copyright (c) 1998-2006 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 
00033 require_once "class.ilObject.php";
00034 
00035 class ilObjAdvancedEditing extends ilObject
00036 {
00037         var $setting;
00038         
00045         function ilObjAdvancedEditing($a_id = 0,$a_call_by_reference = true)
00046         {
00047                 include_once "./Services/Administration/classes/class.ilSetting.php";
00048                 $this->setting = new ilSetting("advanced_editing");
00049                 $this->type = "adve";
00050                 $this->ilObject($a_id,$a_call_by_reference);
00051         }
00052 
00059         function update()
00060         {
00061                 if (!parent::update())
00062                 {
00063                         return false;
00064                 }
00065 
00066                 // put here object specific stuff
00067 
00068                 return true;
00069         }
00070 
00071 
00078         function delete()
00079         {
00080                 // always call parent delete function first!!
00081                 if (!parent::delete())
00082                 {
00083                         return false;
00084                 }
00085 
00086                 //put here your module specific stuff
00087 
00088                 return true;
00089         }
00090 
00100         function initDefaultRoles()
00101         {
00102                 global $rbacadmin;
00103 
00104                 // create a local role folder
00105                 //$rfoldObj = $this->createRoleFolder("Local roles","Role Folder of forum obj_no.".$this->getId());
00106 
00107                 // create moderator role and assign role to rolefolder...
00108                 //$roleObj = $rfoldObj->createRole("Moderator","Moderator of forum obj_no.".$this->getId());
00109                 //$roles[] = $roleObj->getId();
00110 
00111                 //unset($rfoldObj);
00112                 //unset($roleObj);
00113 
00114                 return $roles ? $roles : array();
00115         }
00116 
00130         function notify($a_event,$a_ref_id,$a_parent_non_rbac_id,$a_node_id,$a_params = 0)
00131         {
00132                 global $tree;
00133 
00134                 switch ($a_event)
00135                 {
00136                         case "link":
00137 
00138                                 //var_dump("<pre>",$a_params,"</pre>");
00139                                 //echo "Module name ".$this->getRefId()." triggered by link event. Objects linked into target object ref_id: ".$a_ref_id;
00140                                 //exit;
00141                                 break;
00142 
00143                         case "cut":
00144 
00145                                 //echo "Module name ".$this->getRefId()." triggered by cut event. Objects are removed from target object ref_id: ".$a_ref_id;
00146                                 //exit;
00147                                 break;
00148 
00149                         case "copy":
00150 
00151                                 //var_dump("<pre>",$a_params,"</pre>");
00152                                 //echo "Module name ".$this->getRefId()." triggered by copy event. Objects are copied into target object ref_id: ".$a_ref_id;
00153                                 //exit;
00154                                 break;
00155 
00156                         case "paste":
00157 
00158                                 //echo "Module name ".$this->getRefId()." triggered by paste (cut) event. Objects are pasted into target object ref_id: ".$a_ref_id;
00159                                 //exit;
00160                                 break;
00161 
00162                         case "new":
00163 
00164                                 //echo "Module name ".$this->getRefId()." triggered by paste (new) event. Objects are applied to target object ref_id: ".$a_ref_id;
00165                                 //exit;
00166                                 break;
00167                 }
00168 
00169                 // At the beginning of the recursive process it avoids second call of the notify function with the same parameter
00170                 if ($a_node_id==$_GET["ref_id"])
00171                 {
00172                         $parent_obj =& $this->ilias->obj_factory->getInstanceByRefId($a_node_id);
00173                         $parent_type = $parent_obj->getType();
00174                         if($parent_type == $this->getType())
00175                         {
00176                                 $a_node_id = (int) $tree->getParentId($a_node_id);
00177                         }
00178                 }
00179 
00180                 parent::notify($a_event,$a_ref_id,$a_parent_non_rbac_id,$a_node_id,$a_params);
00181         }
00182 
00191         function &_getUsedHTMLTags($a_module = "")
00192         {
00193                 $usedtags = array();
00194                 include_once "./Services/Administration/classes/class.ilSetting.php";
00195                 $setting = new ilSetting("advanced_editing");
00196                 $tags = $setting->get("advanced_editing_used_html_tags_" . $a_module);
00197                 if (strlen($tags))
00198                 {
00199                         $usedtags = unserialize($tags);
00200                 }
00201                 else
00202                 {
00203                         // default: everything but tables
00204                         $usedtags = array(
00205                         "a",
00206                         "blockquote",
00207                         "br",
00208                         "cite",
00209                         "code",
00210                         "div",
00211                         "em",
00212                         "h1",
00213                         "h2",
00214                         "h3",
00215                         "h4",
00216                         "h5",
00217                         "h6",
00218                         "hr",
00219                         "img",
00220                         "li",
00221                         "ol",
00222                         "p",
00223                         "pre",
00224                         "span",
00225                         "strike",
00226                         "strong",
00227                         "sub",
00228                         "sup",
00229                         "u",
00230                         "ul"                    
00231                         );
00232                 }
00233                 return $usedtags;
00234         }
00235 
00244         function &_getUsedHTMLTagsAsString($a_module = "")
00245         {
00246                 $result = "";
00247                 $tags =& ilObjAdvancedEditing::_getUsedHTMLTags($a_module);
00248                 foreach ($tags as $tag)
00249                 {
00250                         $result .= "<$tag>";
00251                 }
00252                 return $result;
00253         }
00254         
00262         function _getRichTextEditor()
00263         {
00264                 include_once "./Services/Administration/classes/class.ilSetting.php";
00265                 $setting = new ilSetting("advanced_editing");
00266                 $js = $setting->get("advanced_editing_javascript_editor");
00267                 return $js;
00268         }
00269         
00277         function _setRichTextEditor($a_js_editor)
00278         {
00279                 include_once "./Services/Administration/classes/class.ilSetting.php";
00280                 $setting = new ilSetting("advanced_editing");
00281                 $setting->set("advanced_editing_javascript_editor", $a_js_editor);
00282         }
00283         
00292         function _setUsedHTMLTags($a_html_tags, $a_module)
00293         {
00294                 if (strlen($a_module))
00295                 {
00296                         include_once "./Services/Administration/classes/class.ilSetting.php";
00297                         $setting = new ilSetting("advanced_editing");
00298                         $setting->set("advanced_editing_used_html_tags_" . $a_module, serialize($a_html_tags));
00299                 }
00300         }
00301         
00309         function &getHTMLTags()
00310         {
00311                 $tags = array(
00312                         "a",
00313                         "blockquote",
00314                         "br",
00315                         "cite",
00316                         "code",
00317                         "div",
00318                         "em",
00319                         "h1",
00320                         "h2",
00321                         "h3",
00322                         "h4",
00323                         "h5",
00324                         "h6",
00325                         "hr",
00326                         "img",
00327                         "li",
00328                         "object",
00329                         "ol",
00330                         "p",
00331                         "param",
00332                         "pre",
00333                         "span",
00334                         "strike",
00335                         "strong",
00336                         "sub",
00337                         "sup",
00338                         "table",
00339                         "td",
00340                         "tr",
00341                         "u",
00342                         "ul",
00343                         "ruby", // Ruby Annotation XHTML module
00344                         "rbc",
00345                         "rtc",
00346                         "rb",
00347                         "rt",
00348                         "rp"
00349                 );
00350                 return $tags;
00351         }
00352 
00360         function &_getAllHTMLTags()
00361         {
00362                 $tags = array(
00363                         "a",
00364                         "abbr",
00365                         "acronym",
00366                         "address",
00367                         "applet",
00368                         "area",
00369                         "b",
00370                         "base",
00371                         "basefont",
00372                         "bdo",
00373                         "big",
00374                         "blockquote",
00375                         "br",
00376                         "button",
00377                         "caption",
00378                         "center",
00379                         "cite",
00380                         "code",
00381                         "col",
00382                         "colgroup",
00383                         "dd",
00384                         "del",
00385                         "dfn",
00386                         "dir",
00387                         "div",
00388                         "dl",
00389                         "dt",
00390                         "em",
00391                         "fieldset",
00392                         "font",
00393                         "form",
00394                         "h1",
00395                         "h2",
00396                         "h3",
00397                         "h4",
00398                         "h5",
00399                         "h6",
00400                         "hr",
00401                         "i",
00402                         "iframe",
00403                         "img",
00404                         "input",
00405                         "ins",
00406                         "isindex",
00407                         "kbd",
00408                         "label",
00409                         "legend",
00410                         "li",
00411                         "link",
00412                         "map",
00413                         "menu",
00414                         "object",
00415                         "ol",
00416                         "optgroup",
00417                         "option",
00418                         "p",
00419                         "param",
00420                         "pre",
00421                         "q",
00422                         "s",
00423                         "samp",
00424                         "select",
00425                         "small",
00426                         "span",
00427                         "strike",
00428                         "strong",
00429                         "sub",
00430                         "sup",
00431                         "table",
00432                         "tbody",
00433                         "td",
00434                         "textarea",
00435                         "tfoot",
00436                         "th",
00437                         "thead",
00438                         "tr",
00439                         "tt",
00440                         "u",
00441                         "ul",
00442                         "var",
00443                         "ruby", // Ruby Annotation XHTML module
00444                         "rbc",
00445                         "rtc",
00446                         "rb",
00447                         "rt",
00448                         "rp"
00449                         );
00450                         return $tags;
00451                 }
00459                 function _getAllHTMLTagsAsString()
00460                 {
00461                         $result = "";
00462                         $tags =& ilObjAdvancedEditing::_getAllHTMLTags();
00463                         foreach ($tags as $tag)
00464                         {
00465                                 $result .= "<$tag>";
00466                         }
00467                         return $result;
00468                 }
00469         
00477         function _setRichTextEditorUserState($a_state)
00478         {
00479                 global $ilUser;
00480                 $ilUser->writePref("show_rte", $a_state);
00481         }
00482 
00490         function _getRichTextEditorUserState()
00491         {
00492                 global $ilUser;
00493                 if (strlen($ilUser->getPref("show_rte")) > 0)
00494                 {
00495                         return $ilUser->getPref("show_rte");
00496                 }
00497                 return 1;
00498         }
00499         
00500 } // END class.ilObjAdvancedEditing
00501 ?>

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