• 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 
00034 require_once "class.ilObject.php";
00035 
00036 class ilObjAdvancedEditing extends ilObject
00037 {
00038         var $setting;
00039         
00046         function ilObjAdvancedEditing($a_id = 0,$a_call_by_reference = true)
00047         {
00048                 include_once "./Services/Administration/classes/class.ilSetting.php";
00049                 $this->setting = new ilSetting("advanced_editing");
00050                 $this->type = "adve";
00051                 $this->ilObject($a_id,$a_call_by_reference);
00052         }
00053 
00060         function update()
00061         {
00062                 if (!parent::update())
00063                 {
00064                         return false;
00065                 }
00066 
00067                 // put here object specific stuff
00068 
00069                 return true;
00070         }
00071 
00079         function ilClone($a_parent_ref)
00080         {
00081                 global $rbacadmin;
00082 
00083                 // always call parent ilClone function first!!
00084                 $new_ref_id = parent::ilClone($a_parent_ref);
00085 
00086                 // get object instance of ilCloned object
00087                 //$newObj =& $this->ilias->obj_factory->getInstanceByRefId($new_ref_id);
00088 
00089                 // create a local role folder & default roles
00090                 //$roles = $newObj->initDefaultRoles();
00091 
00092                 // ...finally assign role to creator of object
00093                 //$rbacadmin->assignUser($roles[0], $newObj->getOwner(), "n");
00094 
00095                 // always destroy objects in ilClone method because ilClone() is recursive and creates instances for each object in subtree!
00096                 //unset($newObj);
00097 
00098                 // ... and finally always return new reference ID!!
00099                 return $new_ref_id;
00100         }
00101 
00108         function delete()
00109         {
00110                 // always call parent delete function first!!
00111                 if (!parent::delete())
00112                 {
00113                         return false;
00114                 }
00115 
00116                 //put here your module specific stuff
00117 
00118                 return true;
00119         }
00120 
00130         function initDefaultRoles()
00131         {
00132                 global $rbacadmin;
00133 
00134                 // create a local role folder
00135                 //$rfoldObj = $this->createRoleFolder("Local roles","Role Folder of forum obj_no.".$this->getId());
00136 
00137                 // create moderator role and assign role to rolefolder...
00138                 //$roleObj = $rfoldObj->createRole("Moderator","Moderator of forum obj_no.".$this->getId());
00139                 //$roles[] = $roleObj->getId();
00140 
00141                 //unset($rfoldObj);
00142                 //unset($roleObj);
00143 
00144                 return $roles ? $roles : array();
00145         }
00146 
00160         function notify($a_event,$a_ref_id,$a_parent_non_rbac_id,$a_node_id,$a_params = 0)
00161         {
00162                 global $tree;
00163 
00164                 switch ($a_event)
00165                 {
00166                         case "link":
00167 
00168                                 //var_dump("<pre>",$a_params,"</pre>");
00169                                 //echo "Module name ".$this->getRefId()." triggered by link event. Objects linked into target object ref_id: ".$a_ref_id;
00170                                 //exit;
00171                                 break;
00172 
00173                         case "cut":
00174 
00175                                 //echo "Module name ".$this->getRefId()." triggered by cut event. Objects are removed from target object ref_id: ".$a_ref_id;
00176                                 //exit;
00177                                 break;
00178 
00179                         case "copy":
00180 
00181                                 //var_dump("<pre>",$a_params,"</pre>");
00182                                 //echo "Module name ".$this->getRefId()." triggered by copy event. Objects are copied into target object ref_id: ".$a_ref_id;
00183                                 //exit;
00184                                 break;
00185 
00186                         case "paste":
00187 
00188                                 //echo "Module name ".$this->getRefId()." triggered by paste (cut) event. Objects are pasted into target object ref_id: ".$a_ref_id;
00189                                 //exit;
00190                                 break;
00191 
00192                         case "new":
00193 
00194                                 //echo "Module name ".$this->getRefId()." triggered by paste (new) event. Objects are applied to target object ref_id: ".$a_ref_id;
00195                                 //exit;
00196                                 break;
00197                 }
00198 
00199                 // At the beginning of the recursive process it avoids second call of the notify function with the same parameter
00200                 if ($a_node_id==$_GET["ref_id"])
00201                 {
00202                         $parent_obj =& $this->ilias->obj_factory->getInstanceByRefId($a_node_id);
00203                         $parent_type = $parent_obj->getType();
00204                         if($parent_type == $this->getType())
00205                         {
00206                                 $a_node_id = (int) $tree->getParentId($a_node_id);
00207                         }
00208                 }
00209 
00210                 parent::notify($a_event,$a_ref_id,$a_parent_non_rbac_id,$a_node_id,$a_params);
00211         }
00212 
00221         function &_getUsedHTMLTags($a_module = "")
00222         {
00223                 $usedtags = array();
00224                 include_once "./Services/Administration/classes/class.ilSetting.php";
00225                 $setting = new ilSetting("advanced_editing");
00226                 $tags = $setting->get("advanced_editing_used_html_tags_" . $a_module);
00227                 if (strlen($tags))
00228                 {
00229                         $usedtags = unserialize($tags);
00230                 }
00231                 else
00232                 {
00233                         // default: everything but tables
00234                         $usedtags = array(
00235                         "a",
00236                         "blockquote",
00237                         "br",
00238                         "cite",
00239                         "code",
00240                         "div",
00241                         "em",
00242                         "h1",
00243                         "h2",
00244                         "h3",
00245                         "h4",
00246                         "h5",
00247                         "h6",
00248                         "hr",
00249                         "img",
00250                         "li",
00251                         "ol",
00252                         "object",
00253                         "p",
00254                         "pre",
00255                         "span",
00256                         "strike",
00257                         "strong",
00258                         "sub",
00259                         "sup",
00260                         "u",
00261                         "ul"                    
00262                         );
00263                 }
00264                 return $usedtags;
00265         }
00266 
00275         function &_getUsedHTMLTagsAsString($a_module = "")
00276         {
00277                 $result = "";
00278                 $tags =& ilObjAdvancedEditing::_getUsedHTMLTags($a_module);
00279                 foreach ($tags as $tag)
00280                 {
00281                         $result .= "<$tag>";
00282                 }
00283                 return $result;
00284         }
00285         
00293         function _getRichTextEditor()
00294         {
00295                 include_once "./Services/Administration/classes/class.ilSetting.php";
00296                 $setting = new ilSetting("advanced_editing");
00297                 $js = $setting->get("advanced_editing_javascript_editor");
00298                 return $js;
00299         }
00300         
00308         function _setRichTextEditor($a_js_editor)
00309         {
00310                 include_once "./Services/Administration/classes/class.ilSetting.php";
00311                 $setting = new ilSetting("advanced_editing");
00312                 $setting->set("advanced_editing_javascript_editor", $a_js_editor);
00313         }
00314         
00323         function _setUsedHTMLTags($a_html_tags, $a_module)
00324         {
00325                 if (strlen($a_module))
00326                 {
00327                         include_once "./Services/Administration/classes/class.ilSetting.php";
00328                         $setting = new ilSetting("advanced_editing");
00329                         $setting->set("advanced_editing_used_html_tags_" . $a_module, serialize($a_html_tags));
00330                 }
00331         }
00332         
00340         function &getHTMLTags()
00341         {
00342                 $tags = array(
00343                         "a",
00344                         "blockquote",
00345                         "br",
00346                         "cite",
00347                         "code",
00348                         "div",
00349                         "em",
00350                         "h1",
00351                         "h2",
00352                         "h3",
00353                         "h4",
00354                         "h5",
00355                         "h6",
00356                         "hr",
00357                         "img",
00358                         "li",
00359                         "object",
00360                         "ol",
00361                         "p",
00362                         "pre",
00363                         "span",
00364                         "strike",
00365                         "strong",
00366                         "sub",
00367                         "sup",
00368                         "table",
00369                         "td",
00370                         "tr",
00371                         "u",
00372                         "ul",
00373                         "ruby", // Ruby Annotation XHTML module
00374                         "rbc",
00375                         "rtc",
00376                         "rb",
00377                         "rt",
00378                         "rp"
00379                 );
00380                 return $tags;
00381         }
00382         
00390         function &_getAllHTMLTags()
00391         {
00392                 $tags = array(
00393                         "a",
00394                         "abbr",
00395                         "acronym",
00396                         "address",
00397                         "applet",
00398                         "area",
00399                         "b",
00400                         "base",
00401                         "basefont",
00402                         "bdo",
00403                         "big",
00404                         "blockquote",
00405                         "br",
00406                         "button",
00407                         "caption",
00408                         "center",
00409                         "cite",
00410                         "code",
00411                         "col",
00412                         "colgroup",
00413                         "dd",
00414                         "del",
00415                         "dfn",
00416                         "dir",
00417                         "div",
00418                         "dl",
00419                         "dt",
00420                         "em",
00421                         "fieldset",
00422                         "font",
00423                         "form",
00424                         "h1",
00425                         "h2",
00426                         "h3",
00427                         "h4",
00428                         "h5",
00429                         "h6",
00430                         "hr",
00431                         "i",
00432                         "iframe",
00433                         "img",
00434                         "input",
00435                         "ins",
00436                         "isindex",
00437                         "kbd",
00438                         "label",
00439                         "legend",
00440                         "li",
00441                         "link",
00442                         "map",
00443                         "menu",
00444                         "object",
00445                         "ol",
00446                         "optgroup",
00447                         "option",
00448                         "p",
00449                         "param",
00450                         "pre",
00451                         "q",
00452                         "s",
00453                         "samp",
00454                         "select",
00455                         "small",
00456                         "span",
00457                         "strike",
00458                         "strong",
00459                         "sub",
00460                         "sup",
00461                         "table",
00462                         "tbody",
00463                         "td",
00464                         "textarea",
00465                         "tfoot",
00466                         "th",
00467                         "thead",
00468                         "tr",
00469                         "tt",
00470                         "u",
00471                         "ul",
00472                         "var",
00473                         "ruby", // Ruby Annotation XHTML module
00474                         "rbc",
00475                         "rtc",
00476                         "rb",
00477                         "rt",
00478                         "rp"
00479                 );
00480                 return $tags;
00481         }
00482         
00490         function _getAllHTMLTagsAsString()
00491         {
00492                 $result = "";
00493                 $tags =& ilObjAdvancedEditing::_getAllHTMLTags();
00494                 foreach ($tags as $tag)
00495                 {
00496                         $result .= "<$tag>";
00497                 }
00498                 return $result;
00499         }
00500         
00501         
00502 } // END class.ilObjAdvancedEditing
00503 ?>

Generated on Fri Dec 13 2013 13:52:07 for ILIAS Release_3_7_x_branch .rev 46817 by  doxygen 1.7.1